pax_global_header00006660000000000000000000000064147552154210014520gustar00rootroot0000000000000052 comment=51a046477c011a2b19045bf937e73a130658296e level-zero-1.20.6/000077500000000000000000000000001475521542100136725ustar00rootroot00000000000000level-zero-1.20.6/.github/000077500000000000000000000000001475521542100152325ustar00rootroot00000000000000level-zero-1.20.6/.github/docker/000077500000000000000000000000001475521542100165015ustar00rootroot00000000000000level-zero-1.20.6/.github/docker/rhel.Dockerfile000066400000000000000000000002311475521542100214200ustar00rootroot00000000000000# syntax=docker/dockerfile:1.4 ARG VMAJ ARG VMIN FROM ghcr.io/oneapi-src/level-zero-linux-compute/rhel:${VMAJ}.${VMIN} SHELL ["/bin/bash", "-e", "-c"]level-zero-1.20.6/.github/docker/sles.Dockerfile000066400000000000000000000002311475521542100214340ustar00rootroot00000000000000# syntax=docker/dockerfile:1.4 ARG VMAJ ARG VMIN FROM ghcr.io/oneapi-src/level-zero-linux-compute/sles:${VMAJ}.${VMIN} SHELL ["/bin/bash", "-e", "-c"]level-zero-1.20.6/.github/docker/ubuntu.Dockerfile000066400000000000000000000033751475521542100220240ustar00rootroot00000000000000# syntax=docker/dockerfile:1.4 ARG VMAJ ARG VMIN FROM ghcr.io/oneapi-src/level-zero-linux-compute/ubuntu:${VMAJ}.${VMIN} ARG VMAJ ARG VMIN SHELL ["/bin/bash", "-e", "-c"] RUN <> /etc/apt/sources.list <> /etc/apt/sources.list.d/ubuntu.sources <> ${GITHUB_OUTPUT} <- ${{ matrix.os.name == 'windows' && 'windows' || format('{0}-{1}.{2}', matrix.os.name, matrix.os.vmaj, matrix.os.vmin ) }} CCACHE_DIR: ${{ github.workspace }}/ccache run: | cat >> ${GITHUB_OUTPUT} <> ${GITHUB_ENV} - name: "Registry login: ghcr.io" run: | echo ${{ secrets.GITHUB_TOKEN }} | docker login -u sys-lzdev --password-stdin ghcr.io - name: Build image run: | docker info docker build \ ${{ runner.os == 'Windows' && ' \ --memory 16G ' || ' ' }}\ ${{ matrix.os.vmaj != '' && format(' \ --build-arg VMAJ={0} \ --build-arg VMIN={1} ', matrix.os.vmaj, matrix.os.vmin) || ' ' }}\ --pull \ --tag ${DOCKER_IMAGE}:${{ needs.config.outputs.ref-slug }} \ - < .github/docker/${{ matrix.os.name }}.Dockerfile - name: Build id: build run: | mkdir build docker run \ --rm \ --interactive \ -v '${{ github.workspace }}':${MOUNT_TARGET} \ -w ${MOUNT_TARGET}/build \ -e CCACHE_BASEDIR=${MOUNT_TARGET} \ -e CCACHE_DIR=${MOUNT_TARGET}/ccache \ -v '${{ steps.const.outputs.ccache-dir }}':${MOUNT_TARGET}/ccache \ ${DOCKER_IMAGE}:${{ needs.config.outputs.ref-slug }} \ bash -e -x <<-EOF cmake \ ${{ matrix.os.name != 'windows' && ' \ -G Ninja ' || ' ' }}\ ${{ matrix.arch == 'arm64' && ' \ -D CMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ -D CMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \ -D CMAKE_SYSTEM_PROCESSOR=aarch64 ' || ' ' }}\ -D CMAKE_C_COMPILER_LAUNCHER=ccache \ -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_INSTALL_PREFIX=${{ matrix.target == 'install' && '../level-zero-install' || matrix.target == 'package' && '/usr' || '' }} \ -D CPACK_OUTPUT_FILE_PREFIX=${MOUNT_TARGET}/level-zero-package \ .. cmake --build . ${PARALLEL} --target ${{ matrix.target }} ${{ matrix.os.name == 'windows' && '--config Release' || '' }} ccache --show-stats EOF level-zero-1.20.6/.github/workflows/build-quick.yml000066400000000000000000000025131475521542100222240ustar00rootroot00000000000000on: push: branches: [ master ] pull_request: branches: [ master ] workflow_dispatch: permissions: read-all jobs: build-linux: if: github.repository_owner == 'oneapi-src' runs-on: [ubuntu-latest] steps: - uses: actions/checkout@v3 - uses: hendrikmuhs/ccache-action@v1 - name: Build Loader on Latest Ubuntu run: | mkdir build cd build cmake \ -D CMAKE_C_COMPILER_LAUNCHER=ccache \ -D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ -D CMAKE_BUILD_TYPE=Release \ -D BUILD_L0_LOADER_TESTS=1 \ .. make -j$(nproc) - env: ZE_ENABLE_LOADER_DEBUG_TRACE: '1' ZEL_LIBRARY_PATH: '${{ github.workspace }}/build/lib' working-directory: build run: ctest -V build-windows: if: github.repository_owner == 'oneapi-src' runs-on: [windows-latest] steps: - uses: actions/checkout@v3 - name: Build Loader on Latest Windows run: | mkdir build cd build cmake -D BUILD_L0_LOADER_TESTS=1 .. cmake --build . --config Release - env: ZE_ENABLE_LOADER_DEBUG_TRACE: '1' ZEL_LIBRARY_PATH: '${{ github.workspace }}/build/bin/Release' working-directory: build run: ctest -C Release -V level-zero-1.20.6/.github/workflows/check-abi.yml000066400000000000000000000116641475521542100216300ustar00rootroot00000000000000on: pull_request: branches: [master] permissions: read-all jobs: # Use https://lvc.github.io/abi-compliance-checker/ to compare builds # of pull requests against master. Compares checkouts of github.base_ref and # github.head_ref. check-abi-last-release: runs-on: ubuntu-latest if: github.repository_owner == 'oneapi-src' steps: - name: Install dependencies run: | sudo apt update sudo apt install -y elfutils universal-ctags vtable-dumper - uses: actions/checkout@v2 with: fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags - uses: actions-ecosystem/action-get-latest-tag@v1 id: get-latest-tag with: semver_only: true - name: Checkout base uses: actions/checkout@v3 with: ref: ${{ steps.get-latest-tag.outputs.tag }} clean: true path: base - name: Checkout head uses: actions/checkout@v3 with: clean: true path: head ref: ${{ github.event.pull_request.head.sha }} - name: Build debug base run: | mkdir base/build cd base/build cmake -E env CXXFLAGS="-Og -g" cmake -DCMAKE_BUILD_TYPE=Debug .. make -j$(nproc) - name: Build debug head run: | mkdir head/build cd head/build cmake -E env CXXFLAGS="-Og -g" cmake -DCMAKE_BUILD_TYPE=Debug .. make -j$(nproc) - name: Download and setup abi-dumper run: | git clone https://github.com/lvc/abi-dumper.git abi-dumper cp abi-dumper/abi-dumper.pl . chmod +x abi-dumper.pl - name: Generate dump for base run: | ./abi-dumper.pl \ ./base/build/lib/libze_loader.so \ -lver $(cat ./base/build/VERSION) \ -public-headers ./base/include \ -o ./base.dump - name: Generate dump for head run: | ./abi-dumper.pl \ ./head/build/lib/libze_loader.so \ -lver $(cat ./head/build/VERSION)-1 \ -public-headers ./head/include \ -o ./head.dump - name: Download and setup abi-compliance-checker run: | wget https://github.com/lvc/abi-compliance-checker/tarball/master -O abi-compliance-checker.tar.gz tar -xzf abi-compliance-checker.tar.gz chmod +x lvc-abi-compliance-checker-*/abi-compliance-checker.pl - name: Compare dumps run: | lvc-abi-compliance-checker-*/abi-compliance-checker.pl \ -l libze_loader \ -old base.dump \ -new head.dump \ -report-path release_report.html - uses: actions/upload-artifact@v4 if: always() with: name: abi-report-last-release path: release_report.html check-abi-master: runs-on: ubuntu-latest if: github.repository_owner == 'oneapi-src' steps: - name: Install dependencies run: | sudo apt update sudo apt install -y elfutils universal-ctags vtable-dumper - name: Checkout base uses: actions/checkout@v3 with: ref: ${{ github.base_ref }} clean: true path: base - name: Checkout head uses: actions/checkout@v3 with: clean: true path: head ref: ${{ github.event.pull_request.head.sha }} - name: Build debug base run: | mkdir base/build cd base/build cmake -E env CXXFLAGS="-Og -g" cmake -DCMAKE_BUILD_TYPE=Debug .. make -j$(nproc) - name: Build debug head run: | mkdir head/build cd head/build cmake -E env CXXFLAGS="-Og -g" cmake -DCMAKE_BUILD_TYPE=Debug .. make -j$(nproc) - name: Download and setup abi-dumper run: | git clone https://github.com/lvc/abi-dumper.git abi-dumper cp abi-dumper/abi-dumper.pl . chmod +x abi-dumper.pl - name: Generate dump for base run: | ./abi-dumper.pl \ ./base/build/lib/libze_loader.so \ -lver $(cat ./base/build/VERSION) \ -public-headers ./base/include \ -o ./base.dump - name: Generate dump for head run: | ./abi-dumper.pl \ ./head/build/lib/libze_loader.so \ -lver $(cat ./head/build/VERSION)-1 \ -public-headers ./head/include \ -o ./head.dump - name: Download and setup abi-compliance-checker run: | wget https://github.com/lvc/abi-compliance-checker/tarball/master -O abi-compliance-checker.tar.gz tar -xzf abi-compliance-checker.tar.gz chmod +x lvc-abi-compliance-checker-*/abi-compliance-checker.pl - name: Compare dumps run: | lvc-abi-compliance-checker-*/abi-compliance-checker.pl \ -l libze_loader \ -old base.dump \ -new head.dump \ -report-path master_report.html - uses: actions/upload-artifact@v4 if: always() with: name: abi-report-master path: master_report.htmllevel-zero-1.20.6/.github/workflows/scorecard.yml000066400000000000000000000034351475521542100217640ustar00rootroot00000000000000on: # For Branch-Protection check. Only the default branch is supported. See # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection branch_protection_rule: # To guarantee Maintained check is occasionally updated. See # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained schedule: - cron: '20 19 * * 3' push: branches: [ "master" ] pull_request: branches: [ "master" ] permissions: read-all jobs: analysis: runs-on: ubuntu-latest if: github.repository_owner == 'oneapi-src' permissions: # Needed to upload the results to code-scanning dashboard. security-events: write # Needed to publish results and get a badge (see publish_results below). id-token: write steps: - name: "Checkout code" uses: actions/checkout@v4 with: persist-credentials: false - name: "Run analysis" uses: ossf/scorecard-action@v2.3.3 with: results_file: results.sarif results_format: sarif # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: # - you want to enable the Branch-Protection check on a *public* repository, or # - you are installing Scorecard on a *private* repository # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. # repo_token: ${{ secrets.SCORECARD_TOKEN }} publish_results: true - name: "Upload artifact" uses: actions/upload-artifact@v4 with: name: SARIF file path: results.sarif - name: "Upload to code-scanning" if: github.event_name != 'pull_request' uses: github/codeql-action/upload-sarif@v3 with: sarif_file: results.sarif level-zero-1.20.6/.github/workflows/update-spec.yml000066400000000000000000000061211475521542100222240ustar00rootroot00000000000000on: pull_request: branches: [master] paths: - .github/workflows/update-spec.yml workflow_dispatch: inputs: repository: description: Spec repository from which to generate code type: string default: oneapi-src/level-zero-spec ref: description: Ref to checkout from the spec repository type: string default: master version: description: Version of the spec to generate code for type: string branch: description: Branch to (force) push generated code to type: string default: spec-develop permissions: read-all concurrency: ${{ github.event_name == 'pull_request' && github.run_id || inputs.branch }} jobs: generate-code: runs-on: ubuntu-latest steps: - uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install dependencies run: pip install Mako==1.1.0 PyYAML==5.2 - uses: actions/checkout@v3 with: clean: true fetch-depth: 0 fetch-tags: true token: ${{ secrets.TOKEN }} - name: Checkout develop branch or create local version if: ${{ github.event_name == 'workflow_dispatch' }} run: git checkout ${{ inputs.branch }} || git checkout -b ${{ inputs.branch }} - name: Reset develop branch to master if: ${{ github.event_name == 'workflow_dispatch' }} run: git reset --hard origin/master - name: Checkout spec repository uses: actions/checkout@v4 with: repository: ${{ github.event_name == 'pull_request' && 'oneapi-src/level-zero-spec' || inputs.repository }} clean: true fetch-depth: 0 path: spec ref: ${{ github.event_name == 'pull_request' && 'master' || inputs.ref }} - name: Apply latest spec commit to develop branch run: | #bash export LANG="C.UTF-8" cd spec/scripts echo "::group::Generate spec/scripts/input.json" python3 ./run.py --debug '--!html' '--!rst' '--!build' --ver ${{ github.event_name == 'pull_request' && '1.10' || inputs.version }} echo "::endgroup::" cd .. echo "::group::Copy generated header files" jq -r '.[] | select(.|test("^../include"))' scripts/generated.json | cut -c 4- | sort | xargs -I{} cp -v ./{} ../{} echo "::endgroup::" cd .. echo "::group::Generate source files" ./scripts/json2src.py < spec/scripts/input.json --ver ${{ github.event_name == 'pull_request' && '1.10' || inputs.version }} . echo "::endgroup::" if (($(git diff | tee >(wc -l) >&2) == 0)); then echo "::warning::No changes were made to files" else git config user.email "sys-lzdev@intel.com" git config user.name "sys-lzdev" spec_ver=$(sed -n 's/^.*version v.*-r\([0-9]*\.[0-9]*\.[0-9]*\)/\1/p' include/ze_api.h) git add -u git commit -m "Update to spec ${spec_ver}" fi - name: Push changes to develop branch if: ${{ github.event_name == 'workflow_dispatch' }} run: git push origin ${{ inputs.branch }} -f level-zero-1.20.6/.gitignore000066400000000000000000000000751475521542100156640ustar00rootroot00000000000000/build /scripts/__pycache__/ /scripts/templates/__pycache__/ level-zero-1.20.6/CHANGELOG.md000066400000000000000000000272031475521542100155070ustar00rootroot00000000000000# Level zero loader changelog ## v1.20.6 * Add in missing header for ze_handle_t definition for DDI extension ## v1.20.5 * Add option to enable logging each API call * basic_leak_checker: add support for zeMemFreeExt * Fix to teardown check to avoid context use after destroy ## v1.20.4 * Fix stype init for property query during init * Fix Init error checking to check the validation layer checks * Extension validation fixed in the parameter validation checker ## v1.20.3 * Implemented basic leak checker in validation layer * Support for Sorting Drivers based on the devices provided ## v1.20.2 * Fix to Validation Layer Param checking of Extensions for new desc types ## v1.20.1 * Update to spec 1.12.15 * Update Docs for spec links and corrections ## v1.20.0 * Update to spec 1.12 * Allow pkg-config files on Windows as well * Fix GET_FUNCTION_PTR warnings on windows * Fix libddi table query code generation * Fixed pkg-config files generation * fixed potential memory leaks in events checker ## v1.19.2 * Remove static result in InitDrivers given first init fails ## v1.19.1 * Fix to Use relative paths for events deadlock detection third party headers ## v1.19.0 * logging full path of loaded library in traces * Fix utils build * feature: events deadlock detection in validation layer * Add Passing in the Result to Validation Checkers at Epilogue * Disconnect zeInitDrivers and zeDriverGet * Fix backwards compatibility usage of Get*ProcAddrTable * Fix to add missing zeKernelGetExp API and header updates * Fix zeInit Compatibility when zeInitDrivers is undefined ## v1.18.5 * Fix metric types for new experimental types * Fix/Regenerate the Loader files incorrectly reordered by the scripts. * Fix ABI checker build/tests * Update workflows to ABI check with last released tag ## v1.18.4 * Fix Backwards compatibility in ddi structs for EXP features ## v1.18.3 * Update loader headers to spec 1.11 with fixed ddi ordering * Remove preload of all drivers given zeInitDrivers and update unit tests ## v1.18.2 * Fix code generation of EXP tables and EXP functions to remove invalid new ddi tables and apis. ## v1.18.1 * Fix check for new ddi table in 1.11 and fix space in driver count check. ## v1.18.0 * v1.11 Spec Changes for the L0 Loader * Wrap linker flags on Windows for IntelLLVM * Ensure validation_layer::context has init before usage * Replace exception with error string return in zello_log.h ## v1.17.45 * windows: do not exclude DN_NEED_RESTART drivers if LevelZeroStagedDriverPath is set ## v1.17.44 * Add missing guard around debug message ## v1.17.43 * Switch to monotonically increasing patch numbers * Fix warning by updating min cmake version to 3.5 * Add missing guards around debug messages ## v1.17.42 * Fix SysMan driver pointers given no sysman env and no zesInit (#193) * Prevent reinit when zes/ze handles have already been retrieved (#192) ## v1.17.39 * Add Ubuntu 24.04 and 24.10 builds * Proper installation rules * Enable testing with ctest * Fix reading updated state of the driver_t for checking initStatus (#188) * Avoid DDI table reinit if ZE_ENABLE_LOADER_INTERCEPT=1 (#187) * Update spdlog headers (#186) * Fix handle translation when ddi table fallback (#185) * Split Ze and Zes Drivers and only release drivers at close (#184) * Fix issues with intercept layer and zesInit/zeInit given fallback to passthrough (#183) * Fix global teardown of loader handles and check driver status in init_driver (#182) ## v1.17.28 * Add GPU-legacy1 driver to list of known names on Linux * Fix first zeinit to allow for layer checks ## v1.17.25 * Don't exchange zet/zes DDI tables for tracing * Fix OpenSSF token permissions warning * Rename init functions to avoid confusion with zeInit * Add missing ZE_RESULT_ERROR_UNINITIALIZED checks to zesDriverGet ## v1.17.19 * Fix DriverGet to handle failed drivers and avoid layer init during checks ## v1.17.17 * Fix layer init with multiple drivers and ensure init for instrumentation support * Change loader log file location * Add update-spec.yml workflow * Define FMT_HEADER_ONLY for spdlog inclusion * spdlog: Use system library if requested * Create scorecard.yml * Support for Pluggable Validation Layer Checkers * Add NPU Driver to list of known names on linux * Correct casting in tracing layer sample code ## v1.17.6 * Bundle spdlog headers as part of build vs library build ## v1.17.2 * Recognize mutable command list struct types in validation layer ## v1.17.0 * Update to support v1.9.3 of the L0 Spec ## v1.16.15 * Fix Tracing Layer Dynamic Enable Counter ## v1.16.14 * Fix loading environment strings * Avoid init of Logger unless Enabled by ZEL_ENABLE_LOADER_LOGGING ## v1.16.11 * fix Logging build to be static linked ## v1.16.9 * Fix code Gen scripts for zesInit Only * Fix Build using IntelLLVM compiler * Installation path fixes * Add USE_ASAN cmake flag for address sanitization ## v1.16.1 * Fix to spec generated api version defines ## v1.16.0 * Update to spec 1.9.1 ## v1.15.13 * Enable for zesInit to run with zeInit without duplicate init * Addressed OpenSSF Token Permissions * Fix for missing extension types in the validation layer * Added structure for Loader validation testing ## v1.15.8 * Fix build when using clang-cl on Windows * set RUNTIME DESTINATION in install for layer libraries * added github actions runs on latest windows * Windows.h replaced with windows.h * Added support for enabling/disabling tracing layer during runtime * check in DriverGet to verify the dditable pointer is valid ## v1.15.1 * Fix Windows build for Control Flow Guard Mitigation. ## v1.15.0 * Update to spec 1.8.0 ## v1.14.0 * Update to spec 1.7.8 * Fix intercept layer access to array of handles and return of logs * Enable All warnings and warnings as errors to cleanup code * Add validation of module extended descriptor * Add ZE_ENABLE_LOADER_DEBUG_TRACE for tracking Library Load/Unload errors ## v1.13.5 * Updated code generating scripts for updated spec and init functionality * Change zeInit to only init on the first call in a process ## v1.13.1 * Fix Formatting issues ## v1.13.0 * Update to spec 1.7.0 * Add reference to Tracing Layer in README.md * Update dll copyright ## v1.12.0 * Update to spec 1.6.10 ## v1.11.0 * Update to spec 1.6.3 * Add validation for handle lifetime * Improve driver teardown handling ## v1.10.0 * Update to spec 1.6 * Added validation for stype and pnext ## v1.9.9 * Update to spec 1.5.17 * Fix for calling zeInit in zesInit path * Added readme for validation layer * Refactor of validation layer to prepare for future enhancements * Updated Contributing Document with more guidance ## v1.9.4 * Add support for Level Zero spec v1.5 * Fix some compilation issues with windows non-vc compiler * Fix building when included in another cmake project. ## v1.8.12 * Add Image View Handle to image map for SetArgument for translating image handles for multi drivers * Support for translating images/samplers for multi drivers ## v1.8.8 * Update Extension and Experimental Features to return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE instead of ZE_RESULT_ERROR_UNINITIALIZED when not found. ## v1.8.5 * Remove RTLD_DEEPBIND from driver dlopen calls * Add loader code generation scripts * Update to spec 1.4.8 which includes fixes to zes_power_limit_ext_desc_t ## v1.8.1 * Add missing sTypes * Fix argument names in some exp APIs ## v1.8.0 * Add Support for L0 Spec v1.4 which includes * Core Fabric Topology API * Core Extension for memory BW * Core Extension for LUID query * Sysman ECC * Sysman Power Limits Extension ## v1.7.15 * Fix bug during multiple calls to zeInit with no driver present * Add option to support build with sccache ## v1.7.9 * Fix bug in loader handle translation API * Fix tracing layer functionality in newer APIs ## v1.7.4 * Addition of new Loader API to perform handle translations. See doc/loader_api.md * Add Ability to read optional Level Zero Registry Key Containing the Level Zero Loader libraries on windows * Update L0 headers to 1.3.7 Spec which includes: * Fix to bool type that caused compilation issues * Addition of new metrics enum for stall sampling * Changing some param names for consistency ## v1.6.2 * Removed Null Driver Tracing Support (Tracing supported using the Layer implementation) * Fixed ze_callbacks_t for backwards compatibility ## v1.6.1 * Updated L0 API headers to 1.3.0 which includes: * Get PCI Properties Extension * Get Image Allocation Properties Extension * Memory Free Extension * Module Linkage Inspection Extension * Image Copy To/From Memory Extensions * GDDR Memory Type support in SysMan * PCIe Card-level power domains in SysMan * Fixed Return Codes for uninitialized function pointers & tables to return ZE_RESULT_ERROR_UNINITIALIZED vs ZE_RESULT_ERROR_UNSUPPORTED_VERSION * Tracing Context handled during library init & destroy * Enable CPACK support for ARM64 Package Generation ## v1.5.4 * Fixed a bug verifying L0 Driver stability after initializing ddi tables * Updated Windows usage of LoadLibrary for security to only load libraries from system32 * Fixed a bug allowing nullptr keys into handle maps ## v1.5.0 * Added Intel VPU driver to Linux known driver list * Fixed default symbol visibility in Linux builds * Added zeInit call earlier in loader init path to prevent loading drivers that don't match the ze_init_flags_t * Fixed build for certain SLES distros * Fixed bug that prevented tracers from being reenabled after being disabled. * Multi Driver Support: Return success if initialization of at least one driver succeeds. * Updated L0 API headers to 1.2.43 which includes: * Clarification to documentation of several APIs * Added missing STYPE ZE_STRUCTURE_TYPE_IMAGE_MEMORY_EXP_PROPERTIES * Added new experimental metrics extension to retrieve multiple metrics values ## v1.4.1 * Added support for Level Zero Specification 1.2.13 * Fixed a bug that resulted in zeInit failing when multiple drivers are discovered and one of them fails to load. ## v1.3.7 * Fixed build warnings generated when `-Wall` is enabled ## v1.3.6 * New Tracing Layer APIs to support tracing Level Zero core APIs introduced after the 1.0 Specification. A change of design was needed to allow extension to new APIs without breaking backwards compatibility of original tracing APIs. The original tracing layer APIs will continue to be supported for 1.0 core APIs, but users are encouraged to switch to the new tracing layer APIs. * New Loader API to retrieve version information of loader and layers: `zelLoaderGetVersions` * Enabled discovery of Level Zero Compute Accelerators Drivers on windows * Bug Fixes: * Fixed loader bug that could cause corruption of handles when there are multiple drivers loaded. * Corrected version check in layers to future-proof compatibility checks ## v1.2.3 * Support for the new 1.1 Level Zero Specification * Improved library variable lifetime management by initializing variables at load time rather than as static globals. * Added environment variable that allows optionally specifying runtime drivers to use on Linux * Note: Tracing Layer support is not yet available for the APIs newly introduced in the 1.1 spec. Tracing layer support for all other APIs remains functional. ## v1.1.0 Note: Level Zero Specification API did not change. * Update loader library to 1.1.0 to indicate addition of tracing layer implementation and associated APIs * Fixed bug when reading windows environment variables set by process before zeInit call. Before variables were not read correctly resulting in layers not being enabled as expected * Fixed bug in loader when using multiple drivers and a driver API returns an error code. Previously loader would incorrectly translate output handles from failed API calls * Deprecated a tracing implementation layer descriptor enum value due to incorrect name and added a replacement. level-zero-1.20.6/CMakeLists.txt000066400000000000000000000262441475521542100164420ustar00rootroot00000000000000# Copyright (C) 2020-2024 Intel Corporation # SPDX-License-Identifier: MIT cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(THIRD_PARTY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party) if(MSVC AND (MSVC_VERSION LESS 1900)) message(FATAL_ERROR "Visual Studio Compiler Version >= 1900 Required to build.") endif() # This project follows semantic versioning (https://semver.org/) project(level-zero VERSION 1.20.6) include(GNUInstallDirs) find_package(Git) if(Git_FOUND) if(MSVC) execute_process( COMMAND CMD /c ${GIT_EXECUTABLE} rev-parse HEAD OUTPUT_VARIABLE VERSION_SHA OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) else() execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse HEAD OUTPUT_VARIABLE VERSION_SHA OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) endif() else() set(VERSION_SHA " - No git SHA found, compiled outside git folder.") endif() add_definitions(-DLOADER_VERSION_SHA="${VERSION_SHA}") if(SYSTEM_SPDLOG) find_package(spdlog CONFIG) if(spdlog_FOUND) message(STATUS "System spdlog found.") else() message(FATAL_ERROR "SYSTEM_SPDLOG specified but spdlog wasn't found.") endif() else() include_directories("${CMAKE_CURRENT_SOURCE_DIR}/third_party/spdlog_headers") endif() include(FetchContent) if(BUILD_L0_LOADER_TESTS) FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip ) # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) enable_testing() endif() # Update other relevant variables to include the patch set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") set(CMAKE_PROJECT_VERSION_PATCH "${PROJECT_VERSION_PATCH}") set(CMAKE_PROJECT_VERSION "${PROJECT_VERSION}") add_definitions(-DLOADER_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}) add_definitions(-DLOADER_VERSION_MINOR=${PROJECT_VERSION_MINOR}) add_definitions(-DLOADER_VERSION_PATCH=${PROJECT_VERSION_PATCH}) file(WRITE "${CMAKE_BINARY_DIR}/VERSION" "${PROJECT_VERSION}") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) #Define a path for custom commands to work around MSVC set(CUSTOM_COMMAND_BINARY_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) if(MSVC) #MSVC implicitly adds $ to the output path set(CUSTOM_COMMAND_BINARY_DIR ${CUSTOM_COMMAND_BINARY_DIR}/$) #enabling Control Flow Guard set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /guard:cf") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DYNAMICBASE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DYNAMICBASE") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_CXX_LINKER_WRAPPER_FLAG}/DYNAMICBASE") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_CXX_LINKER_WRAPPER_FLAG}/guard:cf") # enable Spectre Mitigation, not supported by clang-cl if((NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang) AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL IntelLLVM)) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Qspectre") endif() if((NOT CMAKE_C_COMPILER_ID STREQUAL Clang) AND NOT (CMAKE_C_COMPILER_ID STREQUAL IntelLLVM)) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Qspectre") endif() endif() #CXX compiler support if(NOT MSVC) include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) if(COMPILER_SUPPORTS_CXX14) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") else() message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler.") endif() if (UNIX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive -fPIC") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive") endif() if(NOT CMAKE_CXX_COMPILER_ID STREQUAL IntelLLVM) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wnon-virtual-dtor") endif() endif() #MSVC compile flags if(MSVC) string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") if(NOT CMAKE_CXX_COMPILER_ID STREQUAL IntelLLVM) # treat warnings as errors set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX /W3") endif() # enable multi-process compilation, not supported by clang-cl if((NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang) AND (NOT CMAKE_CXX_COMPILER_ID STREQUAL IntelLLVM)) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") endif() # enable exceptions handling set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") # enable creation of PDB files for Release Builds set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${CMAKE_CXX_LINKER_WRAPPER_FLAG}/DEBUG ${CMAKE_CXX_LINKER_WRAPPER_FLAG}/OPT:REF ${CMAKE_CXX_LINKER_WRAPPER_FLAG}/OPT:ICF") # enable CET shadow stack set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_CXX_LINKER_WRAPPER_FLAG}/CETCOMPAT") #Use of sccache with MSVC requires workaround of replacing /Zi with /Z7 #https://github.com/mozilla/sccache if(USE_Z7) #sccache string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") endif() endif() if(USE_ASAN) if(NOT MSVC) # -fno-omit-frame-pointer is included for nicer stack traces in error messages set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address") else() message(WARNING "Address Sanitizer is not supported on Windows") endif() endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/source/wrapper/include) include_directories("${CMAKE_CURRENT_SOURCE_DIR}") set(TARGET_LOADER_NAME ze_loader) add_subdirectory(source) add_subdirectory(samples) if(BUILD_L0_LOADER_TESTS) include(CTest) add_subdirectory(test) endif() include("os_release_info.cmake") get_os_release_info(os_name os_version os_codename) string(APPEND os_type "${os_name}") string(COMPARE EQUAL "${os_type}" "sles" sles_distro) #Pick only first character of os_name string(SUBSTRING "${os_name}" 0 1 os_name) file(GLOB LEVEL_ZERO_API_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") install(FILES ${LEVEL_ZERO_API_HEADERS} DESTINATION ./include/level_zero COMPONENT level-zero-devel ) file(GLOB LEVEL_ZERO_LAYERS_API_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/layers/*.h") install(FILES ${LEVEL_ZERO_LAYERS_API_HEADERS} DESTINATION ./include/level_zero/layers COMPONENT level-zero-devel ) file(GLOB LEVEL_ZERO_LOADER_API_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/loader/*.h") install(FILES ${LEVEL_ZERO_LOADER_API_HEADERS} DESTINATION ./include/level_zero/loader COMPONENT level-zero-devel ) # If generators list was not define build native package for current distro if(NOT DEFINED CPACK_GENERATOR) if(EXISTS "/etc/debian_version") set(CPACK_GENERATOR "DEB") elseif(EXISTS "/etc/redhat-release") set(CPACK_GENERATOR "RPM") elseif(EXISTS "/etc/SUSE-brand" OR EXISTS "/etc/SUSE-release" OR sles_distro) set(CPACK_GENERATOR "RPM") else() set(CPACK_GENERATOR "ZIP") endif() endif() if(MSVC) set(CPACK_SET_DESTDIR FALSE) set(CPACK_PACKAGING_INSTALL_PREFIX "") else() set(CPACK_SET_DESTDIR TRUE) endif() set(CPACK_PACKAGE_RELOCATABLE FALSE) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "oneAPI Level Zero") set(CPACK_PACKAGE_VENDOR "Intel") set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}) set(CPACK_PACKAGE_CONTACT "Intel Corporation") set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") if(CPACK_GENERATOR MATCHES "RPM") set(CPACK_RPM_COMPRESSION_TYPE "xz") string(FIND "${CMAKE_CXX_COMPILER}" "aarch64" compiler_arch_check) if((NOT ${compiler_arch_check} MATCHES "-1") OR (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")) set(CPACK_RPM_PACKAGE_ARCHITECTURE "aarch64") elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") set(CPACK_RPM_PACKAGE_ARCHITECTURE "x86_64") endif() set(CPACK_RPM_PACKAGE_AUTOREQ OFF) set(CPACK_RPM_PACKAGE_DESCRIPTION "oneAPI Level Zero") set(CPACK_RPM_PACKAGE_GROUP "System Environment/Libraries") set(CPACK_RPM_PACKAGE_LICENSE "MIT") set(CPACK_RPM_PACKAGE_RELEASE 1) set(CPACK_RPM_PACKAGE_RELEASE_DIST ON) set(CPACK_RPM_PACKAGE_URL "https://github.com/oneapi-src/level-zero") set(CPACK_RPM_COMPONENT_INSTALL ON) set(CPACK_RPM_LEVEL-ZERO_PACKAGE_NAME "${PROJECT_NAME}") set(CPACK_RPM_LEVEL-ZERO-DEVEL_PACKAGE_NAME "${PROJECT_NAME}-devel") set(CPACK_RPM_LEVEL-ZERO_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-${os_name}${os_version}.${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") set(CPACK_RPM_LEVEL-ZERO-DEVEL_FILE_NAME "${PROJECT_NAME}-devel-${PROJECT_VERSION}-${os_name}${os_version}.${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") set(CPACK_RPM_LEVEL-ZERO-DEVEL_PACKAGE_REQUIRES "level-zero = ${PROJECT_VERSION}") set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /etc/ld.so.conf.d /usr/local /usr/local/lib64 /usr/local/bin /usr/local/include ) endif() if(CPACK_GENERATOR MATCHES "DEB") string(FIND "${CMAKE_CXX_COMPILER}" "aarch64" compiler_arch_check) if((NOT ${compiler_arch_check} MATCHES "-1") OR (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")) SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE arm64) elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64) endif() set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/oneapi-src/level-zero") set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) set(CPACK_DEBIAN_LEVEL-ZERO_PACKAGE_NAME "${PROJECT_NAME}") set(CPACK_DEBIAN_LEVEL-ZERO-DEVEL_PACKAGE_NAME "${PROJECT_NAME}-devel") set(CPACK_DEBIAN_LEVEL-ZERO_FILE_NAME "${PROJECT_NAME}_${PROJECT_VERSION}+${os_name}${os_version}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") set(CPACK_DEBIAN_LEVEL-ZERO-DEVEL_FILE_NAME "${PROJECT_NAME}-devel_${PROJECT_VERSION}+${os_name}${os_version}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") set(CPACK_DEBIAN_LEVEL-ZERO-DEVEL_PACKAGE_DEPENDS "level-zero(=${PROJECT_VERSION})") set(CPACK_DEB_COMPONENT_INSTALL ON) set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) endif() INCLUDE(CPack) level-zero-1.20.6/CONTRIBUTING.md000066400000000000000000000140571475521542100161320ustar00rootroot00000000000000# Contributing We encourage anyone who wants to contribute to submit [Issues](https://github.com/oneapi-src/level-zero/issues) and [Pull Requests](https://github.com/oneapi-src/level-zero/pulls). We will help review these for proper alignment with the [Level Zero Specification](https://oneapi-src.github.io/level-zero-spec/level-zero/latest/index.html). ## C++ Coding Standards * C++14 maximum support * Avoid C Arrays, replace with `std::array<>` / `std::vector<>` * Avoid "magic numbers" * Avoid C-style memory allocations in favor of C++ * Use `nullptr` instead of `NULL` * Don't add `void` to empty argument lists * Use `std::unique_ptr` in place of `std::auto_ptr` ## Naming Conventions * The functionality in the Level Zero Loader and layers which follow the Level Zero spec must follow these naming conventions: * https://oneapi-src.github.io/level-zero-spec/level-zero/latest/core/INTRO.html#naming-convention * If the contributions are adding new functionality unique to the Level Zero Loader (ie not Level Zero Spec related): * Level Zero Loader specific APIs must have the prefix: `zel` * see here for examples: [Loader API Documentation](doc/loader_api.md) ## Generating Level Zero Loader and Layer files from scripts As part of each Level Zero specification update, .mako scripts are updated which generate the code for the Level Zero Loader and layers. When one contributes updates to the Level Zero Loader or Layers, one must update the code in [Level Zero Loader Mako Scripts](scripts/templates) to ensure that the new code is not lost in the next specification update. To generate the code from the scripts, run the following commands: * Clone the specification repo: `git clone https://github.com/oneapi-src/level-zero-spec.git level-zero-spec` * Checkout the specification version in the specification repo, for example: * `cd level-zero-spec` * `git checkout v1.12.15` * Generate the specification JSON file and Headers: * `cd level-zero-spec/scripts` * `python3 ./run.py --debug '--!html' '--!rst' '--!build' --ver 1.12` * Copy the Headers From Spec to Loader repo * `cp level-zero-spec/include/* level-zero/include/` * Execute the json2src script in the level-zero repo with the input.json in the specification repo with the corresponding spec version, for example: * `./level-zero/scripts/json2src.py --ver 1.12 --api-json level-zero-spec/scripts/input.json .` These scripts update the code with what would be generated in the next specification update. ## Code Review Quality Code Review of the oneAPI Level Zero Loader & Layers is important for all Maintainers and Contributors to ensure that quality updates are added to the Loader and Layers for customers of oneAPI Level Zero. ### Review Checklist When performing a code review please refer to this checklist to guide your comments: * Does the code follow C++ Coding Standards? [C++ Coding Standards](#c-coding-standards). * Does the code follow the Level Zero naming conventions? [Naming Conventions](#naming-conventions). * Does the code follow the Level Zero specification? See here for the latest spec: https://oneapi-src.github.io/level-zero-spec/level-zero/latest/index.html. * Is the code for the Validation Layer? Please review the following: [Validation Layer README](source/layers/validation/README.md). * Is the code for the Tracing Layer? Please review the following: [Tracing Layer README](source/layers/tracing/README.md). * Is the code "Vendor & Platform agnostic"? ie Are the changes in the loader or in the layers ignorant of the implementation in the L0 drivers? * Is the Code Modular or can the code be Modular? ie Can the code be added to common functions used in loader or layer common functions or is it for a specific usecase? * Can the code handle Multiple Driver or Device environments? Verify that the changes work within the [Intercept Layer](source/loader/ze_ldrddi.cpp) which is used when multiple drivers are present and that support works across devices. * Has the code updated the templates? see here [Generating Level Zero Loader and Layer files from scripts](#generating-level-zero-loader-and-layer-files-from-scripts) ## Sign Your Work Please use the sign-off line at the end of your patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. To do so, if you can certify the below (from [developercertificate.org](http://developercertificate.org/)): ``` Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 660 York Street, Suite 102, San Francisco, CA 94110 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` Then add a line to every git commit message: Signed-off-by: Kris Smith Use your real name (sorry, no pseudonyms or anonymous contributions). If you set your `user.name` and `user.email` git configs, you can sign your commit automatically with `git commit -s`. level-zero-1.20.6/LICENSE000066400000000000000000000020671475521542100147040ustar00rootroot00000000000000MIT License Copyright (C) 2019-2021 Intel Corporation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. level-zero-1.20.6/LICENSES/000077500000000000000000000000001475521542100150775ustar00rootroot00000000000000level-zero-1.20.6/LICENSES/Apache-2.0.txt000066400000000000000000000261341475521542100173240ustar00rootroot00000000000000 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.level-zero-1.20.6/LICENSES/MIT.txt000066400000000000000000000020671475521542100162760ustar00rootroot00000000000000MIT License Copyright (C) 2019-2021 Intel Corporation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. level-zero-1.20.6/README.md000066400000000000000000000075561475521542100151660ustar00rootroot00000000000000# oneAPI Level Zero This repository contains the following components of oneAPI: - Copies of the Level Zero Specification API C/C++ header files - Level Zero Loader - Level Zero Validation Layer - Level Zero Tracing Layer This project is part of the larger [oneAPI](https://www.oneapi.com/) project. See the [oneAPI specification](https://spec.oneapi.com/versions/latest/introduction.html) for more information about the oneAPI project. See the [Level Zero specification](https://oneapi-src.github.io/level-zero-spec/level-zero/latest/index.html) for more information about Level Zero. See the [Level Zero specification repo](https://github.com/oneapi-src/level-zero-spec) for contributing to the specification. Level Zero API versions are listed in the `ze_api_version_t` enumeration, located in the [ze_api.h](./include/ze_api.h) file. # Building and Installing Project is defined using [CMake](https://cmake.org/). ## Linux ``` mkdir build cd build cmake .. -D CMAKE_BUILD_TYPE=Release cmake --build . --target package cmake --build . --target install ``` # Debug Trace The Level Zero Loader has the ability to print warnings and errors which occur within the internals of the Level Zero Loader itself. To enable this debug tracing feature, set the environment variable `ZE_ENABLE_LOADER_DEBUG_TRACE=1`. This will enforce the Loader to print all errors whether fatal or non-fatal to stderr with the PREFIX `ZE_LOADER_DEBUG_TRACE:`. # Logging to File - PREVIEW The Level Zero Loader uses spdlog logging and can be controlled via environment variables: `ZEL_ENABLE_LOADER_LOGGING=1` [DEPRECATED] `ZEL_LOADER_LOG_FILE=/path/to/logfile` `ZEL_LOADER_LOG_DIR='/directory/path'` `ZEL_LOADER_LOGGING_LEVEL=debug` Valid logging levels are trace, debug, info, warn, error, critical, off. Logging is disabled by default but when enabled the default level is 'warn'. The default log file is 'ze_loader.log' in '.oneapi_logs' in the current user's home directory. This feature is in early development and is preview only. # Logging API calls The Level Zero Loader will log all API calls whenever logging level is set to `trace` and validation layer is enabled. Following variables need to be set to enable API logging: `ZEL_ENABLE_LOADER_LOGGING=1` `ZEL_LOADER_LOGGING_LEVEL=trace` `ZE_ENABLE_VALIDATION_LAYER=1` By default logs will be written to the log file, as described above. To print the logs to stderr instead, `ZEL_LOADER_LOG_CONSOLE=1` needs to be set. # Driver/Device Sorting As of v1.20.3 of the Loader, Drivers and Devices reported to the user are sorted to enable the first device to be the best available device. - By default, drivers will be sorted such that the ordering will be: - Drivers with Discrete GPUs only - Drivers with Discrete and Integrated GPUs - Drivers with Integrated GPUs - Drivers with Mixed Devices Types (ie GPU + NPU) - Drivers with Non GPU Devices Only - If ZE_ENABLE_PCI_ID_DEVICE_ORDER is set, then the following ordering is provided: - Drivers with Integrated GPUs - Drivers with Discrete and Integrated GPUs - Drivers with Discrete GPUs only - Drivers with Mixed Devices Types (ie GPU + NPU) - Drivers with Non GPU Devices Only The order of the sorting is based on the enumerator: `zel_driver_type_t` The ordering of the drivers reported to the user is based on the order of the enumerations provided. When additional driver types are added, they should be added to the end of the list to avoid reporting new device types before known device types. # Contributing See [CONTRIBUTING](CONTRIBUTING.md) for more information. # License Distributed under the MIT license. See [LICENSE](LICENSE) for more information. # Security See Intel's [Security Center](https://www.intel.com/content/www/us/en/security-center/default.html) for information on how to report a potential security issue or vulnerability. See also [SECURITY](SECURITY.md). level-zero-1.20.6/SECURITY.md000066400000000000000000000006511475521542100154650ustar00rootroot00000000000000# Security Policy ## 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 level-zero-1.20.6/doc/000077500000000000000000000000001475521542100144375ustar00rootroot00000000000000level-zero-1.20.6/doc/loader_api.md000066400000000000000000000064761475521542100170750ustar00rootroot00000000000000# Level Zero Loader APIs ## Introduction The Level Zero Loader will expose some additional APIs beyond what is defined in the Level Zero spec. The purpose of these APIs will generally be to access and set various loader configuration components. This document does not cover APIs specific to individual layers (ie. tracing) or APIs defined in the Level Zero spec. ## API Reference Exposed Loader APIs will be defined in header files located in this repository at `include/loader`, and installed to `/include/level_zero/loader` ### zelLoaderGetVersions This API is used to retreive the version information of the loader itself and of any layers that are enabled. - __*num_elems__ Is a pointer to the number of version components to get. - __*versions__ Pointer to address to write version components to. If set to `nullptr`, `num_elems` will be set to the total number of version components available. There are currently 3 versioned components assigned the following name strings: - `"tracing layer"` - `"validation layer"` - `"loader"` ### zelLoaderTranslateHandle When a system has multiple L0 drivers, raw handles returned from the L0 drivers are modified by the loader before being returned to the application. This allows the loader to determine which handles belong to which driver and forward API calls appropriately. In most cases the loader will perform this handle translation completely transparently to the application and no manual translation is ever needed. In some rare cases when the application needs to occasionally bypass the loader, handle conflicts can arise. One such case is when an application wants to call a driver extension function whose address has been retreived with `zeDriverGetExtensionFunctionAddress` To solve this issue, `zelLoaderTranslateHandle` is used to retrieve the raw driver handle associated with a loader handle. - __handleType__ Type of the L0 handle to translate - __*handleIn__ Input handle to translate - __**handleOut__ Output location to store the translated handle ### zelEnableTracingLayer When a user wants to enable the Tracing Layer for API Tracing, one usually set `ZE_ENABLE_TRACING_LAYER=1` before the call to zeInit(), however if one wanted to enable and disable tracing during runtime, the only way previously would be to enable tracing with the tracers disabled. This causes a performance hit due to the tracing layer intercepts. To resolve this, the tracing layer additionally can be enabled thru this new api `zelEnableTracingLayer`. This will enable the api tracing layer until the program exits or the user calls `zelDisableTracingLayer`. This call enables the tracing layer for all calls to the Loader after this call completes for all initialized drivers. ### zelDisableTracingLayer Disables the tracing layer intercepts at runtime by restoring the previous call path thru the loader before tracing was enabled. This does not unload the tracing layer library such that one can call `zelEnableTracingLayer` and `zelDisableTracingLayer` as many times one needs to during the application. NOTE: The each call to `zelEnableTracingLayer` tracks a reference count of how many calls to enable have been seen. The Tracing Layer intercepts will not be removed until the reference count has reached 0 indicating that all users of the tracing layer have called `zelDisableTracingLayer`. level-zero-1.20.6/include/000077500000000000000000000000001475521542100153155ustar00rootroot00000000000000level-zero-1.20.6/include/layers/000077500000000000000000000000001475521542100166145ustar00rootroot00000000000000level-zero-1.20.6/include/layers/zel_tracing_api.h000066400000000000000000000164751475521542100221340ustar00rootroot00000000000000/* * Copyright (C) 2020 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_tracing_api.h */ #ifndef _ZEL_TRACING_API_H #define _ZEL_TRACING_API_H #if defined(__cplusplus) #pragma once #endif // 'core' API headers #include "../ze_api.h" #if defined(__cplusplus) extern "C" { #endif // Intel 'oneAPI' Level-Zero Loader Layer Extension APIs for API Tracing #if !defined(__GNUC__) #pragma region zel_tracing #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of tracer object typedef struct _zel_tracer_handle_t *zel_tracer_handle_t; /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// #ifndef ZEL_API_TRACING_NAME /// @brief API Tracing Extension Name #define ZEL_API_TRACING_NAME "ZEL_api_tracing" #endif // ZEL_API_TRACING_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief API Tracing Extension Version(s) typedef enum _zel_api_tracing_version_t { ZEL_API_TRACING_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZEL_API_TRACING_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZEL_API_TRACING_VERSION_FORCE_UINT32 = 0x7fffffff } zel_api_tracing_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Alias the existing callbacks definition for 'core' callbacks typedef ze_callbacks_t zel_core_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Defines structure types typedef enum _zel_structure_type_t { ZEL_STRUCTURE_TYPE_TRACER_DESC = 0x1 ,///< ::zel_tracer_desc_t // This enumeration value is deprecated. // Pluse use ZEL_STRUCTURE_TYPE_TRACER_DESC. ZEL_STRUCTURE_TYPE_TRACER_EXP_DESC = 0x1 ,///< ::zel_tracer_desc_t ZEL_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff } zel_structure_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Tracer descriptor typedef struct _zel_tracer_desc_t { zel_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] pointer to extension-specific structure void* pUserData; ///< [in] pointer passed to every tracer's callbacks } zel_tracer_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a tracer /// /// @details /// - The tracer is created in the disabled state. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == desc->pUserData` /// + `nullptr == phTracer` /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCreate( const zel_tracer_desc_t* desc, ///< [in] pointer to tracer descriptor zel_tracer_handle_t* phTracer ///< [out] pointer to handle of tracer object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a tracer. /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// - The implementation of this function must be thread-safe. /// - The implementation of this function will stall and wait on any /// outstanding threads executing callbacks before freeing any Host /// allocations associated with this tracer. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDestroy( zel_tracer_handle_t hTracer ///< [in][release] handle of tracer object to destroy ); /////////////////////////////////////////////////////////////////////////////// /// @brief Sets the collection of callbacks to be executed **before** driver /// execution. /// /// @details /// - The application only needs to set the function pointers it is /// interested in receiving; all others should be 'nullptr' /// - The application must ensure that no other threads are executing /// functions for which the tracing functions are changing. /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCoreCbs` ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerSetPrologues( zel_tracer_handle_t hTracer, ///< [in] handle of the tracer zel_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Sets the collection of callbacks to be executed **after** driver /// execution. /// /// @details /// - The application only needs to set the function pointers it is /// interested in receiving; all others should be 'nullptr' /// - The application must ensure that no other threads are executing /// functions for which the tracing functions are changing. /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCoreCbs` ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerSetEpilogues( zel_tracer_handle_t hTracer, ///< [in] handle of the tracer zel_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Enables (or disables) the tracer /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerSetEnabled( zel_tracer_handle_t hTracer, ///< [in] handle of the tracer ze_bool_t enable ///< [in] enable the tracer if true; disable if false ); #if !defined(__GNUC__) #pragma endregion #endif #if defined(__cplusplus) } // extern "C" #endif #endif // _ZEL_TRACING_API_Hlevel-zero-1.20.6/include/layers/zel_tracing_ddi.h000066400000000000000000000065231475521542100221140ustar00rootroot00000000000000/* * Copyright (C) 2020 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_tracing_ddi.h * * This file has been manually generated. * There is no "spec" for this loader layer "tracer" API. */ #ifndef _ZEL_TRACING_DDI_H #define _ZEL_TRACING_DDI_H #if defined(__cplusplus) #pragma once #endif #include "layers/zel_tracing_api.h" #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zelTracerCreate typedef ze_result_t (ZE_APICALL *zel_pfnTracerCreate_t)( const zel_tracer_desc_t*, zel_tracer_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetTracerDestroy typedef ze_result_t (ZE_APICALL *zel_pfnTracerDestroy_t)( zel_tracer_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetTracerSetPrologues typedef ze_result_t (ZE_APICALL *zel_pfnTracerSetPrologues_t)( zel_tracer_handle_t, zel_core_callbacks_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetTracerSetEpilogues typedef ze_result_t (ZE_APICALL *zel_pfnTracerSetEpilogues_t)( zel_tracer_handle_t, zel_core_callbacks_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetTracerSetEnabled typedef ze_result_t (ZE_APICALL *zel_pfnTracerSetEnabled_t)( zel_tracer_handle_t, ze_bool_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Tracer functions pointers typedef struct _zel_tracer_dditable_t { zel_pfnTracerCreate_t pfnCreate; zel_pfnTracerDestroy_t pfnDestroy; zel_pfnTracerSetPrologues_t pfnSetPrologues; zel_pfnTracerSetEpilogues_t pfnSetEpilogues; zel_pfnTracerSetEnabled_t pfnSetEnabled; } zel_tracer_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Tracer table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zelGetTracerApiProcAddrTable( ze_api_version_t version, ///< [in] API version requested zel_tracer_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zelGetTracerApiProcAddrTable typedef ze_result_t (ZE_APICALL *zel_pfnGetTracerApiProcAddrTable_t)( ze_api_version_t, zel_tracer_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Container for tracing DDI tables typedef struct _zel_tracing_dditable_t { zel_tracer_dditable_t Tracer; } zel_tracing_dditable_t; #if defined(__cplusplus) } // extern "C" #endif #endif // _ZEL_TRACING_DDI_H level-zero-1.20.6/include/layers/zel_tracing_register_cb.h000066400000000000000000003646121475521542100236520ustar00rootroot00000000000000/* * * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_tracing_register_cb.h * */ #ifndef zel_tracing_register_cb_H #define zel_tracing_register_cb_H #if defined(__cplusplus) #pragma once #endif #include "../ze_api.h" #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of tracer object typedef struct _zel_tracer_handle_t *zel_tracer_handle_t; /// Callback definitions for all API released in LevelZero spec 1.1 or newer /// Callbacks for APIs included in spec 1.0 are contained in ze_api.helper /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeInitDrivers /// @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 _ze_init_drivers_params_t { uint32_t** ppCount; ze_driver_handle_t** pphDrivers; ze_init_driver_type_desc_t** pdesc; } ze_init_drivers_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeInitDrivers /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnInitDriversCb_t)( ze_init_drivers_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeRTASBuilderCreateExp /// @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 _ze_rtas_builder_create_exp_params_t { ze_driver_handle_t* phDriver; const ze_rtas_builder_exp_desc_t** ppDescriptor; ze_rtas_builder_exp_handle_t** pphBuilder; } ze_rtas_builder_create_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeRTASBuilderCreateExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnRTASBuilderCreateExpCb_t)( ze_rtas_builder_create_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeRTASBuilderGetBuildPropertiesExp /// @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 _ze_rtas_builder_get_build_properties_exp_params_t { ze_rtas_builder_exp_handle_t* phBuilder; const ze_rtas_builder_build_op_exp_desc_t** ppBuildOpDescriptor; ze_rtas_builder_exp_properties_t** ppProperties; } ze_rtas_builder_get_build_properties_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeRTASBuilderGetBuildPropertiesExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnRTASBuilderGetBuildPropertiesExpCb_t)( ze_rtas_builder_get_build_properties_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeRTASBuilderBuildExp /// @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 _ze_rtas_builder_build_exp_params_t { ze_rtas_builder_exp_handle_t* phBuilder; const ze_rtas_builder_build_op_exp_desc_t** ppBuildOpDescriptor; void** ppScratchBuffer; size_t* pscratchBufferSizeBytes; void** ppRtasBuffer; size_t* prtasBufferSizeBytes; ze_rtas_parallel_operation_exp_handle_t* phParallelOperation; void** ppBuildUserPtr; ze_rtas_aabb_exp_t** ppBounds; size_t** ppRtasBufferSizeBytes; } ze_rtas_builder_build_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeRTASBuilderBuildExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnRTASBuilderBuildExpCb_t)( ze_rtas_builder_build_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeRTASBuilderDestroyExp /// @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 _ze_rtas_builder_destroy_exp_params_t { ze_rtas_builder_exp_handle_t* phBuilder; } ze_rtas_builder_destroy_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeRTASBuilderDestroyExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnRTASBuilderDestroyExpCb_t)( ze_rtas_builder_destroy_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeRTASParallelOperationCreateExp /// @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 _ze_rtas_parallel_operation_create_exp_params_t { ze_driver_handle_t* phDriver; ze_rtas_parallel_operation_exp_handle_t** pphParallelOperation; } ze_rtas_parallel_operation_create_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeRTASParallelOperationCreateExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnRTASParallelOperationCreateExpCb_t)( ze_rtas_parallel_operation_create_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeRTASParallelOperationGetPropertiesExp /// @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 _ze_rtas_parallel_operation_get_properties_exp_params_t { ze_rtas_parallel_operation_exp_handle_t* phParallelOperation; ze_rtas_parallel_operation_exp_properties_t** ppProperties; } ze_rtas_parallel_operation_get_properties_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeRTASParallelOperationGetPropertiesExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnRTASParallelOperationGetPropertiesExpCb_t)( ze_rtas_parallel_operation_get_properties_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeRTASParallelOperationJoinExp /// @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 _ze_rtas_parallel_operation_join_exp_params_t { ze_rtas_parallel_operation_exp_handle_t* phParallelOperation; } ze_rtas_parallel_operation_join_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeRTASParallelOperationJoinExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnRTASParallelOperationJoinExpCb_t)( ze_rtas_parallel_operation_join_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeRTASParallelOperationDestroyExp /// @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 _ze_rtas_parallel_operation_destroy_exp_params_t { ze_rtas_parallel_operation_exp_handle_t* phParallelOperation; } ze_rtas_parallel_operation_destroy_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeRTASParallelOperationDestroyExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnRTASParallelOperationDestroyExpCb_t)( ze_rtas_parallel_operation_destroy_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDriverGetExtensionFunctionAddress /// @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 _ze_driver_get_extension_function_address_params_t { ze_driver_handle_t* phDriver; const char** pname; void*** pppFunctionAddress; } ze_driver_get_extension_function_address_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDriverGetExtensionFunctionAddress /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDriverGetExtensionFunctionAddressCb_t)( ze_driver_get_extension_function_address_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDriverGetLastErrorDescription /// @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 _ze_driver_get_last_error_description_params_t { ze_driver_handle_t* phDriver; const char*** pppString; } ze_driver_get_last_error_description_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDriverGetLastErrorDescription /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDriverGetLastErrorDescriptionCb_t)( ze_driver_get_last_error_description_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDriverRTASFormatCompatibilityCheckExp /// @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 _ze_driver_rtas_format_compatibility_check_exp_params_t { ze_driver_handle_t* phDriver; ze_rtas_format_exp_t* prtasFormatA; ze_rtas_format_exp_t* prtasFormatB; } ze_driver_rtas_format_compatibility_check_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDriverRTASFormatCompatibilityCheckExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDriverRTASFormatCompatibilityCheckExpCb_t)( ze_driver_rtas_format_compatibility_check_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetGlobalTimestamps /// @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 _ze_device_get_global_timestamps_params_t { ze_device_handle_t* phDevice; uint64_t** phostTimestamp; uint64_t** pdeviceTimestamp; } ze_device_get_global_timestamps_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetGlobalTimestamps /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetGlobalTimestampsCb_t)( ze_device_get_global_timestamps_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceImportExternalSemaphoreExt /// @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 _ze_device_import_external_semaphore_ext_params_t { ze_device_handle_t* phDevice; const ze_external_semaphore_ext_desc_t** pdesc; ze_external_semaphore_ext_handle_t** pphSemaphore; } ze_device_import_external_semaphore_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceImportExternalSemaphoreExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceImportExternalSemaphoreExtCb_t)( ze_device_import_external_semaphore_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceReleaseExternalSemaphoreExt /// @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 _ze_device_release_external_semaphore_ext_params_t { ze_external_semaphore_ext_handle_t* phSemaphore; } ze_device_release_external_semaphore_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceReleaseExternalSemaphoreExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceReleaseExternalSemaphoreExtCb_t)( ze_device_release_external_semaphore_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceReserveCacheExt /// @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 _ze_device_reserve_cache_ext_params_t { ze_device_handle_t* phDevice; size_t* pcacheLevel; size_t* pcacheReservationSize; } ze_device_reserve_cache_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceReserveCacheExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceReserveCacheExtCb_t)( ze_device_reserve_cache_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceSetCacheAdviceExt /// @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 _ze_device_set_cache_advice_ext_params_t { ze_device_handle_t* phDevice; void** pptr; size_t* pregionSize; ze_cache_ext_region_t* pcacheRegion; } ze_device_set_cache_advice_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceSetCacheAdviceExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceSetCacheAdviceExtCb_t)( ze_device_set_cache_advice_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDevicePciGetPropertiesExt /// @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 _ze_device_pci_get_properties_ext_params_t { ze_device_handle_t* phDevice; ze_pci_ext_properties_t** ppPciProperties; } ze_device_pci_get_properties_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDevicePciGetPropertiesExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDevicePciGetPropertiesExtCb_t)( ze_device_pci_get_properties_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetFabricVertexExp /// @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 _ze_device_get_fabric_vertex_exp_params_t { ze_device_handle_t* phDevice; ze_fabric_vertex_handle_t** pphVertex; } ze_device_get_fabric_vertex_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetFabricVertexExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetFabricVertexExpCb_t)( ze_device_get_fabric_vertex_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetRootDevice /// @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 _ze_device_get_root_device_params_t { ze_device_handle_t* phDevice; ze_device_handle_t** pphRootDevice; } ze_device_get_root_device_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetRootDevice /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetRootDeviceCb_t)( ze_device_get_root_device_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeContextCreateEx /// @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 _ze_context_create_ex_params_t { ze_driver_handle_t* phDriver; const ze_context_desc_t** pdesc; uint32_t* pnumDevices; ze_device_handle_t** pphDevices; ze_context_handle_t** pphContext; } ze_context_create_ex_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeContextCreateEx /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnContextCreateExCb_t)( ze_context_create_ex_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandQueueGetOrdinal /// @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 _ze_command_queue_get_ordinal_params_t { ze_command_queue_handle_t* phCommandQueue; uint32_t** ppOrdinal; } ze_command_queue_get_ordinal_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandQueueGetOrdinal /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandQueueGetOrdinalCb_t)( ze_command_queue_get_ordinal_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandQueueGetIndex /// @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 _ze_command_queue_get_index_params_t { ze_command_queue_handle_t* phCommandQueue; uint32_t** ppIndex; } ze_command_queue_get_index_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandQueueGetIndex /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandQueueGetIndexCb_t)( ze_command_queue_get_index_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListGetNextCommandIdWithKernelsExp /// @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 _ze_command_list_get_next_command_id_with_kernels_exp_params_t { ze_command_list_handle_t* phCommandList; const ze_mutable_command_id_exp_desc_t** pdesc; uint32_t* pnumKernels; ze_kernel_handle_t** pphKernels; uint64_t** ppCommandId; } ze_command_list_get_next_command_id_with_kernels_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListGetNextCommandIdWithKernelsExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListGetNextCommandIdWithKernelsExpCb_t)( ze_command_list_get_next_command_id_with_kernels_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListUpdateMutableCommandKernelsExp /// @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 _ze_command_list_update_mutable_command_kernels_exp_params_t { ze_command_list_handle_t* phCommandList; uint32_t* pnumKernels; uint64_t** ppCommandId; ze_kernel_handle_t** pphKernels; } ze_command_list_update_mutable_command_kernels_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListUpdateMutableCommandKernelsExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListUpdateMutableCommandKernelsExpCb_t)( ze_command_list_update_mutable_command_kernels_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendSignalExternalSemaphoreExt /// @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 _ze_command_list_append_signal_external_semaphore_ext_params_t { ze_command_list_handle_t* phCommandList; uint32_t* pnumSemaphores; ze_external_semaphore_ext_handle_t** pphSemaphores; ze_external_semaphore_signal_params_ext_t** psignalParams; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_signal_external_semaphore_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendSignalExternalSemaphoreExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendSignalExternalSemaphoreExtCb_t)( ze_command_list_append_signal_external_semaphore_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendWaitExternalSemaphoreExt /// @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 _ze_command_list_append_wait_external_semaphore_ext_params_t { ze_command_list_handle_t* phCommandList; uint32_t* pnumSemaphores; ze_external_semaphore_ext_handle_t** pphSemaphores; ze_external_semaphore_wait_params_ext_t** pwaitParams; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_wait_external_semaphore_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendWaitExternalSemaphoreExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendWaitExternalSemaphoreExtCb_t)( ze_command_list_append_wait_external_semaphore_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendImageCopyToMemoryExt /// @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 _ze_command_list_append_image_copy_to_memory_ext_params_t { ze_command_list_handle_t* phCommandList; void** pdstptr; ze_image_handle_t* phSrcImage; const ze_image_region_t** ppSrcRegion; uint32_t* pdestRowPitch; uint32_t* pdestSlicePitch; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_image_copy_to_memory_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendImageCopyToMemoryExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendImageCopyToMemoryExtCb_t)( ze_command_list_append_image_copy_to_memory_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendImageCopyFromMemoryExt /// @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 _ze_command_list_append_image_copy_from_memory_ext_params_t { ze_command_list_handle_t* phCommandList; ze_image_handle_t* phDstImage; const void** psrcptr; const ze_image_region_t** ppDstRegion; uint32_t* psrcRowPitch; uint32_t* psrcSlicePitch; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_image_copy_from_memory_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendImageCopyFromMemoryExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendImageCopyFromMemoryExtCb_t)( ze_command_list_append_image_copy_from_memory_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListHostSynchronize /// @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 _ze_command_list_host_synchronize_params_t { ze_command_list_handle_t* phCommandList; uint64_t* ptimeout; } ze_command_list_host_synchronize_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListHostSynchronize /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListHostSynchronizeCb_t)( ze_command_list_host_synchronize_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListCreateCloneExp /// @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 _ze_command_list_create_clone_exp_params_t { ze_command_list_handle_t* phCommandList; ze_command_list_handle_t** pphClonedCommandList; } ze_command_list_create_clone_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListCreateCloneExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListCreateCloneExpCb_t)( ze_command_list_create_clone_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListGetDeviceHandle /// @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 _ze_command_list_get_device_handle_params_t { ze_command_list_handle_t* phCommandList; ze_device_handle_t** pphDevice; } ze_command_list_get_device_handle_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListGetDeviceHandle /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListGetDeviceHandleCb_t)( ze_command_list_get_device_handle_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListGetContextHandle /// @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 _ze_command_list_get_context_handle_params_t { ze_command_list_handle_t* phCommandList; ze_context_handle_t** pphContext; } ze_command_list_get_context_handle_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListGetContextHandle /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListGetContextHandleCb_t)( ze_command_list_get_context_handle_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListGetOrdinal /// @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 _ze_command_list_get_ordinal_params_t { ze_command_list_handle_t* phCommandList; uint32_t** ppOrdinal; } ze_command_list_get_ordinal_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListGetOrdinal /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListGetOrdinalCb_t)( ze_command_list_get_ordinal_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListImmediateGetIndex /// @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 _ze_command_list_immediate_get_index_params_t { ze_command_list_handle_t* phCommandListImmediate; uint32_t** ppIndex; } ze_command_list_immediate_get_index_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListImmediateGetIndex /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListImmediateGetIndexCb_t)( ze_command_list_immediate_get_index_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListIsImmediate /// @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 _ze_command_list_is_immediate_params_t { ze_command_list_handle_t* phCommandList; ze_bool_t** ppIsImmediate; } ze_command_list_is_immediate_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListIsImmediate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListIsImmediateCb_t)( ze_command_list_is_immediate_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListImmediateAppendCommandListsExp /// @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 _ze_command_list_immediate_append_command_lists_exp_params_t { ze_command_list_handle_t* phCommandListImmediate; uint32_t* pnumCommandLists; ze_command_list_handle_t** pphCommandLists; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_immediate_append_command_lists_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListImmediateAppendCommandListsExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListImmediateAppendCommandListsExpCb_t)( ze_command_list_immediate_append_command_lists_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListGetNextCommandIdExp /// @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 _ze_command_list_get_next_command_id_exp_params_t { ze_command_list_handle_t* phCommandList; const ze_mutable_command_id_exp_desc_t** pdesc; uint64_t** ppCommandId; } ze_command_list_get_next_command_id_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListGetNextCommandIdExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListGetNextCommandIdExpCb_t)( ze_command_list_get_next_command_id_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListUpdateMutableCommandsExp /// @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 _ze_command_list_update_mutable_commands_exp_params_t { ze_command_list_handle_t* phCommandList; const ze_mutable_commands_exp_desc_t** pdesc; } ze_command_list_update_mutable_commands_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListUpdateMutableCommandsExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListUpdateMutableCommandsExpCb_t)( ze_command_list_update_mutable_commands_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListUpdateMutableCommandSignalEventExp /// @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 _ze_command_list_update_mutable_command_signal_event_exp_params_t { ze_command_list_handle_t* phCommandList; uint64_t* pcommandId; ze_event_handle_t* phSignalEvent; } ze_command_list_update_mutable_command_signal_event_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListUpdateMutableCommandSignalEventExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListUpdateMutableCommandSignalEventExpCb_t)( ze_command_list_update_mutable_command_signal_event_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListUpdateMutableCommandWaitEventsExp /// @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 _ze_command_list_update_mutable_command_wait_events_exp_params_t { ze_command_list_handle_t* phCommandList; uint64_t* pcommandId; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_update_mutable_command_wait_events_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListUpdateMutableCommandWaitEventsExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListUpdateMutableCommandWaitEventsExpCb_t)( ze_command_list_update_mutable_command_wait_events_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventQueryTimestampsExp /// @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 _ze_event_query_timestamps_exp_params_t { ze_event_handle_t* phEvent; ze_device_handle_t* phDevice; uint32_t** ppCount; ze_kernel_timestamp_result_t** ppTimestamps; } ze_event_query_timestamps_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventQueryTimestampsExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventQueryTimestampsExpCb_t)( ze_event_query_timestamps_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventQueryKernelTimestampsExt /// @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 _ze_event_query_kernel_timestamps_ext_params_t { ze_event_handle_t* phEvent; ze_device_handle_t* phDevice; uint32_t** ppCount; ze_event_query_kernel_timestamps_results_ext_properties_t** ppResults; } ze_event_query_kernel_timestamps_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventQueryKernelTimestampsExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventQueryKernelTimestampsExtCb_t)( ze_event_query_kernel_timestamps_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventGetEventPool /// @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 _ze_event_get_event_pool_params_t { ze_event_handle_t* phEvent; ze_event_pool_handle_t** pphEventPool; } ze_event_get_event_pool_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventGetEventPool /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventGetEventPoolCb_t)( ze_event_get_event_pool_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventGetSignalScope /// @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 _ze_event_get_signal_scope_params_t { ze_event_handle_t* phEvent; ze_event_scope_flags_t** ppSignalScope; } ze_event_get_signal_scope_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventGetSignalScope /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventGetSignalScopeCb_t)( ze_event_get_signal_scope_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventGetWaitScope /// @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 _ze_event_get_wait_scope_params_t { ze_event_handle_t* phEvent; ze_event_scope_flags_t** ppWaitScope; } ze_event_get_wait_scope_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventGetWaitScope /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventGetWaitScopeCb_t)( ze_event_get_wait_scope_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventPoolPutIpcHandle /// @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 _ze_event_pool_put_ipc_handle_params_t { ze_context_handle_t* phContext; ze_ipc_event_pool_handle_t* phIpc; } ze_event_pool_put_ipc_handle_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventPoolPutIpcHandle /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventPoolPutIpcHandleCb_t)( ze_event_pool_put_ipc_handle_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventPoolGetContextHandle /// @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 _ze_event_pool_get_context_handle_params_t { ze_event_pool_handle_t* phEventPool; ze_context_handle_t** pphContext; } ze_event_pool_get_context_handle_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventPoolGetContextHandle /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventPoolGetContextHandleCb_t)( ze_event_pool_get_context_handle_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventPoolGetFlags /// @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 _ze_event_pool_get_flags_params_t { ze_event_pool_handle_t* phEventPool; ze_event_pool_flags_t** ppFlags; } ze_event_pool_get_flags_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventPoolGetFlags /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventPoolGetFlagsCb_t)( ze_event_pool_get_flags_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeImageGetMemoryPropertiesExp /// @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 _ze_image_get_memory_properties_exp_params_t { ze_image_handle_t* phImage; ze_image_memory_properties_exp_t** ppMemoryProperties; } ze_image_get_memory_properties_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeImageGetMemoryPropertiesExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnImageGetMemoryPropertiesExpCb_t)( ze_image_get_memory_properties_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeImageViewCreateExp /// @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 _ze_image_view_create_exp_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; const ze_image_desc_t** pdesc; ze_image_handle_t* phImage; ze_image_handle_t** pphImageView; } ze_image_view_create_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeImageViewCreateExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnImageViewCreateExpCb_t)( ze_image_view_create_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeImageGetAllocPropertiesExt /// @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 _ze_image_get_alloc_properties_ext_params_t { ze_context_handle_t* phContext; ze_image_handle_t* phImage; ze_image_allocation_ext_properties_t** ppImageAllocProperties; } ze_image_get_alloc_properties_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeImageGetAllocPropertiesExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnImageGetAllocPropertiesExtCb_t)( ze_image_get_alloc_properties_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeImageViewCreateExt /// @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 _ze_image_view_create_ext_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; const ze_image_desc_t** pdesc; ze_image_handle_t* phImage; ze_image_handle_t** pphImageView; } ze_image_view_create_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeImageViewCreateExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnImageViewCreateExtCb_t)( ze_image_view_create_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeImageGetDeviceOffsetExp /// @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 _ze_image_get_device_offset_exp_params_t { ze_image_handle_t* phImage; uint64_t** ppDeviceOffset; } ze_image_get_device_offset_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeImageGetDeviceOffsetExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnImageGetDeviceOffsetExpCb_t)( ze_image_get_device_offset_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelSetGlobalOffsetExp /// @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 _ze_kernel_set_global_offset_exp_params_t { ze_kernel_handle_t* phKernel; uint32_t* poffsetX; uint32_t* poffsetY; uint32_t* poffsetZ; } ze_kernel_set_global_offset_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelSetGlobalOffsetExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelSetGlobalOffsetExpCb_t)( ze_kernel_set_global_offset_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelGetBinaryExp /// @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 _ze_kernel_get_binary_exp_params_t { ze_kernel_handle_t* phKernel; size_t** ppSize; uint8_t** ppKernelBinary; } ze_kernel_get_binary_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelGetBinaryExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelGetBinaryExpCb_t)( ze_kernel_get_binary_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelSchedulingHintExp /// @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 _ze_kernel_scheduling_hint_exp_params_t { ze_kernel_handle_t* phKernel; ze_scheduling_hint_exp_desc_t** ppHint; } ze_kernel_scheduling_hint_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelSchedulingHintExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelSchedulingHintExpCb_t)( ze_kernel_scheduling_hint_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemFreeExt /// @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 _ze_mem_free_ext_params_t { ze_context_handle_t* phContext; const ze_memory_free_ext_desc_t** ppMemFreeDesc; void** pptr; } ze_mem_free_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemFreeExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemFreeExtCb_t)( ze_mem_free_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemGetIpcHandleFromFileDescriptorExp /// @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 _ze_mem_get_ipc_handle_from_file_descriptor_exp_params_t { ze_context_handle_t* phContext; uint64_t* phandle; ze_ipc_mem_handle_t** ppIpcHandle; } ze_mem_get_ipc_handle_from_file_descriptor_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemGetIpcHandleFromFileDescriptorExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemGetIpcHandleFromFileDescriptorExpCb_t)( ze_mem_get_ipc_handle_from_file_descriptor_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemGetFileDescriptorFromIpcHandleExp /// @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 _ze_mem_get_file_descriptor_from_ipc_handle_exp_params_t { ze_context_handle_t* phContext; ze_ipc_mem_handle_t* pipcHandle; uint64_t** ppHandle; } ze_mem_get_file_descriptor_from_ipc_handle_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemGetFileDescriptorFromIpcHandleExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemGetFileDescriptorFromIpcHandleExpCb_t)( ze_mem_get_file_descriptor_from_ipc_handle_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemPutIpcHandle /// @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 _ze_mem_put_ipc_handle_params_t { ze_context_handle_t* phContext; ze_ipc_mem_handle_t* phandle; } ze_mem_put_ipc_handle_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemPutIpcHandle /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemPutIpcHandleCb_t)( ze_mem_put_ipc_handle_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemSetAtomicAccessAttributeExp /// @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 _ze_mem_set_atomic_access_attribute_exp_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; const void** pptr; size_t* psize; ze_memory_atomic_attr_exp_flags_t* pattr; } ze_mem_set_atomic_access_attribute_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemSetAtomicAccessAttributeExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemSetAtomicAccessAttributeExpCb_t)( ze_mem_set_atomic_access_attribute_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemGetAtomicAccessAttributeExp /// @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 _ze_mem_get_atomic_access_attribute_exp_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; const void** pptr; size_t* psize; ze_memory_atomic_attr_exp_flags_t** ppAttr; } ze_mem_get_atomic_access_attribute_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemGetAtomicAccessAttributeExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemGetAtomicAccessAttributeExpCb_t)( ze_mem_get_atomic_access_attribute_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemGetPitchFor2dImage /// @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 _ze_mem_get_pitch_for2d_image_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; size_t* pimageWidth; size_t* pimageHeight; unsigned int* pelementSizeInBytes; size_t ** prowPitch; } ze_mem_get_pitch_for2d_image_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemGetPitchFor2dImage /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemGetPitchFor2dImageCb_t)( ze_mem_get_pitch_for2d_image_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeModuleInspectLinkageExt /// @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 _ze_module_inspect_linkage_ext_params_t { ze_linkage_inspection_ext_desc_t** ppInspectDesc; uint32_t* pnumModules; ze_module_handle_t** pphModules; ze_module_build_log_handle_t** pphLog; } ze_module_inspect_linkage_ext_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeModuleInspectLinkageExt /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnModuleInspectLinkageExtCb_t)( ze_module_inspect_linkage_ext_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeFabricEdgeGetExp /// @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 _ze_fabric_edge_get_exp_params_t { ze_fabric_vertex_handle_t* phVertexA; ze_fabric_vertex_handle_t* phVertexB; uint32_t** ppCount; ze_fabric_edge_handle_t** pphEdges; } ze_fabric_edge_get_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeFabricEdgeGetExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnFabricEdgeGetExpCb_t)( ze_fabric_edge_get_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeFabricEdgeGetVerticesExp /// @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 _ze_fabric_edge_get_vertices_exp_params_t { ze_fabric_edge_handle_t* phEdge; ze_fabric_vertex_handle_t** pphVertexA; ze_fabric_vertex_handle_t** pphVertexB; } ze_fabric_edge_get_vertices_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeFabricEdgeGetVerticesExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnFabricEdgeGetVerticesExpCb_t)( ze_fabric_edge_get_vertices_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeFabricEdgeGetPropertiesExp /// @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 _ze_fabric_edge_get_properties_exp_params_t { ze_fabric_edge_handle_t* phEdge; ze_fabric_edge_exp_properties_t** ppEdgeProperties; } ze_fabric_edge_get_properties_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeFabricEdgeGetPropertiesExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnFabricEdgeGetPropertiesExpCb_t)( ze_fabric_edge_get_properties_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeFabricVertexGetExp /// @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 _ze_fabric_vertex_get_exp_params_t { ze_driver_handle_t* phDriver; uint32_t** ppCount; ze_fabric_vertex_handle_t** pphVertices; } ze_fabric_vertex_get_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeFabricVertexGetExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnFabricVertexGetExpCb_t)( ze_fabric_vertex_get_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeFabricVertexGetSubVerticesExp /// @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 _ze_fabric_vertex_get_sub_vertices_exp_params_t { ze_fabric_vertex_handle_t* phVertex; uint32_t** ppCount; ze_fabric_vertex_handle_t** pphSubvertices; } ze_fabric_vertex_get_sub_vertices_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeFabricVertexGetSubVerticesExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnFabricVertexGetSubVerticesExpCb_t)( ze_fabric_vertex_get_sub_vertices_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeFabricVertexGetPropertiesExp /// @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 _ze_fabric_vertex_get_properties_exp_params_t { ze_fabric_vertex_handle_t* phVertex; ze_fabric_vertex_exp_properties_t** ppVertexProperties; } ze_fabric_vertex_get_properties_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeFabricVertexGetPropertiesExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnFabricVertexGetPropertiesExpCb_t)( ze_fabric_vertex_get_properties_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeFabricVertexGetDeviceExp /// @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 _ze_fabric_vertex_get_device_exp_params_t { ze_fabric_vertex_handle_t* phVertex; ze_device_handle_t** pphDevice; } ze_fabric_vertex_get_device_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeFabricVertexGetDeviceExp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnFabricVertexGetDeviceExpCb_t)( ze_fabric_vertex_get_device_exp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); typedef enum _zel_tracer_reg_t { ZEL_REGISTER_PROLOGUE = 0, ZEL_REGISTER_EPILOGUE = 1 } zel_tracer_reg_t; /// APIs to register callbacks for each core API ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerInitRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnInitCb_t pfnInitCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetCb_t pfnGetCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerInitDriversRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnInitDriversCb_t pfnInitDriversCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetApiVersionRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetApiVersionCb_t pfnGetApiVersionCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetPropertiesCb_t pfnGetPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetIpcPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetIpcPropertiesCb_t pfnGetIpcPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetExtensionPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetExtensionPropertiesCb_t pfnGetExtensionPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetExtensionFunctionAddressRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetExtensionFunctionAddressCb_t pfnGetExtensionFunctionAddressCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetLastErrorDescriptionRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetLastErrorDescriptionCb_t pfnGetLastErrorDescriptionCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetCb_t pfnGetCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetRootDeviceRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetRootDeviceCb_t pfnGetRootDeviceCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetSubDevicesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetSubDevicesCb_t pfnGetSubDevicesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetPropertiesCb_t pfnGetPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetComputePropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetComputePropertiesCb_t pfnGetComputePropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetModulePropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetModulePropertiesCb_t pfnGetModulePropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetCommandQueueGroupPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetCommandQueueGroupPropertiesCb_t pfnGetCommandQueueGroupPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetMemoryPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetMemoryPropertiesCb_t pfnGetMemoryPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetMemoryAccessPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetMemoryAccessPropertiesCb_t pfnGetMemoryAccessPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetCachePropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetCachePropertiesCb_t pfnGetCachePropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetImagePropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetImagePropertiesCb_t pfnGetImagePropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetExternalMemoryPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetExternalMemoryPropertiesCb_t pfnGetExternalMemoryPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetP2PPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetP2PPropertiesCb_t pfnGetP2PPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceCanAccessPeerRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceCanAccessPeerCb_t pfnCanAccessPeerCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetStatusRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetStatusCb_t pfnGetStatusCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetGlobalTimestampsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetGlobalTimestampsCb_t pfnGetGlobalTimestampsCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextCreateCb_t pfnCreateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextCreateExRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextCreateExCb_t pfnCreateExCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextDestroyCb_t pfnDestroyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextGetStatusRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextGetStatusCb_t pfnGetStatusCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueCreateCb_t pfnCreateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueDestroyCb_t pfnDestroyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueExecuteCommandListsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueExecuteCommandListsCb_t pfnExecuteCommandListsCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueSynchronizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueSynchronizeCb_t pfnSynchronizeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueGetOrdinalRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueGetOrdinalCb_t pfnGetOrdinalCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueGetIndexRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueGetIndexCb_t pfnGetIndexCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCreateCb_t pfnCreateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListCreateImmediateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCreateImmediateCb_t pfnCreateImmediateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListDestroyCb_t pfnDestroyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListCloseRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCloseCb_t pfnCloseCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListResetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListResetCb_t pfnResetCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendWriteGlobalTimestampRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendWriteGlobalTimestampCb_t pfnAppendWriteGlobalTimestampCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListHostSynchronizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListHostSynchronizeCb_t pfnHostSynchronizeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetDeviceHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetDeviceHandleCb_t pfnGetDeviceHandleCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetContextHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetContextHandleCb_t pfnGetContextHandleCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetOrdinalRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetOrdinalCb_t pfnGetOrdinalCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListImmediateGetIndexRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListImmediateGetIndexCb_t pfnImmediateGetIndexCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListIsImmediateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListIsImmediateCb_t pfnIsImmediateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendBarrierRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendBarrierCb_t pfnAppendBarrierCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryRangesBarrierRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryRangesBarrierCb_t pfnAppendMemoryRangesBarrierCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextSystemBarrierRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextSystemBarrierCb_t pfnSystemBarrierCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryCopyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryCopyCb_t pfnAppendMemoryCopyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryFillRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryFillCb_t pfnAppendMemoryFillCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryCopyRegionRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryCopyRegionCb_t pfnAppendMemoryCopyRegionCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryCopyFromContextRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryCopyFromContextCb_t pfnAppendMemoryCopyFromContextCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyCb_t pfnAppendImageCopyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyRegionRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyRegionCb_t pfnAppendImageCopyRegionCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyToMemoryRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyToMemoryCb_t pfnAppendImageCopyToMemoryCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyFromMemoryRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyFromMemoryCb_t pfnAppendImageCopyFromMemoryCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryPrefetchRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryPrefetchCb_t pfnAppendMemoryPrefetchCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemAdviseRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemAdviseCb_t pfnAppendMemAdviseCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolCreateCb_t pfnCreateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolDestroyCb_t pfnDestroyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventCreateCb_t pfnCreateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventDestroyCb_t pfnDestroyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolGetIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolGetIpcHandleCb_t pfnGetIpcHandleCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolPutIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolPutIpcHandleCb_t pfnPutIpcHandleCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolOpenIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolOpenIpcHandleCb_t pfnOpenIpcHandleCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolCloseIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolCloseIpcHandleCb_t pfnCloseIpcHandleCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendSignalEventRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendSignalEventCb_t pfnAppendSignalEventCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendWaitOnEventsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendWaitOnEventsCb_t pfnAppendWaitOnEventsCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventHostSignalRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventHostSignalCb_t pfnHostSignalCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventHostSynchronizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventHostSynchronizeCb_t pfnHostSynchronizeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventQueryStatusRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryStatusCb_t pfnQueryStatusCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendEventResetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendEventResetCb_t pfnAppendEventResetCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventHostResetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventHostResetCb_t pfnHostResetCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventQueryKernelTimestampRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryKernelTimestampCb_t pfnQueryKernelTimestampCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendQueryKernelTimestampsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendQueryKernelTimestampsCb_t pfnAppendQueryKernelTimestampsCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventGetEventPoolRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventGetEventPoolCb_t pfnGetEventPoolCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventGetSignalScopeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventGetSignalScopeCb_t pfnGetSignalScopeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventGetWaitScopeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventGetWaitScopeCb_t pfnGetWaitScopeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolGetContextHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolGetContextHandleCb_t pfnGetContextHandleCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolGetFlagsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolGetFlagsCb_t pfnGetFlagsCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFenceCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceCreateCb_t pfnCreateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFenceDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceDestroyCb_t pfnDestroyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFenceHostSynchronizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceHostSynchronizeCb_t pfnHostSynchronizeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFenceQueryStatusRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceQueryStatusCb_t pfnQueryStatusCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFenceResetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceResetCb_t pfnResetCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetPropertiesCb_t pfnGetPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageCreateCb_t pfnCreateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageDestroyCb_t pfnDestroyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemAllocSharedRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemAllocSharedCb_t pfnAllocSharedCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemAllocDeviceRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemAllocDeviceCb_t pfnAllocDeviceCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemAllocHostRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemAllocHostCb_t pfnAllocHostCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemFreeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemFreeCb_t pfnFreeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetAllocPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetAllocPropertiesCb_t pfnGetAllocPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetAddressRangeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetAddressRangeCb_t pfnGetAddressRangeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetIpcHandleCb_t pfnGetIpcHandleCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetIpcHandleFromFileDescriptorExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetIpcHandleFromFileDescriptorExpCb_t pfnGetIpcHandleFromFileDescriptorExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetFileDescriptorFromIpcHandleExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetFileDescriptorFromIpcHandleExpCb_t pfnGetFileDescriptorFromIpcHandleExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemPutIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemPutIpcHandleCb_t pfnPutIpcHandleCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemOpenIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemOpenIpcHandleCb_t pfnOpenIpcHandleCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemCloseIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemCloseIpcHandleCb_t pfnCloseIpcHandleCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemSetAtomicAccessAttributeExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemSetAtomicAccessAttributeExpCb_t pfnSetAtomicAccessAttributeExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetAtomicAccessAttributeExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetAtomicAccessAttributeExpCb_t pfnGetAtomicAccessAttributeExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleCreateCb_t pfnCreateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleDestroyCb_t pfnDestroyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleDynamicLinkRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleDynamicLinkCb_t pfnDynamicLinkCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleBuildLogDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleBuildLogDestroyCb_t pfnDestroyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleBuildLogGetStringRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleBuildLogGetStringCb_t pfnGetStringCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleGetNativeBinaryRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetNativeBinaryCb_t pfnGetNativeBinaryCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleGetGlobalPointerRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetGlobalPointerCb_t pfnGetGlobalPointerCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleGetKernelNamesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetKernelNamesCb_t pfnGetKernelNamesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetPropertiesCb_t pfnGetPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelCreateCb_t pfnCreateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelDestroyCb_t pfnDestroyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleGetFunctionPointerRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetFunctionPointerCb_t pfnGetFunctionPointerCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSetGroupSizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetGroupSizeCb_t pfnSetGroupSizeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSuggestGroupSizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSuggestGroupSizeCb_t pfnSuggestGroupSizeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSuggestMaxCooperativeGroupCountRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSuggestMaxCooperativeGroupCountCb_t pfnSuggestMaxCooperativeGroupCountCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSetArgumentValueRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetArgumentValueCb_t pfnSetArgumentValueCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSetIndirectAccessRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetIndirectAccessCb_t pfnSetIndirectAccessCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelGetIndirectAccessRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetIndirectAccessCb_t pfnGetIndirectAccessCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelGetSourceAttributesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetSourceAttributesCb_t pfnGetSourceAttributesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSetCacheConfigRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetCacheConfigCb_t pfnSetCacheConfigCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetPropertiesCb_t pfnGetPropertiesCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelGetNameRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetNameCb_t pfnGetNameCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendLaunchKernelRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchKernelCb_t pfnAppendLaunchKernelCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendLaunchCooperativeKernelRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchCooperativeKernelCb_t pfnAppendLaunchCooperativeKernelCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendLaunchKernelIndirectRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchKernelIndirectCb_t pfnAppendLaunchKernelIndirectCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendLaunchMultipleKernelsIndirectRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchMultipleKernelsIndirectCb_t pfnAppendLaunchMultipleKernelsIndirectCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextMakeMemoryResidentRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextMakeMemoryResidentCb_t pfnMakeMemoryResidentCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextEvictMemoryRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextEvictMemoryCb_t pfnEvictMemoryCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextMakeImageResidentRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextMakeImageResidentCb_t pfnMakeImageResidentCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextEvictImageRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextEvictImageCb_t pfnEvictImageCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerSamplerCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnSamplerCreateCb_t pfnCreateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerSamplerDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnSamplerDestroyCb_t pfnDestroyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemReserveRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemReserveCb_t pfnReserveCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemFreeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemFreeCb_t pfnFreeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemQueryPageSizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemQueryPageSizeCb_t pfnQueryPageSizeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerPhysicalMemCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnPhysicalMemCreateCb_t pfnCreateCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerPhysicalMemDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnPhysicalMemDestroyCb_t pfnDestroyCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemMapRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemMapCb_t pfnMapCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemUnmapRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemUnmapCb_t pfnUnmapCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemSetAccessAttributeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemSetAccessAttributeCb_t pfnSetAccessAttributeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemGetAccessAttributeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemGetAccessAttributeCb_t pfnGetAccessAttributeCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSetGlobalOffsetExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetGlobalOffsetExpCb_t pfnSetGlobalOffsetExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelGetBinaryExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetBinaryExpCb_t pfnGetBinaryExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceImportExternalSemaphoreExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceImportExternalSemaphoreExtCb_t pfnImportExternalSemaphoreExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceReleaseExternalSemaphoreExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceReleaseExternalSemaphoreExtCb_t pfnReleaseExternalSemaphoreExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendSignalExternalSemaphoreExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendSignalExternalSemaphoreExtCb_t pfnAppendSignalExternalSemaphoreExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendWaitExternalSemaphoreExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendWaitExternalSemaphoreExtCb_t pfnAppendWaitExternalSemaphoreExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceReserveCacheExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceReserveCacheExtCb_t pfnReserveCacheExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceSetCacheAdviceExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceSetCacheAdviceExtCb_t pfnSetCacheAdviceExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventQueryTimestampsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryTimestampsExpCb_t pfnQueryTimestampsExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageGetMemoryPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetMemoryPropertiesExpCb_t pfnGetMemoryPropertiesExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageViewCreateExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageViewCreateExtCb_t pfnViewCreateExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageViewCreateExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageViewCreateExpCb_t pfnViewCreateExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSchedulingHintExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSchedulingHintExpCb_t pfnSchedulingHintExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDevicePciGetPropertiesExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDevicePciGetPropertiesExtCb_t pfnPciGetPropertiesExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyToMemoryExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyToMemoryExtCb_t pfnAppendImageCopyToMemoryExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyFromMemoryExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyFromMemoryExtCb_t pfnAppendImageCopyFromMemoryExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageGetAllocPropertiesExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetAllocPropertiesExtCb_t pfnGetAllocPropertiesExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleInspectLinkageExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleInspectLinkageExtCb_t pfnInspectLinkageExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemFreeExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemFreeExtCb_t pfnFreeExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricVertexGetExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetExpCb_t pfnGetExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricVertexGetSubVerticesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetSubVerticesExpCb_t pfnGetSubVerticesExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricVertexGetPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetPropertiesExpCb_t pfnGetPropertiesExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricVertexGetDeviceExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetDeviceExpCb_t pfnGetDeviceExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetFabricVertexExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetFabricVertexExpCb_t pfnGetFabricVertexExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricEdgeGetExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricEdgeGetExpCb_t pfnGetExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricEdgeGetVerticesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricEdgeGetVerticesExpCb_t pfnGetVerticesExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricEdgeGetPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricEdgeGetPropertiesExpCb_t pfnGetPropertiesExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventQueryKernelTimestampsExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryKernelTimestampsExtCb_t pfnQueryKernelTimestampsExtCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASBuilderCreateExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderCreateExpCb_t pfnCreateExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASBuilderGetBuildPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderGetBuildPropertiesExpCb_t pfnGetBuildPropertiesExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverRTASFormatCompatibilityCheckExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverRTASFormatCompatibilityCheckExpCb_t pfnRTASFormatCompatibilityCheckExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASBuilderBuildExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderBuildExpCb_t pfnBuildExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASBuilderDestroyExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderDestroyExpCb_t pfnDestroyExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASParallelOperationCreateExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationCreateExpCb_t pfnCreateExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASParallelOperationGetPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationGetPropertiesExpCb_t pfnGetPropertiesExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASParallelOperationJoinExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationJoinExpCb_t pfnJoinExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASParallelOperationDestroyExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationDestroyExpCb_t pfnDestroyExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetPitchFor2dImageRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetPitchFor2dImageCb_t pfnGetPitchFor2dImageCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageGetDeviceOffsetExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetDeviceOffsetExpCb_t pfnGetDeviceOffsetExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListCreateCloneExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCreateCloneExpCb_t pfnCreateCloneExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListImmediateAppendCommandListsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListImmediateAppendCommandListsExpCb_t pfnImmediateAppendCommandListsExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetNextCommandIdExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetNextCommandIdExpCb_t pfnGetNextCommandIdExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetNextCommandIdWithKernelsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetNextCommandIdWithKernelsExpCb_t pfnGetNextCommandIdWithKernelsExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListUpdateMutableCommandsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandsExpCb_t pfnUpdateMutableCommandsExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListUpdateMutableCommandSignalEventExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandSignalEventExpCb_t pfnUpdateMutableCommandSignalEventExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListUpdateMutableCommandWaitEventsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandWaitEventsExpCb_t pfnUpdateMutableCommandWaitEventsExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListUpdateMutableCommandKernelsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandKernelsExpCb_t pfnUpdateMutableCommandKernelsExpCb ); ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerResetAllCallbacks(zel_tracer_handle_t hTracer); #if defined(__cplusplus) } // extern "C" #endif #endif // zel_tracing_register_cb_H level-zero-1.20.6/include/loader/000077500000000000000000000000001475521542100165635ustar00rootroot00000000000000level-zero-1.20.6/include/loader/ze_loader.h000066400000000000000000000047241475521542100207070ustar00rootroot00000000000000/* * Copyright (C) 2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_loader.h */ #ifndef _ZE_LOADER_H #define _ZE_LOADER_H #if defined(__cplusplus) #pragma once #endif #include "../ze_api.h" #if defined(__cplusplus) extern "C" { #endif typedef struct _zel_version { int major; int minor; int patch; } zel_version_t; //Ex component string "ze_tracing", "ze_validation", etc #define ZEL_COMPONENT_STRING_SIZE 64 typedef struct zel_component_version { char component_name[ZEL_COMPONENT_STRING_SIZE]; ze_api_version_t spec_version; zel_version_t component_lib_version; } zel_component_version_t; ZE_APIEXPORT ze_result_t ZE_APICALL zelLoaderGetVersions( size_t *num_elems, //Pointer to num versions to get. zel_component_version_t *versions); //Pointer to array of versions. If set to NULL, num_elems is returned typedef enum _zel_handle_type_t { ZEL_HANDLE_DRIVER, ZEL_HANDLE_DEVICE, ZEL_HANDLE_CONTEXT, ZEL_HANDLE_COMMAND_QUEUE, ZEL_HANDLE_COMMAND_LIST, ZEL_HANDLE_FENCE, ZEL_HANDLE_EVENT_POOL, ZEL_HANDLE_EVENT, ZEL_HANDLE_IMAGE, ZEL_HANDLE_MODULE, ZEL_HANDLE_MODULE_BUILD_LOG, ZEL_HANDLE_KERNEL, ZEL_HANDLE_SAMPLER, ZEL_HANDLE_PHYSICAL_MEM } zel_handle_type_t; //Translates Loader Handles to Driver Handles if loader handle intercept is enabled. //If handle intercept is not enabled handleOut is set to handleIn ZE_APIEXPORT ze_result_t ZE_APICALL zelLoaderTranslateHandle( zel_handle_type_t handleType, //Handle Type void *handleIn, //Input: handle to translate from loader handle to driver handle void **handleOut); //Output: Pointer to handleOut is set to driver handle if successful /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for handling calls to released drivers in teardown. /// ZE_DLLEXPORT ze_result_t ZE_APICALL zelSetDriverTeardown(); /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for Enabling the Tracing Layer During Runtime. /// ZE_DLLEXPORT ze_result_t ZE_APICALL zelEnableTracingLayer(); /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for Disabling the Tracing Layer During Runtime. /// ZE_DLLEXPORT ze_result_t ZE_APICALL zelDisableTracingLayer(); #if defined(__cplusplus) } // extern "C" #endif #endif //_ZE_LOADER_Hlevel-zero-1.20.6/include/ze.py000066400000000000000000014763031475521542100163230ustar00rootroot00000000000000""" Copyright (C) 2019-2021 Intel Corporation SPDX-License-Identifier: MIT @file ze.py @version v1.12-r1.12.15 """ import platform from ctypes import * from enum import * ############################################################################### __version__ = "1.0" ############################################################################### ## @brief Generates generic 'oneAPI' API versions def ZE_MAKE_VERSION( _major, _minor ): return (( _major << 16 )|( _minor & 0x0000ffff)) ############################################################################### ## @brief Extracts 'oneAPI' API major version def ZE_MAJOR_VERSION( _ver ): return ( _ver >> 16 ) ############################################################################### ## @brief Extracts 'oneAPI' API minor version def ZE_MINOR_VERSION( _ver ): return ( _ver & 0x0000ffff ) ############################################################################### ## @brief Calling convention for all API functions # ZE_APICALL not required for python ############################################################################### ## @brief Microsoft-specific dllexport storage-class attribute # ZE_APIEXPORT not required for python ############################################################################### ## @brief GCC-specific dllexport storage-class attribute # ZE_APIEXPORT not required for python ############################################################################### ## @brief Microsoft-specific dllexport storage-class attribute # ZE_DLLEXPORT not required for python ############################################################################### ## @brief GCC-specific dllexport storage-class attribute # ZE_DLLEXPORT not required for python ############################################################################### ## @brief compiler-independent type class ze_bool_t(c_ubyte): pass ############################################################################### ## @brief Handle of a driver instance class ze_driver_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's device object class ze_device_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's context object class ze_context_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's command queue object class ze_command_queue_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's command list object class ze_command_list_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's fence object class ze_fence_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's event pool object class ze_event_pool_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's event object class ze_event_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's image object class ze_image_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's module object class ze_module_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of module's build log object class ze_module_build_log_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's kernel object class ze_kernel_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's sampler object class ze_sampler_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of physical memory object class ze_physical_mem_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's fabric vertex object class ze_fabric_vertex_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of driver's fabric edge object class ze_fabric_edge_handle_t(c_void_p): pass ############################################################################### ## @brief Maximum IPC handle size ZE_MAX_IPC_HANDLE_SIZE = 64 ############################################################################### ## @brief IPC handle to a memory allocation class ze_ipc_mem_handle_t(Structure): _fields_ = [ ("data", c_char * ZE_MAX_IPC_HANDLE_SIZE) ## [out] Opaque data representing an IPC handle ] ############################################################################### ## @brief IPC handle to a event pool allocation class ze_ipc_event_pool_handle_t(Structure): _fields_ = [ ("data", c_char * ZE_MAX_IPC_HANDLE_SIZE) ## [out] Opaque data representing an IPC handle ] ############################################################################### ## @brief Generic macro for enumerator bit masks def ZE_BIT( _i ): return ( 1 << _i ) ############################################################################### ## @brief Defines Return/Error codes class ze_result_v(IntEnum): SUCCESS = 0 ## [Core] success NOT_READY = 1 ## [Core] synchronization primitive not signaled ERROR_DEVICE_LOST = 0x70000001 ## [Core] device hung, reset, was removed, or driver update occurred ERROR_OUT_OF_HOST_MEMORY = 0x70000002 ## [Core] insufficient host memory to satisfy call ERROR_OUT_OF_DEVICE_MEMORY = 0x70000003 ## [Core] insufficient device memory to satisfy call ERROR_MODULE_BUILD_FAILURE = 0x70000004 ## [Core] error occurred when building module, see build log for details ERROR_MODULE_LINK_FAILURE = 0x70000005 ## [Core] error occurred when linking modules, see build log for details ERROR_DEVICE_REQUIRES_RESET = 0x70000006 ## [Core] device requires a reset ERROR_DEVICE_IN_LOW_POWER_STATE = 0x70000007 ## [Core] device currently in low power state EXP_ERROR_DEVICE_IS_NOT_VERTEX = 0x7ff00001 ## [Core, Experimental] device is not represented by a fabric vertex EXP_ERROR_VERTEX_IS_NOT_DEVICE = 0x7ff00002 ## [Core, Experimental] fabric vertex does not represent a device EXP_ERROR_REMOTE_DEVICE = 0x7ff00003 ## [Core, Experimental] fabric vertex represents a remote device or ## subdevice EXP_ERROR_OPERANDS_INCOMPATIBLE = 0x7ff00004 ## [Core, Experimental] operands of comparison are not compatible EXP_RTAS_BUILD_RETRY = 0x7ff00005 ## [Core, Experimental] ray tracing acceleration structure build ## operation failed due to insufficient resources, retry with a larger ## acceleration structure buffer allocation EXP_RTAS_BUILD_DEFERRED = 0x7ff00006 ## [Core, Experimental] ray tracing acceleration structure build ## operation deferred to parallel operation join ERROR_INSUFFICIENT_PERMISSIONS = 0x70010000 ## [Sysman] access denied due to permission level ERROR_NOT_AVAILABLE = 0x70010001 ## [Sysman] resource already in use and simultaneous access not allowed ## or resource was removed ERROR_DEPENDENCY_UNAVAILABLE = 0x70020000 ## [Common] external required dependency is unavailable or missing WARNING_DROPPED_DATA = 0x70020001 ## [Tools] data may have been dropped ERROR_UNINITIALIZED = 0x78000001 ## [Validation] driver is not initialized ERROR_UNSUPPORTED_VERSION = 0x78000002 ## [Validation] generic error code for unsupported versions ERROR_UNSUPPORTED_FEATURE = 0x78000003 ## [Validation] generic error code for unsupported features ERROR_INVALID_ARGUMENT = 0x78000004 ## [Validation] generic error code for invalid arguments ERROR_INVALID_NULL_HANDLE = 0x78000005 ## [Validation] handle argument is not valid ERROR_HANDLE_OBJECT_IN_USE = 0x78000006 ## [Validation] object pointed to by handle still in-use by device ERROR_INVALID_NULL_POINTER = 0x78000007 ## [Validation] pointer argument may not be nullptr ERROR_INVALID_SIZE = 0x78000008 ## [Validation] size argument is invalid (e.g., must not be zero) ERROR_UNSUPPORTED_SIZE = 0x78000009 ## [Validation] size argument is not supported by the device (e.g., too ## large) ERROR_UNSUPPORTED_ALIGNMENT = 0x7800000a ## [Validation] alignment argument is not supported by the device (e.g., ## too small) ERROR_INVALID_SYNCHRONIZATION_OBJECT = 0x7800000b ## [Validation] synchronization object in invalid state ERROR_INVALID_ENUMERATION = 0x7800000c ## [Validation] enumerator argument is not valid ERROR_UNSUPPORTED_ENUMERATION = 0x7800000d ## [Validation] enumerator argument is not supported by the device ERROR_UNSUPPORTED_IMAGE_FORMAT = 0x7800000e ## [Validation] image format is not supported by the device ERROR_INVALID_NATIVE_BINARY = 0x7800000f ## [Validation] native binary is not supported by the device ERROR_INVALID_GLOBAL_NAME = 0x78000010 ## [Validation] global variable is not found in the module ERROR_INVALID_KERNEL_NAME = 0x78000011 ## [Validation] kernel name is not found in the module ERROR_INVALID_FUNCTION_NAME = 0x78000012 ## [Validation] function name is not found in the module ERROR_INVALID_GROUP_SIZE_DIMENSION = 0x78000013 ## [Validation] group size dimension is not valid for the kernel or ## device ERROR_INVALID_GLOBAL_WIDTH_DIMENSION = 0x78000014 ## [Validation] global width dimension is not valid for the kernel or ## device ERROR_INVALID_KERNEL_ARGUMENT_INDEX = 0x78000015 ## [Validation] kernel argument index is not valid for kernel ERROR_INVALID_KERNEL_ARGUMENT_SIZE = 0x78000016 ## [Validation] kernel argument size does not match kernel ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE = 0x78000017 ## [Validation] value of kernel attribute is not valid for the kernel or ## device ERROR_INVALID_MODULE_UNLINKED = 0x78000018 ## [Validation] module with imports needs to be linked before kernels can ## be created from it. ERROR_INVALID_COMMAND_LIST_TYPE = 0x78000019 ## [Validation] command list type does not match command queue type ERROR_OVERLAPPING_REGIONS = 0x7800001a ## [Validation] copy operations do not support overlapping regions of ## memory WARNING_ACTION_REQUIRED = 0x7800001b ## [Sysman] an action is required to complete the desired operation ERROR_INVALID_KERNEL_HANDLE = 0x7800001c ## [Core, Validation] kernel handle is invalid for the operation ERROR_UNKNOWN = 0x7ffffffe ## [Core] unknown or internal error class ze_result_t(c_int): def __str__(self): return str(ze_result_v(self.value)) ############################################################################### ## @brief Defines structure types class ze_structure_type_v(IntEnum): DRIVER_PROPERTIES = 0x1 ## ::ze_driver_properties_t DRIVER_IPC_PROPERTIES = 0x2 ## ::ze_driver_ipc_properties_t DEVICE_PROPERTIES = 0x3 ## ::ze_device_properties_t DEVICE_COMPUTE_PROPERTIES = 0x4 ## ::ze_device_compute_properties_t DEVICE_MODULE_PROPERTIES = 0x5 ## ::ze_device_module_properties_t COMMAND_QUEUE_GROUP_PROPERTIES = 0x6 ## ::ze_command_queue_group_properties_t DEVICE_MEMORY_PROPERTIES = 0x7 ## ::ze_device_memory_properties_t DEVICE_MEMORY_ACCESS_PROPERTIES = 0x8 ## ::ze_device_memory_access_properties_t DEVICE_CACHE_PROPERTIES = 0x9 ## ::ze_device_cache_properties_t DEVICE_IMAGE_PROPERTIES = 0xa ## ::ze_device_image_properties_t DEVICE_P2P_PROPERTIES = 0xb ## ::ze_device_p2p_properties_t DEVICE_EXTERNAL_MEMORY_PROPERTIES = 0xc ## ::ze_device_external_memory_properties_t CONTEXT_DESC = 0xd ## ::ze_context_desc_t COMMAND_QUEUE_DESC = 0xe ## ::ze_command_queue_desc_t COMMAND_LIST_DESC = 0xf ## ::ze_command_list_desc_t EVENT_POOL_DESC = 0x10 ## ::ze_event_pool_desc_t EVENT_DESC = 0x11 ## ::ze_event_desc_t FENCE_DESC = 0x12 ## ::ze_fence_desc_t IMAGE_DESC = 0x13 ## ::ze_image_desc_t IMAGE_PROPERTIES = 0x14 ## ::ze_image_properties_t DEVICE_MEM_ALLOC_DESC = 0x15 ## ::ze_device_mem_alloc_desc_t HOST_MEM_ALLOC_DESC = 0x16 ## ::ze_host_mem_alloc_desc_t MEMORY_ALLOCATION_PROPERTIES = 0x17 ## ::ze_memory_allocation_properties_t EXTERNAL_MEMORY_EXPORT_DESC = 0x18 ## ::ze_external_memory_export_desc_t EXTERNAL_MEMORY_IMPORT_FD = 0x19 ## ::ze_external_memory_import_fd_t EXTERNAL_MEMORY_EXPORT_FD = 0x1a ## ::ze_external_memory_export_fd_t MODULE_DESC = 0x1b ## ::ze_module_desc_t MODULE_PROPERTIES = 0x1c ## ::ze_module_properties_t KERNEL_DESC = 0x1d ## ::ze_kernel_desc_t KERNEL_PROPERTIES = 0x1e ## ::ze_kernel_properties_t SAMPLER_DESC = 0x1f ## ::ze_sampler_desc_t PHYSICAL_MEM_DESC = 0x20 ## ::ze_physical_mem_desc_t KERNEL_PREFERRED_GROUP_SIZE_PROPERTIES = 0x21 ## ::ze_kernel_preferred_group_size_properties_t EXTERNAL_MEMORY_IMPORT_WIN32 = 0x22 ## ::ze_external_memory_import_win32_handle_t EXTERNAL_MEMORY_EXPORT_WIN32 = 0x23 ## ::ze_external_memory_export_win32_handle_t DEVICE_RAYTRACING_EXT_PROPERTIES = 0x00010001 ## ::ze_device_raytracing_ext_properties_t RAYTRACING_MEM_ALLOC_EXT_DESC = 0x10002 ## ::ze_raytracing_mem_alloc_ext_desc_t FLOAT_ATOMIC_EXT_PROPERTIES = 0x10003 ## ::ze_float_atomic_ext_properties_t CACHE_RESERVATION_EXT_DESC = 0x10004 ## ::ze_cache_reservation_ext_desc_t EU_COUNT_EXT = 0x10005 ## ::ze_eu_count_ext_t SRGB_EXT_DESC = 0x10006 ## ::ze_srgb_ext_desc_t LINKAGE_INSPECTION_EXT_DESC = 0x10007 ## ::ze_linkage_inspection_ext_desc_t PCI_EXT_PROPERTIES = 0x10008 ## ::ze_pci_ext_properties_t DRIVER_MEMORY_FREE_EXT_PROPERTIES = 0x10009 ## ::ze_driver_memory_free_ext_properties_t MEMORY_FREE_EXT_DESC = 0x1000a ## ::ze_memory_free_ext_desc_t MEMORY_COMPRESSION_HINTS_EXT_DESC = 0x1000b ## ::ze_memory_compression_hints_ext_desc_t IMAGE_ALLOCATION_EXT_PROPERTIES = 0x1000c ## ::ze_image_allocation_ext_properties_t DEVICE_LUID_EXT_PROPERTIES = 0x1000d ## ::ze_device_luid_ext_properties_t DEVICE_MEMORY_EXT_PROPERTIES = 0x1000e ## ::ze_device_memory_ext_properties_t DEVICE_IP_VERSION_EXT = 0x1000f ## ::ze_device_ip_version_ext_t IMAGE_VIEW_PLANAR_EXT_DESC = 0x10010 ## ::ze_image_view_planar_ext_desc_t EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_PROPERTIES = 0x10011 ## ::ze_event_query_kernel_timestamps_ext_properties_t EVENT_QUERY_KERNEL_TIMESTAMPS_RESULTS_EXT_PROPERTIES = 0x10012 ## ::ze_event_query_kernel_timestamps_results_ext_properties_t KERNEL_MAX_GROUP_SIZE_EXT_PROPERTIES = 0x10013 ## ::ze_kernel_max_group_size_ext_properties_t RELAXED_ALLOCATION_LIMITS_EXP_DESC = 0x00020001 ## ::ze_relaxed_allocation_limits_exp_desc_t MODULE_PROGRAM_EXP_DESC = 0x00020002 ## ::ze_module_program_exp_desc_t SCHEDULING_HINT_EXP_PROPERTIES = 0x00020003 ## ::ze_scheduling_hint_exp_properties_t SCHEDULING_HINT_EXP_DESC = 0x00020004 ## ::ze_scheduling_hint_exp_desc_t IMAGE_VIEW_PLANAR_EXP_DESC = 0x00020005 ## ::ze_image_view_planar_exp_desc_t DEVICE_PROPERTIES_1_2 = 0x00020006 ## ::ze_device_properties_t IMAGE_MEMORY_EXP_PROPERTIES = 0x00020007 ## ::ze_image_memory_properties_exp_t POWER_SAVING_HINT_EXP_DESC = 0x00020008 ## ::ze_context_power_saving_hint_exp_desc_t COPY_BANDWIDTH_EXP_PROPERTIES = 0x00020009 ## ::ze_copy_bandwidth_exp_properties_t DEVICE_P2P_BANDWIDTH_EXP_PROPERTIES = 0x0002000A ## ::ze_device_p2p_bandwidth_exp_properties_t FABRIC_VERTEX_EXP_PROPERTIES = 0x0002000B ## ::ze_fabric_vertex_exp_properties_t FABRIC_EDGE_EXP_PROPERTIES = 0x0002000C ## ::ze_fabric_edge_exp_properties_t MEMORY_SUB_ALLOCATIONS_EXP_PROPERTIES = 0x0002000D ## ::ze_memory_sub_allocations_exp_properties_t RTAS_BUILDER_EXP_DESC = 0x0002000E ## ::ze_rtas_builder_exp_desc_t RTAS_BUILDER_BUILD_OP_EXP_DESC = 0x0002000F ## ::ze_rtas_builder_build_op_exp_desc_t RTAS_BUILDER_EXP_PROPERTIES = 0x00020010 ## ::ze_rtas_builder_exp_properties_t RTAS_PARALLEL_OPERATION_EXP_PROPERTIES = 0x00020011 ## ::ze_rtas_parallel_operation_exp_properties_t RTAS_DEVICE_EXP_PROPERTIES = 0x00020012 ## ::ze_rtas_device_exp_properties_t RTAS_GEOMETRY_AABBS_EXP_CB_PARAMS = 0x00020013 ## ::ze_rtas_geometry_aabbs_exp_cb_params_t COUNTER_BASED_EVENT_POOL_EXP_DESC = 0x00020014 ## ::ze_event_pool_counter_based_exp_desc_t MUTABLE_COMMAND_LIST_EXP_PROPERTIES = 0x00020015 ## ::ze_mutable_command_list_exp_properties_t MUTABLE_COMMAND_LIST_EXP_DESC = 0x00020016 ## ::ze_mutable_command_list_exp_desc_t MUTABLE_COMMAND_ID_EXP_DESC = 0x00020017 ## ::ze_mutable_command_id_exp_desc_t MUTABLE_COMMANDS_EXP_DESC = 0x00020018 ## ::ze_mutable_commands_exp_desc_t MUTABLE_KERNEL_ARGUMENT_EXP_DESC = 0x00020019 ## ::ze_mutable_kernel_argument_exp_desc_t MUTABLE_GROUP_COUNT_EXP_DESC = 0x0002001A ## ::ze_mutable_group_count_exp_desc_t MUTABLE_GROUP_SIZE_EXP_DESC = 0x0002001B ## ::ze_mutable_group_size_exp_desc_t MUTABLE_GLOBAL_OFFSET_EXP_DESC = 0x0002001C ## ::ze_mutable_global_offset_exp_desc_t PITCHED_ALLOC_DEVICE_EXP_PROPERTIES = 0x0002001D ## ::ze_device_pitched_alloc_exp_properties_t BINDLESS_IMAGE_EXP_DESC = 0x0002001E ## ::ze_image_bindless_exp_desc_t PITCHED_IMAGE_EXP_DESC = 0x0002001F ## ::ze_image_pitched_exp_desc_t MUTABLE_GRAPH_ARGUMENT_EXP_DESC = 0x00020020 ## ::ze_mutable_graph_argument_exp_desc_t INIT_DRIVER_TYPE_DESC = 0x00020021 ## ::ze_init_driver_type_desc_t EXTERNAL_SEMAPHORE_EXT_DESC = 0x00020022 ## ::ze_external_semaphore_ext_desc_t EXTERNAL_SEMAPHORE_WIN32_EXT_DESC = 0x00020023 ## ::ze_external_semaphore_win32_ext_desc_t EXTERNAL_SEMAPHORE_FD_EXT_DESC = 0x00020024 ## ::ze_external_semaphore_fd_ext_desc_t EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_EXT = 0x00020025 ## ::ze_external_semaphore_signal_params_ext_t EXTERNAL_SEMAPHORE_WAIT_PARAMS_EXT = 0x00020026 ## ::ze_external_semaphore_wait_params_ext_t DRIVER_DDI_HANDLES_EXT_PROPERTIES = 0x00020027 ## ::ze_driver_ddi_handles_ext_properties_t class ze_structure_type_t(c_int): def __str__(self): return str(ze_structure_type_v(self.value)) ############################################################################### ## @brief External memory type flags class ze_external_memory_type_flags_v(IntEnum): OPAQUE_FD = ZE_BIT(0) ## an opaque POSIX file descriptor handle DMA_BUF = ZE_BIT(1) ## a file descriptor handle for a Linux dma_buf OPAQUE_WIN32 = ZE_BIT(2) ## an NT handle OPAQUE_WIN32_KMT = ZE_BIT(3) ## a global share (KMT) handle D3D11_TEXTURE = ZE_BIT(4) ## an NT handle referring to a Direct3D 10 or 11 texture resource D3D11_TEXTURE_KMT = ZE_BIT(5) ## a global share (KMT) handle referring to a Direct3D 10 or 11 texture ## resource D3D12_HEAP = ZE_BIT(6) ## an NT handle referring to a Direct3D 12 heap resource D3D12_RESOURCE = ZE_BIT(7) ## an NT handle referring to a Direct3D 12 committed resource class ze_external_memory_type_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Bandwidth unit class ze_bandwidth_unit_v(IntEnum): UNKNOWN = 0 ## The unit used for bandwidth is unknown BYTES_PER_NANOSEC = 1 ## Bandwidth is provided in bytes/nanosec BYTES_PER_CLOCK = 2 ## Bandwidth is provided in bytes/clock class ze_bandwidth_unit_t(c_int): def __str__(self): return str(ze_bandwidth_unit_v(self.value)) ############################################################################### ## @brief Latency unit class ze_latency_unit_v(IntEnum): UNKNOWN = 0 ## The unit used for latency is unknown NANOSEC = 1 ## Latency is provided in nanosecs CLOCK = 2 ## Latency is provided in clocks HOP = 3 ## Latency is provided in hops (normalized so that the lowest latency ## link has a latency of 1 hop) class ze_latency_unit_t(c_int): def __str__(self): return str(ze_latency_unit_v(self.value)) ############################################################################### ## @brief Maximum universal unique id (UUID) size in bytes ZE_MAX_UUID_SIZE = 16 ############################################################################### ## @brief Universal unique id (UUID) class ze_uuid_t(Structure): _fields_ = [ ("id", c_ubyte * ZE_MAX_UUID_SIZE) ## [out] opaque data representing a UUID ] ############################################################################### ## @brief Base for all callback function parameter types class ze_base_cb_params_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p) ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ] ############################################################################### ## @brief Base for all properties types class ze_base_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p) ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ] ############################################################################### ## @brief Base for all descriptor types class ze_base_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p) ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ] ############################################################################### ## @brief Forces driver to only report devices (and sub-devices) as specified by ## values ############################################################################### ## @brief Forces driver to report devices from lowest to highest PCI bus ID ############################################################################### ## @brief Forces all shared allocations into device memory ############################################################################### ## @brief Defines the device hierarchy model exposed by Level Zero driver ## implementation ############################################################################### ## @brief Supported initialization flags class ze_init_flags_v(IntEnum): GPU_ONLY = ZE_BIT(0) ## only initialize GPU drivers VPU_ONLY = ZE_BIT(1) ## only initialize VPU drivers class ze_init_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Supported driver initialization type flags ## ## @details ## - Bit Field which details the driver types to be initialized and ## returned to the user. ## - Value Definition: ## - 0, do not init or retrieve any drivers. ## - ZE_INIT_DRIVER_TYPE_FLAG_GPU, GPU Drivers are Init and driver handles ## retrieved. ## - ZE_INIT_DRIVER_TYPE_FLAG_NPU, NPU Drivers are Init and driver handles ## retrieved. ## - ZE_INIT_DRIVER_TYPE_FLAG_GPU | ZE_INIT_DRIVER_TYPE_FLAG_NPU, NPU & GPU ## Drivers are Init and driver handles retrieved. ## - UINT32_MAX All Drivers of any type are Init and driver handles ## retrieved. class ze_init_driver_type_flags_v(IntEnum): GPU = ZE_BIT(0) ## initialize and retrieve GPU drivers NPU = ZE_BIT(1) ## initialize and retrieve NPU drivers class ze_init_driver_type_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Init Driver Type descriptor class ze_init_driver_type_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_init_driver_type_flags_t) ## [in] driver type init flags. ## must be a valid combination of ::ze_init_driver_type_flag_t or UINT32_MAX; ## driver types are init and retrieved based on these init flags in zeInitDrivers(). ] ############################################################################### ## @brief Supported API versions ## ## @details ## - API versions contain major and minor attributes, use ## ::ZE_MAJOR_VERSION and ::ZE_MINOR_VERSION class ze_api_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 _1_1 = ZE_MAKE_VERSION( 1, 1 ) ## version 1.1 _1_2 = ZE_MAKE_VERSION( 1, 2 ) ## version 1.2 _1_3 = ZE_MAKE_VERSION( 1, 3 ) ## version 1.3 _1_4 = ZE_MAKE_VERSION( 1, 4 ) ## version 1.4 _1_5 = ZE_MAKE_VERSION( 1, 5 ) ## version 1.5 _1_6 = ZE_MAKE_VERSION( 1, 6 ) ## version 1.6 _1_7 = ZE_MAKE_VERSION( 1, 7 ) ## version 1.7 _1_8 = ZE_MAKE_VERSION( 1, 8 ) ## version 1.8 _1_9 = ZE_MAKE_VERSION( 1, 9 ) ## version 1.9 _1_10 = ZE_MAKE_VERSION( 1, 10 ) ## version 1.10 _1_11 = ZE_MAKE_VERSION( 1, 11 ) ## version 1.11 _1_12 = ZE_MAKE_VERSION( 1, 12 ) ## version 1.12 CURRENT = ZE_MAKE_VERSION( 1, 12 ) ## latest known version class ze_api_version_t(c_int): def __str__(self): return str(ze_api_version_v(self.value)) ############################################################################### ## @brief Current API version as a macro ZE_API_VERSION_CURRENT_M = ZE_MAKE_VERSION( 1, 12 ) ############################################################################### ## @brief Maximum driver universal unique id (UUID) size in bytes ZE_MAX_DRIVER_UUID_SIZE = 16 ############################################################################### ## @brief Driver universal unique id (UUID) class ze_driver_uuid_t(Structure): _fields_ = [ ("id", c_ubyte * ZE_MAX_DRIVER_UUID_SIZE) ## [out] opaque data representing a driver UUID ] ############################################################################### ## @brief Driver properties queried using ::zeDriverGetProperties class ze_driver_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("uuid", ze_driver_uuid_t), ## [out] universal unique identifier. ("driverVersion", c_ulong) ## [out] driver version ## The driver version is a non-zero, monotonically increasing value where ## higher values always indicate a more recent version. ] ############################################################################### ## @brief Supported IPC property flags class ze_ipc_property_flags_v(IntEnum): MEMORY = ZE_BIT(0) ## Supports passing memory allocations between processes. See ## ::zeMemGetIpcHandle. EVENT_POOL = ZE_BIT(1) ## Supports passing event pools between processes. See ## ::zeEventPoolGetIpcHandle. class ze_ipc_property_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief IPC properties queried using ::zeDriverGetIpcProperties class ze_driver_ipc_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_ipc_property_flags_t) ## [out] 0 (none) or a valid combination of ::ze_ipc_property_flag_t ] ############################################################################### ## @brief Maximum extension name string size ZE_MAX_EXTENSION_NAME = 256 ############################################################################### ## @brief Extension properties queried using ::zeDriverGetExtensionProperties class ze_driver_extension_properties_t(Structure): _fields_ = [ ("name", c_char * ZE_MAX_EXTENSION_NAME), ## [out] extension name ("version", c_ulong) ## [out] extension version using ::ZE_MAKE_VERSION ] ############################################################################### ## @brief Supported device types class ze_device_type_v(IntEnum): GPU = 1 ## Graphics Processing Unit CPU = 2 ## Central Processing Unit FPGA = 3 ## Field Programmable Gate Array MCA = 4 ## Memory Copy Accelerator VPU = 5 ## Vision Processing Unit class ze_device_type_t(c_int): def __str__(self): return str(ze_device_type_v(self.value)) ############################################################################### ## @brief Maximum device universal unique id (UUID) size in bytes ZE_MAX_DEVICE_UUID_SIZE = 16 ############################################################################### ## @brief Device universal unique id (UUID) class ze_device_uuid_t(Structure): _fields_ = [ ("id", c_ubyte * ZE_MAX_DEVICE_UUID_SIZE) ## [out] opaque data representing a device UUID ] ############################################################################### ## @brief Maximum device name string size ZE_MAX_DEVICE_NAME = 256 ############################################################################### ## @brief Supported device property flags class ze_device_property_flags_v(IntEnum): INTEGRATED = ZE_BIT(0) ## Device is integrated with the Host. SUBDEVICE = ZE_BIT(1) ## Device handle used for query represents a sub-device. ECC = ZE_BIT(2) ## Device supports error correction memory access. ONDEMANDPAGING = ZE_BIT(3) ## Device supports on-demand page-faulting. class ze_device_property_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device properties queried using ::zeDeviceGetProperties class ze_device_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", ze_device_type_t), ## [out] generic device type ("vendorId", c_ulong), ## [out] vendor id from PCI configuration ("deviceId", c_ulong), ## [out] device id from PCI configuration. ## Note, the device id uses little-endian format. ("flags", ze_device_property_flags_t), ## [out] 0 (none) or a valid combination of ::ze_device_property_flag_t ("subdeviceId", c_ulong), ## [out] sub-device id. Only valid if ::ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE ## is set. ("coreClockRate", c_ulong), ## [out] Clock rate for device core. ("maxMemAllocSize", c_ulonglong), ## [out] Maximum memory allocation size. ("maxHardwareContexts", c_ulong), ## [out] Maximum number of logical hardware contexts. ("maxCommandQueuePriority", c_ulong), ## [out] Maximum priority for command queues. Higher value is higher ## priority. ("numThreadsPerEU", c_ulong), ## [out] Maximum number of threads per EU. ("physicalEUSimdWidth", c_ulong), ## [out] The physical EU simd width. ("numEUsPerSubslice", c_ulong), ## [out] Maximum number of EUs per sub-slice. ("numSubslicesPerSlice", c_ulong), ## [out] Maximum number of sub-slices per slice. ("numSlices", c_ulong), ## [out] Maximum number of slices. ("timerResolution", c_ulonglong), ## [out] Returns the resolution of device timer used for profiling, ## timestamps, etc. When stype==::ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES the ## units are in nanoseconds. When ## stype==::ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2 units are in ## cycles/sec ("timestampValidBits", c_ulong), ## [out] Returns the number of valid bits in the timestamp value. ("kernelTimestampValidBits", c_ulong), ## [out] Returns the number of valid bits in the kernel timestamp values ("uuid", ze_device_uuid_t), ## [out] universal unique identifier. Note: Subdevices will have their ## own uuid. ("name", c_char * ZE_MAX_DEVICE_NAME) ## [out] Device name ] ############################################################################### ## @brief Device thread identifier. class ze_device_thread_t(Structure): _fields_ = [ ("slice", c_ulong), ## [in,out] the slice number. ## Must be `UINT32_MAX` (all) or less than the `numSlices` member of ::ze_device_properties_t. ("subslice", c_ulong), ## [in,out] the sub-slice number within its slice. ## Must be `UINT32_MAX` (all) or less than the `numSubslicesPerSlice` ## member of ::ze_device_properties_t. ("eu", c_ulong), ## [in,out] the EU number within its sub-slice. ## Must be `UINT32_MAX` (all) or less than the `numEUsPerSubslice` member ## of ::ze_device_properties_t. ("thread", c_ulong) ## [in,out] the thread number within its EU. ## Must be `UINT32_MAX` (all) or less than the `numThreadsPerEU` member ## of ::ze_device_properties_t. ] ############################################################################### ## @brief Maximum number of subgroup sizes supported. ZE_SUBGROUPSIZE_COUNT = 8 ############################################################################### ## @brief Device compute properties queried using ::zeDeviceGetComputeProperties class ze_device_compute_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("maxTotalGroupSize", c_ulong), ## [out] Maximum items per compute group. (groupSizeX * groupSizeY * ## groupSizeZ) <= maxTotalGroupSize ("maxGroupSizeX", c_ulong), ## [out] Maximum items for X dimension in group ("maxGroupSizeY", c_ulong), ## [out] Maximum items for Y dimension in group ("maxGroupSizeZ", c_ulong), ## [out] Maximum items for Z dimension in group ("maxGroupCountX", c_ulong), ## [out] Maximum groups that can be launched for x dimension ("maxGroupCountY", c_ulong), ## [out] Maximum groups that can be launched for y dimension ("maxGroupCountZ", c_ulong), ## [out] Maximum groups that can be launched for z dimension ("maxSharedLocalMemory", c_ulong), ## [out] Maximum shared local memory per group. ("numSubGroupSizes", c_ulong), ## [out] Number of subgroup sizes supported. This indicates number of ## entries in subGroupSizes. ("subGroupSizes", c_ulong * ZE_SUBGROUPSIZE_COUNT) ## [out] Size group sizes supported. ] ############################################################################### ## @brief Maximum native kernel universal unique id (UUID) size in bytes ZE_MAX_NATIVE_KERNEL_UUID_SIZE = 16 ############################################################################### ## @brief Native kernel universal unique id (UUID) class ze_native_kernel_uuid_t(Structure): _fields_ = [ ("id", c_ubyte * ZE_MAX_NATIVE_KERNEL_UUID_SIZE) ## [out] opaque data representing a native kernel UUID ] ############################################################################### ## @brief Supported device module flags class ze_device_module_flags_v(IntEnum): FP16 = ZE_BIT(0) ## Device supports 16-bit floating-point operations FP64 = ZE_BIT(1) ## Device supports 64-bit floating-point operations INT64_ATOMICS = ZE_BIT(2) ## Device supports 64-bit atomic operations DP4A = ZE_BIT(3) ## Device supports four component dot product and accumulate operations class ze_device_module_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Supported floating-Point capability flags class ze_device_fp_flags_v(IntEnum): DENORM = ZE_BIT(0) ## Supports denorms INF_NAN = ZE_BIT(1) ## Supports INF and quiet NaNs ROUND_TO_NEAREST = ZE_BIT(2) ## Supports rounding to nearest even rounding mode ROUND_TO_ZERO = ZE_BIT(3) ## Supports rounding to zero. ROUND_TO_INF = ZE_BIT(4) ## Supports rounding to both positive and negative INF. FMA = ZE_BIT(5) ## Supports IEEE754-2008 fused multiply-add. ROUNDED_DIVIDE_SQRT = ZE_BIT(6) ## Supports rounding as defined by IEEE754 for divide and sqrt ## operations. SOFT_FLOAT = ZE_BIT(7) ## Uses software implementation for basic floating-point operations. class ze_device_fp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device module properties queried using ::zeDeviceGetModuleProperties class ze_device_module_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("spirvVersionSupported", c_ulong), ## [out] Maximum supported SPIR-V version. ## Returns zero if SPIR-V is not supported. ## Contains major and minor attributes, use ::ZE_MAJOR_VERSION and ::ZE_MINOR_VERSION. ("flags", ze_device_module_flags_t), ## [out] 0 or a valid combination of ::ze_device_module_flag_t ("fp16flags", ze_device_fp_flags_t), ## [out] Capabilities for half-precision floating-point operations. ## returns 0 (if ::ZE_DEVICE_MODULE_FLAG_FP16 is not set) or a ## combination of ::ze_device_fp_flag_t. ("fp32flags", ze_device_fp_flags_t), ## [out] Capabilities for single-precision floating-point operations. ## returns a combination of ::ze_device_fp_flag_t. ("fp64flags", ze_device_fp_flags_t), ## [out] Capabilities for double-precision floating-point operations. ## returns 0 (if ::ZE_DEVICE_MODULE_FLAG_FP64 is not set) or a ## combination of ::ze_device_fp_flag_t. ("maxArgumentsSize", c_ulong), ## [out] Maximum kernel argument size that is supported. ("printfBufferSize", c_ulong), ## [out] Maximum size of internal buffer that holds output of printf ## calls from kernel. ("nativeKernelSupported", ze_native_kernel_uuid_t) ## [out] Compatibility UUID of supported native kernel. ## UUID may or may not be the same across driver release, devices, or ## operating systems. ## Application is responsible for ensuring UUID matches before creating ## module using ## previously created native kernel. ] ############################################################################### ## @brief Supported command queue group property flags class ze_command_queue_group_property_flags_v(IntEnum): COMPUTE = ZE_BIT(0) ## Command queue group supports enqueing compute commands. COPY = ZE_BIT(1) ## Command queue group supports enqueing copy commands. COOPERATIVE_KERNELS = ZE_BIT(2) ## Command queue group supports cooperative kernels. ## See ::zeCommandListAppendLaunchCooperativeKernel for more details. METRICS = ZE_BIT(3) ## Command queue groups supports metric queries. class ze_command_queue_group_property_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Command queue group properties queried using ## ::zeDeviceGetCommandQueueGroupProperties class ze_command_queue_group_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_command_queue_group_property_flags_t), ## [out] 0 (none) or a valid combination of ## ::ze_command_queue_group_property_flag_t ("maxMemoryFillPatternSize", c_size_t), ## [out] maximum `pattern_size` supported by command queue group. ## See ::zeCommandListAppendMemoryFill for more details. ("numQueues", c_ulong) ## [out] the number of physical engines within the group. ] ############################################################################### ## @brief Supported device memory property flags class ze_device_memory_property_flags_v(IntEnum): TBD = ZE_BIT(0) ## reserved for future use class ze_device_memory_property_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device local memory properties queried using ## ::zeDeviceGetMemoryProperties class ze_device_memory_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_device_memory_property_flags_t), ## [out] 0 (none) or a valid combination of ## ::ze_device_memory_property_flag_t ("maxClockRate", c_ulong), ## [out] Maximum clock rate for device memory. ("maxBusWidth", c_ulong), ## [out] Maximum bus width between device and memory. ("totalSize", c_ulonglong), ## [out] Total memory size in bytes that is available to the device. ("name", c_char * ZE_MAX_DEVICE_NAME) ## [out] Memory name ] ############################################################################### ## @brief Memory access capability flags ## ## @details ## - Supported access capabilities for different types of memory ## allocations class ze_memory_access_cap_flags_v(IntEnum): RW = ZE_BIT(0) ## Supports load/store access ATOMIC = ZE_BIT(1) ## Supports atomic access CONCURRENT = ZE_BIT(2) ## Supports concurrent access CONCURRENT_ATOMIC = ZE_BIT(3) ## Supports concurrent atomic access class ze_memory_access_cap_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device memory access properties queried using ## ::zeDeviceGetMemoryAccessProperties class ze_device_memory_access_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("hostAllocCapabilities", ze_memory_access_cap_flags_t), ## [out] host memory capabilities. ## returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t. ("deviceAllocCapabilities", ze_memory_access_cap_flags_t), ## [out] device memory capabilities. ## returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t. ("sharedSingleDeviceAllocCapabilities", ze_memory_access_cap_flags_t), ## [out] shared, single-device memory capabilities. ## returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t. ("sharedCrossDeviceAllocCapabilities", ze_memory_access_cap_flags_t), ## [out] shared, cross-device memory capabilities. ## returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t. ("sharedSystemAllocCapabilities", ze_memory_access_cap_flags_t) ## [out] shared, system memory capabilities. ## returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t. ] ############################################################################### ## @brief Supported cache control property flags class ze_device_cache_property_flags_v(IntEnum): USER_CONTROL = ZE_BIT(0) ## Device support User Cache Control (i.e. SLM section vs Generic Cache) class ze_device_cache_property_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device cache properties queried using ::zeDeviceGetCacheProperties class ze_device_cache_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_device_cache_property_flags_t), ## [out] 0 (none) or a valid combination of ## ::ze_device_cache_property_flag_t ("cacheSize", c_size_t) ## [out] Per-cache size, in bytes ] ############################################################################### ## @brief Device image properties queried using ::zeDeviceGetImageProperties class ze_device_image_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("maxImageDims1D", c_ulong), ## [out] Maximum image dimensions for 1D resources. if 0, then 1D images ## are unsupported. ("maxImageDims2D", c_ulong), ## [out] Maximum image dimensions for 2D resources. if 0, then 2D images ## are unsupported. ("maxImageDims3D", c_ulong), ## [out] Maximum image dimensions for 3D resources. if 0, then 3D images ## are unsupported. ("maxImageBufferSize", c_ulonglong), ## [out] Maximum image buffer size in bytes. if 0, then buffer images are ## unsupported. ("maxImageArraySlices", c_ulong), ## [out] Maximum image array slices. if 0, then image arrays are ## unsupported. ("maxSamplers", c_ulong), ## [out] Max samplers that can be used in kernel. if 0, then sampling is ## unsupported. ("maxReadImageArgs", c_ulong), ## [out] Returns the maximum number of simultaneous image objects that ## can be read from by a kernel. if 0, then reading images is ## unsupported. ("maxWriteImageArgs", c_ulong) ## [out] Returns the maximum number of simultaneous image objects that ## can be written to by a kernel. if 0, then writing images is ## unsupported. ] ############################################################################### ## @brief Device external memory import and export properties class ze_device_external_memory_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("memoryAllocationImportTypes", ze_external_memory_type_flags_t), ## [out] Supported external memory import types for memory allocations. ("memoryAllocationExportTypes", ze_external_memory_type_flags_t), ## [out] Supported external memory export types for memory allocations. ("imageImportTypes", ze_external_memory_type_flags_t), ## [out] Supported external memory import types for images. ("imageExportTypes", ze_external_memory_type_flags_t) ## [out] Supported external memory export types for images. ] ############################################################################### ## @brief Supported device peer-to-peer property flags class ze_device_p2p_property_flags_v(IntEnum): ACCESS = ZE_BIT(0) ## Device supports access between peer devices. ATOMICS = ZE_BIT(1) ## Device supports atomics between peer devices. class ze_device_p2p_property_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device peer-to-peer properties queried using ## ::zeDeviceGetP2PProperties class ze_device_p2p_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_device_p2p_property_flags_t) ## [out] 0 (none) or a valid combination of ## ::ze_device_p2p_property_flag_t ] ############################################################################### ## @brief Supported context creation flags class ze_context_flags_v(IntEnum): TBD = ZE_BIT(0) ## reserved for future use class ze_context_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Context descriptor class ze_context_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_context_flags_t) ## [in] creation flags. ## must be 0 (default) or a valid combination of ::ze_context_flag_t; ## default behavior may use implicit driver-based heuristics. ] ############################################################################### ## @brief Supported command queue flags class ze_command_queue_flags_v(IntEnum): EXPLICIT_ONLY = ZE_BIT(0) ## command queue should be optimized for submission to a single device engine. ## driver **must** disable any implicit optimizations for distributing ## work across multiple engines. ## this flag should be used when applications want full control over ## multi-engine submission and scheduling. IN_ORDER = ZE_BIT(1) ## To be used only when creating immediate command lists. Commands ## appended to the immediate command ## list are executed in-order, with driver implementation enforcing ## dependencies between them. ## Application is not required to have the signal event of a given ## command being the wait event of ## the next to define an in-order list, and application is allowed to ## pass signal and wait events ## to each appended command to implement more complex dependency graphs. class ze_command_queue_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Supported command queue modes class ze_command_queue_mode_v(IntEnum): DEFAULT = 0 ## implicit default behavior; uses driver-based heuristics SYNCHRONOUS = 1 ## Device execution always completes immediately on execute; ## Host thread is blocked using wait on implicit synchronization object ASYNCHRONOUS = 2 ## Device execution is scheduled and will complete in future; ## explicit synchronization object must be used to determine completeness class ze_command_queue_mode_t(c_int): def __str__(self): return str(ze_command_queue_mode_v(self.value)) ############################################################################### ## @brief Supported command queue priorities class ze_command_queue_priority_v(IntEnum): NORMAL = 0 ## [default] normal priority PRIORITY_LOW = 1 ## lower priority than normal PRIORITY_HIGH = 2 ## higher priority than normal class ze_command_queue_priority_t(c_int): def __str__(self): return str(ze_command_queue_priority_v(self.value)) ############################################################################### ## @brief Command Queue descriptor class ze_command_queue_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("ordinal", c_ulong), ## [in] command queue group ordinal ("index", c_ulong), ## [in] command queue index within the group; ## must be zero if ::ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY is not set ("flags", ze_command_queue_flags_t), ## [in] usage flags. ## must be 0 (default) or a valid combination of ::ze_command_queue_flag_t; ## default behavior may use implicit driver-based heuristics to balance ## latency and throughput. ("mode", ze_command_queue_mode_t), ## [in] operation mode ("priority", ze_command_queue_priority_t) ## [in] priority ] ############################################################################### ## @brief Supported command list creation flags class ze_command_list_flags_v(IntEnum): RELAXED_ORDERING = ZE_BIT(0) ## driver may reorder commands (e.g., kernels, copies) between barriers ## and synchronization primitives. ## using this flag may increase Host overhead of ::zeCommandListClose. ## therefore, this flag should **not** be set for low-latency usage-models. MAXIMIZE_THROUGHPUT = ZE_BIT(1) ## driver may perform additional optimizations that increase execution ## throughput. ## using this flag may increase Host overhead of ::zeCommandListClose and ::zeCommandQueueExecuteCommandLists. ## therefore, this flag should **not** be set for low-latency usage-models. EXPLICIT_ONLY = ZE_BIT(2) ## command list should be optimized for submission to a single command ## queue and device engine. ## driver **must** disable any implicit optimizations for distributing ## work across multiple engines. ## this flag should be used when applications want full control over ## multi-engine submission and scheduling. IN_ORDER = ZE_BIT(3) ## commands appended to this command list are executed in-order, with ## driver implementation ## enforcing dependencies between them. Application is not required to ## have the signal event ## of a given command being the wait event of the next to define an ## in-order list, and ## application is allowed to pass signal and wait events to each appended ## command to implement ## more complex dependency graphs. Cannot be combined with ::ZE_COMMAND_LIST_FLAG_RELAXED_ORDERING. EXP_CLONEABLE = ZE_BIT(4) ## this command list may be cloned using ::zeCommandListCreateCloneExp ## after ::zeCommandListClose. class ze_command_list_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Command List descriptor class ze_command_list_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("commandQueueGroupOrdinal", c_ulong), ## [in] command queue group ordinal to which this command list will be ## submitted ("flags", ze_command_list_flags_t) ## [in] usage flags. ## must be 0 (default) or a valid combination of ::ze_command_list_flag_t; ## default behavior may use implicit driver-based heuristics to balance ## latency and throughput. ] ############################################################################### ## @brief Copy region descriptor class ze_copy_region_t(Structure): _fields_ = [ ("originX", c_ulong), ## [in] The origin x offset for region in bytes ("originY", c_ulong), ## [in] The origin y offset for region in rows ("originZ", c_ulong), ## [in] The origin z offset for region in slices ("width", c_ulong), ## [in] The region width relative to origin in bytes ("height", c_ulong), ## [in] The region height relative to origin in rows ("depth", c_ulong) ## [in] The region depth relative to origin in slices. Set this to 0 for ## 2D copy. ] ############################################################################### ## @brief Region descriptor class ze_image_region_t(Structure): _fields_ = [ ("originX", c_ulong), ## [in] The origin x offset for region in pixels ("originY", c_ulong), ## [in] The origin y offset for region in pixels ("originZ", c_ulong), ## [in] The origin z offset for region in pixels ("width", c_ulong), ## [in] The region width relative to origin in pixels ("height", c_ulong), ## [in] The region height relative to origin in pixels ("depth", c_ulong) ## [in] The region depth relative to origin. For 1D or 2D images, set ## this to 1. ] ############################################################################### ## @brief Supported memory advice hints class ze_memory_advice_v(IntEnum): SET_READ_MOSTLY = 0 ## hint that memory will be read from frequently and written to rarely CLEAR_READ_MOSTLY = 1 ## removes the effect of ::ZE_MEMORY_ADVICE_SET_READ_MOSTLY SET_PREFERRED_LOCATION = 2 ## hint that the preferred memory location is the specified device CLEAR_PREFERRED_LOCATION = 3 ## removes the effect of ::ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION SET_NON_ATOMIC_MOSTLY = 4 ## hints that memory will mostly be accessed non-atomically CLEAR_NON_ATOMIC_MOSTLY = 5 ## removes the effect of ::ZE_MEMORY_ADVICE_SET_NON_ATOMIC_MOSTLY BIAS_CACHED = 6 ## hints that memory should be cached BIAS_UNCACHED = 7 ## hints that memory should be not be cached SET_SYSTEM_MEMORY_PREFERRED_LOCATION = 8 ## hint that the preferred memory location is host memory CLEAR_SYSTEM_MEMORY_PREFERRED_LOCATION = 9 ## removes the effect of ## ::ZE_MEMORY_ADVICE_SET_SYSTEM_MEMORY_PREFERRED_LOCATION class ze_memory_advice_t(c_int): def __str__(self): return str(ze_memory_advice_v(self.value)) ############################################################################### ## @brief Supported event pool creation flags class ze_event_pool_flags_v(IntEnum): HOST_VISIBLE = ZE_BIT(0) ## signals and waits are also visible to host IPC = ZE_BIT(1) ## signals and waits may be shared across processes KERNEL_TIMESTAMP = ZE_BIT(2) ## Indicates all events in pool will contain kernel timestamps KERNEL_MAPPED_TIMESTAMP = ZE_BIT(3) ## Indicates all events in pool will contain kernel timestamps ## synchronized to host time domain; cannot be combined with ## ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP class ze_event_pool_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Event pool descriptor class ze_event_pool_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_event_pool_flags_t), ## [in] creation flags. ## must be 0 (default) or a valid combination of ::ze_event_pool_flag_t; ## default behavior is signals and waits are visible to the entire device ## and peer devices. ("count", c_ulong) ## [in] number of events within the pool; must be greater than 0 ] ############################################################################### ## @brief Supported event scope flags class ze_event_scope_flags_v(IntEnum): SUBDEVICE = ZE_BIT(0) ## cache hierarchies are flushed or invalidated sufficient for local ## sub-device access DEVICE = ZE_BIT(1) ## cache hierarchies are flushed or invalidated sufficient for global ## device access and peer device access HOST = ZE_BIT(2) ## cache hierarchies are flushed or invalidated sufficient for device and ## host access class ze_event_scope_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Event descriptor class ze_event_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("index", c_ulong), ## [in] index of the event within the pool; must be less than the count ## specified during pool creation ("signal", ze_event_scope_flags_t), ## [in] defines the scope of relevant cache hierarchies to flush on a ## signal action before the event is triggered. ## must be 0 (default) or a valid combination of ::ze_event_scope_flag_t; ## default behavior is synchronization within the command list only, no ## additional cache hierarchies are flushed. ("wait", ze_event_scope_flags_t) ## [in] defines the scope of relevant cache hierarchies to invalidate on ## a wait action after the event is complete. ## must be 0 (default) or a valid combination of ::ze_event_scope_flag_t; ## default behavior is synchronization within the command list only, no ## additional cache hierarchies are invalidated. ] ############################################################################### ## @brief Kernel timestamp clock data ## ## @details ## - The timestamp frequency can be queried from the `timerResolution` ## member of ::ze_device_properties_t. ## - The number of valid bits in the timestamp value can be queried from ## the `kernelTimestampValidBits` member of ::ze_device_properties_t. class ze_kernel_timestamp_data_t(Structure): _fields_ = [ ("kernelStart", c_ulonglong), ## [out] device clock at start of kernel execution ("kernelEnd", c_ulonglong) ## [out] device clock at end of kernel execution ] ############################################################################### ## @brief Kernel timestamp result class ze_kernel_timestamp_result_t(Structure): _fields_ = [ ("global", ze_kernel_timestamp_data_t), ## [out] wall-clock data ("context", ze_kernel_timestamp_data_t) ## [out] context-active data; only includes clocks while device context ## was actively executing. ] ############################################################################### ## @brief Supported fence creation flags class ze_fence_flags_v(IntEnum): SIGNALED = ZE_BIT(0) ## fence is created in the signaled state, otherwise not signaled. class ze_fence_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Fence descriptor class ze_fence_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_fence_flags_t) ## [in] creation flags. ## must be 0 (default) or a valid combination of ::ze_fence_flag_t. ] ############################################################################### ## @brief Supported image creation flags class ze_image_flags_v(IntEnum): KERNEL_WRITE = ZE_BIT(0) ## kernels will write contents BIAS_UNCACHED = ZE_BIT(1) ## device should not cache contents class ze_image_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Supported image types class ze_image_type_v(IntEnum): _1D = 0 ## 1D _1DARRAY = 1 ## 1D array _2D = 2 ## 2D _2DARRAY = 3 ## 2D array _3D = 4 ## 3D BUFFER = 5 ## Buffer class ze_image_type_t(c_int): def __str__(self): return str(ze_image_type_v(self.value)) ############################################################################### ## @brief Supported image format layouts class ze_image_format_layout_v(IntEnum): _8 = 0 ## 8-bit single component layout _16 = 1 ## 16-bit single component layout _32 = 2 ## 32-bit single component layout _8_8 = 3 ## 2-component 8-bit layout _8_8_8_8 = 4 ## 4-component 8-bit layout _16_16 = 5 ## 2-component 16-bit layout _16_16_16_16 = 6 ## 4-component 16-bit layout _32_32 = 7 ## 2-component 32-bit layout _32_32_32_32 = 8 ## 4-component 32-bit layout _10_10_10_2 = 9 ## 4-component 10_10_10_2 layout _11_11_10 = 10 ## 3-component 11_11_10 layout _5_6_5 = 11 ## 3-component 5_6_5 layout _5_5_5_1 = 12 ## 4-component 5_5_5_1 layout _4_4_4_4 = 13 ## 4-component 4_4_4_4 layout Y8 = 14 ## Media Format: Y8. Format type and swizzle is ignored for this. NV12 = 15 ## Media Format: NV12. Format type and swizzle is ignored for this. YUYV = 16 ## Media Format: YUYV. Format type and swizzle is ignored for this. VYUY = 17 ## Media Format: VYUY. Format type and swizzle is ignored for this. YVYU = 18 ## Media Format: YVYU. Format type and swizzle is ignored for this. UYVY = 19 ## Media Format: UYVY. Format type and swizzle is ignored for this. AYUV = 20 ## Media Format: AYUV. Format type and swizzle is ignored for this. P010 = 21 ## Media Format: P010. Format type and swizzle is ignored for this. Y410 = 22 ## Media Format: Y410. Format type and swizzle is ignored for this. P012 = 23 ## Media Format: P012. Format type and swizzle is ignored for this. Y16 = 24 ## Media Format: Y16. Format type and swizzle is ignored for this. P016 = 25 ## Media Format: P016. Format type and swizzle is ignored for this. Y216 = 26 ## Media Format: Y216. Format type and swizzle is ignored for this. P216 = 27 ## Media Format: P216. Format type and swizzle is ignored for this. P8 = 28 ## Media Format: P8. Format type and swizzle is ignored for this. YUY2 = 29 ## Media Format: YUY2. Format type and swizzle is ignored for this. A8P8 = 30 ## Media Format: A8P8. Format type and swizzle is ignored for this. IA44 = 31 ## Media Format: IA44. Format type and swizzle is ignored for this. AI44 = 32 ## Media Format: AI44. Format type and swizzle is ignored for this. Y416 = 33 ## Media Format: Y416. Format type and swizzle is ignored for this. Y210 = 34 ## Media Format: Y210. Format type and swizzle is ignored for this. I420 = 35 ## Media Format: I420. Format type and swizzle is ignored for this. YV12 = 36 ## Media Format: YV12. Format type and swizzle is ignored for this. _400P = 37 ## Media Format: 400P. Format type and swizzle is ignored for this. _422H = 38 ## Media Format: 422H. Format type and swizzle is ignored for this. _422V = 39 ## Media Format: 422V. Format type and swizzle is ignored for this. _444P = 40 ## Media Format: 444P. Format type and swizzle is ignored for this. RGBP = 41 ## Media Format: RGBP. Format type and swizzle is ignored for this. BRGP = 42 ## Media Format: BRGP. Format type and swizzle is ignored for this. _8_8_8 = 43 ## 3-component 8-bit layout _16_16_16 = 44 ## 3-component 16-bit layout _32_32_32 = 45 ## 3-component 32-bit layout class ze_image_format_layout_t(c_int): def __str__(self): return str(ze_image_format_layout_v(self.value)) ############################################################################### ## @brief Supported image format types class ze_image_format_type_v(IntEnum): UINT = 0 ## Unsigned integer SINT = 1 ## Signed integer UNORM = 2 ## Unsigned normalized integer SNORM = 3 ## Signed normalized integer FLOAT = 4 ## Float class ze_image_format_type_t(c_int): def __str__(self): return str(ze_image_format_type_v(self.value)) ############################################################################### ## @brief Supported image format component swizzle into channel class ze_image_format_swizzle_v(IntEnum): R = 0 ## Red component G = 1 ## Green component B = 2 ## Blue component A = 3 ## Alpha component _0 = 4 ## Zero _1 = 5 ## One X = 6 ## Don't care class ze_image_format_swizzle_t(c_int): def __str__(self): return str(ze_image_format_swizzle_v(self.value)) ############################################################################### ## @brief Image format class ze_image_format_t(Structure): _fields_ = [ ("layout", ze_image_format_layout_t), ## [in] image format component layout (e.g. N-component layouts and media ## formats) ("type", ze_image_format_type_t), ## [in] image format type ("x", ze_image_format_swizzle_t), ## [in] image component swizzle into channel x ("y", ze_image_format_swizzle_t), ## [in] image component swizzle into channel y ("z", ze_image_format_swizzle_t), ## [in] image component swizzle into channel z ("w", ze_image_format_swizzle_t) ## [in] image component swizzle into channel w ] ############################################################################### ## @brief Image descriptor class ze_image_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_image_flags_t), ## [in] creation flags. ## must be 0 (default) or a valid combination of ::ze_image_flag_t; ## default is read-only, cached access. ("type", ze_image_type_t), ## [in] image type. Media format layouts are unsupported for ## ::ZE_IMAGE_TYPE_BUFFER ("format", ze_image_format_t), ## [in] image format ("width", c_ulonglong), ## [in] width dimension. ## ::ZE_IMAGE_TYPE_BUFFER: size in bytes; see the `maxImageBufferSize` ## member of ::ze_device_image_properties_t for limits. ## ::ZE_IMAGE_TYPE_1D, ::ZE_IMAGE_TYPE_1DARRAY: width in pixels; see the ## `maxImageDims1D` member of ::ze_device_image_properties_t for limits. ## ::ZE_IMAGE_TYPE_2D, ::ZE_IMAGE_TYPE_2DARRAY: width in pixels; see the ## `maxImageDims2D` member of ::ze_device_image_properties_t for limits. ## ::ZE_IMAGE_TYPE_3D: width in pixels; see the `maxImageDims3D` member ## of ::ze_device_image_properties_t for limits. ("height", c_ulong), ## [in] height dimension. ## ::ZE_IMAGE_TYPE_2D, ::ZE_IMAGE_TYPE_2DARRAY: height in pixels; see the ## `maxImageDims2D` member of ::ze_device_image_properties_t for limits. ## ::ZE_IMAGE_TYPE_3D: height in pixels; see the `maxImageDims3D` member ## of ::ze_device_image_properties_t for limits. ## other: ignored. ("depth", c_ulong), ## [in] depth dimension. ## ::ZE_IMAGE_TYPE_3D: depth in pixels; see the `maxImageDims3D` member ## of ::ze_device_image_properties_t for limits. ## other: ignored. ("arraylevels", c_ulong), ## [in] array levels. ## ::ZE_IMAGE_TYPE_1DARRAY, ::ZE_IMAGE_TYPE_2DARRAY: see the ## `maxImageArraySlices` member of ::ze_device_image_properties_t for limits. ## other: ignored. ("miplevels", c_ulong) ## [in] mipmap levels (must be 0) ] ############################################################################### ## @brief Supported sampler filtering flags class ze_image_sampler_filter_flags_v(IntEnum): POINT = ZE_BIT(0) ## device supports point filtering LINEAR = ZE_BIT(1) ## device supports linear filtering class ze_image_sampler_filter_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Image properties class ze_image_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("samplerFilterFlags", ze_image_sampler_filter_flags_t) ## [out] supported sampler filtering. ## returns 0 (unsupported) or a combination of ::ze_image_sampler_filter_flag_t. ] ############################################################################### ## @brief Supported memory allocation flags class ze_device_mem_alloc_flags_v(IntEnum): BIAS_CACHED = ZE_BIT(0) ## device should cache allocation BIAS_UNCACHED = ZE_BIT(1) ## device should not cache allocation (UC) BIAS_INITIAL_PLACEMENT = ZE_BIT(2) ## optimize shared allocation for first access on the device class ze_device_mem_alloc_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device memory allocation descriptor class ze_device_mem_alloc_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_device_mem_alloc_flags_t), ## [in] flags specifying additional allocation controls. ## must be 0 (default) or a valid combination of ::ze_device_mem_alloc_flag_t; ## default behavior may use implicit driver-based heuristics. ("ordinal", c_ulong) ## [in] ordinal of the device's local memory to allocate from. ## must be less than the count returned from ::zeDeviceGetMemoryProperties. ] ############################################################################### ## @brief Supported host memory allocation flags class ze_host_mem_alloc_flags_v(IntEnum): BIAS_CACHED = ZE_BIT(0) ## host should cache allocation BIAS_UNCACHED = ZE_BIT(1) ## host should not cache allocation (UC) BIAS_WRITE_COMBINED = ZE_BIT(2) ## host memory should be allocated write-combined (WC) BIAS_INITIAL_PLACEMENT = ZE_BIT(3) ## optimize shared allocation for first access on the host class ze_host_mem_alloc_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Host memory allocation descriptor class ze_host_mem_alloc_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_host_mem_alloc_flags_t) ## [in] flags specifying additional allocation controls. ## must be 0 (default) or a valid combination of ::ze_host_mem_alloc_flag_t; ## default behavior may use implicit driver-based heuristics. ] ############################################################################### ## @brief Memory allocation type class ze_memory_type_v(IntEnum): UNKNOWN = 0 ## the memory pointed to is of unknown type HOST = 1 ## the memory pointed to is a host allocation DEVICE = 2 ## the memory pointed to is a device allocation SHARED = 3 ## the memory pointed to is a shared ownership allocation class ze_memory_type_t(c_int): def __str__(self): return str(ze_memory_type_v(self.value)) ############################################################################### ## @brief Memory allocation properties queried using ::zeMemGetAllocProperties class ze_memory_allocation_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", ze_memory_type_t), ## [out] type of allocated memory ("id", c_ulonglong), ## [out] identifier for this allocation ("pageSize", c_ulonglong) ## [out] page size used for allocation ] ############################################################################### ## @brief Supported IPC memory flags class ze_ipc_memory_flags_v(IntEnum): BIAS_CACHED = ZE_BIT(0) ## device should cache allocation BIAS_UNCACHED = ZE_BIT(1) ## device should not cache allocation (UC) class ze_ipc_memory_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Additional allocation descriptor for exporting external memory ## ## @details ## - This structure may be passed to ::zeMemAllocDevice and ## ::zeMemAllocHost, via the `pNext` member of ## ::ze_device_mem_alloc_desc_t or ::ze_host_mem_alloc_desc_t, ## respectively, to indicate an exportable memory allocation. ## - This structure may be passed to ::zeImageCreate, via the `pNext` ## member of ::ze_image_desc_t, to indicate an exportable image. class ze_external_memory_export_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_external_memory_type_flags_t) ## [in] flags specifying memory export types for this allocation. ## must be 0 (default) or a valid combination of ::ze_external_memory_type_flags_t ] ############################################################################### ## @brief Additional allocation descriptor for importing external memory as a ## file descriptor ## ## @details ## - This structure may be passed to ::zeMemAllocDevice or ## ::zeMemAllocHost, via the `pNext` member of ## ::ze_device_mem_alloc_desc_t or of ::ze_host_mem_alloc_desc_t, ## respectively, to import memory from a file descriptor. ## - This structure may be passed to ::zeImageCreate, via the `pNext` ## member of ::ze_image_desc_t, to import memory from a file descriptor. class ze_external_memory_import_fd_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_external_memory_type_flags_t), ## [in] flags specifying the memory import type for the file descriptor. ## must be 0 (default) or a valid combination of ::ze_external_memory_type_flags_t ("fd", c_int) ## [in] the file descriptor handle to import ] ############################################################################### ## @brief Exports an allocation as a file descriptor ## ## @details ## - This structure may be passed to ::zeMemGetAllocProperties, via the ## `pNext` member of ::ze_memory_allocation_properties_t, to export a ## memory allocation as a file descriptor. ## - This structure may be passed to ::zeImageGetAllocPropertiesExt, via ## the `pNext` member of ::ze_image_allocation_ext_properties_t, to ## export an image as a file descriptor. ## - The requested memory export type must have been specified when the ## allocation was made. class ze_external_memory_export_fd_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_external_memory_type_flags_t), ## [in] flags specifying the memory export type for the file descriptor. ## must be 0 (default) or a valid combination of ::ze_external_memory_type_flags_t ("fd", c_int) ## [out] the exported file descriptor handle representing the allocation. ] ############################################################################### ## @brief Additional allocation descriptor for importing external memory as a ## Win32 handle ## ## @details ## - When `handle` is `nullptr`, `name` must not be `nullptr`. ## - When `name` is `nullptr`, `handle` must not be `nullptr`. ## - When `flags` is ::ZE_EXTERNAL_MEMORY_TYPE_FLAG_OPAQUE_WIN32_KMT, ## `name` must be `nullptr`. ## - This structure may be passed to ::zeMemAllocDevice or ## ::zeMemAllocHost, via the `pNext` member of ## ::ze_device_mem_alloc_desc_t or of ::ze_host_mem_alloc_desc_t, ## respectively, to import memory from a Win32 handle. ## - This structure may be passed to ::zeImageCreate, via the `pNext` ## member of ::ze_image_desc_t, to import memory from a Win32 handle. class ze_external_memory_import_win32_handle_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_external_memory_type_flags_t), ## [in] flags specifying the memory import type for the Win32 handle. ## must be 0 (default) or a valid combination of ::ze_external_memory_type_flags_t ("handle", c_void_p), ## [in][optional] the Win32 handle to import ("name", c_void_p) ## [in][optional] name of a memory object to import ] ############################################################################### ## @brief Exports an allocation as a Win32 handle ## ## @details ## - This structure may be passed to ::zeMemGetAllocProperties, via the ## `pNext` member of ::ze_memory_allocation_properties_t, to export a ## memory allocation as a Win32 handle. ## - This structure may be passed to ::zeImageGetAllocPropertiesExt, via ## the `pNext` member of ::ze_image_allocation_ext_properties_t, to ## export an image as a Win32 handle. ## - The requested memory export type must have been specified when the ## allocation was made. class ze_external_memory_export_win32_handle_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_external_memory_type_flags_t), ## [in] flags specifying the memory export type for the Win32 handle. ## must be 0 (default) or a valid combination of ::ze_external_memory_type_flags_t ("handle", c_void_p) ## [out] the exported Win32 handle representing the allocation. ] ############################################################################### ## @brief atomic access attribute flags class ze_memory_atomic_attr_exp_flags_v(IntEnum): NO_ATOMICS = ZE_BIT(0) ## Atomics on the pointer are not allowed NO_HOST_ATOMICS = ZE_BIT(1) ## Host atomics on the pointer are not allowed HOST_ATOMICS = ZE_BIT(2) ## Host atomics on the pointer are allowed. Requires ## ::ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC returned by ## ::zeDeviceGetMemoryAccessProperties. NO_DEVICE_ATOMICS = ZE_BIT(3) ## Device atomics on the pointer are not allowed DEVICE_ATOMICS = ZE_BIT(4) ## Device atomics on the pointer are allowed. Requires ## ::ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC returned by ## ::zeDeviceGetMemoryAccessProperties. NO_SYSTEM_ATOMICS = ZE_BIT(5) ## Concurrent atomics on the pointer from both host and device are not ## allowed SYSTEM_ATOMICS = ZE_BIT(6) ## Concurrent atomics on the pointer from both host and device are ## allowed. Requires ::ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT_ATOMIC ## returned by ::zeDeviceGetMemoryAccessProperties. class ze_memory_atomic_attr_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Supported module creation input formats class ze_module_format_v(IntEnum): IL_SPIRV = 0 ## Format is SPIRV IL format NATIVE = 1 ## Format is device native format class ze_module_format_t(c_int): def __str__(self): return str(ze_module_format_v(self.value)) ############################################################################### ## @brief Specialization constants - User defined constants class ze_module_constants_t(Structure): _fields_ = [ ("numConstants", c_ulong), ## [in] Number of specialization constants. ("pConstantIds", POINTER(c_ulong)), ## [in][range(0, numConstants)] Array of IDs that is sized to ## numConstants. ("pConstantValues", POINTER(c_void_p)) ## [in][range(0, numConstants)] Array of pointers to values that is sized ## to numConstants. ] ############################################################################### ## @brief Module descriptor class ze_module_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("format", ze_module_format_t), ## [in] Module format passed in with pInputModule ("inputSize", c_size_t), ## [in] size of input IL or ISA from pInputModule. ("pInputModule", POINTER(c_ubyte)), ## [in] pointer to IL or ISA ("pBuildFlags", c_char_p), ## [in][optional] string containing one or more (comma-separated) ## compiler flags. If unsupported, flag is ignored with a warning. ## - "-ze-opt-disable" ## - Disable optimizations ## - "-ze-opt-level" ## - Specifies optimization level for compiler. Levels are ## implementation specific. ## - 0 is no optimizations (equivalent to -ze-opt-disable) ## - 1 is optimize minimally (may be the same as 2) ## - 2 is optimize more (default) ## - "-ze-opt-greater-than-4GB-buffer-required" ## - Use 64-bit offset calculations for buffers. ## - "-ze-opt-large-register-file" ## - Increase number of registers available to threads. ## - "-ze-opt-has-buffer-offset-arg" ## - Extend stateless to stateful optimization to more ## cases with the use of additional offset (e.g. 64-bit ## pointer to binding table with 32-bit offset). ## - "-g" ## - Include debugging information. ("pConstants", POINTER(ze_module_constants_t)) ## [in][optional] pointer to specialization constants. Valid only for ## SPIR-V input. This must be set to nullptr if no specialization ## constants are provided. ] ############################################################################### ## @brief Supported module property flags class ze_module_property_flags_v(IntEnum): IMPORTS = ZE_BIT(0) ## Module has imports (i.e. imported global variables and/or kernels). ## See ::zeModuleDynamicLink. class ze_module_property_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Module properties class ze_module_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_module_property_flags_t) ## [out] 0 (none) or a valid combination of ::ze_module_property_flag_t ] ############################################################################### ## @brief Supported kernel creation flags class ze_kernel_flags_v(IntEnum): FORCE_RESIDENCY = ZE_BIT(0) ## force all device allocations to be resident during execution EXPLICIT_RESIDENCY = ZE_BIT(1) ## application is responsible for all residency of device allocations. ## driver may disable implicit residency management. class ze_kernel_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Kernel descriptor class ze_kernel_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_kernel_flags_t), ## [in] creation flags. ## must be 0 (default) or a valid combination of ::ze_kernel_flag_t; ## default behavior may use driver-based residency. ("pKernelName", c_char_p) ## [in] null-terminated name of kernel in module ] ############################################################################### ## @brief Kernel indirect access flags class ze_kernel_indirect_access_flags_v(IntEnum): HOST = ZE_BIT(0) ## Indicates that the kernel accesses host allocations indirectly. DEVICE = ZE_BIT(1) ## Indicates that the kernel accesses device allocations indirectly. SHARED = ZE_BIT(2) ## Indicates that the kernel accesses shared allocations indirectly. class ze_kernel_indirect_access_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Supported Cache Config flags class ze_cache_config_flags_v(IntEnum): LARGE_SLM = ZE_BIT(0) ## Large SLM size LARGE_DATA = ZE_BIT(1) ## Large General Data size class ze_cache_config_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Maximum kernel universal unique id (UUID) size in bytes ZE_MAX_KERNEL_UUID_SIZE = 16 ############################################################################### ## @brief Maximum module universal unique id (UUID) size in bytes ZE_MAX_MODULE_UUID_SIZE = 16 ############################################################################### ## @brief Kernel universal unique id (UUID) class ze_kernel_uuid_t(Structure): _fields_ = [ ("kid", c_ubyte * ZE_MAX_KERNEL_UUID_SIZE), ## [out] opaque data representing a kernel UUID ("mid", c_ubyte * ZE_MAX_MODULE_UUID_SIZE) ## [out] opaque data representing the kernel's module UUID ] ############################################################################### ## @brief Kernel properties class ze_kernel_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("numKernelArgs", c_ulong), ## [out] number of kernel arguments. ("requiredGroupSizeX", c_ulong), ## [out] required group size in the X dimension, ## or zero if there is no required group size ("requiredGroupSizeY", c_ulong), ## [out] required group size in the Y dimension, ## or zero if there is no required group size ("requiredGroupSizeZ", c_ulong), ## [out] required group size in the Z dimension, ## or zero if there is no required group size ("requiredNumSubGroups", c_ulong), ## [out] required number of subgroups per thread group, ## or zero if there is no required number of subgroups ("requiredSubgroupSize", c_ulong), ## [out] required subgroup size, ## or zero if there is no required subgroup size ("maxSubgroupSize", c_ulong), ## [out] maximum subgroup size ("maxNumSubgroups", c_ulong), ## [out] maximum number of subgroups per thread group ("localMemSize", c_ulong), ## [out] local memory size used by each thread group ("privateMemSize", c_ulong), ## [out] private memory size allocated by compiler used by each thread ("spillMemSize", c_ulong), ## [out] spill memory size allocated by compiler ("uuid", ze_kernel_uuid_t) ## [out] universal unique identifier. ] ############################################################################### ## @brief Additional kernel preferred group size properties ## ## @details ## - This structure may be passed to ::zeKernelGetProperties, via the ## `pNext` member of ::ze_kernel_properties_t, to query additional kernel ## preferred group size properties. class ze_kernel_preferred_group_size_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("preferredMultiple", c_ulong) ## [out] preferred group size multiple ] ############################################################################### ## @brief Kernel dispatch group count. class ze_group_count_t(Structure): _fields_ = [ ("groupCountX", c_ulong), ## [in] number of thread groups in X dimension ("groupCountY", c_ulong), ## [in] number of thread groups in Y dimension ("groupCountZ", c_ulong) ## [in] number of thread groups in Z dimension ] ############################################################################### ## @brief Module Program Extension Name ZE_MODULE_PROGRAM_EXP_NAME = "ZE_experimental_module_program" ############################################################################### ## @brief Module Program Extension Version(s) class ze_module_program_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_module_program_exp_version_t(c_int): def __str__(self): return str(ze_module_program_exp_version_v(self.value)) ############################################################################### ## @brief Module extended descriptor to support multiple input modules. ## ## @details ## - Implementation must support ::ZE_experimental_module_program extension ## - Modules support import and export linkage for functions and global ## variables. ## - SPIR-V import and export linkage types are used. See SPIR-V ## specification for linkage details. ## - pInputModules, pBuildFlags, and pConstants from ::ze_module_desc_t is ## ignored. ## - Format in ::ze_module_desc_t needs to be set to ## ::ZE_MODULE_FORMAT_IL_SPIRV. class ze_module_program_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("count", c_ulong), ## [in] Count of input modules ("inputSizes", POINTER(c_size_t)), ## [in][range(0, count)] sizes of each input IL module in pInputModules. ("pInputModules", POINTER(c_ubyte*)), ## [in][range(0, count)] pointer to an array of IL (e.g. SPIR-V modules). ## Valid only for SPIR-V input. ("pBuildFlags", POINTER(c_char_p)), ## [in][optional][range(0, count)] array of strings containing build ## flags. See pBuildFlags in ::ze_module_desc_t. ("pConstants", POINTER(ze_module_constants_t*)) ## [in][optional][range(0, count)] pointer to array of specialization ## constant strings. Valid only for SPIR-V input. This must be set to ## nullptr if no specialization constants are provided. ] ############################################################################### ## @brief Raytracing Extension Name ZE_RAYTRACING_EXT_NAME = "ZE_extension_raytracing" ############################################################################### ## @brief Raytracing Extension Version(s) class ze_raytracing_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_raytracing_ext_version_t(c_int): def __str__(self): return str(ze_raytracing_ext_version_v(self.value)) ############################################################################### ## @brief Supported raytracing capability flags class ze_device_raytracing_ext_flags_v(IntEnum): RAYQUERY = ZE_BIT(0) ## Supports rayquery class ze_device_raytracing_ext_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Raytracing properties queried using ::zeDeviceGetModuleProperties ## ## @details ## - This structure may be returned from ::zeDeviceGetModuleProperties, via ## the `pNext` member of ::ze_device_module_properties_t. class ze_device_raytracing_ext_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_device_raytracing_ext_flags_t), ## [out] 0 or a valid combination of ::ze_device_raytracing_ext_flags_t ("maxBVHLevels", c_ulong) ## [out] Maximum number of BVH levels supported ] ############################################################################### ## @brief Supported raytracing memory allocation flags class ze_raytracing_mem_alloc_ext_flags_v(IntEnum): TBD = ZE_BIT(0) ## reserved for future use class ze_raytracing_mem_alloc_ext_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Raytracing memory allocation descriptor ## ## @details ## - This structure must be passed to ::zeMemAllocShared or ## ::zeMemAllocDevice, via the `pNext` member of ## ::ze_device_mem_alloc_desc_t, for any memory allocation that is to be ## accessed by raytracing fixed-function of the device. class ze_raytracing_mem_alloc_ext_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_raytracing_mem_alloc_ext_flags_t) ## [in] flags specifying additional allocation controls. ## must be 0 (default) or a valid combination of ::ze_raytracing_mem_alloc_ext_flag_t; ## default behavior may use implicit driver-based heuristics. ] ############################################################################### ## @brief Sampler addressing modes class ze_sampler_address_mode_v(IntEnum): NONE = 0 ## No coordinate modifications for out-of-bounds image access. REPEAT = 1 ## Out-of-bounds coordinates are wrapped back around. CLAMP = 2 ## Out-of-bounds coordinates are clamped to edge. CLAMP_TO_BORDER = 3 ## Out-of-bounds coordinates are clamped to border color which is (0.0f, ## 0.0f, 0.0f, 0.0f) if image format swizzle contains alpha, otherwise ## (0.0f, 0.0f, 0.0f, 1.0f). MIRROR = 4 ## Out-of-bounds coordinates are mirrored starting from edge. class ze_sampler_address_mode_t(c_int): def __str__(self): return str(ze_sampler_address_mode_v(self.value)) ############################################################################### ## @brief Sampler filtering modes class ze_sampler_filter_mode_v(IntEnum): NEAREST = 0 ## No coordinate modifications for out of bounds image access. LINEAR = 1 ## Out-of-bounds coordinates are wrapped back around. class ze_sampler_filter_mode_t(c_int): def __str__(self): return str(ze_sampler_filter_mode_v(self.value)) ############################################################################### ## @brief Sampler descriptor class ze_sampler_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("addressMode", ze_sampler_address_mode_t), ## [in] Sampler addressing mode to determine how out-of-bounds ## coordinates are handled. ("filterMode", ze_sampler_filter_mode_t), ## [in] Sampler filter mode to determine how samples are filtered. ("isNormalized", ze_bool_t) ## [in] Are coordinates normalized [0, 1] or not. ] ############################################################################### ## @brief Virtual memory page access attributes class ze_memory_access_attribute_v(IntEnum): NONE = 0 ## Indicates the memory page is inaccessible. READWRITE = 1 ## Indicates the memory page supports read write access. READONLY = 2 ## Indicates the memory page supports read-only access. class ze_memory_access_attribute_t(c_int): def __str__(self): return str(ze_memory_access_attribute_v(self.value)) ############################################################################### ## @brief Supported physical memory creation flags class ze_physical_mem_flags_v(IntEnum): ALLOCATE_ON_DEVICE = ZE_BIT(0) ## [default] allocate physical device memory. ALLOCATE_ON_HOST = ZE_BIT(1) ## Allocate physical host memory instead. class ze_physical_mem_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Physical memory descriptor class ze_physical_mem_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_physical_mem_flags_t), ## [in] creation flags. ## must be 0 (default) or a valid combination of ## ::ze_physical_mem_flag_t; default is to create physical device memory. ("size", c_size_t) ## [in] size in bytes to reserve; must be page aligned. ] ############################################################################### ## @brief Floating-Point Atomics Extension Name ZE_FLOAT_ATOMICS_EXT_NAME = "ZE_extension_float_atomics" ############################################################################### ## @brief Floating-Point Atomics Extension Version(s) class ze_float_atomics_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_float_atomics_ext_version_t(c_int): def __str__(self): return str(ze_float_atomics_ext_version_v(self.value)) ############################################################################### ## @brief Supported floating-point atomic capability flags class ze_device_fp_atomic_ext_flags_v(IntEnum): GLOBAL_LOAD_STORE = ZE_BIT(0) ## Supports atomic load, store, and exchange GLOBAL_ADD = ZE_BIT(1) ## Supports atomic add and subtract GLOBAL_MIN_MAX = ZE_BIT(2) ## Supports atomic min and max LOCAL_LOAD_STORE = ZE_BIT(16) ## Supports atomic load, store, and exchange LOCAL_ADD = ZE_BIT(17) ## Supports atomic add and subtract LOCAL_MIN_MAX = ZE_BIT(18) ## Supports atomic min and max class ze_device_fp_atomic_ext_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device floating-point atomic properties queried using ## ::zeDeviceGetModuleProperties ## ## @details ## - This structure may be returned from ::zeDeviceGetModuleProperties, via ## the `pNext` member of ::ze_device_module_properties_t. class ze_float_atomic_ext_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("fp16Flags", ze_device_fp_atomic_ext_flags_t), ## [out] Capabilities for half-precision floating-point atomic operations ("fp32Flags", ze_device_fp_atomic_ext_flags_t), ## [out] Capabilities for single-precision floating-point atomic ## operations ("fp64Flags", ze_device_fp_atomic_ext_flags_t) ## [out] Capabilities for double-precision floating-point atomic ## operations ] ############################################################################### ## @brief Global Offset Extension Name ZE_GLOBAL_OFFSET_EXP_NAME = "ZE_experimental_global_offset" ############################################################################### ## @brief Global Offset Extension Version(s) class ze_global_offset_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_global_offset_exp_version_t(c_int): def __str__(self): return str(ze_global_offset_exp_version_v(self.value)) ############################################################################### ## @brief Relaxed Allocation Limits Extension Name ZE_RELAXED_ALLOCATION_LIMITS_EXP_NAME = "ZE_experimental_relaxed_allocation_limits" ############################################################################### ## @brief Relaxed Allocation Limits Extension Version(s) class ze_relaxed_allocation_limits_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_relaxed_allocation_limits_exp_version_t(c_int): def __str__(self): return str(ze_relaxed_allocation_limits_exp_version_v(self.value)) ############################################################################### ## @brief Supported relaxed memory allocation flags class ze_relaxed_allocation_limits_exp_flags_v(IntEnum): MAX_SIZE = ZE_BIT(0) ## Allocation size may exceed the `maxMemAllocSize` member of ## ::ze_device_properties_t. class ze_relaxed_allocation_limits_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Relaxed limits memory allocation descriptor ## ## @details ## - This structure may be passed to ::zeMemAllocShared or ## ::zeMemAllocDevice, via the `pNext` member of ## ::ze_device_mem_alloc_desc_t. ## - This structure may also be passed to ::zeMemAllocHost, via the `pNext` ## member of ::ze_host_mem_alloc_desc_t. class ze_relaxed_allocation_limits_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_relaxed_allocation_limits_exp_flags_t) ## [in] flags specifying allocation limits to relax. ## must be 0 (default) or a valid combination of ::ze_relaxed_allocation_limits_exp_flag_t; ] ############################################################################### ## @brief Get Kernel Binary Extension Name ZE_GET_KERNEL_BINARY_EXP_NAME = "ZE_extension_kernel_binary_exp" ############################################################################### ## @brief Get Kernel Binary Extension Version(s) class ze_kernel_get_binary_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_kernel_get_binary_exp_version_t(c_int): def __str__(self): return str(ze_kernel_get_binary_exp_version_v(self.value)) ############################################################################### ## @brief Driver Direct Device Interface (DDI) Handles Extension Name ZE_DRIVER_DDI_HANDLES_EXT_NAME = "ZE_extension_driver_ddi_handles" ############################################################################### ## @brief Driver Direct Device Interface (DDI) Handles Extension Version(s) class ze_driver_ddi_handles_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_driver_ddi_handles_ext_version_t(c_int): def __str__(self): return str(ze_driver_ddi_handles_ext_version_v(self.value)) ############################################################################### ## @brief Driver Direct Device Interface (DDI) Handle Extension Flags class ze_driver_ddi_handle_ext_flags_v(IntEnum): DDI_HANDLE_EXT_SUPPORTED = ZE_BIT(0) ## Driver Supports DDI Handles Extension class ze_driver_ddi_handle_ext_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Driver DDI Handles properties queried using ::zeDriverGetProperties ## ## @details ## - This structure may be returned from ::zeDriverGetProperties, via the ## `pNext` member of ::ze_driver_properties_t. class ze_driver_ddi_handles_ext_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_driver_ddi_handle_ext_flags_t) ## [out] 0 (none) or a valid combination of ::ze_driver_ddi_handle_ext_flags_t ] ############################################################################### ## @brief External Semaphores Extension Name ZE_EXTERNAL_SEMAPHORES_EXTENSION_NAME = "ZE_extension_external_semaphores" ############################################################################### ## @brief External Semaphores Extension Version class ze_external_semaphore_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_external_semaphore_ext_version_t(c_int): def __str__(self): return str(ze_external_semaphore_ext_version_v(self.value)) ############################################################################### ## @brief Handle of external semaphore object class ze_external_semaphore_ext_handle_t(c_void_p): pass ############################################################################### ## @brief External Semaphores Type Flags class ze_external_semaphore_ext_flags_v(IntEnum): OPAQUE_FD = ZE_BIT(0) ## Semaphore is an Linux opaque file descriptor OPAQUE_WIN32 = ZE_BIT(1) ## Semaphore is an opaque Win32 handle for monitored fence OPAQUE_WIN32_KMT = ZE_BIT(2) ## Semaphore is an opaque Win32 KMT handle for monitored fence D3D12_FENCE = ZE_BIT(3) ## Semaphore is a D3D12 fence D3D11_FENCE = ZE_BIT(4) ## Semaphore is a D3D11 fence KEYED_MUTEX = ZE_BIT(5) ## Semaphore is a keyed mutex for Win32 KEYED_MUTEX_KMT = ZE_BIT(6) ## Semaphore is a keyed mutex for Win32 KMT VK_TIMELINE_SEMAPHORE_FD = ZE_BIT(7) ## Semaphore is a Vulkan Timeline semaphore for Linux VK_TIMELINE_SEMAPHORE_WIN32 = ZE_BIT(8) ## Semaphore is a Vulkan Timeline semaphore for Win32 class ze_external_semaphore_ext_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief External Semaphore Descriptor class ze_external_semaphore_ext_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_external_semaphore_ext_flags_t) ## [in] The flags describing the type of the semaphore. ## must be 0 (default) or a valid combination of ::ze_external_semaphore_ext_flag_t. ## When importing a semaphore, pNext should be pointing to one of the ## following structures: ::ze_external_semaphore_win32_ext_desc_t or ::ze_external_semaphore_fd_ext_desc_t. ] ############################################################################### ## @brief External Semaphore Win32 Descriptor class ze_external_semaphore_win32_ext_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("handle", c_void_p), ## [in] Win32 handle of the semaphore. ## Must be a valid Win32 handle. ("name", c_char_p) ## [in] Name of the semaphore. ## Must be a valid null-terminated string. ] ############################################################################### ## @brief External Semaphore FD Descriptor class ze_external_semaphore_fd_ext_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("fd", c_int) ## [in] File descriptor of the semaphore. ## Must be a valid file descriptor. ] ############################################################################### ## @brief External Semaphore Signal parameters class ze_external_semaphore_signal_params_ext_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("value", c_ulonglong) ## [in] [optional] Value to signal. ## Specified by user as an expected value with some of semaphore types, ## such as ::ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_D3D12_FENCE. ] ############################################################################### ## @brief External Semaphore Wait parameters class ze_external_semaphore_wait_params_ext_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("value", c_ulonglong) ## [in] [optional] Value to wait for. ## Specified by user as an expected value with some of semaphore types, ## such as ::ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_D3D12_FENCE. ] ############################################################################### ## @brief Cache_Reservation Extension Name ZE_CACHE_RESERVATION_EXT_NAME = "ZE_extension_cache_reservation" ############################################################################### ## @brief Cache_Reservation Extension Version(s) class ze_cache_reservation_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_cache_reservation_ext_version_t(c_int): def __str__(self): return str(ze_cache_reservation_ext_version_v(self.value)) ############################################################################### ## @brief Cache Reservation Region class ze_cache_ext_region_v(IntEnum): ZE_CACHE_REGION_DEFAULT = 0 ## [DEPRECATED] utilize driver default scheme. Use ## ::ZE_CACHE_EXT_REGION_DEFAULT. ZE_CACHE_RESERVE_REGION = 1 ## [DEPRECATED] utilize reserved region. Use ## ::ZE_CACHE_EXT_REGION_RESERVED. ZE_CACHE_NON_RESERVED_REGION = 2 ## [DEPRECATED] utilize non-reserverd region. Use ## ::ZE_CACHE_EXT_REGION_NON_RESERVED. DEFAULT = 0 ## utilize driver default scheme RESERVED = 1 ## utilize reserved region NON_RESERVED = 2 ## utilize non-reserverd region class ze_cache_ext_region_t(c_int): def __str__(self): return str(ze_cache_ext_region_v(self.value)) ############################################################################### ## @brief CacheReservation structure ## ## @details ## - This structure must be passed to ::zeDeviceGetCacheProperties via the ## `pNext` member of ::ze_device_cache_properties_t ## - Used for determining the max cache reservation allowed on device. Size ## of zero means no reservation available. class ze_cache_reservation_ext_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("maxCacheReservationSize", c_size_t) ## [out] max cache reservation size ] ############################################################################### ## @brief Event Query Timestamps Extension Name ZE_EVENT_QUERY_TIMESTAMPS_EXP_NAME = "ZE_experimental_event_query_timestamps" ############################################################################### ## @brief Event Query Timestamps Extension Version(s) class ze_event_query_timestamps_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_event_query_timestamps_exp_version_t(c_int): def __str__(self): return str(ze_event_query_timestamps_exp_version_v(self.value)) ############################################################################### ## @brief Image Memory Properties Extension Name ZE_IMAGE_MEMORY_PROPERTIES_EXP_NAME = "ZE_experimental_image_memory_properties" ############################################################################### ## @brief Image Memory Properties Extension Version(s) class ze_image_memory_properties_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_image_memory_properties_exp_version_t(c_int): def __str__(self): return str(ze_image_memory_properties_exp_version_v(self.value)) ############################################################################### ## @brief Image memory properties class ze_image_memory_properties_exp_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("size", c_ulonglong), ## [out] size of image allocation in bytes. ("rowPitch", c_ulonglong), ## [out] size of image row in bytes. ("slicePitch", c_ulonglong) ## [out] size of image slice in bytes. ] ############################################################################### ## @brief Image View Extension Name ZE_IMAGE_VIEW_EXT_NAME = "ZE_extension_image_view" ############################################################################### ## @brief Image View Extension Version(s) class ze_image_view_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_image_view_ext_version_t(c_int): def __str__(self): return str(ze_image_view_ext_version_v(self.value)) ############################################################################### ## @brief Image View Extension Name ZE_IMAGE_VIEW_EXP_NAME = "ZE_experimental_image_view" ############################################################################### ## @brief Image View Extension Version(s) class ze_image_view_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_image_view_exp_version_t(c_int): def __str__(self): return str(ze_image_view_exp_version_v(self.value)) ############################################################################### ## @brief Image View Planar Extension Name ZE_IMAGE_VIEW_PLANAR_EXT_NAME = "ZE_extension_image_view_planar" ############################################################################### ## @brief Image View Planar Extension Version(s) class ze_image_view_planar_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_image_view_planar_ext_version_t(c_int): def __str__(self): return str(ze_image_view_planar_ext_version_v(self.value)) ############################################################################### ## @brief Image view planar descriptor class ze_image_view_planar_ext_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("planeIndex", c_ulong) ## [in] the 0-based plane index (e.g. NV12 is 0 = Y plane, 1 UV plane) ] ############################################################################### ## @brief Image View Planar Extension Name ZE_IMAGE_VIEW_PLANAR_EXP_NAME = "ZE_experimental_image_view_planar" ############################################################################### ## @brief Image View Planar Extension Version(s) class ze_image_view_planar_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_image_view_planar_exp_version_t(c_int): def __str__(self): return str(ze_image_view_planar_exp_version_v(self.value)) ############################################################################### ## @brief Image view planar descriptor class ze_image_view_planar_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("planeIndex", c_ulong) ## [in] the 0-based plane index (e.g. NV12 is 0 = Y plane, 1 UV plane) ] ############################################################################### ## @brief Kernel Scheduling Hints Extension Name ZE_KERNEL_SCHEDULING_HINTS_EXP_NAME = "ZE_experimental_scheduling_hints" ############################################################################### ## @brief Kernel Scheduling Hints Extension Version(s) class ze_scheduling_hints_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_scheduling_hints_exp_version_t(c_int): def __str__(self): return str(ze_scheduling_hints_exp_version_v(self.value)) ############################################################################### ## @brief Supported kernel scheduling hint flags class ze_scheduling_hint_exp_flags_v(IntEnum): OLDEST_FIRST = ZE_BIT(0) ## Hint that the kernel prefers oldest-first scheduling ROUND_ROBIN = ZE_BIT(1) ## Hint that the kernel prefers round-robin scheduling STALL_BASED_ROUND_ROBIN = ZE_BIT(2) ## Hint that the kernel prefers stall-based round-robin scheduling class ze_scheduling_hint_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device kernel scheduling hint properties queried using ## ::zeDeviceGetModuleProperties ## ## @details ## - This structure may be returned from ::zeDeviceGetModuleProperties, via ## the `pNext` member of ::ze_device_module_properties_t. class ze_scheduling_hint_exp_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("schedulingHintFlags", ze_scheduling_hint_exp_flags_t) ## [out] Supported kernel scheduling hints. ## May be 0 (none) or a valid combination of ::ze_scheduling_hint_exp_flag_t. ] ############################################################################### ## @brief Kernel scheduling hint descriptor ## ## @details ## - This structure may be passed to ::zeKernelSchedulingHintExp. class ze_scheduling_hint_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_scheduling_hint_exp_flags_t) ## [in] flags specifying kernel scheduling hints. ## must be 0 (default) or a valid combination of ::ze_scheduling_hint_exp_flag_t. ] ############################################################################### ## @brief Linkonce ODR Extension Name ZE_LINKONCE_ODR_EXT_NAME = "ZE_extension_linkonce_odr" ############################################################################### ## @brief Linkonce ODR Extension Version(s) class ze_linkonce_odr_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_linkonce_odr_ext_version_t(c_int): def __str__(self): return str(ze_linkonce_odr_ext_version_v(self.value)) ############################################################################### ## @brief Power Saving Hint Extension Name ZE_CONTEXT_POWER_SAVING_HINT_EXP_NAME = "ZE_experimental_power_saving_hint" ############################################################################### ## @brief Power Saving Hint Extension Version(s) class ze_power_saving_hint_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_power_saving_hint_exp_version_t(c_int): def __str__(self): return str(ze_power_saving_hint_exp_version_v(self.value)) ############################################################################### ## @brief Supported device types class ze_power_saving_hint_type_v(IntEnum): MIN = 0 ## Minumum power savings. The device will make no attempt to save power ## while executing work submitted to this context. MAX = 100 ## Maximum power savings. The device will do everything to bring power to ## a minimum while executing work submitted to this context. class ze_power_saving_hint_type_t(c_int): def __str__(self): return str(ze_power_saving_hint_type_v(self.value)) ############################################################################### ## @brief Extended context descriptor containing power saving hint. class ze_context_power_saving_hint_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("hint", c_ulong) ## [in] power saving hint (default value = 0). This is value from [0,100] ## and can use pre-defined settings from ::ze_power_saving_hint_type_t. ] ############################################################################### ## @brief Subgroups Extension Name ZE_SUBGROUPS_EXT_NAME = "ZE_extension_subgroups" ############################################################################### ## @brief Subgroups Extension Version(s) class ze_subgroup_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_subgroup_ext_version_t(c_int): def __str__(self): return str(ze_subgroup_ext_version_v(self.value)) ############################################################################### ## @brief EU Count Extension Name ZE_EU_COUNT_EXT_NAME = "ZE_extension_eu_count" ############################################################################### ## @brief EU Count Extension Version(s) class ze_eu_count_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_eu_count_ext_version_t(c_int): def __str__(self): return str(ze_eu_count_ext_version_v(self.value)) ############################################################################### ## @brief EU count queried using ::zeDeviceGetProperties ## ## @details ## - This structure may be returned from ::zeDeviceGetProperties via the ## `pNext` member of ::ze_device_properties_t. ## - Used for determining the total number of EUs available on device. class ze_eu_count_ext_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("numTotalEUs", c_ulong) ## [out] Total number of EUs available ] ############################################################################### ## @brief PCI Properties Extension Name ZE_PCI_PROPERTIES_EXT_NAME = "ZE_extension_pci_properties" ############################################################################### ## @brief PCI Properties Extension Version(s) class ze_pci_properties_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_pci_properties_ext_version_t(c_int): def __str__(self): return str(ze_pci_properties_ext_version_v(self.value)) ############################################################################### ## @brief Device PCI address ## ## @details ## - This structure may be passed to ::zeDevicePciGetPropertiesExt as an ## attribute of ::ze_pci_ext_properties_t. ## - A PCI BDF address is the bus:device:function address of the device and ## is useful for locating the device in the PCI switch fabric. class ze_pci_address_ext_t(Structure): _fields_ = [ ("domain", c_ulong), ## [out] PCI domain number ("bus", c_ulong), ## [out] PCI BDF bus number ("device", c_ulong), ## [out] PCI BDF device number ("function", c_ulong) ## [out] PCI BDF function number ] ############################################################################### ## @brief Device PCI speed class ze_pci_speed_ext_t(Structure): _fields_ = [ ("genVersion", c_int32_t), ## [out] The link generation. A value of -1 means that this property is ## unknown. ("width", c_int32_t), ## [out] The number of lanes. A value of -1 means that this property is ## unknown. ("maxBandwidth", c_int64_t) ## [out] The theoretical maximum bandwidth in bytes/sec (sum of all ## lanes). A value of -1 means that this property is unknown. ] ############################################################################### ## @brief Static PCI properties class ze_pci_ext_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("address", ze_pci_address_ext_t), ## [out] The BDF address ("maxSpeed", ze_pci_speed_ext_t) ## [out] Fastest port configuration supported by the device (sum of all ## lanes) ] ############################################################################### ## @brief sRGB Extension Name ZE_SRGB_EXT_NAME = "ZE_extension_srgb" ############################################################################### ## @brief sRGB Extension Version(s) class ze_srgb_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_srgb_ext_version_t(c_int): def __str__(self): return str(ze_srgb_ext_version_v(self.value)) ############################################################################### ## @brief sRGB image descriptor ## ## @details ## - This structure may be passed to ::zeImageCreate via the `pNext` member ## of ::ze_image_desc_t ## - Used for specifying that the image is in sRGB format. class ze_srgb_ext_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("sRGB", ze_bool_t) ## [in] Is sRGB. ] ############################################################################### ## @brief Image Copy Extension Name ZE_IMAGE_COPY_EXT_NAME = "ZE_extension_image_copy" ############################################################################### ## @brief Image Copy Extension Version(s) class ze_image_copy_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_image_copy_ext_version_t(c_int): def __str__(self): return str(ze_image_copy_ext_version_v(self.value)) ############################################################################### ## @brief Image Query Allocation Properties Extension Name ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_NAME = "ZE_extension_image_query_alloc_properties" ############################################################################### ## @brief Image Query Allocation Properties Extension Version(s) class ze_image_query_alloc_properties_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_image_query_alloc_properties_ext_version_t(c_int): def __str__(self): return str(ze_image_query_alloc_properties_ext_version_v(self.value)) ############################################################################### ## @brief Image allocation properties queried using ## ::zeImageGetAllocPropertiesExt class ze_image_allocation_ext_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("id", c_ulonglong) ## [out] identifier for this allocation ] ############################################################################### ## @brief Linkage Inspection Extension Name ZE_LINKAGE_INSPECTION_EXT_NAME = "ZE_extension_linkage_inspection" ############################################################################### ## @brief Linkage Inspection Extension Version(s) class ze_linkage_inspection_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_linkage_inspection_ext_version_t(c_int): def __str__(self): return str(ze_linkage_inspection_ext_version_v(self.value)) ############################################################################### ## @brief Supported module linkage inspection flags class ze_linkage_inspection_ext_flags_v(IntEnum): IMPORTS = ZE_BIT(0) ## List all imports of modules UNRESOLVABLE_IMPORTS = ZE_BIT(1) ## List all imports of modules that do not have a corresponding export EXPORTS = ZE_BIT(2) ## List all exports of modules class ze_linkage_inspection_ext_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Module linkage inspection descriptor ## ## @details ## - This structure may be passed to ::zeModuleInspectLinkageExt. class ze_linkage_inspection_ext_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_linkage_inspection_ext_flags_t) ## [in] flags specifying module linkage inspection. ## must be 0 (default) or a valid combination of ::ze_linkage_inspection_ext_flag_t. ] ############################################################################### ## @brief Memory Compression Hints Extension Name ZE_MEMORY_COMPRESSION_HINTS_EXT_NAME = "ZE_extension_memory_compression_hints" ############################################################################### ## @brief Memory Compression Hints Extension Version(s) class ze_memory_compression_hints_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_memory_compression_hints_ext_version_t(c_int): def __str__(self): return str(ze_memory_compression_hints_ext_version_v(self.value)) ############################################################################### ## @brief Supported memory compression hints flags class ze_memory_compression_hints_ext_flags_v(IntEnum): COMPRESSED = ZE_BIT(0) ## Hint Driver implementation to make allocation compressible UNCOMPRESSED = ZE_BIT(1) ## Hint Driver implementation to make allocation not compressible class ze_memory_compression_hints_ext_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Compression hints memory allocation descriptor ## ## @details ## - This structure may be passed to ::zeMemAllocShared or ## ::zeMemAllocDevice, via the `pNext` member of ## ::ze_device_mem_alloc_desc_t. ## - This structure may be passed to ::zeMemAllocHost, via the `pNext` ## member of ::ze_host_mem_alloc_desc_t. ## - This structure may be passed to ::zeImageCreate, via the `pNext` ## member of ::ze_image_desc_t. class ze_memory_compression_hints_ext_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_memory_compression_hints_ext_flags_t) ## [in] flags specifying if allocation should be compressible or not. ## Must be set to one of the ::ze_memory_compression_hints_ext_flag_t; ] ############################################################################### ## @brief Memory Free Policies Extension Name ZE_MEMORY_FREE_POLICIES_EXT_NAME = "ZE_extension_memory_free_policies" ############################################################################### ## @brief Memory Free Policies Extension Version(s) class ze_memory_free_policies_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_memory_free_policies_ext_version_t(c_int): def __str__(self): return str(ze_memory_free_policies_ext_version_v(self.value)) ############################################################################### ## @brief Supported memory free policy capability flags class ze_driver_memory_free_policy_ext_flags_v(IntEnum): BLOCKING_FREE = ZE_BIT(0) ## blocks until all commands using the memory are complete before freeing DEFER_FREE = ZE_BIT(1) ## schedules the memory to be freed but does not free immediately class ze_driver_memory_free_policy_ext_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Driver memory free properties queried using ::zeDriverGetProperties ## ## @details ## - All drivers must support an immediate free policy, which is the ## default free policy. ## - This structure may be returned from ::zeDriverGetProperties, via the ## `pNext` member of ::ze_driver_properties_t. class ze_driver_memory_free_ext_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("freePolicies", ze_driver_memory_free_policy_ext_flags_t) ## [out] Supported memory free policies. ## must be 0 or a combination of ::ze_driver_memory_free_policy_ext_flag_t. ] ############################################################################### ## @brief Memory free descriptor with free policy class ze_memory_free_ext_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("freePolicy", ze_driver_memory_free_policy_ext_flags_t) ## [in] flags specifying the memory free policy. ## must be 0 (default) or a supported ::ze_driver_memory_free_policy_ext_flag_t; ## default behavior is to free immediately. ] ############################################################################### ## @brief Bandwidth Extension Name ZE_BANDWIDTH_PROPERTIES_EXP_NAME = "ZE_experimental_bandwidth_properties" ############################################################################### ## @brief P2P Bandwidth Properties ## ## @details ## - This structure may be passed to ::zeDeviceGetP2PProperties by having ## the pNext member of ::ze_device_p2p_properties_t point at this struct. class ze_device_p2p_bandwidth_exp_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("logicalBandwidth", c_ulong), ## [out] total logical design bandwidth for all links connecting the two ## devices ("physicalBandwidth", c_ulong), ## [out] total physical design bandwidth for all links connecting the two ## devices ("bandwidthUnit", ze_bandwidth_unit_t), ## [out] bandwidth unit ("logicalLatency", c_ulong), ## [out] average logical design latency for all links connecting the two ## devices ("physicalLatency", c_ulong), ## [out] average physical design latency for all links connecting the two ## devices ("latencyUnit", ze_latency_unit_t) ## [out] latency unit ] ############################################################################### ## @brief Copy Bandwidth Properties ## ## @details ## - This structure may be passed to ## ::zeDeviceGetCommandQueueGroupProperties by having the pNext member of ## ::ze_command_queue_group_properties_t point at this struct. class ze_copy_bandwidth_exp_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("copyBandwidth", c_ulong), ## [out] design bandwidth supported by this engine type for copy ## operations ("copyBandwidthUnit", ze_bandwidth_unit_t) ## [out] copy bandwidth unit ] ############################################################################### ## @brief Device Local Identifier (LUID) Extension Name ZE_DEVICE_LUID_EXT_NAME = "ZE_extension_device_luid" ############################################################################### ## @brief Device Local Identifier (LUID) Extension Version(s) class ze_device_luid_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_device_luid_ext_version_t(c_int): def __str__(self): return str(ze_device_luid_ext_version_v(self.value)) ############################################################################### ## @brief Maximum device local identifier (LUID) size in bytes ZE_MAX_DEVICE_LUID_SIZE_EXT = 8 ############################################################################### ## @brief Device local identifier (LUID) class ze_device_luid_ext_t(Structure): _fields_ = [ ("id", c_ubyte * ZE_MAX_DEVICE_LUID_SIZE_EXT) ## [out] opaque data representing a device LUID ] ############################################################################### ## @brief Device LUID properties queried using ::zeDeviceGetProperties ## ## @details ## - This structure may be returned from ::zeDeviceGetProperties, via the ## `pNext` member of ::ze_device_properties_t. class ze_device_luid_ext_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("luid", ze_device_luid_ext_t), ## [out] locally unique identifier (LUID). ## The returned LUID can be cast to a LUID object and must be equal to ## the locally ## unique identifier of an IDXGIAdapter1 object that corresponds to the device. ("nodeMask", c_ulong) ## [out] node mask. ## The returned node mask must contain exactly one bit. ## If the device is running on an operating system that supports the ## Direct3D 12 API ## and the device corresponds to an individual device in a linked device ## adapter, the ## returned node mask identifies the Direct3D 12 node corresponding to ## the device. ## Otherwise, the returned node mask must be 1. ] ############################################################################### ## @brief Fabric Topology Discovery Extension Name ZE_FABRIC_EXP_NAME = "ZE_experimental_fabric" ############################################################################### ## @brief Maximum fabric edge model string size ZE_MAX_FABRIC_EDGE_MODEL_EXP_SIZE = 256 ############################################################################### ## @brief Fabric Vertex types class ze_fabric_vertex_exp_type_v(IntEnum): UNKNOWN = 0 ## Fabric vertex type is unknown DEVICE = 1 ## Fabric vertex represents a device SUBDEVICE = 2 ## Fabric vertex represents a subdevice SWITCH = 3 ## Fabric vertex represents a switch class ze_fabric_vertex_exp_type_t(c_int): def __str__(self): return str(ze_fabric_vertex_exp_type_v(self.value)) ############################################################################### ## @brief Fabric edge duplexity class ze_fabric_edge_exp_duplexity_v(IntEnum): UNKNOWN = 0 ## Fabric edge duplexity is unknown HALF_DUPLEX = 1 ## Fabric edge is half duplex, i.e. stated bandwidth is obtained in only ## one direction at time FULL_DUPLEX = 2 ## Fabric edge is full duplex, i.e. stated bandwidth is supported in both ## directions simultaneously class ze_fabric_edge_exp_duplexity_t(c_int): def __str__(self): return str(ze_fabric_edge_exp_duplexity_v(self.value)) ############################################################################### ## @brief PCI address ## ## @details ## - A PCI BDF address is the bus:device:function address of the device and ## is useful for locating the device in the PCI switch fabric. class ze_fabric_vertex_pci_exp_address_t(Structure): _fields_ = [ ("domain", c_ulong), ## [out] PCI domain number ("bus", c_ulong), ## [out] PCI BDF bus number ("device", c_ulong), ## [out] PCI BDF device number ("function", c_ulong) ## [out] PCI BDF function number ] ############################################################################### ## @brief Fabric Vertex properties class ze_fabric_vertex_exp_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("uuid", ze_uuid_t), ## [out] universal unique identifier. If the vertex is co-located with a ## device/subdevice, then this uuid will match that of the corresponding ## device/subdevice ("type", ze_fabric_vertex_exp_type_t), ## [out] does the fabric vertex represent a device, subdevice, or switch? ("remote", ze_bool_t), ## [out] does the fabric vertex live on the local node or on a remote ## node? ("address", ze_fabric_vertex_pci_exp_address_t) ## [out] B/D/F address of fabric vertex & associated device/subdevice if ## available ] ############################################################################### ## @brief Fabric Edge properties class ze_fabric_edge_exp_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("uuid", ze_uuid_t), ## [out] universal unique identifier. ("model", c_char * ZE_MAX_FABRIC_EDGE_MODEL_EXP_SIZE), ## [out] Description of fabric edge technology. Will be set to the string ## "unkown" if this cannot be determined for this edge ("bandwidth", c_ulong), ## [out] design bandwidth ("bandwidthUnit", ze_bandwidth_unit_t), ## [out] bandwidth unit ("latency", c_ulong), ## [out] design latency ("latencyUnit", ze_latency_unit_t), ## [out] latency unit ("duplexity", ze_fabric_edge_exp_duplexity_t) ## [out] Duplexity of the fabric edge ] ############################################################################### ## @brief Device Memory Properties Extension Name ZE_DEVICE_MEMORY_PROPERTIES_EXT_NAME = "ZE_extension_device_memory_properties" ############################################################################### ## @brief Device Memory Properties Extension Version(s) class ze_device_memory_properties_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_device_memory_properties_ext_version_t(c_int): def __str__(self): return str(ze_device_memory_properties_ext_version_v(self.value)) ############################################################################### ## @brief Memory module types class ze_device_memory_ext_type_v(IntEnum): HBM = 0 ## HBM memory HBM2 = 1 ## HBM2 memory DDR = 2 ## DDR memory DDR2 = 3 ## DDR2 memory DDR3 = 4 ## DDR3 memory DDR4 = 5 ## DDR4 memory DDR5 = 6 ## DDR5 memory LPDDR = 7 ## LPDDR memory LPDDR3 = 8 ## LPDDR3 memory LPDDR4 = 9 ## LPDDR4 memory LPDDR5 = 10 ## LPDDR5 memory SRAM = 11 ## SRAM memory L1 = 12 ## L1 cache L3 = 13 ## L3 cache GRF = 14 ## Execution unit register file SLM = 15 ## Execution unit shared local memory GDDR4 = 16 ## GDDR4 memory GDDR5 = 17 ## GDDR5 memory GDDR5X = 18 ## GDDR5X memory GDDR6 = 19 ## GDDR6 memory GDDR6X = 20 ## GDDR6X memory GDDR7 = 21 ## GDDR7 memory class ze_device_memory_ext_type_t(c_int): def __str__(self): return str(ze_device_memory_ext_type_v(self.value)) ############################################################################### ## @brief Memory properties ## ## @details ## - This structure may be returned from ::zeDeviceGetMemoryProperties via ## the `pNext` member of ::ze_device_memory_properties_t class ze_device_memory_ext_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", ze_device_memory_ext_type_t), ## [out] The memory type ("physicalSize", c_ulonglong), ## [out] Physical memory size in bytes. A value of 0 indicates that this ## property is not known. However, a call to ::zesMemoryGetState() will ## correctly return the total size of usable memory. ("readBandwidth", c_ulong), ## [out] Design bandwidth for reads ("writeBandwidth", c_ulong), ## [out] Design bandwidth for writes ("bandwidthUnit", ze_bandwidth_unit_t) ## [out] bandwidth unit ] ############################################################################### ## @brief Bfloat16 Conversions Extension Name ZE_BFLOAT16_CONVERSIONS_EXT_NAME = "ZE_extension_bfloat16_conversions" ############################################################################### ## @brief Bfloat16 Conversions Extension Version(s) class ze_bfloat16_conversions_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_bfloat16_conversions_ext_version_t(c_int): def __str__(self): return str(ze_bfloat16_conversions_ext_version_v(self.value)) ############################################################################### ## @brief Device IP Version Extension Name ZE_DEVICE_IP_VERSION_EXT_NAME = "ZE_extension_device_ip_version" ############################################################################### ## @brief Device IP Version Extension Version(s) class ze_device_ip_version_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_device_ip_version_version_t(c_int): def __str__(self): return str(ze_device_ip_version_version_v(self.value)) ############################################################################### ## @brief Device IP version queried using ::zeDeviceGetProperties ## ## @details ## - This structure may be returned from ::zeDeviceGetProperties via the ## `pNext` member of ::ze_device_properties_t class ze_device_ip_version_ext_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("ipVersion", c_ulong) ## [out] Device IP version. The meaning of the device IP version is ## implementation-defined, but newer devices should have a higher ## version than older devices. ] ############################################################################### ## @brief Kernel Max Group Size Properties Extension Name ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_NAME = "ZE_extension_kernel_max_group_size_properties" ############################################################################### ## @brief Kernel Max Group Size Properties Extension Version(s) class ze_kernel_max_group_size_properties_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_kernel_max_group_size_properties_ext_version_t(c_int): def __str__(self): return str(ze_kernel_max_group_size_properties_ext_version_v(self.value)) ############################################################################### ## @brief Additional kernel max group size properties ## ## @details ## - This structure may be passed to ::zeKernelGetProperties, via the ## `pNext` member of ::ze_kernel_properties_t, to query additional kernel ## max group size properties. class ze_kernel_max_group_size_properties_ext_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("maxGroupSize", c_ulong) ## [out] maximum group size that can be used to execute the kernel. This ## value may be less than or equal to the `maxTotalGroupSize` member of ## ::ze_device_compute_properties_t. ] ############################################################################### ## @brief compiler-independent type class ze_kernel_max_group_size_ext_properties_t(ze_kernel_max_group_size_properties_ext_t): pass ############################################################################### ## @brief Sub-Allocations Properties Extension Name ZE_SUB_ALLOCATIONS_EXP_NAME = "ZE_experimental_sub_allocations" ############################################################################### ## @brief Sub-Allocations Properties Extension Version(s) class ze_sub_allocations_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_sub_allocations_exp_version_t(c_int): def __str__(self): return str(ze_sub_allocations_exp_version_v(self.value)) ############################################################################### ## @brief Properties returned for a sub-allocation class ze_sub_allocation_t(Structure): _fields_ = [ ("base", c_void_p), ## [in,out][optional] base address of the sub-allocation ("size", c_size_t) ## [in,out][optional] size of the allocation ] ############################################################################### ## @brief Sub-Allocations Properties ## ## @details ## - This structure may be passed to ::zeMemGetAllocProperties, via the ## `pNext` member of ::ze_memory_allocation_properties_t. class ze_memory_sub_allocations_exp_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("pCount", POINTER(c_ulong)), ## [in,out] pointer to the number of sub-allocations. ## if count is zero, then the driver shall update the value with the ## total number of sub-allocations on which the allocation has been divided. ## if count is greater than the number of sub-allocations, then the ## driver shall update the value with the correct number of sub-allocations. ("pSubAllocations", POINTER(ze_sub_allocation_t)) ## [in,out][optional][range(0, *pCount)] array of properties for sub-allocations. ## if count is less than the number of sub-allocations available, then ## driver shall only retrieve properties for that number of sub-allocations. ] ############################################################################### ## @brief Event Query Kernel Timestamps Extension Name ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_NAME = "ZE_extension_event_query_kernel_timestamps" ############################################################################### ## @brief Event Query Kernel Timestamps Extension Version(s) class ze_event_query_kernel_timestamps_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_event_query_kernel_timestamps_ext_version_t(c_int): def __str__(self): return str(ze_event_query_kernel_timestamps_ext_version_v(self.value)) ############################################################################### ## @brief Event query kernel timestamps flags class ze_event_query_kernel_timestamps_ext_flags_v(IntEnum): KERNEL = ZE_BIT(0) ## Kernel timestamp results SYNCHRONIZED = ZE_BIT(1) ## Device event timestamps synchronized to the host time domain class ze_event_query_kernel_timestamps_ext_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Event query kernel timestamps properties ## ## @details ## - This structure may be returned from ::zeDeviceGetProperties, via the ## `pNext` member of ::ze_device_properties_t. class ze_event_query_kernel_timestamps_ext_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_event_query_kernel_timestamps_ext_flags_t) ## [out] 0 or some combination of ## ::ze_event_query_kernel_timestamps_ext_flag_t flags ] ############################################################################### ## @brief Kernel timestamp clock data synchronized to the host time domain class ze_synchronized_timestamp_data_ext_t(Structure): _fields_ = [ ("kernelStart", c_ulonglong), ## [out] synchronized clock at start of kernel execution ("kernelEnd", c_ulonglong) ## [out] synchronized clock at end of kernel execution ] ############################################################################### ## @brief Synchronized kernel timestamp result class ze_synchronized_timestamp_result_ext_t(Structure): _fields_ = [ ("global", ze_synchronized_timestamp_data_ext_t), ## [out] wall-clock data ("context", ze_synchronized_timestamp_data_ext_t) ## [out] context-active data; only includes clocks while device context ## was actively executing. ] ############################################################################### ## @brief Event query kernel timestamps results properties class ze_event_query_kernel_timestamps_results_ext_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("pKernelTimestampsBuffer", POINTER(ze_kernel_timestamp_result_t)), ## [in,out][optional][range(0, *pCount)] pointer to destination buffer of ## kernel timestamp results ("pSynchronizedTimestampsBuffer", POINTER(ze_synchronized_timestamp_result_ext_t)) ## [in,out][optional][range(0, *pCount)] pointer to destination buffer of ## synchronized timestamp results ] ############################################################################### ## @brief Ray Tracing Acceleration Structure Builder Extension Name ZE_RTAS_BUILDER_EXP_NAME = "ZE_experimental_rtas_builder" ############################################################################### ## @brief Ray Tracing Acceleration Structure Builder Extension Version(s) class ze_rtas_builder_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_rtas_builder_exp_version_t(c_int): def __str__(self): return str(ze_rtas_builder_exp_version_v(self.value)) ############################################################################### ## @brief Ray tracing acceleration structure device flags class ze_rtas_device_exp_flags_v(IntEnum): RESERVED = ZE_BIT(0) ## reserved for future use class ze_rtas_device_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Ray tracing acceleration structure format ## ## @details ## - This is an opaque ray tracing acceleration structure format ## identifier. class ze_rtas_format_exp_v(IntEnum): INVALID = 0 ## Invalid acceleration structure format class ze_rtas_format_exp_t(c_int): def __str__(self): return str(ze_rtas_format_exp_v(self.value)) ############################################################################### ## @brief Ray tracing acceleration structure builder flags class ze_rtas_builder_exp_flags_v(IntEnum): RESERVED = ZE_BIT(0) ## Reserved for future use class ze_rtas_builder_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Ray tracing acceleration structure builder parallel operation flags class ze_rtas_parallel_operation_exp_flags_v(IntEnum): RESERVED = ZE_BIT(0) ## Reserved for future use class ze_rtas_parallel_operation_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Ray tracing acceleration structure builder geometry flags class ze_rtas_builder_geometry_exp_flags_v(IntEnum): NON_OPAQUE = ZE_BIT(0) ## non-opaque geometries invoke an any-hit shader class ze_rtas_builder_geometry_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Packed ray tracing acceleration structure builder geometry flags (see ## ::ze_rtas_builder_geometry_exp_flags_t) class ze_rtas_builder_packed_geometry_exp_flags_t(c_ubyte): pass ############################################################################### ## @brief Ray tracing acceleration structure builder instance flags class ze_rtas_builder_instance_exp_flags_v(IntEnum): TRIANGLE_CULL_DISABLE = ZE_BIT(0) ## disables culling of front-facing and back-facing triangles TRIANGLE_FRONT_COUNTERCLOCKWISE = ZE_BIT(1) ## reverses front and back face of triangles TRIANGLE_FORCE_OPAQUE = ZE_BIT(2) ## forces instanced geometry to be opaque, unless ray flag forces it to ## be non-opaque TRIANGLE_FORCE_NON_OPAQUE = ZE_BIT(3) ## forces instanced geometry to be non-opaque, unless ray flag forces it ## to be opaque class ze_rtas_builder_instance_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Packed ray tracing acceleration structure builder instance flags (see ## ::ze_rtas_builder_instance_exp_flags_t) class ze_rtas_builder_packed_instance_exp_flags_t(c_ubyte): pass ############################################################################### ## @brief Ray tracing acceleration structure builder build operation flags ## ## @details ## - These flags allow the application to tune the acceleration structure ## build operation. ## - The acceleration structure builder implementation might choose to use ## spatial splitting to split large or long primitives into smaller ## pieces. This may result in any-hit shaders being invoked multiple ## times for non-opaque primitives, unless ## ::ZE_RTAS_BUILDER_BUILD_OP_EXP_FLAG_NO_DUPLICATE_ANYHIT_INVOCATION is specified. ## - Usage of any of these flags may reduce ray tracing performance. class ze_rtas_builder_build_op_exp_flags_v(IntEnum): COMPACT = ZE_BIT(0) ## build more compact acceleration structure NO_DUPLICATE_ANYHIT_INVOCATION = ZE_BIT(1) ## guarantees single any-hit shader invocation per primitive class ze_rtas_builder_build_op_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Ray tracing acceleration structure builder build quality hint ## ## @details ## - Depending on use case different quality modes for acceleration ## structure build are supported. ## - A low-quality build builds an acceleration structure fast, but at the ## cost of some reduction in ray tracing performance. This mode is ## recommended for dynamic content, such as animated characters. ## - A medium-quality build uses a compromise between build quality and ray ## tracing performance. This mode should be used by default. ## - Higher ray tracing performance can be achieved by using a high-quality ## build, but acceleration structure build performance might be ## significantly reduced. class ze_rtas_builder_build_quality_hint_exp_v(IntEnum): LOW = 0 ## build low-quality acceleration structure (fast) MEDIUM = 1 ## build medium-quality acceleration structure (slower) HIGH = 2 ## build high-quality acceleration structure (slow) class ze_rtas_builder_build_quality_hint_exp_t(c_int): def __str__(self): return str(ze_rtas_builder_build_quality_hint_exp_v(self.value)) ############################################################################### ## @brief Ray tracing acceleration structure builder geometry type class ze_rtas_builder_geometry_type_exp_v(IntEnum): TRIANGLES = 0 ## triangle mesh geometry type QUADS = 1 ## quad mesh geometry type PROCEDURAL = 2 ## procedural geometry type INSTANCE = 3 ## instance geometry type class ze_rtas_builder_geometry_type_exp_t(c_int): def __str__(self): return str(ze_rtas_builder_geometry_type_exp_v(self.value)) ############################################################################### ## @brief Packed ray tracing acceleration structure builder geometry type (see ## ::ze_rtas_builder_geometry_type_exp_t) class ze_rtas_builder_packed_geometry_type_exp_t(c_ubyte): pass ############################################################################### ## @brief Ray tracing acceleration structure data buffer element format ## ## @details ## - Specifies the format of data buffer elements. ## - Data buffers may contain instancing transform matrices, triangle/quad ## vertex indices, etc... class ze_rtas_builder_input_data_format_exp_v(IntEnum): FLOAT3 = 0 ## 3-component float vector (see ::ze_rtas_float3_exp_t) FLOAT3X4_COLUMN_MAJOR = 1 ## 3x4 affine transformation in column-major format (see ## ::ze_rtas_transform_float3x4_column_major_exp_t) FLOAT3X4_ALIGNED_COLUMN_MAJOR = 2 ## 3x4 affine transformation in column-major format (see ## ::ze_rtas_transform_float3x4_aligned_column_major_exp_t) FLOAT3X4_ROW_MAJOR = 3 ## 3x4 affine transformation in row-major format (see ## ::ze_rtas_transform_float3x4_row_major_exp_t) AABB = 4 ## 3-dimensional axis-aligned bounding-box (see ::ze_rtas_aabb_exp_t) TRIANGLE_INDICES_UINT32 = 5 ## Unsigned 32-bit triangle indices (see ## ::ze_rtas_triangle_indices_uint32_exp_t) QUAD_INDICES_UINT32 = 6 ## Unsigned 32-bit quad indices (see ::ze_rtas_quad_indices_uint32_exp_t) class ze_rtas_builder_input_data_format_exp_t(c_int): def __str__(self): return str(ze_rtas_builder_input_data_format_exp_v(self.value)) ############################################################################### ## @brief Packed ray tracing acceleration structure data buffer element format ## (see ::ze_rtas_builder_input_data_format_exp_t) class ze_rtas_builder_packed_input_data_format_exp_t(c_ubyte): pass ############################################################################### ## @brief Handle of ray tracing acceleration structure builder object class ze_rtas_builder_exp_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of ray tracing acceleration structure builder parallel ## operation object class ze_rtas_parallel_operation_exp_handle_t(c_void_p): pass ############################################################################### ## @brief Ray tracing acceleration structure builder descriptor class ze_rtas_builder_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("builderVersion", ze_rtas_builder_exp_version_t) ## [in] ray tracing acceleration structure builder version ] ############################################################################### ## @brief Ray tracing acceleration structure builder properties class ze_rtas_builder_exp_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_rtas_builder_exp_flags_t), ## [out] ray tracing acceleration structure builder flags ("rtasBufferSizeBytesExpected", c_size_t), ## [out] expected size (in bytes) required for acceleration structure buffer ## - When using an acceleration structure buffer of this size, the ## build is expected to succeed; however, it is possible that the build ## may fail with ::ZE_RESULT_EXP_RTAS_BUILD_RETRY ("rtasBufferSizeBytesMaxRequired", c_size_t), ## [out] worst-case size (in bytes) required for acceleration structure buffer ## - When using an acceleration structure buffer of this size, the ## build is guaranteed to not run out of memory. ("scratchBufferSizeBytes", c_size_t) ## [out] scratch buffer size (in bytes) required for acceleration ## structure build. ] ############################################################################### ## @brief Ray tracing acceleration structure builder parallel operation ## properties class ze_rtas_parallel_operation_exp_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_rtas_parallel_operation_exp_flags_t), ## [out] ray tracing acceleration structure builder parallel operation ## flags ("maxConcurrency", c_ulong) ## [out] maximum number of threads that may join the parallel operation ] ############################################################################### ## @brief Ray tracing acceleration structure device properties ## ## @details ## - This structure may be passed to ::zeDeviceGetProperties, via `pNext` ## member of ::ze_device_properties_t. ## - The implementation shall populate `format` with a value other than ## ::ZE_RTAS_FORMAT_EXP_INVALID when the device supports ray tracing. class ze_rtas_device_exp_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_rtas_device_exp_flags_t), ## [out] ray tracing acceleration structure device flags ("rtasFormat", ze_rtas_format_exp_t), ## [out] ray tracing acceleration structure format ("rtasBufferAlignment", c_ulong) ## [out] required alignment of acceleration structure buffer ] ############################################################################### ## @brief A 3-component vector type class ze_rtas_float3_exp_t(Structure): _fields_ = [ ("x", c_float), ## [in] x-coordinate of float3 vector ("y", c_float), ## [in] y-coordinate of float3 vector ("z", c_float) ## [in] z-coordinate of float3 vector ] ############################################################################### ## @brief 3x4 affine transformation in column-major layout ## ## @details ## - A 3x4 affine transformation in column major layout, consisting of vectors ## - vx=(vx_x, vx_y, vx_z), ## - vy=(vy_x, vy_y, vy_z), ## - vz=(vz_x, vz_y, vz_z), and ## - p=(p_x, p_y, p_z) ## - The transformation transforms a point (x, y, z) to: `x*vx + y*vy + ## z*vz + p`. class ze_rtas_transform_float3x4_column_major_exp_t(Structure): _fields_ = [ ("vx_x", c_float), ## [in] element 0 of column 0 of 3x4 matrix ("vx_y", c_float), ## [in] element 1 of column 0 of 3x4 matrix ("vx_z", c_float), ## [in] element 2 of column 0 of 3x4 matrix ("vy_x", c_float), ## [in] element 0 of column 1 of 3x4 matrix ("vy_y", c_float), ## [in] element 1 of column 1 of 3x4 matrix ("vy_z", c_float), ## [in] element 2 of column 1 of 3x4 matrix ("vz_x", c_float), ## [in] element 0 of column 2 of 3x4 matrix ("vz_y", c_float), ## [in] element 1 of column 2 of 3x4 matrix ("vz_z", c_float), ## [in] element 2 of column 2 of 3x4 matrix ("p_x", c_float), ## [in] element 0 of column 3 of 3x4 matrix ("p_y", c_float), ## [in] element 1 of column 3 of 3x4 matrix ("p_z", c_float) ## [in] element 2 of column 3 of 3x4 matrix ] ############################################################################### ## @brief 3x4 affine transformation in column-major layout with aligned column ## vectors ## ## @details ## - A 3x4 affine transformation in column major layout, consisting of vectors ## - vx=(vx_x, vx_y, vx_z), ## - vy=(vy_x, vy_y, vy_z), ## - vz=(vz_x, vz_y, vz_z), and ## - p=(p_x, p_y, p_z) ## - The transformation transforms a point (x, y, z) to: `x*vx + y*vy + ## z*vz + p`. ## - The column vectors are aligned to 16-bytes and pad members are ## ignored. class ze_rtas_transform_float3x4_aligned_column_major_exp_t(Structure): _fields_ = [ ("vx_x", c_float), ## [in] element 0 of column 0 of 3x4 matrix ("vx_y", c_float), ## [in] element 1 of column 0 of 3x4 matrix ("vx_z", c_float), ## [in] element 2 of column 0 of 3x4 matrix ("pad0", c_float), ## [in] ignored padding ("vy_x", c_float), ## [in] element 0 of column 1 of 3x4 matrix ("vy_y", c_float), ## [in] element 1 of column 1 of 3x4 matrix ("vy_z", c_float), ## [in] element 2 of column 1 of 3x4 matrix ("pad1", c_float), ## [in] ignored padding ("vz_x", c_float), ## [in] element 0 of column 2 of 3x4 matrix ("vz_y", c_float), ## [in] element 1 of column 2 of 3x4 matrix ("vz_z", c_float), ## [in] element 2 of column 2 of 3x4 matrix ("pad2", c_float), ## [in] ignored padding ("p_x", c_float), ## [in] element 0 of column 3 of 3x4 matrix ("p_y", c_float), ## [in] element 1 of column 3 of 3x4 matrix ("p_z", c_float), ## [in] element 2 of column 3 of 3x4 matrix ("pad3", c_float) ## [in] ignored padding ] ############################################################################### ## @brief 3x4 affine transformation in row-major layout ## ## @details ## - A 3x4 affine transformation in row-major layout, consisting of vectors ## - vx=(vx_x, vx_y, vx_z), ## - vy=(vy_x, vy_y, vy_z), ## - vz=(vz_x, vz_y, vz_z), and ## - p=(p_x, p_y, p_z) ## - The transformation transforms a point (x, y, z) to: `x*vx + y*vy + ## z*vz + p`. class ze_rtas_transform_float3x4_row_major_exp_t(Structure): _fields_ = [ ("vx_x", c_float), ## [in] element 0 of row 0 of 3x4 matrix ("vy_x", c_float), ## [in] element 1 of row 0 of 3x4 matrix ("vz_x", c_float), ## [in] element 2 of row 0 of 3x4 matrix ("p_x", c_float), ## [in] element 3 of row 0 of 3x4 matrix ("vx_y", c_float), ## [in] element 0 of row 1 of 3x4 matrix ("vy_y", c_float), ## [in] element 1 of row 1 of 3x4 matrix ("vz_y", c_float), ## [in] element 2 of row 1 of 3x4 matrix ("p_y", c_float), ## [in] element 3 of row 1 of 3x4 matrix ("vx_z", c_float), ## [in] element 0 of row 2 of 3x4 matrix ("vy_z", c_float), ## [in] element 1 of row 2 of 3x4 matrix ("vz_z", c_float), ## [in] element 2 of row 2 of 3x4 matrix ("p_z", c_float) ## [in] element 3 of row 2 of 3x4 matrix ] ############################################################################### ## @brief A 3-dimensional axis-aligned bounding-box with lower and upper bounds ## in each dimension class ze_rtas_aabb_exp_t(Structure): _fields_ = [ ("lower", ze_rtas_c_float3_exp_t), ## [in] lower bounds of AABB ("upper", ze_rtas_c_float3_exp_t) ## [in] upper bounds of AABB ] ############################################################################### ## @brief Triangle represented using 3 vertex indices ## ## @details ## - Represents a triangle using 3 vertex indices that index into a vertex ## array that needs to be provided together with the index array. ## - The linear barycentric u/v parametrization of the triangle is defined as: ## - (u=0, v=0) at v0, ## - (u=1, v=0) at v1, and ## - (u=0, v=1) at v2 class ze_rtas_triangle_indices_uint32_exp_t(Structure): _fields_ = [ ("v0", c_ulong), ## [in] first index pointing to the first triangle vertex in vertex array ("v1", c_ulong), ## [in] second index pointing to the second triangle vertex in vertex ## array ("v2", c_ulong) ## [in] third index pointing to the third triangle vertex in vertex array ] ############################################################################### ## @brief Quad represented using 4 vertex indices ## ## @details ## - Represents a quad composed of 4 indices that index into a vertex array ## that needs to be provided together with the index array. ## - A quad is a triangle pair represented using 4 vertex indices v0, v1, ## v2, v3. ## The first triangle is made out of indices v0, v1, v3 and the second triangle ## from indices v2, v3, v1. The piecewise linear barycentric u/v parametrization ## of the quad is defined as: ## - (u=0, v=0) at v0, ## - (u=1, v=0) at v1, ## - (u=0, v=1) at v3, and ## - (u=1, v=1) at v2 ## This is achieved by correcting the u'/v' coordinates of the second ## triangle by ## *u = 1-u'* and *v = 1-v'*, yielding a piecewise linear parametrization. class ze_rtas_quad_indices_uint32_exp_t(Structure): _fields_ = [ ("v0", c_ulong), ## [in] first index pointing to the first quad vertex in vertex array ("v1", c_ulong), ## [in] second index pointing to the second quad vertex in vertex array ("v2", c_ulong), ## [in] third index pointing to the third quad vertex in vertex array ("v3", c_ulong) ## [in] fourth index pointing to the fourth quad vertex in vertex array ] ############################################################################### ## @brief Ray tracing acceleration structure builder geometry info class ze_rtas_builder_geometry_info_exp_t(Structure): _fields_ = [ ("geometryType", ze_rtas_builder_packed_geometry_type_exp_t) ## [in] geometry type ] ############################################################################### ## @brief Ray tracing acceleration structure builder triangle mesh geometry info ## ## @details ## - The linear barycentric u/v parametrization of the triangle is defined as: ## - (u=0, v=0) at v0, ## - (u=1, v=0) at v1, and ## - (u=0, v=1) at v2 class ze_rtas_builder_triangles_geometry_info_exp_t(Structure): _fields_ = [ ("geometryType", ze_rtas_builder_packed_geometry_type_exp_t), ## [in] geometry type, must be ## ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_TRIANGLES ("geometryFlags", ze_rtas_builder_packed_geometry_exp_flags_t), ## [in] 0 or some combination of ::ze_rtas_builder_geometry_exp_flag_t ## bits representing the geometry flags for all primitives of this ## geometry ("geometryMask", c_ubyte), ## [in] 8-bit geometry mask for ray masking ("triangleFormat", ze_rtas_builder_packed_input_data_format_exp_t), ## [in] format of triangle buffer data, must be ## ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_TRIANGLE_INDICES_UINT32 ("vertexFormat", ze_rtas_builder_packed_input_data_format_exp_t), ## [in] format of vertex buffer data, must be ## ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_FLOAT3 ("triangleCount", c_ulong), ## [in] number of triangles in triangle buffer ("vertexCount", c_ulong), ## [in] number of vertices in vertex buffer ("triangleStride", c_ulong), ## [in] stride (in bytes) of triangles in triangle buffer ("vertexStride", c_ulong), ## [in] stride (in bytes) of vertices in vertex buffer ("pTriangleBuffer", c_void_p), ## [in] pointer to array of triangle indices in specified format ("pVertexBuffer", c_void_p) ## [in] pointer to array of triangle vertices in specified format ] ############################################################################### ## @brief Ray tracing acceleration structure builder quad mesh geometry info ## ## @details ## - A quad is a triangle pair represented using 4 vertex indices v0, v1, ## v2, v3. ## The first triangle is made out of indices v0, v1, v3 and the second triangle ## from indices v2, v3, v1. The piecewise linear barycentric u/v parametrization ## of the quad is defined as: ## - (u=0, v=0) at v0, ## - (u=1, v=0) at v1, ## - (u=0, v=1) at v3, and ## - (u=1, v=1) at v2 ## This is achieved by correcting the u'/v' coordinates of the second ## triangle by ## *u = 1-u'* and *v = 1-v'*, yielding a piecewise linear parametrization. class ze_rtas_builder_quads_geometry_info_exp_t(Structure): _fields_ = [ ("geometryType", ze_rtas_builder_packed_geometry_type_exp_t), ## [in] geometry type, must be ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_QUADS ("geometryFlags", ze_rtas_builder_packed_geometry_exp_flags_t), ## [in] 0 or some combination of ::ze_rtas_builder_geometry_exp_flag_t ## bits representing the geometry flags for all primitives of this ## geometry ("geometryMask", c_ubyte), ## [in] 8-bit geometry mask for ray masking ("quadFormat", ze_rtas_builder_packed_input_data_format_exp_t), ## [in] format of quad buffer data, must be ## ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_QUAD_INDICES_UINT32 ("vertexFormat", ze_rtas_builder_packed_input_data_format_exp_t), ## [in] format of vertex buffer data, must be ## ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_FLOAT3 ("quadCount", c_ulong), ## [in] number of quads in quad buffer ("vertexCount", c_ulong), ## [in] number of vertices in vertex buffer ("quadStride", c_ulong), ## [in] stride (in bytes) of quads in quad buffer ("vertexStride", c_ulong), ## [in] stride (in bytes) of vertices in vertex buffer ("pQuadBuffer", c_void_p), ## [in] pointer to array of quad indices in specified format ("pVertexBuffer", c_void_p) ## [in] pointer to array of quad vertices in specified format ] ############################################################################### ## @brief AABB callback function parameters class ze_rtas_geometry_aabbs_exp_cb_params_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("primID", c_ulong), ## [in] first primitive to return bounds for ("primIDCount", c_ulong), ## [in] number of primitives to return bounds for ("pGeomUserPtr", c_void_p), ## [in] pointer provided through geometry descriptor ("pBuildUserPtr", c_void_p), ## [in] pointer provided through ::zeRTASBuilderBuildExp function ("pBoundsOut", POINTER(ze_rtas_aabb_exp_t)) ## [out] destination buffer to write AABB bounds to ] ############################################################################### ## @brief Callback function pointer type to return AABBs for a range of ## procedural primitives ############################################################################### ## @brief Ray tracing acceleration structure builder procedural primitives ## geometry info ## ## @details ## - A host-side bounds callback function is invoked by the acceleration ## structure builder to query the bounds of procedural primitives on ## demand. The callback is passed some `pGeomUserPtr` that can point to ## an application-side representation of the procedural primitives. ## Further, a second `pBuildUserPtr`, which is set by a parameter to ## ::zeRTASBuilderBuildExp, is passed to the callback. This allows the ## build to change the bounds of the procedural geometry, for example, to ## build a BVH only over a short time range to implement multi-segment ## motion blur. class ze_rtas_builder_procedural_geometry_info_exp_t(Structure): _fields_ = [ ("geometryType", ze_rtas_builder_packed_geometry_type_exp_t), ## [in] geometry type, must be ## ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_PROCEDURAL ("geometryFlags", ze_rtas_builder_packed_geometry_exp_flags_t), ## [in] 0 or some combination of ::ze_rtas_builder_geometry_exp_flag_t ## bits representing the geometry flags for all primitives of this ## geometry ("geometryMask", c_ubyte), ## [in] 8-bit geometry mask for ray masking ("reserved", c_ubyte), ## [in] reserved for future use ("primCount", c_ulong), ## [in] number of primitives in geometry ("pfnGetBoundsCb", ze_rtas_geometry_aabbs_cb_exp_t), ## [in] pointer to callback function to get the axis-aligned bounding-box ## for a range of primitives ("pGeomUserPtr", c_void_p) ## [in] user data pointer passed to callback ] ############################################################################### ## @brief Ray tracing acceleration structure builder instance geometry info class ze_rtas_builder_instance_geometry_info_exp_t(Structure): _fields_ = [ ("geometryType", ze_rtas_builder_packed_geometry_type_exp_t), ## [in] geometry type, must be ## ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_INSTANCE ("instanceFlags", ze_rtas_builder_packed_instance_exp_flags_t), ## [in] 0 or some combination of ::ze_rtas_builder_geometry_exp_flag_t ## bits representing the geometry flags for all primitives of this ## geometry ("geometryMask", c_ubyte), ## [in] 8-bit geometry mask for ray masking ("transformFormat", ze_rtas_builder_packed_input_data_format_exp_t),## [in] format of the specified transformation ("instanceUserID", c_ulong), ## [in] user-specified identifier for the instance ("pTransform", c_void_p), ## [in] object-to-world instance transformation in specified format ("pBounds", POINTER(ze_rtas_aabb_exp_t)), ## [in] object-space axis-aligned bounding-box of the instanced ## acceleration structure ("pAccelerationStructure", c_void_p) ## [in] pointer to acceleration structure to instantiate ] ############################################################################### ## @brief class ze_rtas_builder_build_op_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("rtasFormat", ze_rtas_format_exp_t), ## [in] ray tracing acceleration structure format ("buildQuality", ze_rtas_builder_build_quality_hint_exp_t), ## [in] acceleration structure build quality hint ("buildFlags", ze_rtas_builder_build_op_exp_flags_t), ## [in] 0 or some combination of ::ze_rtas_builder_build_op_exp_flag_t ## flags ("ppGeometries", POINTER(ze_rtas_builder_geometry_info_exp_t*)),## [in][optional][range(0, `numGeometries`)] NULL or a valid array of ## pointers to geometry infos ("numGeometries", c_ulong) ## [in] number of geometries in geometry infos array, can be zero when ## `ppGeometries` is NULL ] ############################################################################### ## @brief Counter-based Event Pools Extension Name ZE_EVENT_POOL_COUNTER_BASED_EXP_NAME = "ZE_experimental_event_pool_counter_based" ############################################################################### ## @brief Counter-based Event Pools Extension Version(s) class ze_event_pool_counter_based_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_event_pool_counter_based_exp_version_t(c_int): def __str__(self): return str(ze_event_pool_counter_based_exp_version_v(self.value)) ############################################################################### ## @brief Supported event flags for defining counter-based event pools. class ze_event_pool_counter_based_exp_flags_v(IntEnum): IMMEDIATE = ZE_BIT(0) ## Counter-based event pool is used for immediate command lists (default) NON_IMMEDIATE = ZE_BIT(1) ## Counter-based event pool is for non-immediate command lists class ze_event_pool_counter_based_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Event pool descriptor for counter-based events. This structure may be ## passed to ::zeEventPoolCreate as pNext member of ## ::ze_event_pool_desc_t. class ze_event_pool_counter_based_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_event_pool_counter_based_exp_flags_t) ## [in] mode flags. ## must be 0 (default) or a valid value of ::ze_event_pool_counter_based_exp_flag_t ## default behavior is counter-based event pool is only used for ## immediate command lists. ] ############################################################################### ## @brief Image Memory Properties Extension Name ZE_BINDLESS_IMAGE_EXP_NAME = "ZE_experimental_bindless_image" ############################################################################### ## @brief Bindless Image Extension Version(s) class ze_bindless_image_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_bindless_image_exp_version_t(c_int): def __str__(self): return str(ze_bindless_image_exp_version_v(self.value)) ############################################################################### ## @brief Image flags for Bindless images class ze_image_bindless_exp_flags_v(IntEnum): BINDLESS = ZE_BIT(0) ## Bindless images are created with ::zeImageCreate. The image handle ## created with this flag is valid on both host and device. SAMPLED_IMAGE = ZE_BIT(1) ## Bindless sampled images are created with ::zeImageCreate by combining ## BINDLESS and SAMPLED_IMAGE. ## Create sampled image view from bindless unsampled image using SAMPLED_IMAGE. class ze_image_bindless_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Image descriptor for bindless images. This structure may be passed to ## ::zeImageCreate via pNext member of ::ze_image_desc_t. class ze_image_bindless_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_image_bindless_exp_flags_t) ## [in] image flags. ## must be 0 (default) or a valid value of ::ze_image_bindless_exp_flag_t ## default behavior is bindless images are not used when creating handles ## via ::zeImageCreate. ## When the flag is passed to ::zeImageCreate, then only the memory for ## the image is allocated. ## Additional image handles can be created with ::zeImageViewCreateExt. ## When ::ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE flag is passed, ## ::ze_sampler_desc_t must be attached via pNext member of ::ze_image_bindless_exp_desc_t. ] ############################################################################### ## @brief Image descriptor for bindless images created from pitched allocations. ## This structure may be passed to ::zeImageCreate via pNext member of ## ::ze_image_desc_t. class ze_image_pitched_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("ptr", c_void_p) ## [in] pointer to pitched device allocation allocated using ::zeMemAllocDevice ] ############################################################################### ## @brief Device specific properties for pitched allocations ## ## @details ## - This structure may be passed to ::zeDeviceGetImageProperties via the ## pNext member of ::ze_device_image_properties_t. class ze_device_pitched_alloc_exp_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("maxImageLinearWidth", c_size_t), ## [out] Maximum image linear width. ("maxImageLinearHeight", c_size_t) ## [out] Maximum image linear height. ] ############################################################################### ## @brief Command List Clone Extension Name ZE_COMMAND_LIST_CLONE_EXP_NAME = "ZE_experimental_command_list_clone" ############################################################################### ## @brief Command List Clone Extension Version(s) class ze_command_list_clone_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_command_list_clone_exp_version_t(c_int): def __str__(self): return str(ze_command_list_clone_exp_version_v(self.value)) ############################################################################### ## @brief Immediate Command List Append Extension Name ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_NAME = "ZE_experimental_immediate_command_list_append" ############################################################################### ## @brief Immediate Command List Append Extension Version(s) class ze_immediate_command_list_append_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_immediate_command_list_append_exp_version_t(c_int): def __str__(self): return str(ze_immediate_command_list_append_exp_version_v(self.value)) ############################################################################### ## @brief Mutable Command List Extension Name ZE_MUTABLE_COMMAND_LIST_EXP_NAME = "ZE_experimental_mutable_command_list" ############################################################################### ## @brief Mutable Command List Extension Version(s) class ze_mutable_command_list_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 _1_1 = ZE_MAKE_VERSION( 1, 1 ) ## version 1.1 CURRENT = ZE_MAKE_VERSION( 1, 1 ) ## latest known version class ze_mutable_command_list_exp_version_t(c_int): def __str__(self): return str(ze_mutable_command_list_exp_version_v(self.value)) ############################################################################### ## @brief Mutable command flags class ze_mutable_command_exp_flags_v(IntEnum): KERNEL_ARGUMENTS = ZE_BIT(0) ## kernel arguments GROUP_COUNT = ZE_BIT(1) ## kernel group count GROUP_SIZE = ZE_BIT(2) ## kernel group size GLOBAL_OFFSET = ZE_BIT(3) ## kernel global offset SIGNAL_EVENT = ZE_BIT(4) ## command signal event WAIT_EVENTS = ZE_BIT(5) ## command wait events KERNEL_INSTRUCTION = ZE_BIT(6) ## command kernel GRAPH_ARGUMENTS = ZE_BIT(7) ## graph arguments class ze_mutable_command_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Mutable command identifier descriptor class ze_mutable_command_id_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_mutable_command_exp_flags_t) ## [in] mutable command flags. ## - must be 0 (default, equivalent to setting all flags bar kernel ## instruction), or a valid combination of ::ze_mutable_command_exp_flag_t ## - in order to include kernel instruction mutation, ## ::ZE_MUTABLE_COMMAND_EXP_FLAG_KERNEL_INSTRUCTION must be explictly included ] ############################################################################### ## @brief Mutable command list flags class ze_mutable_command_list_exp_flags_v(IntEnum): RESERVED = ZE_BIT(0) ## reserved class ze_mutable_command_list_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Mutable command list properties class ze_mutable_command_list_exp_properties_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("mutableCommandListFlags", ze_mutable_command_list_exp_flags_t), ## [out] mutable command list flags ("mutableCommandFlags", ze_mutable_command_exp_flags_t) ## [out] mutable command flags ] ############################################################################### ## @brief Mutable command list descriptor class ze_mutable_command_list_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", ze_mutable_command_list_exp_flags_t) ## [in] mutable command list flags. ## - must be 0 (default) or a valid combination of ::ze_mutable_command_list_exp_flag_t ] ############################################################################### ## @brief Mutable commands descriptor class ze_mutable_commands_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", c_ulong) ## [in] must be 0, this field is reserved for future use ] ############################################################################### ## @brief Mutable kernel argument descriptor class ze_mutable_kernel_argument_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("commandId", c_ulonglong), ## [in] command identifier ("argIndex", c_ulong), ## [in] kernel argument index ("argSize", c_size_t), ## [in] kernel argument size ("pArgValue", c_void_p) ## [in] pointer to kernel argument value ] ############################################################################### ## @brief Mutable kernel group count descriptor class ze_mutable_group_count_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("commandId", c_ulonglong), ## [in] command identifier ("pGroupCount", POINTER(ze_group_count_t)) ## [in] pointer to group count ] ############################################################################### ## @brief Mutable kernel group size descriptor class ze_mutable_group_size_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("commandId", c_ulonglong), ## [in] command identifier ("groupSizeX", c_ulong), ## [in] group size for X dimension to use for the kernel ("groupSizeY", c_ulong), ## [in] group size for Y dimension to use for the kernel ("groupSizeZ", c_ulong) ## [in] group size for Z dimension to use for the kernel ] ############################################################################### ## @brief Mutable kernel global offset descriptor class ze_mutable_global_offset_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("commandId", c_ulonglong), ## [in] command identifier ("offsetX", c_ulong), ## [in] global offset for X dimension to use for this kernel ("offsetY", c_ulong), ## [in] global offset for Y dimension to use for this kernel ("offsetZ", c_ulong) ## [in] global offset for Z dimension to use for this kernel ] ############################################################################### ## @brief Mutable graph argument descriptor class ze_mutable_graph_argument_exp_desc_t(Structure): _fields_ = [ ("stype", ze_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("commandId", c_ulonglong), ## [in] command identifier ("argIndex", c_ulong), ## [in] graph argument index ("pArgValue", c_void_p) ## [in] pointer to graph argument value ] ############################################################################### __use_win_types = "Windows" == platform.uname()[0] ############################################################################### ## @brief Function-pointer for zeRTASBuilderCreateExp if __use_win_types: _zeRTASBuilderCreateExp_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_rtas_builder_exp_desc_t), POINTER(ze_rtas_builder_exp_handle_t) ) else: _zeRTASBuilderCreateExp_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_rtas_builder_exp_desc_t), POINTER(ze_rtas_builder_exp_handle_t) ) ############################################################################### ## @brief Function-pointer for zeRTASBuilderGetBuildPropertiesExp if __use_win_types: _zeRTASBuilderGetBuildPropertiesExp_t = WINFUNCTYPE( ze_result_t, ze_rtas_builder_exp_handle_t, POINTER(ze_rtas_builder_build_op_exp_desc_t), POINTER(ze_rtas_builder_exp_properties_t) ) else: _zeRTASBuilderGetBuildPropertiesExp_t = CFUNCTYPE( ze_result_t, ze_rtas_builder_exp_handle_t, POINTER(ze_rtas_builder_build_op_exp_desc_t), POINTER(ze_rtas_builder_exp_properties_t) ) ############################################################################### ## @brief Function-pointer for zeRTASBuilderBuildExp if __use_win_types: _zeRTASBuilderBuildExp_t = WINFUNCTYPE( ze_result_t, ze_rtas_builder_exp_handle_t, POINTER(ze_rtas_builder_build_op_exp_desc_t), c_void_p, c_size_t, c_void_p, c_size_t, ze_rtas_parallel_operation_exp_handle_t, c_void_p, POINTER(ze_rtas_aabb_exp_t), POINTER(c_size_t) ) else: _zeRTASBuilderBuildExp_t = CFUNCTYPE( ze_result_t, ze_rtas_builder_exp_handle_t, POINTER(ze_rtas_builder_build_op_exp_desc_t), c_void_p, c_size_t, c_void_p, c_size_t, ze_rtas_parallel_operation_exp_handle_t, c_void_p, POINTER(ze_rtas_aabb_exp_t), POINTER(c_size_t) ) ############################################################################### ## @brief Function-pointer for zeRTASBuilderDestroyExp if __use_win_types: _zeRTASBuilderDestroyExp_t = WINFUNCTYPE( ze_result_t, ze_rtas_builder_exp_handle_t ) else: _zeRTASBuilderDestroyExp_t = CFUNCTYPE( ze_result_t, ze_rtas_builder_exp_handle_t ) ############################################################################### ## @brief Table of RTASBuilderExp functions pointers class _ze_rtas_builder_exp_dditable_t(Structure): _fields_ = [ ("pfnCreateExp", c_void_p), ## _zeRTASBuilderCreateExp_t ("pfnGetBuildPropertiesExp", c_void_p), ## _zeRTASBuilderGetBuildPropertiesExp_t ("pfnBuildExp", c_void_p), ## _zeRTASBuilderBuildExp_t ("pfnDestroyExp", c_void_p) ## _zeRTASBuilderDestroyExp_t ] ############################################################################### ## @brief Function-pointer for zeRTASParallelOperationCreateExp if __use_win_types: _zeRTASParallelOperationCreateExp_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_rtas_parallel_operation_exp_handle_t) ) else: _zeRTASParallelOperationCreateExp_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_rtas_parallel_operation_exp_handle_t) ) ############################################################################### ## @brief Function-pointer for zeRTASParallelOperationGetPropertiesExp if __use_win_types: _zeRTASParallelOperationGetPropertiesExp_t = WINFUNCTYPE( ze_result_t, ze_rtas_parallel_operation_exp_handle_t, POINTER(ze_rtas_parallel_operation_exp_properties_t) ) else: _zeRTASParallelOperationGetPropertiesExp_t = CFUNCTYPE( ze_result_t, ze_rtas_parallel_operation_exp_handle_t, POINTER(ze_rtas_parallel_operation_exp_properties_t) ) ############################################################################### ## @brief Function-pointer for zeRTASParallelOperationJoinExp if __use_win_types: _zeRTASParallelOperationJoinExp_t = WINFUNCTYPE( ze_result_t, ze_rtas_parallel_operation_exp_handle_t ) else: _zeRTASParallelOperationJoinExp_t = CFUNCTYPE( ze_result_t, ze_rtas_parallel_operation_exp_handle_t ) ############################################################################### ## @brief Function-pointer for zeRTASParallelOperationDestroyExp if __use_win_types: _zeRTASParallelOperationDestroyExp_t = WINFUNCTYPE( ze_result_t, ze_rtas_parallel_operation_exp_handle_t ) else: _zeRTASParallelOperationDestroyExp_t = CFUNCTYPE( ze_result_t, ze_rtas_parallel_operation_exp_handle_t ) ############################################################################### ## @brief Table of RTASParallelOperationExp functions pointers class _ze_rtas_parallel_operation_exp_dditable_t(Structure): _fields_ = [ ("pfnCreateExp", c_void_p), ## _zeRTASParallelOperationCreateExp_t ("pfnGetPropertiesExp", c_void_p), ## _zeRTASParallelOperationGetPropertiesExp_t ("pfnJoinExp", c_void_p), ## _zeRTASParallelOperationJoinExp_t ("pfnDestroyExp", c_void_p) ## _zeRTASParallelOperationDestroyExp_t ] ############################################################################### ## @brief Function-pointer for zeInit if __use_win_types: _zeInit_t = WINFUNCTYPE( ze_result_t, ze_init_flags_t ) else: _zeInit_t = CFUNCTYPE( ze_result_t, ze_init_flags_t ) ############################################################################### ## @brief Function-pointer for zeInitDrivers if __use_win_types: _zeInitDrivers_t = WINFUNCTYPE( ze_result_t, POINTER(c_ulong), POINTER(ze_driver_handle_t), POINTER(ze_init_driver_type_desc_t) ) else: _zeInitDrivers_t = CFUNCTYPE( ze_result_t, POINTER(c_ulong), POINTER(ze_driver_handle_t), POINTER(ze_init_driver_type_desc_t) ) ############################################################################### ## @brief Table of Global functions pointers class _ze_global_dditable_t(Structure): _fields_ = [ ("pfnInit", c_void_p), ## _zeInit_t ("pfnInitDrivers", c_void_p) ## _zeInitDrivers_t ] ############################################################################### ## @brief Function-pointer for zeDriverGet if __use_win_types: _zeDriverGet_t = WINFUNCTYPE( ze_result_t, POINTER(c_ulong), POINTER(ze_driver_handle_t) ) else: _zeDriverGet_t = CFUNCTYPE( ze_result_t, POINTER(c_ulong), POINTER(ze_driver_handle_t) ) ############################################################################### ## @brief Function-pointer for zeDriverGetApiVersion if __use_win_types: _zeDriverGetApiVersion_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_api_version_t) ) else: _zeDriverGetApiVersion_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_api_version_t) ) ############################################################################### ## @brief Function-pointer for zeDriverGetProperties if __use_win_types: _zeDriverGetProperties_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_driver_properties_t) ) else: _zeDriverGetProperties_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_driver_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDriverGetIpcProperties if __use_win_types: _zeDriverGetIpcProperties_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_driver_ipc_properties_t) ) else: _zeDriverGetIpcProperties_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_driver_ipc_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDriverGetExtensionProperties if __use_win_types: _zeDriverGetExtensionProperties_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(c_ulong), POINTER(ze_driver_extension_properties_t) ) else: _zeDriverGetExtensionProperties_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(c_ulong), POINTER(ze_driver_extension_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDriverGetExtensionFunctionAddress if __use_win_types: _zeDriverGetExtensionFunctionAddress_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, c_char_p, POINTER(c_void_p) ) else: _zeDriverGetExtensionFunctionAddress_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, c_char_p, POINTER(c_void_p) ) ############################################################################### ## @brief Function-pointer for zeDriverGetLastErrorDescription if __use_win_types: _zeDriverGetLastErrorDescription_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(c_char_p) ) else: _zeDriverGetLastErrorDescription_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(c_char_p) ) ############################################################################### ## @brief Table of Driver functions pointers class _ze_driver_dditable_t(Structure): _fields_ = [ ("pfnGet", c_void_p), ## _zeDriverGet_t ("pfnGetApiVersion", c_void_p), ## _zeDriverGetApiVersion_t ("pfnGetProperties", c_void_p), ## _zeDriverGetProperties_t ("pfnGetIpcProperties", c_void_p), ## _zeDriverGetIpcProperties_t ("pfnGetExtensionProperties", c_void_p), ## _zeDriverGetExtensionProperties_t ("pfnGetExtensionFunctionAddress", c_void_p), ## _zeDriverGetExtensionFunctionAddress_t ("pfnGetLastErrorDescription", c_void_p) ## _zeDriverGetLastErrorDescription_t ] ############################################################################### ## @brief Function-pointer for zeDriverRTASFormatCompatibilityCheckExp if __use_win_types: _zeDriverRTASFormatCompatibilityCheckExp_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, ze_rtas_format_exp_t, ze_rtas_format_exp_t ) else: _zeDriverRTASFormatCompatibilityCheckExp_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, ze_rtas_format_exp_t, ze_rtas_format_exp_t ) ############################################################################### ## @brief Table of DriverExp functions pointers class _ze_driver_exp_dditable_t(Structure): _fields_ = [ ("pfnRTASFormatCompatibilityCheckExp", c_void_p) ## _zeDriverRTASFormatCompatibilityCheckExp_t ] ############################################################################### ## @brief Function-pointer for zeDeviceGet if __use_win_types: _zeDeviceGet_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(c_ulong), POINTER(ze_device_handle_t) ) else: _zeDeviceGet_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(c_ulong), POINTER(ze_device_handle_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetSubDevices if __use_win_types: _zeDeviceGetSubDevices_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_device_handle_t) ) else: _zeDeviceGetSubDevices_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_device_handle_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetProperties if __use_win_types: _zeDeviceGetProperties_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_properties_t) ) else: _zeDeviceGetProperties_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetComputeProperties if __use_win_types: _zeDeviceGetComputeProperties_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_compute_properties_t) ) else: _zeDeviceGetComputeProperties_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_compute_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetModuleProperties if __use_win_types: _zeDeviceGetModuleProperties_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_module_properties_t) ) else: _zeDeviceGetModuleProperties_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_module_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetCommandQueueGroupProperties if __use_win_types: _zeDeviceGetCommandQueueGroupProperties_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_command_queue_group_properties_t) ) else: _zeDeviceGetCommandQueueGroupProperties_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_command_queue_group_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetMemoryProperties if __use_win_types: _zeDeviceGetMemoryProperties_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_device_memory_properties_t) ) else: _zeDeviceGetMemoryProperties_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_device_memory_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetMemoryAccessProperties if __use_win_types: _zeDeviceGetMemoryAccessProperties_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_memory_access_properties_t) ) else: _zeDeviceGetMemoryAccessProperties_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_memory_access_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetCacheProperties if __use_win_types: _zeDeviceGetCacheProperties_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_device_cache_properties_t) ) else: _zeDeviceGetCacheProperties_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_device_cache_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetImageProperties if __use_win_types: _zeDeviceGetImageProperties_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_image_properties_t) ) else: _zeDeviceGetImageProperties_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_image_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetExternalMemoryProperties if __use_win_types: _zeDeviceGetExternalMemoryProperties_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_external_memory_properties_t) ) else: _zeDeviceGetExternalMemoryProperties_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_external_memory_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetP2PProperties if __use_win_types: _zeDeviceGetP2PProperties_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, ze_device_handle_t, POINTER(ze_device_p2p_properties_t) ) else: _zeDeviceGetP2PProperties_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, ze_device_handle_t, POINTER(ze_device_p2p_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceCanAccessPeer if __use_win_types: _zeDeviceCanAccessPeer_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, ze_device_handle_t, POINTER(ze_bool_t) ) else: _zeDeviceCanAccessPeer_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, ze_device_handle_t, POINTER(ze_bool_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetStatus if __use_win_types: _zeDeviceGetStatus_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t ) else: _zeDeviceGetStatus_t = CFUNCTYPE( ze_result_t, ze_device_handle_t ) ############################################################################### ## @brief Function-pointer for zeDeviceGetGlobalTimestamps if __use_win_types: _zeDeviceGetGlobalTimestamps_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulonglong), POINTER(c_ulonglong) ) else: _zeDeviceGetGlobalTimestamps_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(c_ulonglong), POINTER(c_ulonglong) ) ############################################################################### ## @brief Function-pointer for zeDeviceReserveCacheExt if __use_win_types: _zeDeviceReserveCacheExt_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, c_size_t, c_size_t ) else: _zeDeviceReserveCacheExt_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, c_size_t, c_size_t ) ############################################################################### ## @brief Function-pointer for zeDeviceSetCacheAdviceExt if __use_win_types: _zeDeviceSetCacheAdviceExt_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, c_void_p, c_size_t, ze_cache_ext_region_t ) else: _zeDeviceSetCacheAdviceExt_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, c_void_p, c_size_t, ze_cache_ext_region_t ) ############################################################################### ## @brief Function-pointer for zeDevicePciGetPropertiesExt if __use_win_types: _zeDevicePciGetPropertiesExt_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_pci_ext_properties_t) ) else: _zeDevicePciGetPropertiesExt_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_pci_ext_properties_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceGetRootDevice if __use_win_types: _zeDeviceGetRootDevice_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_handle_t) ) else: _zeDeviceGetRootDevice_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_device_handle_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceImportExternalSemaphoreExt if __use_win_types: _zeDeviceImportExternalSemaphoreExt_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_external_semaphore_ext_desc_t), POINTER(ze_external_semaphore_ext_handle_t) ) else: _zeDeviceImportExternalSemaphoreExt_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_external_semaphore_ext_desc_t), POINTER(ze_external_semaphore_ext_handle_t) ) ############################################################################### ## @brief Function-pointer for zeDeviceReleaseExternalSemaphoreExt if __use_win_types: _zeDeviceReleaseExternalSemaphoreExt_t = WINFUNCTYPE( ze_result_t, ze_external_semaphore_ext_handle_t ) else: _zeDeviceReleaseExternalSemaphoreExt_t = CFUNCTYPE( ze_result_t, ze_external_semaphore_ext_handle_t ) ############################################################################### ## @brief Table of Device functions pointers class _ze_device_dditable_t(Structure): _fields_ = [ ("pfnGet", c_void_p), ## _zeDeviceGet_t ("pfnGetSubDevices", c_void_p), ## _zeDeviceGetSubDevices_t ("pfnGetProperties", c_void_p), ## _zeDeviceGetProperties_t ("pfnGetComputeProperties", c_void_p), ## _zeDeviceGetComputeProperties_t ("pfnGetModuleProperties", c_void_p), ## _zeDeviceGetModuleProperties_t ("pfnGetCommandQueueGroupProperties", c_void_p), ## _zeDeviceGetCommandQueueGroupProperties_t ("pfnGetMemoryProperties", c_void_p), ## _zeDeviceGetMemoryProperties_t ("pfnGetMemoryAccessProperties", c_void_p), ## _zeDeviceGetMemoryAccessProperties_t ("pfnGetCacheProperties", c_void_p), ## _zeDeviceGetCacheProperties_t ("pfnGetImageProperties", c_void_p), ## _zeDeviceGetImageProperties_t ("pfnGetExternalMemoryProperties", c_void_p), ## _zeDeviceGetExternalMemoryProperties_t ("pfnGetP2PProperties", c_void_p), ## _zeDeviceGetP2PProperties_t ("pfnCanAccessPeer", c_void_p), ## _zeDeviceCanAccessPeer_t ("pfnGetStatus", c_void_p), ## _zeDeviceGetStatus_t ("pfnGetGlobalTimestamps", c_void_p), ## _zeDeviceGetGlobalTimestamps_t ("pfnReserveCacheExt", c_void_p), ## _zeDeviceReserveCacheExt_t ("pfnSetCacheAdviceExt", c_void_p), ## _zeDeviceSetCacheAdviceExt_t ("pfnPciGetPropertiesExt", c_void_p), ## _zeDevicePciGetPropertiesExt_t ("pfnGetRootDevice", c_void_p), ## _zeDeviceGetRootDevice_t ("pfnImportExternalSemaphoreExt", c_void_p), ## _zeDeviceImportExternalSemaphoreExt_t ("pfnReleaseExternalSemaphoreExt", c_void_p) ## _zeDeviceReleaseExternalSemaphoreExt_t ] ############################################################################### ## @brief Function-pointer for zeDeviceGetFabricVertexExp if __use_win_types: _zeDeviceGetFabricVertexExp_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_fabric_vertex_handle_t) ) else: _zeDeviceGetFabricVertexExp_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_fabric_vertex_handle_t) ) ############################################################################### ## @brief Table of DeviceExp functions pointers class _ze_device_exp_dditable_t(Structure): _fields_ = [ ("pfnGetFabricVertexExp", c_void_p) ## _zeDeviceGetFabricVertexExp_t ] ############################################################################### ## @brief Function-pointer for zeContextCreate if __use_win_types: _zeContextCreate_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_context_desc_t), POINTER(ze_context_handle_t) ) else: _zeContextCreate_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_context_desc_t), POINTER(ze_context_handle_t) ) ############################################################################### ## @brief Function-pointer for zeContextDestroy if __use_win_types: _zeContextDestroy_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t ) else: _zeContextDestroy_t = CFUNCTYPE( ze_result_t, ze_context_handle_t ) ############################################################################### ## @brief Function-pointer for zeContextGetStatus if __use_win_types: _zeContextGetStatus_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t ) else: _zeContextGetStatus_t = CFUNCTYPE( ze_result_t, ze_context_handle_t ) ############################################################################### ## @brief Function-pointer for zeContextSystemBarrier if __use_win_types: _zeContextSystemBarrier_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t ) else: _zeContextSystemBarrier_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t ) ############################################################################### ## @brief Function-pointer for zeContextMakeMemoryResident if __use_win_types: _zeContextMakeMemoryResident_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, c_void_p, c_size_t ) else: _zeContextMakeMemoryResident_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, c_void_p, c_size_t ) ############################################################################### ## @brief Function-pointer for zeContextEvictMemory if __use_win_types: _zeContextEvictMemory_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, c_void_p, c_size_t ) else: _zeContextEvictMemory_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, c_void_p, c_size_t ) ############################################################################### ## @brief Function-pointer for zeContextMakeImageResident if __use_win_types: _zeContextMakeImageResident_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, ze_image_handle_t ) else: _zeContextMakeImageResident_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, ze_image_handle_t ) ############################################################################### ## @brief Function-pointer for zeContextEvictImage if __use_win_types: _zeContextEvictImage_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, ze_image_handle_t ) else: _zeContextEvictImage_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, ze_image_handle_t ) ############################################################################### ## @brief Function-pointer for zeContextCreateEx if __use_win_types: _zeContextCreateEx_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_context_desc_t), c_ulong, POINTER(ze_device_handle_t), POINTER(ze_context_handle_t) ) else: _zeContextCreateEx_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(ze_context_desc_t), c_ulong, POINTER(ze_device_handle_t), POINTER(ze_context_handle_t) ) ############################################################################### ## @brief Table of Context functions pointers class _ze_context_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zeContextCreate_t ("pfnDestroy", c_void_p), ## _zeContextDestroy_t ("pfnGetStatus", c_void_p), ## _zeContextGetStatus_t ("pfnSystemBarrier", c_void_p), ## _zeContextSystemBarrier_t ("pfnMakeMemoryResident", c_void_p), ## _zeContextMakeMemoryResident_t ("pfnEvictMemory", c_void_p), ## _zeContextEvictMemory_t ("pfnMakeImageResident", c_void_p), ## _zeContextMakeImageResident_t ("pfnEvictImage", c_void_p), ## _zeContextEvictImage_t ("pfnCreateEx", c_void_p) ## _zeContextCreateEx_t ] ############################################################################### ## @brief Function-pointer for zeCommandQueueCreate if __use_win_types: _zeCommandQueueCreate_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_command_queue_desc_t), POINTER(ze_command_queue_handle_t) ) else: _zeCommandQueueCreate_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_command_queue_desc_t), POINTER(ze_command_queue_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandQueueDestroy if __use_win_types: _zeCommandQueueDestroy_t = WINFUNCTYPE( ze_result_t, ze_command_queue_handle_t ) else: _zeCommandQueueDestroy_t = CFUNCTYPE( ze_result_t, ze_command_queue_handle_t ) ############################################################################### ## @brief Function-pointer for zeCommandQueueExecuteCommandLists if __use_win_types: _zeCommandQueueExecuteCommandLists_t = WINFUNCTYPE( ze_result_t, ze_command_queue_handle_t, c_ulong, POINTER(ze_command_list_handle_t), ze_fence_handle_t ) else: _zeCommandQueueExecuteCommandLists_t = CFUNCTYPE( ze_result_t, ze_command_queue_handle_t, c_ulong, POINTER(ze_command_list_handle_t), ze_fence_handle_t ) ############################################################################### ## @brief Function-pointer for zeCommandQueueSynchronize if __use_win_types: _zeCommandQueueSynchronize_t = WINFUNCTYPE( ze_result_t, ze_command_queue_handle_t, c_ulonglong ) else: _zeCommandQueueSynchronize_t = CFUNCTYPE( ze_result_t, ze_command_queue_handle_t, c_ulonglong ) ############################################################################### ## @brief Function-pointer for zeCommandQueueGetOrdinal if __use_win_types: _zeCommandQueueGetOrdinal_t = WINFUNCTYPE( ze_result_t, ze_command_queue_handle_t, POINTER(c_ulong) ) else: _zeCommandQueueGetOrdinal_t = CFUNCTYPE( ze_result_t, ze_command_queue_handle_t, POINTER(c_ulong) ) ############################################################################### ## @brief Function-pointer for zeCommandQueueGetIndex if __use_win_types: _zeCommandQueueGetIndex_t = WINFUNCTYPE( ze_result_t, ze_command_queue_handle_t, POINTER(c_ulong) ) else: _zeCommandQueueGetIndex_t = CFUNCTYPE( ze_result_t, ze_command_queue_handle_t, POINTER(c_ulong) ) ############################################################################### ## @brief Table of CommandQueue functions pointers class _ze_command_queue_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zeCommandQueueCreate_t ("pfnDestroy", c_void_p), ## _zeCommandQueueDestroy_t ("pfnExecuteCommandLists", c_void_p), ## _zeCommandQueueExecuteCommandLists_t ("pfnSynchronize", c_void_p), ## _zeCommandQueueSynchronize_t ("pfnGetOrdinal", c_void_p), ## _zeCommandQueueGetOrdinal_t ("pfnGetIndex", c_void_p) ## _zeCommandQueueGetIndex_t ] ############################################################################### ## @brief Function-pointer for zeCommandListCreate if __use_win_types: _zeCommandListCreate_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_command_list_desc_t), POINTER(ze_command_list_handle_t) ) else: _zeCommandListCreate_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_command_list_desc_t), POINTER(ze_command_list_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListCreateImmediate if __use_win_types: _zeCommandListCreateImmediate_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_command_queue_desc_t), POINTER(ze_command_list_handle_t) ) else: _zeCommandListCreateImmediate_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_command_queue_desc_t), POINTER(ze_command_list_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListDestroy if __use_win_types: _zeCommandListDestroy_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t ) else: _zeCommandListDestroy_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t ) ############################################################################### ## @brief Function-pointer for zeCommandListClose if __use_win_types: _zeCommandListClose_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t ) else: _zeCommandListClose_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t ) ############################################################################### ## @brief Function-pointer for zeCommandListReset if __use_win_types: _zeCommandListReset_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t ) else: _zeCommandListReset_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendWriteGlobalTimestamp if __use_win_types: _zeCommandListAppendWriteGlobalTimestamp_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(c_ulonglong), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendWriteGlobalTimestamp_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(c_ulonglong), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendBarrier if __use_win_types: _zeCommandListAppendBarrier_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendBarrier_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendMemoryRangesBarrier if __use_win_types: _zeCommandListAppendMemoryRangesBarrier_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(c_size_t), POINTER(c_void_p), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendMemoryRangesBarrier_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(c_size_t), POINTER(c_void_p), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendMemoryCopy if __use_win_types: _zeCommandListAppendMemoryCopy_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, c_void_p, c_size_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendMemoryCopy_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, c_void_p, c_size_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendMemoryFill if __use_win_types: _zeCommandListAppendMemoryFill_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, c_void_p, c_size_t, c_size_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendMemoryFill_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, c_void_p, c_size_t, c_size_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendMemoryCopyRegion if __use_win_types: _zeCommandListAppendMemoryCopyRegion_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, POINTER(ze_copy_region_t), c_ulong, c_ulong, c_void_p, POINTER(ze_copy_region_t), c_ulong, c_ulong, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendMemoryCopyRegion_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, POINTER(ze_copy_region_t), c_ulong, c_ulong, c_void_p, POINTER(ze_copy_region_t), c_ulong, c_ulong, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendMemoryCopyFromContext if __use_win_types: _zeCommandListAppendMemoryCopyFromContext_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, ze_context_handle_t, c_void_p, c_size_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendMemoryCopyFromContext_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, ze_context_handle_t, c_void_p, c_size_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendImageCopy if __use_win_types: _zeCommandListAppendImageCopy_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_image_handle_t, ze_image_handle_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendImageCopy_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_image_handle_t, ze_image_handle_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendImageCopyRegion if __use_win_types: _zeCommandListAppendImageCopyRegion_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_image_handle_t, ze_image_handle_t, POINTER(ze_image_region_t), POINTER(ze_image_region_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendImageCopyRegion_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_image_handle_t, ze_image_handle_t, POINTER(ze_image_region_t), POINTER(ze_image_region_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendImageCopyToMemory if __use_win_types: _zeCommandListAppendImageCopyToMemory_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, ze_image_handle_t, POINTER(ze_image_region_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendImageCopyToMemory_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, ze_image_handle_t, POINTER(ze_image_region_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendImageCopyFromMemory if __use_win_types: _zeCommandListAppendImageCopyFromMemory_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_image_handle_t, c_void_p, POINTER(ze_image_region_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendImageCopyFromMemory_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_image_handle_t, c_void_p, POINTER(ze_image_region_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendMemoryPrefetch if __use_win_types: _zeCommandListAppendMemoryPrefetch_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, c_size_t ) else: _zeCommandListAppendMemoryPrefetch_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, c_size_t ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendMemAdvise if __use_win_types: _zeCommandListAppendMemAdvise_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_device_handle_t, c_void_p, c_size_t, ze_memory_advice_t ) else: _zeCommandListAppendMemAdvise_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_device_handle_t, c_void_p, c_size_t, ze_memory_advice_t ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendSignalEvent if __use_win_types: _zeCommandListAppendSignalEvent_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_event_handle_t ) else: _zeCommandListAppendSignalEvent_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_event_handle_t ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendWaitOnEvents if __use_win_types: _zeCommandListAppendWaitOnEvents_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendWaitOnEvents_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendEventReset if __use_win_types: _zeCommandListAppendEventReset_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_event_handle_t ) else: _zeCommandListAppendEventReset_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_event_handle_t ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendQueryKernelTimestamps if __use_win_types: _zeCommandListAppendQueryKernelTimestamps_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_event_handle_t), c_void_p, POINTER(c_size_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendQueryKernelTimestamps_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_event_handle_t), c_void_p, POINTER(c_size_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendLaunchKernel if __use_win_types: _zeCommandListAppendLaunchKernel_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_kernel_handle_t, POINTER(ze_group_count_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendLaunchKernel_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_kernel_handle_t, POINTER(ze_group_count_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendLaunchCooperativeKernel if __use_win_types: _zeCommandListAppendLaunchCooperativeKernel_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_kernel_handle_t, POINTER(ze_group_count_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendLaunchCooperativeKernel_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_kernel_handle_t, POINTER(ze_group_count_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendLaunchKernelIndirect if __use_win_types: _zeCommandListAppendLaunchKernelIndirect_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_kernel_handle_t, POINTER(ze_group_count_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendLaunchKernelIndirect_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_kernel_handle_t, POINTER(ze_group_count_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendLaunchMultipleKernelsIndirect if __use_win_types: _zeCommandListAppendLaunchMultipleKernelsIndirect_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_kernel_handle_t), POINTER(c_ulong), POINTER(ze_group_count_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendLaunchMultipleKernelsIndirect_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_kernel_handle_t), POINTER(c_ulong), POINTER(ze_group_count_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendImageCopyToMemoryExt if __use_win_types: _zeCommandListAppendImageCopyToMemoryExt_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, ze_image_handle_t, POINTER(ze_image_region_t), c_ulong, c_ulong, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendImageCopyToMemoryExt_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_void_p, ze_image_handle_t, POINTER(ze_image_region_t), c_ulong, c_ulong, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendImageCopyFromMemoryExt if __use_win_types: _zeCommandListAppendImageCopyFromMemoryExt_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_image_handle_t, c_void_p, POINTER(ze_image_region_t), c_ulong, c_ulong, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendImageCopyFromMemoryExt_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, ze_image_handle_t, c_void_p, POINTER(ze_image_region_t), c_ulong, c_ulong, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListHostSynchronize if __use_win_types: _zeCommandListHostSynchronize_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulonglong ) else: _zeCommandListHostSynchronize_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulonglong ) ############################################################################### ## @brief Function-pointer for zeCommandListGetDeviceHandle if __use_win_types: _zeCommandListGetDeviceHandle_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_device_handle_t) ) else: _zeCommandListGetDeviceHandle_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_device_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListGetContextHandle if __use_win_types: _zeCommandListGetContextHandle_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_context_handle_t) ) else: _zeCommandListGetContextHandle_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_context_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListGetOrdinal if __use_win_types: _zeCommandListGetOrdinal_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(c_ulong) ) else: _zeCommandListGetOrdinal_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(c_ulong) ) ############################################################################### ## @brief Function-pointer for zeCommandListImmediateGetIndex if __use_win_types: _zeCommandListImmediateGetIndex_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(c_ulong) ) else: _zeCommandListImmediateGetIndex_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(c_ulong) ) ############################################################################### ## @brief Function-pointer for zeCommandListIsImmediate if __use_win_types: _zeCommandListIsImmediate_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_bool_t) ) else: _zeCommandListIsImmediate_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_bool_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendSignalExternalSemaphoreExt if __use_win_types: _zeCommandListAppendSignalExternalSemaphoreExt_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_external_semaphore_ext_handle_t), POINTER(ze_external_semaphore_signal_params_ext_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendSignalExternalSemaphoreExt_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_external_semaphore_ext_handle_t), POINTER(ze_external_semaphore_signal_params_ext_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListAppendWaitExternalSemaphoreExt if __use_win_types: _zeCommandListAppendWaitExternalSemaphoreExt_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_external_semaphore_ext_handle_t), POINTER(ze_external_semaphore_wait_params_ext_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListAppendWaitExternalSemaphoreExt_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_external_semaphore_ext_handle_t), POINTER(ze_external_semaphore_wait_params_ext_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Table of CommandList functions pointers class _ze_command_list_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zeCommandListCreate_t ("pfnCreateImmediate", c_void_p), ## _zeCommandListCreateImmediate_t ("pfnDestroy", c_void_p), ## _zeCommandListDestroy_t ("pfnClose", c_void_p), ## _zeCommandListClose_t ("pfnReset", c_void_p), ## _zeCommandListReset_t ("pfnAppendWriteGlobalTimestamp", c_void_p), ## _zeCommandListAppendWriteGlobalTimestamp_t ("pfnAppendBarrier", c_void_p), ## _zeCommandListAppendBarrier_t ("pfnAppendMemoryRangesBarrier", c_void_p), ## _zeCommandListAppendMemoryRangesBarrier_t ("pfnAppendMemoryCopy", c_void_p), ## _zeCommandListAppendMemoryCopy_t ("pfnAppendMemoryFill", c_void_p), ## _zeCommandListAppendMemoryFill_t ("pfnAppendMemoryCopyRegion", c_void_p), ## _zeCommandListAppendMemoryCopyRegion_t ("pfnAppendMemoryCopyFromContext", c_void_p), ## _zeCommandListAppendMemoryCopyFromContext_t ("pfnAppendImageCopy", c_void_p), ## _zeCommandListAppendImageCopy_t ("pfnAppendImageCopyRegion", c_void_p), ## _zeCommandListAppendImageCopyRegion_t ("pfnAppendImageCopyToMemory", c_void_p), ## _zeCommandListAppendImageCopyToMemory_t ("pfnAppendImageCopyFromMemory", c_void_p), ## _zeCommandListAppendImageCopyFromMemory_t ("pfnAppendMemoryPrefetch", c_void_p), ## _zeCommandListAppendMemoryPrefetch_t ("pfnAppendMemAdvise", c_void_p), ## _zeCommandListAppendMemAdvise_t ("pfnAppendSignalEvent", c_void_p), ## _zeCommandListAppendSignalEvent_t ("pfnAppendWaitOnEvents", c_void_p), ## _zeCommandListAppendWaitOnEvents_t ("pfnAppendEventReset", c_void_p), ## _zeCommandListAppendEventReset_t ("pfnAppendQueryKernelTimestamps", c_void_p), ## _zeCommandListAppendQueryKernelTimestamps_t ("pfnAppendLaunchKernel", c_void_p), ## _zeCommandListAppendLaunchKernel_t ("pfnAppendLaunchCooperativeKernel", c_void_p), ## _zeCommandListAppendLaunchCooperativeKernel_t ("pfnAppendLaunchKernelIndirect", c_void_p), ## _zeCommandListAppendLaunchKernelIndirect_t ("pfnAppendLaunchMultipleKernelsIndirect", c_void_p), ## _zeCommandListAppendLaunchMultipleKernelsIndirect_t ("pfnAppendImageCopyToMemoryExt", c_void_p), ## _zeCommandListAppendImageCopyToMemoryExt_t ("pfnAppendImageCopyFromMemoryExt", c_void_p), ## _zeCommandListAppendImageCopyFromMemoryExt_t ("pfnHostSynchronize", c_void_p), ## _zeCommandListHostSynchronize_t ("pfnGetDeviceHandle", c_void_p), ## _zeCommandListGetDeviceHandle_t ("pfnGetContextHandle", c_void_p), ## _zeCommandListGetContextHandle_t ("pfnGetOrdinal", c_void_p), ## _zeCommandListGetOrdinal_t ("pfnImmediateGetIndex", c_void_p), ## _zeCommandListImmediateGetIndex_t ("pfnIsImmediate", c_void_p), ## _zeCommandListIsImmediate_t ("pfnAppendSignalExternalSemaphoreExt", c_void_p), ## _zeCommandListAppendSignalExternalSemaphoreExt_t ("pfnAppendWaitExternalSemaphoreExt", c_void_p) ## _zeCommandListAppendWaitExternalSemaphoreExt_t ] ############################################################################### ## @brief Function-pointer for zeCommandListCreateCloneExp if __use_win_types: _zeCommandListCreateCloneExp_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_command_list_handle_t) ) else: _zeCommandListCreateCloneExp_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_command_list_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListImmediateAppendCommandListsExp if __use_win_types: _zeCommandListImmediateAppendCommandListsExp_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_command_list_handle_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListImmediateAppendCommandListsExp_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(ze_command_list_handle_t), ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListGetNextCommandIdExp if __use_win_types: _zeCommandListGetNextCommandIdExp_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_mutable_command_id_exp_desc_t), POINTER(c_ulonglong) ) else: _zeCommandListGetNextCommandIdExp_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_mutable_command_id_exp_desc_t), POINTER(c_ulonglong) ) ############################################################################### ## @brief Function-pointer for zeCommandListUpdateMutableCommandsExp if __use_win_types: _zeCommandListUpdateMutableCommandsExp_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_mutable_commands_exp_desc_t) ) else: _zeCommandListUpdateMutableCommandsExp_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_mutable_commands_exp_desc_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListUpdateMutableCommandSignalEventExp if __use_win_types: _zeCommandListUpdateMutableCommandSignalEventExp_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulonglong, ze_event_handle_t ) else: _zeCommandListUpdateMutableCommandSignalEventExp_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulonglong, ze_event_handle_t ) ############################################################################### ## @brief Function-pointer for zeCommandListUpdateMutableCommandWaitEventsExp if __use_win_types: _zeCommandListUpdateMutableCommandWaitEventsExp_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulonglong, c_ulong, POINTER(ze_event_handle_t) ) else: _zeCommandListUpdateMutableCommandWaitEventsExp_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulonglong, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeCommandListGetNextCommandIdWithKernelsExp if __use_win_types: _zeCommandListGetNextCommandIdWithKernelsExp_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_mutable_command_id_exp_desc_t), c_ulong, POINTER(ze_kernel_handle_t), POINTER(c_ulonglong) ) else: _zeCommandListGetNextCommandIdWithKernelsExp_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, POINTER(ze_mutable_command_id_exp_desc_t), c_ulong, POINTER(ze_kernel_handle_t), POINTER(c_ulonglong) ) ############################################################################### ## @brief Function-pointer for zeCommandListUpdateMutableCommandKernelsExp if __use_win_types: _zeCommandListUpdateMutableCommandKernelsExp_t = WINFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(c_ulonglong), POINTER(ze_kernel_handle_t) ) else: _zeCommandListUpdateMutableCommandKernelsExp_t = CFUNCTYPE( ze_result_t, ze_command_list_handle_t, c_ulong, POINTER(c_ulonglong), POINTER(ze_kernel_handle_t) ) ############################################################################### ## @brief Table of CommandListExp functions pointers class _ze_command_list_exp_dditable_t(Structure): _fields_ = [ ("pfnCreateCloneExp", c_void_p), ## _zeCommandListCreateCloneExp_t ("pfnImmediateAppendCommandListsExp", c_void_p), ## _zeCommandListImmediateAppendCommandListsExp_t ("pfnGetNextCommandIdExp", c_void_p), ## _zeCommandListGetNextCommandIdExp_t ("pfnUpdateMutableCommandsExp", c_void_p), ## _zeCommandListUpdateMutableCommandsExp_t ("pfnUpdateMutableCommandSignalEventExp", c_void_p), ## _zeCommandListUpdateMutableCommandSignalEventExp_t ("pfnUpdateMutableCommandWaitEventsExp", c_void_p), ## _zeCommandListUpdateMutableCommandWaitEventsExp_t ("pfnGetNextCommandIdWithKernelsExp", c_void_p), ## _zeCommandListGetNextCommandIdWithKernelsExp_t ("pfnUpdateMutableCommandKernelsExp", c_void_p) ## _zeCommandListUpdateMutableCommandKernelsExp_t ] ############################################################################### ## @brief Function-pointer for zeImageGetProperties if __use_win_types: _zeImageGetProperties_t = WINFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_image_desc_t), POINTER(ze_image_properties_t) ) else: _zeImageGetProperties_t = CFUNCTYPE( ze_result_t, ze_device_handle_t, POINTER(ze_image_desc_t), POINTER(ze_image_properties_t) ) ############################################################################### ## @brief Function-pointer for zeImageCreate if __use_win_types: _zeImageCreate_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_image_desc_t), POINTER(ze_image_handle_t) ) else: _zeImageCreate_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_image_desc_t), POINTER(ze_image_handle_t) ) ############################################################################### ## @brief Function-pointer for zeImageDestroy if __use_win_types: _zeImageDestroy_t = WINFUNCTYPE( ze_result_t, ze_image_handle_t ) else: _zeImageDestroy_t = CFUNCTYPE( ze_result_t, ze_image_handle_t ) ############################################################################### ## @brief Function-pointer for zeImageGetAllocPropertiesExt if __use_win_types: _zeImageGetAllocPropertiesExt_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_image_handle_t, POINTER(ze_image_allocation_ext_properties_t) ) else: _zeImageGetAllocPropertiesExt_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_image_handle_t, POINTER(ze_image_allocation_ext_properties_t) ) ############################################################################### ## @brief Function-pointer for zeImageViewCreateExt if __use_win_types: _zeImageViewCreateExt_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_image_desc_t), ze_image_handle_t, POINTER(ze_image_handle_t) ) else: _zeImageViewCreateExt_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_image_desc_t), ze_image_handle_t, POINTER(ze_image_handle_t) ) ############################################################################### ## @brief Table of Image functions pointers class _ze_image_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zeImageGetProperties_t ("pfnCreate", c_void_p), ## _zeImageCreate_t ("pfnDestroy", c_void_p), ## _zeImageDestroy_t ("pfnGetAllocPropertiesExt", c_void_p), ## _zeImageGetAllocPropertiesExt_t ("pfnViewCreateExt", c_void_p) ## _zeImageViewCreateExt_t ] ############################################################################### ## @brief Function-pointer for zeImageGetMemoryPropertiesExp if __use_win_types: _zeImageGetMemoryPropertiesExp_t = WINFUNCTYPE( ze_result_t, ze_image_handle_t, POINTER(ze_image_memory_properties_exp_t) ) else: _zeImageGetMemoryPropertiesExp_t = CFUNCTYPE( ze_result_t, ze_image_handle_t, POINTER(ze_image_memory_properties_exp_t) ) ############################################################################### ## @brief Function-pointer for zeImageViewCreateExp if __use_win_types: _zeImageViewCreateExp_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_image_desc_t), ze_image_handle_t, POINTER(ze_image_handle_t) ) else: _zeImageViewCreateExp_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_image_desc_t), ze_image_handle_t, POINTER(ze_image_handle_t) ) ############################################################################### ## @brief Function-pointer for zeImageGetDeviceOffsetExp if __use_win_types: _zeImageGetDeviceOffsetExp_t = WINFUNCTYPE( ze_result_t, ze_image_handle_t, POINTER(c_ulonglong) ) else: _zeImageGetDeviceOffsetExp_t = CFUNCTYPE( ze_result_t, ze_image_handle_t, POINTER(c_ulonglong) ) ############################################################################### ## @brief Table of ImageExp functions pointers class _ze_image_exp_dditable_t(Structure): _fields_ = [ ("pfnGetMemoryPropertiesExp", c_void_p), ## _zeImageGetMemoryPropertiesExp_t ("pfnViewCreateExp", c_void_p), ## _zeImageViewCreateExp_t ("pfnGetDeviceOffsetExp", c_void_p) ## _zeImageGetDeviceOffsetExp_t ] ############################################################################### ## @brief Function-pointer for zeMemAllocShared if __use_win_types: _zeMemAllocShared_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, POINTER(ze_device_mem_alloc_desc_t), POINTER(ze_host_mem_alloc_desc_t), c_size_t, c_size_t, ze_device_handle_t, POINTER(c_void_p) ) else: _zeMemAllocShared_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, POINTER(ze_device_mem_alloc_desc_t), POINTER(ze_host_mem_alloc_desc_t), c_size_t, c_size_t, ze_device_handle_t, POINTER(c_void_p) ) ############################################################################### ## @brief Function-pointer for zeMemAllocDevice if __use_win_types: _zeMemAllocDevice_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, POINTER(ze_device_mem_alloc_desc_t), c_size_t, c_size_t, ze_device_handle_t, POINTER(c_void_p) ) else: _zeMemAllocDevice_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, POINTER(ze_device_mem_alloc_desc_t), c_size_t, c_size_t, ze_device_handle_t, POINTER(c_void_p) ) ############################################################################### ## @brief Function-pointer for zeMemAllocHost if __use_win_types: _zeMemAllocHost_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, POINTER(ze_host_mem_alloc_desc_t), c_size_t, c_size_t, POINTER(c_void_p) ) else: _zeMemAllocHost_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, POINTER(ze_host_mem_alloc_desc_t), c_size_t, c_size_t, POINTER(c_void_p) ) ############################################################################### ## @brief Function-pointer for zeMemFree if __use_win_types: _zeMemFree_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p ) else: _zeMemFree_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p ) ############################################################################### ## @brief Function-pointer for zeMemGetAllocProperties if __use_win_types: _zeMemGetAllocProperties_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, POINTER(ze_memory_allocation_properties_t), POINTER(ze_device_handle_t) ) else: _zeMemGetAllocProperties_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, POINTER(ze_memory_allocation_properties_t), POINTER(ze_device_handle_t) ) ############################################################################### ## @brief Function-pointer for zeMemGetAddressRange if __use_win_types: _zeMemGetAddressRange_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, POINTER(c_void_p), POINTER(c_size_t) ) else: _zeMemGetAddressRange_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, POINTER(c_void_p), POINTER(c_size_t) ) ############################################################################### ## @brief Function-pointer for zeMemGetIpcHandle if __use_win_types: _zeMemGetIpcHandle_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, POINTER(ze_ipc_mem_handle_t) ) else: _zeMemGetIpcHandle_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, POINTER(ze_ipc_mem_handle_t) ) ############################################################################### ## @brief Function-pointer for zeMemOpenIpcHandle if __use_win_types: _zeMemOpenIpcHandle_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, ze_ipc_mem_handle_t, ze_ipc_memory_flags_t, POINTER(c_void_p) ) else: _zeMemOpenIpcHandle_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, ze_ipc_mem_handle_t, ze_ipc_memory_flags_t, POINTER(c_void_p) ) ############################################################################### ## @brief Function-pointer for zeMemCloseIpcHandle if __use_win_types: _zeMemCloseIpcHandle_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p ) else: _zeMemCloseIpcHandle_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p ) ############################################################################### ## @brief Function-pointer for zeMemFreeExt if __use_win_types: _zeMemFreeExt_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, POINTER(ze_memory_free_ext_desc_t), c_void_p ) else: _zeMemFreeExt_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, POINTER(ze_memory_free_ext_desc_t), c_void_p ) ############################################################################### ## @brief Function-pointer for zeMemPutIpcHandle if __use_win_types: _zeMemPutIpcHandle_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_ipc_mem_handle_t ) else: _zeMemPutIpcHandle_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_ipc_mem_handle_t ) ############################################################################### ## @brief Function-pointer for zeMemGetPitchFor2dImage if __use_win_types: _zeMemGetPitchFor2dImage_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, c_size_t, c_size_t, c_int, * ) else: _zeMemGetPitchFor2dImage_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, c_size_t, c_size_t, c_int, * ) ############################################################################### ## @brief Table of Mem functions pointers class _ze_mem_dditable_t(Structure): _fields_ = [ ("pfnAllocShared", c_void_p), ## _zeMemAllocShared_t ("pfnAllocDevice", c_void_p), ## _zeMemAllocDevice_t ("pfnAllocHost", c_void_p), ## _zeMemAllocHost_t ("pfnFree", c_void_p), ## _zeMemFree_t ("pfnGetAllocProperties", c_void_p), ## _zeMemGetAllocProperties_t ("pfnGetAddressRange", c_void_p), ## _zeMemGetAddressRange_t ("pfnGetIpcHandle", c_void_p), ## _zeMemGetIpcHandle_t ("pfnOpenIpcHandle", c_void_p), ## _zeMemOpenIpcHandle_t ("pfnCloseIpcHandle", c_void_p), ## _zeMemCloseIpcHandle_t ("pfnFreeExt", c_void_p), ## _zeMemFreeExt_t ("pfnPutIpcHandle", c_void_p), ## _zeMemPutIpcHandle_t ("pfnGetPitchFor2dImage", c_void_p) ## _zeMemGetPitchFor2dImage_t ] ############################################################################### ## @brief Function-pointer for zeMemGetIpcHandleFromFileDescriptorExp if __use_win_types: _zeMemGetIpcHandleFromFileDescriptorExp_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, c_ulonglong, POINTER(ze_ipc_mem_handle_t) ) else: _zeMemGetIpcHandleFromFileDescriptorExp_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, c_ulonglong, POINTER(ze_ipc_mem_handle_t) ) ############################################################################### ## @brief Function-pointer for zeMemGetFileDescriptorFromIpcHandleExp if __use_win_types: _zeMemGetFileDescriptorFromIpcHandleExp_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_ipc_mem_handle_t, POINTER(c_ulonglong) ) else: _zeMemGetFileDescriptorFromIpcHandleExp_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_ipc_mem_handle_t, POINTER(c_ulonglong) ) ############################################################################### ## @brief Function-pointer for zeMemSetAtomicAccessAttributeExp if __use_win_types: _zeMemSetAtomicAccessAttributeExp_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, c_void_p, c_size_t, ze_memory_atomic_attr_exp_flags_t ) else: _zeMemSetAtomicAccessAttributeExp_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, c_void_p, c_size_t, ze_memory_atomic_attr_exp_flags_t ) ############################################################################### ## @brief Function-pointer for zeMemGetAtomicAccessAttributeExp if __use_win_types: _zeMemGetAtomicAccessAttributeExp_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, c_void_p, c_size_t, POINTER(ze_memory_atomic_attr_exp_flags_t) ) else: _zeMemGetAtomicAccessAttributeExp_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, c_void_p, c_size_t, POINTER(ze_memory_atomic_attr_exp_flags_t) ) ############################################################################### ## @brief Table of MemExp functions pointers class _ze_mem_exp_dditable_t(Structure): _fields_ = [ ("pfnGetIpcHandleFromFileDescriptorExp", c_void_p), ## _zeMemGetIpcHandleFromFileDescriptorExp_t ("pfnGetFileDescriptorFromIpcHandleExp", c_void_p), ## _zeMemGetFileDescriptorFromIpcHandleExp_t ("pfnSetAtomicAccessAttributeExp", c_void_p), ## _zeMemSetAtomicAccessAttributeExp_t ("pfnGetAtomicAccessAttributeExp", c_void_p) ## _zeMemGetAtomicAccessAttributeExp_t ] ############################################################################### ## @brief Function-pointer for zeFenceCreate if __use_win_types: _zeFenceCreate_t = WINFUNCTYPE( ze_result_t, ze_command_queue_handle_t, POINTER(ze_fence_desc_t), POINTER(ze_fence_handle_t) ) else: _zeFenceCreate_t = CFUNCTYPE( ze_result_t, ze_command_queue_handle_t, POINTER(ze_fence_desc_t), POINTER(ze_fence_handle_t) ) ############################################################################### ## @brief Function-pointer for zeFenceDestroy if __use_win_types: _zeFenceDestroy_t = WINFUNCTYPE( ze_result_t, ze_fence_handle_t ) else: _zeFenceDestroy_t = CFUNCTYPE( ze_result_t, ze_fence_handle_t ) ############################################################################### ## @brief Function-pointer for zeFenceHostSynchronize if __use_win_types: _zeFenceHostSynchronize_t = WINFUNCTYPE( ze_result_t, ze_fence_handle_t, c_ulonglong ) else: _zeFenceHostSynchronize_t = CFUNCTYPE( ze_result_t, ze_fence_handle_t, c_ulonglong ) ############################################################################### ## @brief Function-pointer for zeFenceQueryStatus if __use_win_types: _zeFenceQueryStatus_t = WINFUNCTYPE( ze_result_t, ze_fence_handle_t ) else: _zeFenceQueryStatus_t = CFUNCTYPE( ze_result_t, ze_fence_handle_t ) ############################################################################### ## @brief Function-pointer for zeFenceReset if __use_win_types: _zeFenceReset_t = WINFUNCTYPE( ze_result_t, ze_fence_handle_t ) else: _zeFenceReset_t = CFUNCTYPE( ze_result_t, ze_fence_handle_t ) ############################################################################### ## @brief Table of Fence functions pointers class _ze_fence_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zeFenceCreate_t ("pfnDestroy", c_void_p), ## _zeFenceDestroy_t ("pfnHostSynchronize", c_void_p), ## _zeFenceHostSynchronize_t ("pfnQueryStatus", c_void_p), ## _zeFenceQueryStatus_t ("pfnReset", c_void_p) ## _zeFenceReset_t ] ############################################################################### ## @brief Function-pointer for zeEventPoolCreate if __use_win_types: _zeEventPoolCreate_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, POINTER(ze_event_pool_desc_t), c_ulong, POINTER(ze_device_handle_t), POINTER(ze_event_pool_handle_t) ) else: _zeEventPoolCreate_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, POINTER(ze_event_pool_desc_t), c_ulong, POINTER(ze_device_handle_t), POINTER(ze_event_pool_handle_t) ) ############################################################################### ## @brief Function-pointer for zeEventPoolDestroy if __use_win_types: _zeEventPoolDestroy_t = WINFUNCTYPE( ze_result_t, ze_event_pool_handle_t ) else: _zeEventPoolDestroy_t = CFUNCTYPE( ze_result_t, ze_event_pool_handle_t ) ############################################################################### ## @brief Function-pointer for zeEventPoolGetIpcHandle if __use_win_types: _zeEventPoolGetIpcHandle_t = WINFUNCTYPE( ze_result_t, ze_event_pool_handle_t, POINTER(ze_ipc_event_pool_handle_t) ) else: _zeEventPoolGetIpcHandle_t = CFUNCTYPE( ze_result_t, ze_event_pool_handle_t, POINTER(ze_ipc_event_pool_handle_t) ) ############################################################################### ## @brief Function-pointer for zeEventPoolOpenIpcHandle if __use_win_types: _zeEventPoolOpenIpcHandle_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_ipc_event_pool_handle_t, POINTER(ze_event_pool_handle_t) ) else: _zeEventPoolOpenIpcHandle_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_ipc_event_pool_handle_t, POINTER(ze_event_pool_handle_t) ) ############################################################################### ## @brief Function-pointer for zeEventPoolCloseIpcHandle if __use_win_types: _zeEventPoolCloseIpcHandle_t = WINFUNCTYPE( ze_result_t, ze_event_pool_handle_t ) else: _zeEventPoolCloseIpcHandle_t = CFUNCTYPE( ze_result_t, ze_event_pool_handle_t ) ############################################################################### ## @brief Function-pointer for zeEventPoolPutIpcHandle if __use_win_types: _zeEventPoolPutIpcHandle_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_ipc_event_pool_handle_t ) else: _zeEventPoolPutIpcHandle_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_ipc_event_pool_handle_t ) ############################################################################### ## @brief Function-pointer for zeEventPoolGetContextHandle if __use_win_types: _zeEventPoolGetContextHandle_t = WINFUNCTYPE( ze_result_t, ze_event_pool_handle_t, POINTER(ze_context_handle_t) ) else: _zeEventPoolGetContextHandle_t = CFUNCTYPE( ze_result_t, ze_event_pool_handle_t, POINTER(ze_context_handle_t) ) ############################################################################### ## @brief Function-pointer for zeEventPoolGetFlags if __use_win_types: _zeEventPoolGetFlags_t = WINFUNCTYPE( ze_result_t, ze_event_pool_handle_t, POINTER(ze_event_pool_flags_t) ) else: _zeEventPoolGetFlags_t = CFUNCTYPE( ze_result_t, ze_event_pool_handle_t, POINTER(ze_event_pool_flags_t) ) ############################################################################### ## @brief Table of EventPool functions pointers class _ze_event_pool_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zeEventPoolCreate_t ("pfnDestroy", c_void_p), ## _zeEventPoolDestroy_t ("pfnGetIpcHandle", c_void_p), ## _zeEventPoolGetIpcHandle_t ("pfnOpenIpcHandle", c_void_p), ## _zeEventPoolOpenIpcHandle_t ("pfnCloseIpcHandle", c_void_p), ## _zeEventPoolCloseIpcHandle_t ("pfnPutIpcHandle", c_void_p), ## _zeEventPoolPutIpcHandle_t ("pfnGetContextHandle", c_void_p), ## _zeEventPoolGetContextHandle_t ("pfnGetFlags", c_void_p) ## _zeEventPoolGetFlags_t ] ############################################################################### ## @brief Function-pointer for zeEventCreate if __use_win_types: _zeEventCreate_t = WINFUNCTYPE( ze_result_t, ze_event_pool_handle_t, POINTER(ze_event_desc_t), POINTER(ze_event_handle_t) ) else: _zeEventCreate_t = CFUNCTYPE( ze_result_t, ze_event_pool_handle_t, POINTER(ze_event_desc_t), POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zeEventDestroy if __use_win_types: _zeEventDestroy_t = WINFUNCTYPE( ze_result_t, ze_event_handle_t ) else: _zeEventDestroy_t = CFUNCTYPE( ze_result_t, ze_event_handle_t ) ############################################################################### ## @brief Function-pointer for zeEventHostSignal if __use_win_types: _zeEventHostSignal_t = WINFUNCTYPE( ze_result_t, ze_event_handle_t ) else: _zeEventHostSignal_t = CFUNCTYPE( ze_result_t, ze_event_handle_t ) ############################################################################### ## @brief Function-pointer for zeEventHostSynchronize if __use_win_types: _zeEventHostSynchronize_t = WINFUNCTYPE( ze_result_t, ze_event_handle_t, c_ulonglong ) else: _zeEventHostSynchronize_t = CFUNCTYPE( ze_result_t, ze_event_handle_t, c_ulonglong ) ############################################################################### ## @brief Function-pointer for zeEventQueryStatus if __use_win_types: _zeEventQueryStatus_t = WINFUNCTYPE( ze_result_t, ze_event_handle_t ) else: _zeEventQueryStatus_t = CFUNCTYPE( ze_result_t, ze_event_handle_t ) ############################################################################### ## @brief Function-pointer for zeEventHostReset if __use_win_types: _zeEventHostReset_t = WINFUNCTYPE( ze_result_t, ze_event_handle_t ) else: _zeEventHostReset_t = CFUNCTYPE( ze_result_t, ze_event_handle_t ) ############################################################################### ## @brief Function-pointer for zeEventQueryKernelTimestamp if __use_win_types: _zeEventQueryKernelTimestamp_t = WINFUNCTYPE( ze_result_t, ze_event_handle_t, POINTER(ze_kernel_timestamp_result_t) ) else: _zeEventQueryKernelTimestamp_t = CFUNCTYPE( ze_result_t, ze_event_handle_t, POINTER(ze_kernel_timestamp_result_t) ) ############################################################################### ## @brief Function-pointer for zeEventQueryKernelTimestampsExt if __use_win_types: _zeEventQueryKernelTimestampsExt_t = WINFUNCTYPE( ze_result_t, ze_event_handle_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_event_query_kernel_timestamps_results_ext_properties_t) ) else: _zeEventQueryKernelTimestampsExt_t = CFUNCTYPE( ze_result_t, ze_event_handle_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_event_query_kernel_timestamps_results_ext_properties_t) ) ############################################################################### ## @brief Function-pointer for zeEventGetEventPool if __use_win_types: _zeEventGetEventPool_t = WINFUNCTYPE( ze_result_t, ze_event_handle_t, POINTER(ze_event_pool_handle_t) ) else: _zeEventGetEventPool_t = CFUNCTYPE( ze_result_t, ze_event_handle_t, POINTER(ze_event_pool_handle_t) ) ############################################################################### ## @brief Function-pointer for zeEventGetSignalScope if __use_win_types: _zeEventGetSignalScope_t = WINFUNCTYPE( ze_result_t, ze_event_handle_t, POINTER(ze_event_scope_flags_t) ) else: _zeEventGetSignalScope_t = CFUNCTYPE( ze_result_t, ze_event_handle_t, POINTER(ze_event_scope_flags_t) ) ############################################################################### ## @brief Function-pointer for zeEventGetWaitScope if __use_win_types: _zeEventGetWaitScope_t = WINFUNCTYPE( ze_result_t, ze_event_handle_t, POINTER(ze_event_scope_flags_t) ) else: _zeEventGetWaitScope_t = CFUNCTYPE( ze_result_t, ze_event_handle_t, POINTER(ze_event_scope_flags_t) ) ############################################################################### ## @brief Table of Event functions pointers class _ze_event_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zeEventCreate_t ("pfnDestroy", c_void_p), ## _zeEventDestroy_t ("pfnHostSignal", c_void_p), ## _zeEventHostSignal_t ("pfnHostSynchronize", c_void_p), ## _zeEventHostSynchronize_t ("pfnQueryStatus", c_void_p), ## _zeEventQueryStatus_t ("pfnHostReset", c_void_p), ## _zeEventHostReset_t ("pfnQueryKernelTimestamp", c_void_p), ## _zeEventQueryKernelTimestamp_t ("pfnQueryKernelTimestampsExt", c_void_p), ## _zeEventQueryKernelTimestampsExt_t ("pfnGetEventPool", c_void_p), ## _zeEventGetEventPool_t ("pfnGetSignalScope", c_void_p), ## _zeEventGetSignalScope_t ("pfnGetWaitScope", c_void_p) ## _zeEventGetWaitScope_t ] ############################################################################### ## @brief Function-pointer for zeEventQueryTimestampsExp if __use_win_types: _zeEventQueryTimestampsExp_t = WINFUNCTYPE( ze_result_t, ze_event_handle_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_kernel_timestamp_result_t) ) else: _zeEventQueryTimestampsExp_t = CFUNCTYPE( ze_result_t, ze_event_handle_t, ze_device_handle_t, POINTER(c_ulong), POINTER(ze_kernel_timestamp_result_t) ) ############################################################################### ## @brief Table of EventExp functions pointers class _ze_event_exp_dditable_t(Structure): _fields_ = [ ("pfnQueryTimestampsExp", c_void_p) ## _zeEventQueryTimestampsExp_t ] ############################################################################### ## @brief Function-pointer for zeModuleCreate if __use_win_types: _zeModuleCreate_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_module_desc_t), POINTER(ze_module_handle_t), POINTER(ze_module_build_log_handle_t) ) else: _zeModuleCreate_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_module_desc_t), POINTER(ze_module_handle_t), POINTER(ze_module_build_log_handle_t) ) ############################################################################### ## @brief Function-pointer for zeModuleDestroy if __use_win_types: _zeModuleDestroy_t = WINFUNCTYPE( ze_result_t, ze_module_handle_t ) else: _zeModuleDestroy_t = CFUNCTYPE( ze_result_t, ze_module_handle_t ) ############################################################################### ## @brief Function-pointer for zeModuleDynamicLink if __use_win_types: _zeModuleDynamicLink_t = WINFUNCTYPE( ze_result_t, c_ulong, POINTER(ze_module_handle_t), POINTER(ze_module_build_log_handle_t) ) else: _zeModuleDynamicLink_t = CFUNCTYPE( ze_result_t, c_ulong, POINTER(ze_module_handle_t), POINTER(ze_module_build_log_handle_t) ) ############################################################################### ## @brief Function-pointer for zeModuleGetNativeBinary if __use_win_types: _zeModuleGetNativeBinary_t = WINFUNCTYPE( ze_result_t, ze_module_handle_t, POINTER(c_size_t), POINTER(c_ubyte) ) else: _zeModuleGetNativeBinary_t = CFUNCTYPE( ze_result_t, ze_module_handle_t, POINTER(c_size_t), POINTER(c_ubyte) ) ############################################################################### ## @brief Function-pointer for zeModuleGetGlobalPointer if __use_win_types: _zeModuleGetGlobalPointer_t = WINFUNCTYPE( ze_result_t, ze_module_handle_t, c_char_p, POINTER(c_size_t), POINTER(c_void_p) ) else: _zeModuleGetGlobalPointer_t = CFUNCTYPE( ze_result_t, ze_module_handle_t, c_char_p, POINTER(c_size_t), POINTER(c_void_p) ) ############################################################################### ## @brief Function-pointer for zeModuleGetKernelNames if __use_win_types: _zeModuleGetKernelNames_t = WINFUNCTYPE( ze_result_t, ze_module_handle_t, POINTER(c_ulong), POINTER(c_char_p) ) else: _zeModuleGetKernelNames_t = CFUNCTYPE( ze_result_t, ze_module_handle_t, POINTER(c_ulong), POINTER(c_char_p) ) ############################################################################### ## @brief Function-pointer for zeModuleGetProperties if __use_win_types: _zeModuleGetProperties_t = WINFUNCTYPE( ze_result_t, ze_module_handle_t, POINTER(ze_module_properties_t) ) else: _zeModuleGetProperties_t = CFUNCTYPE( ze_result_t, ze_module_handle_t, POINTER(ze_module_properties_t) ) ############################################################################### ## @brief Function-pointer for zeModuleGetFunctionPointer if __use_win_types: _zeModuleGetFunctionPointer_t = WINFUNCTYPE( ze_result_t, ze_module_handle_t, c_char_p, POINTER(c_void_p) ) else: _zeModuleGetFunctionPointer_t = CFUNCTYPE( ze_result_t, ze_module_handle_t, c_char_p, POINTER(c_void_p) ) ############################################################################### ## @brief Function-pointer for zeModuleInspectLinkageExt if __use_win_types: _zeModuleInspectLinkageExt_t = WINFUNCTYPE( ze_result_t, POINTER(ze_linkage_inspection_ext_desc_t), c_ulong, POINTER(ze_module_handle_t), POINTER(ze_module_build_log_handle_t) ) else: _zeModuleInspectLinkageExt_t = CFUNCTYPE( ze_result_t, POINTER(ze_linkage_inspection_ext_desc_t), c_ulong, POINTER(ze_module_handle_t), POINTER(ze_module_build_log_handle_t) ) ############################################################################### ## @brief Table of Module functions pointers class _ze_module_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zeModuleCreate_t ("pfnDestroy", c_void_p), ## _zeModuleDestroy_t ("pfnDynamicLink", c_void_p), ## _zeModuleDynamicLink_t ("pfnGetNativeBinary", c_void_p), ## _zeModuleGetNativeBinary_t ("pfnGetGlobalPointer", c_void_p), ## _zeModuleGetGlobalPointer_t ("pfnGetKernelNames", c_void_p), ## _zeModuleGetKernelNames_t ("pfnGetProperties", c_void_p), ## _zeModuleGetProperties_t ("pfnGetFunctionPointer", c_void_p), ## _zeModuleGetFunctionPointer_t ("pfnInspectLinkageExt", c_void_p) ## _zeModuleInspectLinkageExt_t ] ############################################################################### ## @brief Function-pointer for zeModuleBuildLogDestroy if __use_win_types: _zeModuleBuildLogDestroy_t = WINFUNCTYPE( ze_result_t, ze_module_build_log_handle_t ) else: _zeModuleBuildLogDestroy_t = CFUNCTYPE( ze_result_t, ze_module_build_log_handle_t ) ############################################################################### ## @brief Function-pointer for zeModuleBuildLogGetString if __use_win_types: _zeModuleBuildLogGetString_t = WINFUNCTYPE( ze_result_t, ze_module_build_log_handle_t, POINTER(c_size_t), c_char_p ) else: _zeModuleBuildLogGetString_t = CFUNCTYPE( ze_result_t, ze_module_build_log_handle_t, POINTER(c_size_t), c_char_p ) ############################################################################### ## @brief Table of ModuleBuildLog functions pointers class _ze_module_build_log_dditable_t(Structure): _fields_ = [ ("pfnDestroy", c_void_p), ## _zeModuleBuildLogDestroy_t ("pfnGetString", c_void_p) ## _zeModuleBuildLogGetString_t ] ############################################################################### ## @brief Function-pointer for zeKernelCreate if __use_win_types: _zeKernelCreate_t = WINFUNCTYPE( ze_result_t, ze_module_handle_t, POINTER(ze_kernel_desc_t), POINTER(ze_kernel_handle_t) ) else: _zeKernelCreate_t = CFUNCTYPE( ze_result_t, ze_module_handle_t, POINTER(ze_kernel_desc_t), POINTER(ze_kernel_handle_t) ) ############################################################################### ## @brief Function-pointer for zeKernelDestroy if __use_win_types: _zeKernelDestroy_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t ) else: _zeKernelDestroy_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t ) ############################################################################### ## @brief Function-pointer for zeKernelSetCacheConfig if __use_win_types: _zeKernelSetCacheConfig_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, ze_cache_config_flags_t ) else: _zeKernelSetCacheConfig_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, ze_cache_config_flags_t ) ############################################################################### ## @brief Function-pointer for zeKernelSetGroupSize if __use_win_types: _zeKernelSetGroupSize_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, c_ulong, c_ulong, c_ulong ) else: _zeKernelSetGroupSize_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, c_ulong, c_ulong, c_ulong ) ############################################################################### ## @brief Function-pointer for zeKernelSuggestGroupSize if __use_win_types: _zeKernelSuggestGroupSize_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, c_ulong, c_ulong, c_ulong, POINTER(c_ulong), POINTER(c_ulong), POINTER(c_ulong) ) else: _zeKernelSuggestGroupSize_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, c_ulong, c_ulong, c_ulong, POINTER(c_ulong), POINTER(c_ulong), POINTER(c_ulong) ) ############################################################################### ## @brief Function-pointer for zeKernelSuggestMaxCooperativeGroupCount if __use_win_types: _zeKernelSuggestMaxCooperativeGroupCount_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(c_ulong) ) else: _zeKernelSuggestMaxCooperativeGroupCount_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(c_ulong) ) ############################################################################### ## @brief Function-pointer for zeKernelSetArgumentValue if __use_win_types: _zeKernelSetArgumentValue_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, c_ulong, c_size_t, c_void_p ) else: _zeKernelSetArgumentValue_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, c_ulong, c_size_t, c_void_p ) ############################################################################### ## @brief Function-pointer for zeKernelSetIndirectAccess if __use_win_types: _zeKernelSetIndirectAccess_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, ze_kernel_indirect_access_flags_t ) else: _zeKernelSetIndirectAccess_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, ze_kernel_indirect_access_flags_t ) ############################################################################### ## @brief Function-pointer for zeKernelGetIndirectAccess if __use_win_types: _zeKernelGetIndirectAccess_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(ze_kernel_indirect_access_flags_t) ) else: _zeKernelGetIndirectAccess_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(ze_kernel_indirect_access_flags_t) ) ############################################################################### ## @brief Function-pointer for zeKernelGetSourceAttributes if __use_win_types: _zeKernelGetSourceAttributes_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(c_ulong), POINTER(c_char_p) ) else: _zeKernelGetSourceAttributes_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(c_ulong), POINTER(c_char_p) ) ############################################################################### ## @brief Function-pointer for zeKernelGetProperties if __use_win_types: _zeKernelGetProperties_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(ze_kernel_properties_t) ) else: _zeKernelGetProperties_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(ze_kernel_properties_t) ) ############################################################################### ## @brief Function-pointer for zeKernelGetName if __use_win_types: _zeKernelGetName_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(c_size_t), c_char_p ) else: _zeKernelGetName_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(c_size_t), c_char_p ) ############################################################################### ## @brief Table of Kernel functions pointers class _ze_kernel_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zeKernelCreate_t ("pfnDestroy", c_void_p), ## _zeKernelDestroy_t ("pfnSetCacheConfig", c_void_p), ## _zeKernelSetCacheConfig_t ("pfnSetGroupSize", c_void_p), ## _zeKernelSetGroupSize_t ("pfnSuggestGroupSize", c_void_p), ## _zeKernelSuggestGroupSize_t ("pfnSuggestMaxCooperativeGroupCount", c_void_p), ## _zeKernelSuggestMaxCooperativeGroupCount_t ("pfnSetArgumentValue", c_void_p), ## _zeKernelSetArgumentValue_t ("pfnSetIndirectAccess", c_void_p), ## _zeKernelSetIndirectAccess_t ("pfnGetIndirectAccess", c_void_p), ## _zeKernelGetIndirectAccess_t ("pfnGetSourceAttributes", c_void_p), ## _zeKernelGetSourceAttributes_t ("pfnGetProperties", c_void_p), ## _zeKernelGetProperties_t ("pfnGetName", c_void_p) ## _zeKernelGetName_t ] ############################################################################### ## @brief Function-pointer for zeKernelSetGlobalOffsetExp if __use_win_types: _zeKernelSetGlobalOffsetExp_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, c_ulong, c_ulong, c_ulong ) else: _zeKernelSetGlobalOffsetExp_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, c_ulong, c_ulong, c_ulong ) ############################################################################### ## @brief Function-pointer for zeKernelSchedulingHintExp if __use_win_types: _zeKernelSchedulingHintExp_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(ze_scheduling_hint_exp_desc_t) ) else: _zeKernelSchedulingHintExp_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(ze_scheduling_hint_exp_desc_t) ) ############################################################################### ## @brief Function-pointer for zeKernelGetBinaryExp if __use_win_types: _zeKernelGetBinaryExp_t = WINFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(c_size_t), POINTER(c_ubyte) ) else: _zeKernelGetBinaryExp_t = CFUNCTYPE( ze_result_t, ze_kernel_handle_t, POINTER(c_size_t), POINTER(c_ubyte) ) ############################################################################### ## @brief Table of KernelExp functions pointers class _ze_kernel_exp_dditable_t(Structure): _fields_ = [ ("pfnSetGlobalOffsetExp", c_void_p), ## _zeKernelSetGlobalOffsetExp_t ("pfnSchedulingHintExp", c_void_p), ## _zeKernelSchedulingHintExp_t ("pfnGetBinaryExp", c_void_p) ## _zeKernelGetBinaryExp_t ] ############################################################################### ## @brief Function-pointer for zeSamplerCreate if __use_win_types: _zeSamplerCreate_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_sampler_desc_t), POINTER(ze_sampler_handle_t) ) else: _zeSamplerCreate_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_sampler_desc_t), POINTER(ze_sampler_handle_t) ) ############################################################################### ## @brief Function-pointer for zeSamplerDestroy if __use_win_types: _zeSamplerDestroy_t = WINFUNCTYPE( ze_result_t, ze_sampler_handle_t ) else: _zeSamplerDestroy_t = CFUNCTYPE( ze_result_t, ze_sampler_handle_t ) ############################################################################### ## @brief Table of Sampler functions pointers class _ze_sampler_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zeSamplerCreate_t ("pfnDestroy", c_void_p) ## _zeSamplerDestroy_t ] ############################################################################### ## @brief Function-pointer for zePhysicalMemCreate if __use_win_types: _zePhysicalMemCreate_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_physical_mem_desc_t), POINTER(ze_physical_mem_handle_t) ) else: _zePhysicalMemCreate_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, POINTER(ze_physical_mem_desc_t), POINTER(ze_physical_mem_handle_t) ) ############################################################################### ## @brief Function-pointer for zePhysicalMemDestroy if __use_win_types: _zePhysicalMemDestroy_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_physical_mem_handle_t ) else: _zePhysicalMemDestroy_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_physical_mem_handle_t ) ############################################################################### ## @brief Table of PhysicalMem functions pointers class _ze_physical_mem_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zePhysicalMemCreate_t ("pfnDestroy", c_void_p) ## _zePhysicalMemDestroy_t ] ############################################################################### ## @brief Function-pointer for zeVirtualMemReserve if __use_win_types: _zeVirtualMemReserve_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, c_size_t, POINTER(c_void_p) ) else: _zeVirtualMemReserve_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, c_size_t, POINTER(c_void_p) ) ############################################################################### ## @brief Function-pointer for zeVirtualMemFree if __use_win_types: _zeVirtualMemFree_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, c_size_t ) else: _zeVirtualMemFree_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, c_size_t ) ############################################################################### ## @brief Function-pointer for zeVirtualMemQueryPageSize if __use_win_types: _zeVirtualMemQueryPageSize_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, c_size_t, POINTER(c_size_t) ) else: _zeVirtualMemQueryPageSize_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, ze_device_handle_t, c_size_t, POINTER(c_size_t) ) ############################################################################### ## @brief Function-pointer for zeVirtualMemMap if __use_win_types: _zeVirtualMemMap_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, c_size_t, ze_physical_mem_handle_t, c_size_t, ze_memory_access_attribute_t ) else: _zeVirtualMemMap_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, c_size_t, ze_physical_mem_handle_t, c_size_t, ze_memory_access_attribute_t ) ############################################################################### ## @brief Function-pointer for zeVirtualMemUnmap if __use_win_types: _zeVirtualMemUnmap_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, c_size_t ) else: _zeVirtualMemUnmap_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, c_size_t ) ############################################################################### ## @brief Function-pointer for zeVirtualMemSetAccessAttribute if __use_win_types: _zeVirtualMemSetAccessAttribute_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, c_size_t, ze_memory_access_attribute_t ) else: _zeVirtualMemSetAccessAttribute_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, c_size_t, ze_memory_access_attribute_t ) ############################################################################### ## @brief Function-pointer for zeVirtualMemGetAccessAttribute if __use_win_types: _zeVirtualMemGetAccessAttribute_t = WINFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, c_size_t, POINTER(ze_memory_access_attribute_t), POINTER(c_size_t) ) else: _zeVirtualMemGetAccessAttribute_t = CFUNCTYPE( ze_result_t, ze_context_handle_t, c_void_p, c_size_t, POINTER(ze_memory_access_attribute_t), POINTER(c_size_t) ) ############################################################################### ## @brief Table of VirtualMem functions pointers class _ze_virtual_mem_dditable_t(Structure): _fields_ = [ ("pfnReserve", c_void_p), ## _zeVirtualMemReserve_t ("pfnFree", c_void_p), ## _zeVirtualMemFree_t ("pfnQueryPageSize", c_void_p), ## _zeVirtualMemQueryPageSize_t ("pfnMap", c_void_p), ## _zeVirtualMemMap_t ("pfnUnmap", c_void_p), ## _zeVirtualMemUnmap_t ("pfnSetAccessAttribute", c_void_p), ## _zeVirtualMemSetAccessAttribute_t ("pfnGetAccessAttribute", c_void_p) ## _zeVirtualMemGetAccessAttribute_t ] ############################################################################### ## @brief Function-pointer for zeFabricVertexGetExp if __use_win_types: _zeFabricVertexGetExp_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(c_ulong), POINTER(ze_fabric_vertex_handle_t) ) else: _zeFabricVertexGetExp_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, POINTER(c_ulong), POINTER(ze_fabric_vertex_handle_t) ) ############################################################################### ## @brief Function-pointer for zeFabricVertexGetSubVerticesExp if __use_win_types: _zeFabricVertexGetSubVerticesExp_t = WINFUNCTYPE( ze_result_t, ze_fabric_vertex_handle_t, POINTER(c_ulong), POINTER(ze_fabric_vertex_handle_t) ) else: _zeFabricVertexGetSubVerticesExp_t = CFUNCTYPE( ze_result_t, ze_fabric_vertex_handle_t, POINTER(c_ulong), POINTER(ze_fabric_vertex_handle_t) ) ############################################################################### ## @brief Function-pointer for zeFabricVertexGetPropertiesExp if __use_win_types: _zeFabricVertexGetPropertiesExp_t = WINFUNCTYPE( ze_result_t, ze_fabric_vertex_handle_t, POINTER(ze_fabric_vertex_exp_properties_t) ) else: _zeFabricVertexGetPropertiesExp_t = CFUNCTYPE( ze_result_t, ze_fabric_vertex_handle_t, POINTER(ze_fabric_vertex_exp_properties_t) ) ############################################################################### ## @brief Function-pointer for zeFabricVertexGetDeviceExp if __use_win_types: _zeFabricVertexGetDeviceExp_t = WINFUNCTYPE( ze_result_t, ze_fabric_vertex_handle_t, POINTER(ze_device_handle_t) ) else: _zeFabricVertexGetDeviceExp_t = CFUNCTYPE( ze_result_t, ze_fabric_vertex_handle_t, POINTER(ze_device_handle_t) ) ############################################################################### ## @brief Table of FabricVertexExp functions pointers class _ze_fabric_vertex_exp_dditable_t(Structure): _fields_ = [ ("pfnGetExp", c_void_p), ## _zeFabricVertexGetExp_t ("pfnGetSubVerticesExp", c_void_p), ## _zeFabricVertexGetSubVerticesExp_t ("pfnGetPropertiesExp", c_void_p), ## _zeFabricVertexGetPropertiesExp_t ("pfnGetDeviceExp", c_void_p) ## _zeFabricVertexGetDeviceExp_t ] ############################################################################### ## @brief Function-pointer for zeFabricEdgeGetExp if __use_win_types: _zeFabricEdgeGetExp_t = WINFUNCTYPE( ze_result_t, ze_fabric_vertex_handle_t, ze_fabric_vertex_handle_t, POINTER(c_ulong), POINTER(ze_fabric_edge_handle_t) ) else: _zeFabricEdgeGetExp_t = CFUNCTYPE( ze_result_t, ze_fabric_vertex_handle_t, ze_fabric_vertex_handle_t, POINTER(c_ulong), POINTER(ze_fabric_edge_handle_t) ) ############################################################################### ## @brief Function-pointer for zeFabricEdgeGetVerticesExp if __use_win_types: _zeFabricEdgeGetVerticesExp_t = WINFUNCTYPE( ze_result_t, ze_fabric_edge_handle_t, POINTER(ze_fabric_vertex_handle_t), POINTER(ze_fabric_vertex_handle_t) ) else: _zeFabricEdgeGetVerticesExp_t = CFUNCTYPE( ze_result_t, ze_fabric_edge_handle_t, POINTER(ze_fabric_vertex_handle_t), POINTER(ze_fabric_vertex_handle_t) ) ############################################################################### ## @brief Function-pointer for zeFabricEdgeGetPropertiesExp if __use_win_types: _zeFabricEdgeGetPropertiesExp_t = WINFUNCTYPE( ze_result_t, ze_fabric_edge_handle_t, POINTER(ze_fabric_edge_exp_properties_t) ) else: _zeFabricEdgeGetPropertiesExp_t = CFUNCTYPE( ze_result_t, ze_fabric_edge_handle_t, POINTER(ze_fabric_edge_exp_properties_t) ) ############################################################################### ## @brief Table of FabricEdgeExp functions pointers class _ze_fabric_edge_exp_dditable_t(Structure): _fields_ = [ ("pfnGetExp", c_void_p), ## _zeFabricEdgeGetExp_t ("pfnGetVerticesExp", c_void_p), ## _zeFabricEdgeGetVerticesExp_t ("pfnGetPropertiesExp", c_void_p) ## _zeFabricEdgeGetPropertiesExp_t ] ############################################################################### class _ze_dditable_t(Structure): _fields_ = [ ("RTASBuilderExp", _ze_rtas_builder_exp_dditable_t), ("RTASParallelOperationExp", _ze_rtas_parallel_operation_exp_dditable_t), ("Global", _ze_global_dditable_t), ("Driver", _ze_driver_dditable_t), ("DriverExp", _ze_driver_exp_dditable_t), ("Device", _ze_device_dditable_t), ("DeviceExp", _ze_device_exp_dditable_t), ("Context", _ze_context_dditable_t), ("CommandQueue", _ze_command_queue_dditable_t), ("CommandList", _ze_command_list_dditable_t), ("CommandListExp", _ze_command_list_exp_dditable_t), ("Image", _ze_image_dditable_t), ("ImageExp", _ze_image_exp_dditable_t), ("Mem", _ze_mem_dditable_t), ("MemExp", _ze_mem_exp_dditable_t), ("Fence", _ze_fence_dditable_t), ("EventPool", _ze_event_pool_dditable_t), ("Event", _ze_event_dditable_t), ("EventExp", _ze_event_exp_dditable_t), ("Module", _ze_module_dditable_t), ("ModuleBuildLog", _ze_module_build_log_dditable_t), ("Kernel", _ze_kernel_dditable_t), ("KernelExp", _ze_kernel_exp_dditable_t), ("Sampler", _ze_sampler_dditable_t), ("PhysicalMem", _ze_physical_mem_dditable_t), ("VirtualMem", _ze_virtual_mem_dditable_t), ("FabricVertexExp", _ze_fabric_vertex_exp_dditable_t), ("FabricEdgeExp", _ze_fabric_edge_exp_dditable_t) ] ############################################################################### ## @brief ze device-driver interfaces class ZE_DDI: def __init__(self, version : ze_api_version_t): # load the ze_loader library if "Windows" == platform.uname()[0]: self.__dll = WinDLL("ze_loader.dll") else: self.__dll = CDLL("ze_loader.so") # fill the ddi tables self.__dditable = _ze_dditable_t() # call driver to get function pointers _RTASBuilderExp = _ze_rtas_builder_exp_dditable_t() r = ze_result_v(self.__dll.zeGetRTASBuilderExpProcAddrTable(version, byref(_RTASBuilderExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.RTASBuilderExp = _RTASBuilderExp # attach function interface to function address self.zeRTASBuilderCreateExp = _zeRTASBuilderCreateExp_t(self.__dditable.RTASBuilderExp.pfnCreateExp) self.zeRTASBuilderGetBuildPropertiesExp = _zeRTASBuilderGetBuildPropertiesExp_t(self.__dditable.RTASBuilderExp.pfnGetBuildPropertiesExp) self.zeRTASBuilderBuildExp = _zeRTASBuilderBuildExp_t(self.__dditable.RTASBuilderExp.pfnBuildExp) self.zeRTASBuilderDestroyExp = _zeRTASBuilderDestroyExp_t(self.__dditable.RTASBuilderExp.pfnDestroyExp) # call driver to get function pointers _RTASParallelOperationExp = _ze_rtas_parallel_operation_exp_dditable_t() r = ze_result_v(self.__dll.zeGetRTASParallelOperationExpProcAddrTable(version, byref(_RTASParallelOperationExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.RTASParallelOperationExp = _RTASParallelOperationExp # attach function interface to function address self.zeRTASParallelOperationCreateExp = _zeRTASParallelOperationCreateExp_t(self.__dditable.RTASParallelOperationExp.pfnCreateExp) self.zeRTASParallelOperationGetPropertiesExp = _zeRTASParallelOperationGetPropertiesExp_t(self.__dditable.RTASParallelOperationExp.pfnGetPropertiesExp) self.zeRTASParallelOperationJoinExp = _zeRTASParallelOperationJoinExp_t(self.__dditable.RTASParallelOperationExp.pfnJoinExp) self.zeRTASParallelOperationDestroyExp = _zeRTASParallelOperationDestroyExp_t(self.__dditable.RTASParallelOperationExp.pfnDestroyExp) # call driver to get function pointers _Global = _ze_global_dditable_t() r = ze_result_v(self.__dll.zeGetGlobalProcAddrTable(version, byref(_Global))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Global = _Global # attach function interface to function address self.zeInit = _zeInit_t(self.__dditable.Global.pfnInit) self.zeInitDrivers = _zeInitDrivers_t(self.__dditable.Global.pfnInitDrivers) # call driver to get function pointers _Driver = _ze_driver_dditable_t() r = ze_result_v(self.__dll.zeGetDriverProcAddrTable(version, byref(_Driver))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Driver = _Driver # attach function interface to function address self.zeDriverGet = _zeDriverGet_t(self.__dditable.Driver.pfnGet) self.zeDriverGetApiVersion = _zeDriverGetApiVersion_t(self.__dditable.Driver.pfnGetApiVersion) self.zeDriverGetProperties = _zeDriverGetProperties_t(self.__dditable.Driver.pfnGetProperties) self.zeDriverGetIpcProperties = _zeDriverGetIpcProperties_t(self.__dditable.Driver.pfnGetIpcProperties) self.zeDriverGetExtensionProperties = _zeDriverGetExtensionProperties_t(self.__dditable.Driver.pfnGetExtensionProperties) self.zeDriverGetExtensionFunctionAddress = _zeDriverGetExtensionFunctionAddress_t(self.__dditable.Driver.pfnGetExtensionFunctionAddress) self.zeDriverGetLastErrorDescription = _zeDriverGetLastErrorDescription_t(self.__dditable.Driver.pfnGetLastErrorDescription) # call driver to get function pointers _DriverExp = _ze_driver_exp_dditable_t() r = ze_result_v(self.__dll.zeGetDriverExpProcAddrTable(version, byref(_DriverExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.DriverExp = _DriverExp # attach function interface to function address self.zeDriverRTASFormatCompatibilityCheckExp = _zeDriverRTASFormatCompatibilityCheckExp_t(self.__dditable.DriverExp.pfnRTASFormatCompatibilityCheckExp) # call driver to get function pointers _Device = _ze_device_dditable_t() r = ze_result_v(self.__dll.zeGetDeviceProcAddrTable(version, byref(_Device))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Device = _Device # attach function interface to function address self.zeDeviceGet = _zeDeviceGet_t(self.__dditable.Device.pfnGet) self.zeDeviceGetSubDevices = _zeDeviceGetSubDevices_t(self.__dditable.Device.pfnGetSubDevices) self.zeDeviceGetProperties = _zeDeviceGetProperties_t(self.__dditable.Device.pfnGetProperties) self.zeDeviceGetComputeProperties = _zeDeviceGetComputeProperties_t(self.__dditable.Device.pfnGetComputeProperties) self.zeDeviceGetModuleProperties = _zeDeviceGetModuleProperties_t(self.__dditable.Device.pfnGetModuleProperties) self.zeDeviceGetCommandQueueGroupProperties = _zeDeviceGetCommandQueueGroupProperties_t(self.__dditable.Device.pfnGetCommandQueueGroupProperties) self.zeDeviceGetMemoryProperties = _zeDeviceGetMemoryProperties_t(self.__dditable.Device.pfnGetMemoryProperties) self.zeDeviceGetMemoryAccessProperties = _zeDeviceGetMemoryAccessProperties_t(self.__dditable.Device.pfnGetMemoryAccessProperties) self.zeDeviceGetCacheProperties = _zeDeviceGetCacheProperties_t(self.__dditable.Device.pfnGetCacheProperties) self.zeDeviceGetImageProperties = _zeDeviceGetImageProperties_t(self.__dditable.Device.pfnGetImageProperties) self.zeDeviceGetExternalMemoryProperties = _zeDeviceGetExternalMemoryProperties_t(self.__dditable.Device.pfnGetExternalMemoryProperties) self.zeDeviceGetP2PProperties = _zeDeviceGetP2PProperties_t(self.__dditable.Device.pfnGetP2PProperties) self.zeDeviceCanAccessPeer = _zeDeviceCanAccessPeer_t(self.__dditable.Device.pfnCanAccessPeer) self.zeDeviceGetStatus = _zeDeviceGetStatus_t(self.__dditable.Device.pfnGetStatus) self.zeDeviceGetGlobalTimestamps = _zeDeviceGetGlobalTimestamps_t(self.__dditable.Device.pfnGetGlobalTimestamps) self.zeDeviceReserveCacheExt = _zeDeviceReserveCacheExt_t(self.__dditable.Device.pfnReserveCacheExt) self.zeDeviceSetCacheAdviceExt = _zeDeviceSetCacheAdviceExt_t(self.__dditable.Device.pfnSetCacheAdviceExt) self.zeDevicePciGetPropertiesExt = _zeDevicePciGetPropertiesExt_t(self.__dditable.Device.pfnPciGetPropertiesExt) self.zeDeviceGetRootDevice = _zeDeviceGetRootDevice_t(self.__dditable.Device.pfnGetRootDevice) self.zeDeviceImportExternalSemaphoreExt = _zeDeviceImportExternalSemaphoreExt_t(self.__dditable.Device.pfnImportExternalSemaphoreExt) self.zeDeviceReleaseExternalSemaphoreExt = _zeDeviceReleaseExternalSemaphoreExt_t(self.__dditable.Device.pfnReleaseExternalSemaphoreExt) # call driver to get function pointers _DeviceExp = _ze_device_exp_dditable_t() r = ze_result_v(self.__dll.zeGetDeviceExpProcAddrTable(version, byref(_DeviceExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.DeviceExp = _DeviceExp # attach function interface to function address self.zeDeviceGetFabricVertexExp = _zeDeviceGetFabricVertexExp_t(self.__dditable.DeviceExp.pfnGetFabricVertexExp) # call driver to get function pointers _Context = _ze_context_dditable_t() r = ze_result_v(self.__dll.zeGetContextProcAddrTable(version, byref(_Context))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Context = _Context # attach function interface to function address self.zeContextCreate = _zeContextCreate_t(self.__dditable.Context.pfnCreate) self.zeContextDestroy = _zeContextDestroy_t(self.__dditable.Context.pfnDestroy) self.zeContextGetStatus = _zeContextGetStatus_t(self.__dditable.Context.pfnGetStatus) self.zeContextSystemBarrier = _zeContextSystemBarrier_t(self.__dditable.Context.pfnSystemBarrier) self.zeContextMakeMemoryResident = _zeContextMakeMemoryResident_t(self.__dditable.Context.pfnMakeMemoryResident) self.zeContextEvictMemory = _zeContextEvictMemory_t(self.__dditable.Context.pfnEvictMemory) self.zeContextMakeImageResident = _zeContextMakeImageResident_t(self.__dditable.Context.pfnMakeImageResident) self.zeContextEvictImage = _zeContextEvictImage_t(self.__dditable.Context.pfnEvictImage) self.zeContextCreateEx = _zeContextCreateEx_t(self.__dditable.Context.pfnCreateEx) # call driver to get function pointers _CommandQueue = _ze_command_queue_dditable_t() r = ze_result_v(self.__dll.zeGetCommandQueueProcAddrTable(version, byref(_CommandQueue))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.CommandQueue = _CommandQueue # attach function interface to function address self.zeCommandQueueCreate = _zeCommandQueueCreate_t(self.__dditable.CommandQueue.pfnCreate) self.zeCommandQueueDestroy = _zeCommandQueueDestroy_t(self.__dditable.CommandQueue.pfnDestroy) self.zeCommandQueueExecuteCommandLists = _zeCommandQueueExecuteCommandLists_t(self.__dditable.CommandQueue.pfnExecuteCommandLists) self.zeCommandQueueSynchronize = _zeCommandQueueSynchronize_t(self.__dditable.CommandQueue.pfnSynchronize) self.zeCommandQueueGetOrdinal = _zeCommandQueueGetOrdinal_t(self.__dditable.CommandQueue.pfnGetOrdinal) self.zeCommandQueueGetIndex = _zeCommandQueueGetIndex_t(self.__dditable.CommandQueue.pfnGetIndex) # call driver to get function pointers _CommandList = _ze_command_list_dditable_t() r = ze_result_v(self.__dll.zeGetCommandListProcAddrTable(version, byref(_CommandList))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.CommandList = _CommandList # attach function interface to function address self.zeCommandListCreate = _zeCommandListCreate_t(self.__dditable.CommandList.pfnCreate) self.zeCommandListCreateImmediate = _zeCommandListCreateImmediate_t(self.__dditable.CommandList.pfnCreateImmediate) self.zeCommandListDestroy = _zeCommandListDestroy_t(self.__dditable.CommandList.pfnDestroy) self.zeCommandListClose = _zeCommandListClose_t(self.__dditable.CommandList.pfnClose) self.zeCommandListReset = _zeCommandListReset_t(self.__dditable.CommandList.pfnReset) self.zeCommandListAppendWriteGlobalTimestamp = _zeCommandListAppendWriteGlobalTimestamp_t(self.__dditable.CommandList.pfnAppendWriteGlobalTimestamp) self.zeCommandListAppendBarrier = _zeCommandListAppendBarrier_t(self.__dditable.CommandList.pfnAppendBarrier) self.zeCommandListAppendMemoryRangesBarrier = _zeCommandListAppendMemoryRangesBarrier_t(self.__dditable.CommandList.pfnAppendMemoryRangesBarrier) self.zeCommandListAppendMemoryCopy = _zeCommandListAppendMemoryCopy_t(self.__dditable.CommandList.pfnAppendMemoryCopy) self.zeCommandListAppendMemoryFill = _zeCommandListAppendMemoryFill_t(self.__dditable.CommandList.pfnAppendMemoryFill) self.zeCommandListAppendMemoryCopyRegion = _zeCommandListAppendMemoryCopyRegion_t(self.__dditable.CommandList.pfnAppendMemoryCopyRegion) self.zeCommandListAppendMemoryCopyFromContext = _zeCommandListAppendMemoryCopyFromContext_t(self.__dditable.CommandList.pfnAppendMemoryCopyFromContext) self.zeCommandListAppendImageCopy = _zeCommandListAppendImageCopy_t(self.__dditable.CommandList.pfnAppendImageCopy) self.zeCommandListAppendImageCopyRegion = _zeCommandListAppendImageCopyRegion_t(self.__dditable.CommandList.pfnAppendImageCopyRegion) self.zeCommandListAppendImageCopyToMemory = _zeCommandListAppendImageCopyToMemory_t(self.__dditable.CommandList.pfnAppendImageCopyToMemory) self.zeCommandListAppendImageCopyFromMemory = _zeCommandListAppendImageCopyFromMemory_t(self.__dditable.CommandList.pfnAppendImageCopyFromMemory) self.zeCommandListAppendMemoryPrefetch = _zeCommandListAppendMemoryPrefetch_t(self.__dditable.CommandList.pfnAppendMemoryPrefetch) self.zeCommandListAppendMemAdvise = _zeCommandListAppendMemAdvise_t(self.__dditable.CommandList.pfnAppendMemAdvise) self.zeCommandListAppendSignalEvent = _zeCommandListAppendSignalEvent_t(self.__dditable.CommandList.pfnAppendSignalEvent) self.zeCommandListAppendWaitOnEvents = _zeCommandListAppendWaitOnEvents_t(self.__dditable.CommandList.pfnAppendWaitOnEvents) self.zeCommandListAppendEventReset = _zeCommandListAppendEventReset_t(self.__dditable.CommandList.pfnAppendEventReset) self.zeCommandListAppendQueryKernelTimestamps = _zeCommandListAppendQueryKernelTimestamps_t(self.__dditable.CommandList.pfnAppendQueryKernelTimestamps) self.zeCommandListAppendLaunchKernel = _zeCommandListAppendLaunchKernel_t(self.__dditable.CommandList.pfnAppendLaunchKernel) self.zeCommandListAppendLaunchCooperativeKernel = _zeCommandListAppendLaunchCooperativeKernel_t(self.__dditable.CommandList.pfnAppendLaunchCooperativeKernel) self.zeCommandListAppendLaunchKernelIndirect = _zeCommandListAppendLaunchKernelIndirect_t(self.__dditable.CommandList.pfnAppendLaunchKernelIndirect) self.zeCommandListAppendLaunchMultipleKernelsIndirect = _zeCommandListAppendLaunchMultipleKernelsIndirect_t(self.__dditable.CommandList.pfnAppendLaunchMultipleKernelsIndirect) self.zeCommandListAppendImageCopyToMemoryExt = _zeCommandListAppendImageCopyToMemoryExt_t(self.__dditable.CommandList.pfnAppendImageCopyToMemoryExt) self.zeCommandListAppendImageCopyFromMemoryExt = _zeCommandListAppendImageCopyFromMemoryExt_t(self.__dditable.CommandList.pfnAppendImageCopyFromMemoryExt) self.zeCommandListHostSynchronize = _zeCommandListHostSynchronize_t(self.__dditable.CommandList.pfnHostSynchronize) self.zeCommandListGetDeviceHandle = _zeCommandListGetDeviceHandle_t(self.__dditable.CommandList.pfnGetDeviceHandle) self.zeCommandListGetContextHandle = _zeCommandListGetContextHandle_t(self.__dditable.CommandList.pfnGetContextHandle) self.zeCommandListGetOrdinal = _zeCommandListGetOrdinal_t(self.__dditable.CommandList.pfnGetOrdinal) self.zeCommandListImmediateGetIndex = _zeCommandListImmediateGetIndex_t(self.__dditable.CommandList.pfnImmediateGetIndex) self.zeCommandListIsImmediate = _zeCommandListIsImmediate_t(self.__dditable.CommandList.pfnIsImmediate) self.zeCommandListAppendSignalExternalSemaphoreExt = _zeCommandListAppendSignalExternalSemaphoreExt_t(self.__dditable.CommandList.pfnAppendSignalExternalSemaphoreExt) self.zeCommandListAppendWaitExternalSemaphoreExt = _zeCommandListAppendWaitExternalSemaphoreExt_t(self.__dditable.CommandList.pfnAppendWaitExternalSemaphoreExt) # call driver to get function pointers _CommandListExp = _ze_command_list_exp_dditable_t() r = ze_result_v(self.__dll.zeGetCommandListExpProcAddrTable(version, byref(_CommandListExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.CommandListExp = _CommandListExp # attach function interface to function address self.zeCommandListCreateCloneExp = _zeCommandListCreateCloneExp_t(self.__dditable.CommandListExp.pfnCreateCloneExp) self.zeCommandListImmediateAppendCommandListsExp = _zeCommandListImmediateAppendCommandListsExp_t(self.__dditable.CommandListExp.pfnImmediateAppendCommandListsExp) self.zeCommandListGetNextCommandIdExp = _zeCommandListGetNextCommandIdExp_t(self.__dditable.CommandListExp.pfnGetNextCommandIdExp) self.zeCommandListUpdateMutableCommandsExp = _zeCommandListUpdateMutableCommandsExp_t(self.__dditable.CommandListExp.pfnUpdateMutableCommandsExp) self.zeCommandListUpdateMutableCommandSignalEventExp = _zeCommandListUpdateMutableCommandSignalEventExp_t(self.__dditable.CommandListExp.pfnUpdateMutableCommandSignalEventExp) self.zeCommandListUpdateMutableCommandWaitEventsExp = _zeCommandListUpdateMutableCommandWaitEventsExp_t(self.__dditable.CommandListExp.pfnUpdateMutableCommandWaitEventsExp) self.zeCommandListGetNextCommandIdWithKernelsExp = _zeCommandListGetNextCommandIdWithKernelsExp_t(self.__dditable.CommandListExp.pfnGetNextCommandIdWithKernelsExp) self.zeCommandListUpdateMutableCommandKernelsExp = _zeCommandListUpdateMutableCommandKernelsExp_t(self.__dditable.CommandListExp.pfnUpdateMutableCommandKernelsExp) # call driver to get function pointers _Image = _ze_image_dditable_t() r = ze_result_v(self.__dll.zeGetImageProcAddrTable(version, byref(_Image))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Image = _Image # attach function interface to function address self.zeImageGetProperties = _zeImageGetProperties_t(self.__dditable.Image.pfnGetProperties) self.zeImageCreate = _zeImageCreate_t(self.__dditable.Image.pfnCreate) self.zeImageDestroy = _zeImageDestroy_t(self.__dditable.Image.pfnDestroy) self.zeImageGetAllocPropertiesExt = _zeImageGetAllocPropertiesExt_t(self.__dditable.Image.pfnGetAllocPropertiesExt) self.zeImageViewCreateExt = _zeImageViewCreateExt_t(self.__dditable.Image.pfnViewCreateExt) # call driver to get function pointers _ImageExp = _ze_image_exp_dditable_t() r = ze_result_v(self.__dll.zeGetImageExpProcAddrTable(version, byref(_ImageExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.ImageExp = _ImageExp # attach function interface to function address self.zeImageGetMemoryPropertiesExp = _zeImageGetMemoryPropertiesExp_t(self.__dditable.ImageExp.pfnGetMemoryPropertiesExp) self.zeImageViewCreateExp = _zeImageViewCreateExp_t(self.__dditable.ImageExp.pfnViewCreateExp) self.zeImageGetDeviceOffsetExp = _zeImageGetDeviceOffsetExp_t(self.__dditable.ImageExp.pfnGetDeviceOffsetExp) # call driver to get function pointers _Mem = _ze_mem_dditable_t() r = ze_result_v(self.__dll.zeGetMemProcAddrTable(version, byref(_Mem))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Mem = _Mem # attach function interface to function address self.zeMemAllocShared = _zeMemAllocShared_t(self.__dditable.Mem.pfnAllocShared) self.zeMemAllocDevice = _zeMemAllocDevice_t(self.__dditable.Mem.pfnAllocDevice) self.zeMemAllocHost = _zeMemAllocHost_t(self.__dditable.Mem.pfnAllocHost) self.zeMemFree = _zeMemFree_t(self.__dditable.Mem.pfnFree) self.zeMemGetAllocProperties = _zeMemGetAllocProperties_t(self.__dditable.Mem.pfnGetAllocProperties) self.zeMemGetAddressRange = _zeMemGetAddressRange_t(self.__dditable.Mem.pfnGetAddressRange) self.zeMemGetIpcHandle = _zeMemGetIpcHandle_t(self.__dditable.Mem.pfnGetIpcHandle) self.zeMemOpenIpcHandle = _zeMemOpenIpcHandle_t(self.__dditable.Mem.pfnOpenIpcHandle) self.zeMemCloseIpcHandle = _zeMemCloseIpcHandle_t(self.__dditable.Mem.pfnCloseIpcHandle) self.zeMemFreeExt = _zeMemFreeExt_t(self.__dditable.Mem.pfnFreeExt) self.zeMemPutIpcHandle = _zeMemPutIpcHandle_t(self.__dditable.Mem.pfnPutIpcHandle) self.zeMemGetPitchFor2dImage = _zeMemGetPitchFor2dImage_t(self.__dditable.Mem.pfnGetPitchFor2dImage) # call driver to get function pointers _MemExp = _ze_mem_exp_dditable_t() r = ze_result_v(self.__dll.zeGetMemExpProcAddrTable(version, byref(_MemExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.MemExp = _MemExp # attach function interface to function address self.zeMemGetIpcHandleFromFileDescriptorExp = _zeMemGetIpcHandleFromFileDescriptorExp_t(self.__dditable.MemExp.pfnGetIpcHandleFromFileDescriptorExp) self.zeMemGetFileDescriptorFromIpcHandleExp = _zeMemGetFileDescriptorFromIpcHandleExp_t(self.__dditable.MemExp.pfnGetFileDescriptorFromIpcHandleExp) self.zeMemSetAtomicAccessAttributeExp = _zeMemSetAtomicAccessAttributeExp_t(self.__dditable.MemExp.pfnSetAtomicAccessAttributeExp) self.zeMemGetAtomicAccessAttributeExp = _zeMemGetAtomicAccessAttributeExp_t(self.__dditable.MemExp.pfnGetAtomicAccessAttributeExp) # call driver to get function pointers _Fence = _ze_fence_dditable_t() r = ze_result_v(self.__dll.zeGetFenceProcAddrTable(version, byref(_Fence))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Fence = _Fence # attach function interface to function address self.zeFenceCreate = _zeFenceCreate_t(self.__dditable.Fence.pfnCreate) self.zeFenceDestroy = _zeFenceDestroy_t(self.__dditable.Fence.pfnDestroy) self.zeFenceHostSynchronize = _zeFenceHostSynchronize_t(self.__dditable.Fence.pfnHostSynchronize) self.zeFenceQueryStatus = _zeFenceQueryStatus_t(self.__dditable.Fence.pfnQueryStatus) self.zeFenceReset = _zeFenceReset_t(self.__dditable.Fence.pfnReset) # call driver to get function pointers _EventPool = _ze_event_pool_dditable_t() r = ze_result_v(self.__dll.zeGetEventPoolProcAddrTable(version, byref(_EventPool))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.EventPool = _EventPool # attach function interface to function address self.zeEventPoolCreate = _zeEventPoolCreate_t(self.__dditable.EventPool.pfnCreate) self.zeEventPoolDestroy = _zeEventPoolDestroy_t(self.__dditable.EventPool.pfnDestroy) self.zeEventPoolGetIpcHandle = _zeEventPoolGetIpcHandle_t(self.__dditable.EventPool.pfnGetIpcHandle) self.zeEventPoolOpenIpcHandle = _zeEventPoolOpenIpcHandle_t(self.__dditable.EventPool.pfnOpenIpcHandle) self.zeEventPoolCloseIpcHandle = _zeEventPoolCloseIpcHandle_t(self.__dditable.EventPool.pfnCloseIpcHandle) self.zeEventPoolPutIpcHandle = _zeEventPoolPutIpcHandle_t(self.__dditable.EventPool.pfnPutIpcHandle) self.zeEventPoolGetContextHandle = _zeEventPoolGetContextHandle_t(self.__dditable.EventPool.pfnGetContextHandle) self.zeEventPoolGetFlags = _zeEventPoolGetFlags_t(self.__dditable.EventPool.pfnGetFlags) # call driver to get function pointers _Event = _ze_event_dditable_t() r = ze_result_v(self.__dll.zeGetEventProcAddrTable(version, byref(_Event))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Event = _Event # attach function interface to function address self.zeEventCreate = _zeEventCreate_t(self.__dditable.Event.pfnCreate) self.zeEventDestroy = _zeEventDestroy_t(self.__dditable.Event.pfnDestroy) self.zeEventHostSignal = _zeEventHostSignal_t(self.__dditable.Event.pfnHostSignal) self.zeEventHostSynchronize = _zeEventHostSynchronize_t(self.__dditable.Event.pfnHostSynchronize) self.zeEventQueryStatus = _zeEventQueryStatus_t(self.__dditable.Event.pfnQueryStatus) self.zeEventHostReset = _zeEventHostReset_t(self.__dditable.Event.pfnHostReset) self.zeEventQueryKernelTimestamp = _zeEventQueryKernelTimestamp_t(self.__dditable.Event.pfnQueryKernelTimestamp) self.zeEventQueryKernelTimestampsExt = _zeEventQueryKernelTimestampsExt_t(self.__dditable.Event.pfnQueryKernelTimestampsExt) self.zeEventGetEventPool = _zeEventGetEventPool_t(self.__dditable.Event.pfnGetEventPool) self.zeEventGetSignalScope = _zeEventGetSignalScope_t(self.__dditable.Event.pfnGetSignalScope) self.zeEventGetWaitScope = _zeEventGetWaitScope_t(self.__dditable.Event.pfnGetWaitScope) # call driver to get function pointers _EventExp = _ze_event_exp_dditable_t() r = ze_result_v(self.__dll.zeGetEventExpProcAddrTable(version, byref(_EventExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.EventExp = _EventExp # attach function interface to function address self.zeEventQueryTimestampsExp = _zeEventQueryTimestampsExp_t(self.__dditable.EventExp.pfnQueryTimestampsExp) # call driver to get function pointers _Module = _ze_module_dditable_t() r = ze_result_v(self.__dll.zeGetModuleProcAddrTable(version, byref(_Module))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Module = _Module # attach function interface to function address self.zeModuleCreate = _zeModuleCreate_t(self.__dditable.Module.pfnCreate) self.zeModuleDestroy = _zeModuleDestroy_t(self.__dditable.Module.pfnDestroy) self.zeModuleDynamicLink = _zeModuleDynamicLink_t(self.__dditable.Module.pfnDynamicLink) self.zeModuleGetNativeBinary = _zeModuleGetNativeBinary_t(self.__dditable.Module.pfnGetNativeBinary) self.zeModuleGetGlobalPointer = _zeModuleGetGlobalPointer_t(self.__dditable.Module.pfnGetGlobalPointer) self.zeModuleGetKernelNames = _zeModuleGetKernelNames_t(self.__dditable.Module.pfnGetKernelNames) self.zeModuleGetProperties = _zeModuleGetProperties_t(self.__dditable.Module.pfnGetProperties) self.zeModuleGetFunctionPointer = _zeModuleGetFunctionPointer_t(self.__dditable.Module.pfnGetFunctionPointer) self.zeModuleInspectLinkageExt = _zeModuleInspectLinkageExt_t(self.__dditable.Module.pfnInspectLinkageExt) # call driver to get function pointers _ModuleBuildLog = _ze_module_build_log_dditable_t() r = ze_result_v(self.__dll.zeGetModuleBuildLogProcAddrTable(version, byref(_ModuleBuildLog))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.ModuleBuildLog = _ModuleBuildLog # attach function interface to function address self.zeModuleBuildLogDestroy = _zeModuleBuildLogDestroy_t(self.__dditable.ModuleBuildLog.pfnDestroy) self.zeModuleBuildLogGetString = _zeModuleBuildLogGetString_t(self.__dditable.ModuleBuildLog.pfnGetString) # call driver to get function pointers _Kernel = _ze_kernel_dditable_t() r = ze_result_v(self.__dll.zeGetKernelProcAddrTable(version, byref(_Kernel))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Kernel = _Kernel # attach function interface to function address self.zeKernelCreate = _zeKernelCreate_t(self.__dditable.Kernel.pfnCreate) self.zeKernelDestroy = _zeKernelDestroy_t(self.__dditable.Kernel.pfnDestroy) self.zeKernelSetCacheConfig = _zeKernelSetCacheConfig_t(self.__dditable.Kernel.pfnSetCacheConfig) self.zeKernelSetGroupSize = _zeKernelSetGroupSize_t(self.__dditable.Kernel.pfnSetGroupSize) self.zeKernelSuggestGroupSize = _zeKernelSuggestGroupSize_t(self.__dditable.Kernel.pfnSuggestGroupSize) self.zeKernelSuggestMaxCooperativeGroupCount = _zeKernelSuggestMaxCooperativeGroupCount_t(self.__dditable.Kernel.pfnSuggestMaxCooperativeGroupCount) self.zeKernelSetArgumentValue = _zeKernelSetArgumentValue_t(self.__dditable.Kernel.pfnSetArgumentValue) self.zeKernelSetIndirectAccess = _zeKernelSetIndirectAccess_t(self.__dditable.Kernel.pfnSetIndirectAccess) self.zeKernelGetIndirectAccess = _zeKernelGetIndirectAccess_t(self.__dditable.Kernel.pfnGetIndirectAccess) self.zeKernelGetSourceAttributes = _zeKernelGetSourceAttributes_t(self.__dditable.Kernel.pfnGetSourceAttributes) self.zeKernelGetProperties = _zeKernelGetProperties_t(self.__dditable.Kernel.pfnGetProperties) self.zeKernelGetName = _zeKernelGetName_t(self.__dditable.Kernel.pfnGetName) # call driver to get function pointers _KernelExp = _ze_kernel_exp_dditable_t() r = ze_result_v(self.__dll.zeGetKernelExpProcAddrTable(version, byref(_KernelExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.KernelExp = _KernelExp # attach function interface to function address self.zeKernelSetGlobalOffsetExp = _zeKernelSetGlobalOffsetExp_t(self.__dditable.KernelExp.pfnSetGlobalOffsetExp) self.zeKernelSchedulingHintExp = _zeKernelSchedulingHintExp_t(self.__dditable.KernelExp.pfnSchedulingHintExp) self.zeKernelGetBinaryExp = _zeKernelGetBinaryExp_t(self.__dditable.KernelExp.pfnGetBinaryExp) # call driver to get function pointers _Sampler = _ze_sampler_dditable_t() r = ze_result_v(self.__dll.zeGetSamplerProcAddrTable(version, byref(_Sampler))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Sampler = _Sampler # attach function interface to function address self.zeSamplerCreate = _zeSamplerCreate_t(self.__dditable.Sampler.pfnCreate) self.zeSamplerDestroy = _zeSamplerDestroy_t(self.__dditable.Sampler.pfnDestroy) # call driver to get function pointers _PhysicalMem = _ze_physical_mem_dditable_t() r = ze_result_v(self.__dll.zeGetPhysicalMemProcAddrTable(version, byref(_PhysicalMem))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.PhysicalMem = _PhysicalMem # attach function interface to function address self.zePhysicalMemCreate = _zePhysicalMemCreate_t(self.__dditable.PhysicalMem.pfnCreate) self.zePhysicalMemDestroy = _zePhysicalMemDestroy_t(self.__dditable.PhysicalMem.pfnDestroy) # call driver to get function pointers _VirtualMem = _ze_virtual_mem_dditable_t() r = ze_result_v(self.__dll.zeGetVirtualMemProcAddrTable(version, byref(_VirtualMem))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.VirtualMem = _VirtualMem # attach function interface to function address self.zeVirtualMemReserve = _zeVirtualMemReserve_t(self.__dditable.VirtualMem.pfnReserve) self.zeVirtualMemFree = _zeVirtualMemFree_t(self.__dditable.VirtualMem.pfnFree) self.zeVirtualMemQueryPageSize = _zeVirtualMemQueryPageSize_t(self.__dditable.VirtualMem.pfnQueryPageSize) self.zeVirtualMemMap = _zeVirtualMemMap_t(self.__dditable.VirtualMem.pfnMap) self.zeVirtualMemUnmap = _zeVirtualMemUnmap_t(self.__dditable.VirtualMem.pfnUnmap) self.zeVirtualMemSetAccessAttribute = _zeVirtualMemSetAccessAttribute_t(self.__dditable.VirtualMem.pfnSetAccessAttribute) self.zeVirtualMemGetAccessAttribute = _zeVirtualMemGetAccessAttribute_t(self.__dditable.VirtualMem.pfnGetAccessAttribute) # call driver to get function pointers _FabricVertexExp = _ze_fabric_vertex_exp_dditable_t() r = ze_result_v(self.__dll.zeGetFabricVertexExpProcAddrTable(version, byref(_FabricVertexExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.FabricVertexExp = _FabricVertexExp # attach function interface to function address self.zeFabricVertexGetExp = _zeFabricVertexGetExp_t(self.__dditable.FabricVertexExp.pfnGetExp) self.zeFabricVertexGetSubVerticesExp = _zeFabricVertexGetSubVerticesExp_t(self.__dditable.FabricVertexExp.pfnGetSubVerticesExp) self.zeFabricVertexGetPropertiesExp = _zeFabricVertexGetPropertiesExp_t(self.__dditable.FabricVertexExp.pfnGetPropertiesExp) self.zeFabricVertexGetDeviceExp = _zeFabricVertexGetDeviceExp_t(self.__dditable.FabricVertexExp.pfnGetDeviceExp) # call driver to get function pointers _FabricEdgeExp = _ze_fabric_edge_exp_dditable_t() r = ze_result_v(self.__dll.zeGetFabricEdgeExpProcAddrTable(version, byref(_FabricEdgeExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.FabricEdgeExp = _FabricEdgeExp # attach function interface to function address self.zeFabricEdgeGetExp = _zeFabricEdgeGetExp_t(self.__dditable.FabricEdgeExp.pfnGetExp) self.zeFabricEdgeGetVerticesExp = _zeFabricEdgeGetVerticesExp_t(self.__dditable.FabricEdgeExp.pfnGetVerticesExp) self.zeFabricEdgeGetPropertiesExp = _zeFabricEdgeGetPropertiesExp_t(self.__dditable.FabricEdgeExp.pfnGetPropertiesExp) # success! level-zero-1.20.6/include/ze_api.h000066400000000000000000030745141475521542100167530ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_api.h * @version v1.12-r1.12.15 * */ #ifndef _ZE_API_H #define _ZE_API_H #if defined(__cplusplus) #pragma once #endif // standard headers #include #include #if defined(__cplusplus) extern "C" { #endif // Intel 'oneAPI' Level-Zero API common types #if !defined(__GNUC__) #pragma region common #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAKE_VERSION /// @brief Generates generic 'oneAPI' API versions #define ZE_MAKE_VERSION( _major, _minor ) (( _major << 16 )|( _minor & 0x0000ffff)) #endif // ZE_MAKE_VERSION /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAJOR_VERSION /// @brief Extracts 'oneAPI' API major version #define ZE_MAJOR_VERSION( _ver ) ( _ver >> 16 ) #endif // ZE_MAJOR_VERSION /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MINOR_VERSION /// @brief Extracts 'oneAPI' API minor version #define ZE_MINOR_VERSION( _ver ) ( _ver & 0x0000ffff ) #endif // ZE_MINOR_VERSION /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_APICALL #if defined(_WIN32) /// @brief Calling convention for all API functions #define ZE_APICALL __cdecl #else #define ZE_APICALL #endif // defined(_WIN32) #endif // ZE_APICALL /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_APIEXPORT #if defined(_WIN32) /// @brief Microsoft-specific dllexport storage-class attribute #define ZE_APIEXPORT __declspec(dllexport) #endif // defined(_WIN32) #endif // ZE_APIEXPORT /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_APIEXPORT #if __GNUC__ >= 4 /// @brief GCC-specific dllexport storage-class attribute #define ZE_APIEXPORT __attribute__ ((visibility ("default"))) #else #define ZE_APIEXPORT #endif // __GNUC__ >= 4 #endif // ZE_APIEXPORT /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_DLLEXPORT #if defined(_WIN32) /// @brief Microsoft-specific dllexport storage-class attribute #define ZE_DLLEXPORT __declspec(dllexport) #endif // defined(_WIN32) #endif // ZE_DLLEXPORT /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_DLLEXPORT #if __GNUC__ >= 4 /// @brief GCC-specific dllexport storage-class attribute #define ZE_DLLEXPORT __attribute__ ((visibility ("default"))) #else #define ZE_DLLEXPORT #endif // __GNUC__ >= 4 #endif // ZE_DLLEXPORT /////////////////////////////////////////////////////////////////////////////// /// @brief compiler-independent type typedef uint8_t ze_bool_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of a driver instance typedef struct _ze_driver_handle_t *ze_driver_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's device object typedef struct _ze_device_handle_t *ze_device_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's context object typedef struct _ze_context_handle_t *ze_context_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's command queue object typedef struct _ze_command_queue_handle_t *ze_command_queue_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's command list object typedef struct _ze_command_list_handle_t *ze_command_list_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's fence object typedef struct _ze_fence_handle_t *ze_fence_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's event pool object typedef struct _ze_event_pool_handle_t *ze_event_pool_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's event object typedef struct _ze_event_handle_t *ze_event_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's image object typedef struct _ze_image_handle_t *ze_image_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's module object typedef struct _ze_module_handle_t *ze_module_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of module's build log object typedef struct _ze_module_build_log_handle_t *ze_module_build_log_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's kernel object typedef struct _ze_kernel_handle_t *ze_kernel_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's sampler object typedef struct _ze_sampler_handle_t *ze_sampler_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of physical memory object typedef struct _ze_physical_mem_handle_t *ze_physical_mem_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's fabric vertex object typedef struct _ze_fabric_vertex_handle_t *ze_fabric_vertex_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of driver's fabric edge object typedef struct _ze_fabric_edge_handle_t *ze_fabric_edge_handle_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAX_IPC_HANDLE_SIZE /// @brief Maximum IPC handle size #define ZE_MAX_IPC_HANDLE_SIZE 64 #endif // ZE_MAX_IPC_HANDLE_SIZE /////////////////////////////////////////////////////////////////////////////// /// @brief IPC handle to a memory allocation typedef struct _ze_ipc_mem_handle_t { char data[ZE_MAX_IPC_HANDLE_SIZE]; ///< [out] Opaque data representing an IPC handle } ze_ipc_mem_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief IPC handle to a event pool allocation typedef struct _ze_ipc_event_pool_handle_t { char data[ZE_MAX_IPC_HANDLE_SIZE]; ///< [out] Opaque data representing an IPC handle } ze_ipc_event_pool_handle_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_BIT /// @brief Generic macro for enumerator bit masks #define ZE_BIT( _i ) ( 1 << _i ) #endif // ZE_BIT /////////////////////////////////////////////////////////////////////////////// /// @brief Defines Return/Error codes typedef enum _ze_result_t { ZE_RESULT_SUCCESS = 0, ///< [Core] success ZE_RESULT_NOT_READY = 1, ///< [Core] synchronization primitive not signaled ZE_RESULT_ERROR_DEVICE_LOST = 0x70000001, ///< [Core] device hung, reset, was removed, or driver update occurred ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY = 0x70000002, ///< [Core] insufficient host memory to satisfy call ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY = 0x70000003, ///< [Core] insufficient device memory to satisfy call ZE_RESULT_ERROR_MODULE_BUILD_FAILURE = 0x70000004, ///< [Core] error occurred when building module, see build log for details ZE_RESULT_ERROR_MODULE_LINK_FAILURE = 0x70000005, ///< [Core] error occurred when linking modules, see build log for details ZE_RESULT_ERROR_DEVICE_REQUIRES_RESET = 0x70000006, ///< [Core] device requires a reset ZE_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE = 0x70000007, ///< [Core] device currently in low power state ZE_RESULT_EXP_ERROR_DEVICE_IS_NOT_VERTEX = 0x7ff00001, ///< [Core, Experimental] device is not represented by a fabric vertex ZE_RESULT_EXP_ERROR_VERTEX_IS_NOT_DEVICE = 0x7ff00002, ///< [Core, Experimental] fabric vertex does not represent a device ZE_RESULT_EXP_ERROR_REMOTE_DEVICE = 0x7ff00003, ///< [Core, Experimental] fabric vertex represents a remote device or ///< subdevice ZE_RESULT_EXP_ERROR_OPERANDS_INCOMPATIBLE = 0x7ff00004, ///< [Core, Experimental] operands of comparison are not compatible ZE_RESULT_EXP_RTAS_BUILD_RETRY = 0x7ff00005, ///< [Core, Experimental] ray tracing acceleration structure build ///< operation failed due to insufficient resources, retry with a larger ///< acceleration structure buffer allocation ZE_RESULT_EXP_RTAS_BUILD_DEFERRED = 0x7ff00006, ///< [Core, Experimental] ray tracing acceleration structure build ///< operation deferred to parallel operation join ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS = 0x70010000, ///< [Sysman] access denied due to permission level ZE_RESULT_ERROR_NOT_AVAILABLE = 0x70010001, ///< [Sysman] resource already in use and simultaneous access not allowed ///< or resource was removed ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE = 0x70020000, ///< [Common] external required dependency is unavailable or missing ZE_RESULT_WARNING_DROPPED_DATA = 0x70020001, ///< [Tools] data may have been dropped ZE_RESULT_ERROR_UNINITIALIZED = 0x78000001, ///< [Validation] driver is not initialized ZE_RESULT_ERROR_UNSUPPORTED_VERSION = 0x78000002, ///< [Validation] generic error code for unsupported versions ZE_RESULT_ERROR_UNSUPPORTED_FEATURE = 0x78000003, ///< [Validation] generic error code for unsupported features ZE_RESULT_ERROR_INVALID_ARGUMENT = 0x78000004, ///< [Validation] generic error code for invalid arguments ZE_RESULT_ERROR_INVALID_NULL_HANDLE = 0x78000005, ///< [Validation] handle argument is not valid ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE = 0x78000006, ///< [Validation] object pointed to by handle still in-use by device ZE_RESULT_ERROR_INVALID_NULL_POINTER = 0x78000007, ///< [Validation] pointer argument may not be nullptr ZE_RESULT_ERROR_INVALID_SIZE = 0x78000008, ///< [Validation] size argument is invalid (e.g., must not be zero) ZE_RESULT_ERROR_UNSUPPORTED_SIZE = 0x78000009, ///< [Validation] size argument is not supported by the device (e.g., too ///< large) ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT = 0x7800000a, ///< [Validation] alignment argument is not supported by the device (e.g., ///< too small) ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT = 0x7800000b, ///< [Validation] synchronization object in invalid state ZE_RESULT_ERROR_INVALID_ENUMERATION = 0x7800000c, ///< [Validation] enumerator argument is not valid ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION = 0x7800000d, ///< [Validation] enumerator argument is not supported by the device ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT = 0x7800000e, ///< [Validation] image format is not supported by the device ZE_RESULT_ERROR_INVALID_NATIVE_BINARY = 0x7800000f, ///< [Validation] native binary is not supported by the device ZE_RESULT_ERROR_INVALID_GLOBAL_NAME = 0x78000010, ///< [Validation] global variable is not found in the module ZE_RESULT_ERROR_INVALID_KERNEL_NAME = 0x78000011, ///< [Validation] kernel name is not found in the module ZE_RESULT_ERROR_INVALID_FUNCTION_NAME = 0x78000012, ///< [Validation] function name is not found in the module ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION = 0x78000013, ///< [Validation] group size dimension is not valid for the kernel or ///< device ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION = 0x78000014, ///< [Validation] global width dimension is not valid for the kernel or ///< device ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX = 0x78000015, ///< [Validation] kernel argument index is not valid for kernel ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE = 0x78000016, ///< [Validation] kernel argument size does not match kernel ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE = 0x78000017, ///< [Validation] value of kernel attribute is not valid for the kernel or ///< device ZE_RESULT_ERROR_INVALID_MODULE_UNLINKED = 0x78000018, ///< [Validation] module with imports needs to be linked before kernels can ///< be created from it. ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE = 0x78000019, ///< [Validation] command list type does not match command queue type ZE_RESULT_ERROR_OVERLAPPING_REGIONS = 0x7800001a, ///< [Validation] copy operations do not support overlapping regions of ///< memory ZE_RESULT_WARNING_ACTION_REQUIRED = 0x7800001b, ///< [Sysman] an action is required to complete the desired operation ZE_RESULT_ERROR_INVALID_KERNEL_HANDLE = 0x7800001c, ///< [Core, Validation] kernel handle is invalid for the operation ZE_RESULT_ERROR_UNKNOWN = 0x7ffffffe, ///< [Core] unknown or internal error ZE_RESULT_FORCE_UINT32 = 0x7fffffff } ze_result_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Defines structure types typedef enum _ze_structure_type_t { ZE_STRUCTURE_TYPE_DRIVER_PROPERTIES = 0x1, ///< ::ze_driver_properties_t ZE_STRUCTURE_TYPE_DRIVER_IPC_PROPERTIES = 0x2, ///< ::ze_driver_ipc_properties_t ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES = 0x3, ///< ::ze_device_properties_t ZE_STRUCTURE_TYPE_DEVICE_COMPUTE_PROPERTIES = 0x4, ///< ::ze_device_compute_properties_t ZE_STRUCTURE_TYPE_DEVICE_MODULE_PROPERTIES = 0x5, ///< ::ze_device_module_properties_t ZE_STRUCTURE_TYPE_COMMAND_QUEUE_GROUP_PROPERTIES = 0x6, ///< ::ze_command_queue_group_properties_t ZE_STRUCTURE_TYPE_DEVICE_MEMORY_PROPERTIES = 0x7, ///< ::ze_device_memory_properties_t ZE_STRUCTURE_TYPE_DEVICE_MEMORY_ACCESS_PROPERTIES = 0x8, ///< ::ze_device_memory_access_properties_t ZE_STRUCTURE_TYPE_DEVICE_CACHE_PROPERTIES = 0x9, ///< ::ze_device_cache_properties_t ZE_STRUCTURE_TYPE_DEVICE_IMAGE_PROPERTIES = 0xa, ///< ::ze_device_image_properties_t ZE_STRUCTURE_TYPE_DEVICE_P2P_PROPERTIES = 0xb, ///< ::ze_device_p2p_properties_t ZE_STRUCTURE_TYPE_DEVICE_EXTERNAL_MEMORY_PROPERTIES = 0xc, ///< ::ze_device_external_memory_properties_t ZE_STRUCTURE_TYPE_CONTEXT_DESC = 0xd, ///< ::ze_context_desc_t ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC = 0xe, ///< ::ze_command_queue_desc_t ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC = 0xf, ///< ::ze_command_list_desc_t ZE_STRUCTURE_TYPE_EVENT_POOL_DESC = 0x10, ///< ::ze_event_pool_desc_t ZE_STRUCTURE_TYPE_EVENT_DESC = 0x11, ///< ::ze_event_desc_t ZE_STRUCTURE_TYPE_FENCE_DESC = 0x12, ///< ::ze_fence_desc_t ZE_STRUCTURE_TYPE_IMAGE_DESC = 0x13, ///< ::ze_image_desc_t ZE_STRUCTURE_TYPE_IMAGE_PROPERTIES = 0x14, ///< ::ze_image_properties_t ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC = 0x15, ///< ::ze_device_mem_alloc_desc_t ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC = 0x16, ///< ::ze_host_mem_alloc_desc_t ZE_STRUCTURE_TYPE_MEMORY_ALLOCATION_PROPERTIES = 0x17, ///< ::ze_memory_allocation_properties_t ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_DESC = 0x18, ///< ::ze_external_memory_export_desc_t ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMPORT_FD = 0x19, ///< ::ze_external_memory_import_fd_t ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_FD = 0x1a, ///< ::ze_external_memory_export_fd_t ZE_STRUCTURE_TYPE_MODULE_DESC = 0x1b, ///< ::ze_module_desc_t ZE_STRUCTURE_TYPE_MODULE_PROPERTIES = 0x1c, ///< ::ze_module_properties_t ZE_STRUCTURE_TYPE_KERNEL_DESC = 0x1d, ///< ::ze_kernel_desc_t ZE_STRUCTURE_TYPE_KERNEL_PROPERTIES = 0x1e, ///< ::ze_kernel_properties_t ZE_STRUCTURE_TYPE_SAMPLER_DESC = 0x1f, ///< ::ze_sampler_desc_t ZE_STRUCTURE_TYPE_PHYSICAL_MEM_DESC = 0x20, ///< ::ze_physical_mem_desc_t ZE_STRUCTURE_TYPE_KERNEL_PREFERRED_GROUP_SIZE_PROPERTIES = 0x21, ///< ::ze_kernel_preferred_group_size_properties_t ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMPORT_WIN32 = 0x22, ///< ::ze_external_memory_import_win32_handle_t ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_WIN32 = 0x23, ///< ::ze_external_memory_export_win32_handle_t ZE_STRUCTURE_TYPE_DEVICE_RAYTRACING_EXT_PROPERTIES = 0x00010001, ///< ::ze_device_raytracing_ext_properties_t ZE_STRUCTURE_TYPE_RAYTRACING_MEM_ALLOC_EXT_DESC = 0x10002, ///< ::ze_raytracing_mem_alloc_ext_desc_t ZE_STRUCTURE_TYPE_FLOAT_ATOMIC_EXT_PROPERTIES = 0x10003, ///< ::ze_float_atomic_ext_properties_t ZE_STRUCTURE_TYPE_CACHE_RESERVATION_EXT_DESC = 0x10004, ///< ::ze_cache_reservation_ext_desc_t ZE_STRUCTURE_TYPE_EU_COUNT_EXT = 0x10005, ///< ::ze_eu_count_ext_t ZE_STRUCTURE_TYPE_SRGB_EXT_DESC = 0x10006, ///< ::ze_srgb_ext_desc_t ZE_STRUCTURE_TYPE_LINKAGE_INSPECTION_EXT_DESC = 0x10007, ///< ::ze_linkage_inspection_ext_desc_t ZE_STRUCTURE_TYPE_PCI_EXT_PROPERTIES = 0x10008, ///< ::ze_pci_ext_properties_t ZE_STRUCTURE_TYPE_DRIVER_MEMORY_FREE_EXT_PROPERTIES = 0x10009, ///< ::ze_driver_memory_free_ext_properties_t ZE_STRUCTURE_TYPE_MEMORY_FREE_EXT_DESC = 0x1000a, ///< ::ze_memory_free_ext_desc_t ZE_STRUCTURE_TYPE_MEMORY_COMPRESSION_HINTS_EXT_DESC = 0x1000b, ///< ::ze_memory_compression_hints_ext_desc_t ZE_STRUCTURE_TYPE_IMAGE_ALLOCATION_EXT_PROPERTIES = 0x1000c, ///< ::ze_image_allocation_ext_properties_t ZE_STRUCTURE_TYPE_DEVICE_LUID_EXT_PROPERTIES = 0x1000d, ///< ::ze_device_luid_ext_properties_t ZE_STRUCTURE_TYPE_DEVICE_MEMORY_EXT_PROPERTIES = 0x1000e, ///< ::ze_device_memory_ext_properties_t ZE_STRUCTURE_TYPE_DEVICE_IP_VERSION_EXT = 0x1000f, ///< ::ze_device_ip_version_ext_t ZE_STRUCTURE_TYPE_IMAGE_VIEW_PLANAR_EXT_DESC = 0x10010, ///< ::ze_image_view_planar_ext_desc_t ZE_STRUCTURE_TYPE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_PROPERTIES = 0x10011, ///< ::ze_event_query_kernel_timestamps_ext_properties_t ZE_STRUCTURE_TYPE_EVENT_QUERY_KERNEL_TIMESTAMPS_RESULTS_EXT_PROPERTIES = 0x10012, ///< ::ze_event_query_kernel_timestamps_results_ext_properties_t ZE_STRUCTURE_TYPE_KERNEL_MAX_GROUP_SIZE_EXT_PROPERTIES = 0x10013, ///< ::ze_kernel_max_group_size_ext_properties_t ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC = 0x00020001, ///< ::ze_relaxed_allocation_limits_exp_desc_t ZE_STRUCTURE_TYPE_MODULE_PROGRAM_EXP_DESC = 0x00020002, ///< ::ze_module_program_exp_desc_t ZE_STRUCTURE_TYPE_SCHEDULING_HINT_EXP_PROPERTIES = 0x00020003, ///< ::ze_scheduling_hint_exp_properties_t ZE_STRUCTURE_TYPE_SCHEDULING_HINT_EXP_DESC = 0x00020004, ///< ::ze_scheduling_hint_exp_desc_t ZE_STRUCTURE_TYPE_IMAGE_VIEW_PLANAR_EXP_DESC = 0x00020005, ///< ::ze_image_view_planar_exp_desc_t ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2 = 0x00020006, ///< ::ze_device_properties_t ZE_STRUCTURE_TYPE_IMAGE_MEMORY_EXP_PROPERTIES = 0x00020007, ///< ::ze_image_memory_properties_exp_t ZE_STRUCTURE_TYPE_POWER_SAVING_HINT_EXP_DESC = 0x00020008, ///< ::ze_context_power_saving_hint_exp_desc_t ZE_STRUCTURE_TYPE_COPY_BANDWIDTH_EXP_PROPERTIES = 0x00020009, ///< ::ze_copy_bandwidth_exp_properties_t ZE_STRUCTURE_TYPE_DEVICE_P2P_BANDWIDTH_EXP_PROPERTIES = 0x0002000A, ///< ::ze_device_p2p_bandwidth_exp_properties_t ZE_STRUCTURE_TYPE_FABRIC_VERTEX_EXP_PROPERTIES = 0x0002000B, ///< ::ze_fabric_vertex_exp_properties_t ZE_STRUCTURE_TYPE_FABRIC_EDGE_EXP_PROPERTIES = 0x0002000C, ///< ::ze_fabric_edge_exp_properties_t ZE_STRUCTURE_TYPE_MEMORY_SUB_ALLOCATIONS_EXP_PROPERTIES = 0x0002000D, ///< ::ze_memory_sub_allocations_exp_properties_t ZE_STRUCTURE_TYPE_RTAS_BUILDER_EXP_DESC = 0x0002000E, ///< ::ze_rtas_builder_exp_desc_t ZE_STRUCTURE_TYPE_RTAS_BUILDER_BUILD_OP_EXP_DESC = 0x0002000F, ///< ::ze_rtas_builder_build_op_exp_desc_t ZE_STRUCTURE_TYPE_RTAS_BUILDER_EXP_PROPERTIES = 0x00020010, ///< ::ze_rtas_builder_exp_properties_t ZE_STRUCTURE_TYPE_RTAS_PARALLEL_OPERATION_EXP_PROPERTIES = 0x00020011, ///< ::ze_rtas_parallel_operation_exp_properties_t ZE_STRUCTURE_TYPE_RTAS_DEVICE_EXP_PROPERTIES = 0x00020012, ///< ::ze_rtas_device_exp_properties_t ZE_STRUCTURE_TYPE_RTAS_GEOMETRY_AABBS_EXP_CB_PARAMS = 0x00020013, ///< ::ze_rtas_geometry_aabbs_exp_cb_params_t ZE_STRUCTURE_TYPE_COUNTER_BASED_EVENT_POOL_EXP_DESC = 0x00020014, ///< ::ze_event_pool_counter_based_exp_desc_t ZE_STRUCTURE_TYPE_MUTABLE_COMMAND_LIST_EXP_PROPERTIES = 0x00020015, ///< ::ze_mutable_command_list_exp_properties_t ZE_STRUCTURE_TYPE_MUTABLE_COMMAND_LIST_EXP_DESC = 0x00020016, ///< ::ze_mutable_command_list_exp_desc_t ZE_STRUCTURE_TYPE_MUTABLE_COMMAND_ID_EXP_DESC = 0x00020017, ///< ::ze_mutable_command_id_exp_desc_t ZE_STRUCTURE_TYPE_MUTABLE_COMMANDS_EXP_DESC = 0x00020018, ///< ::ze_mutable_commands_exp_desc_t ZE_STRUCTURE_TYPE_MUTABLE_KERNEL_ARGUMENT_EXP_DESC = 0x00020019, ///< ::ze_mutable_kernel_argument_exp_desc_t ZE_STRUCTURE_TYPE_MUTABLE_GROUP_COUNT_EXP_DESC = 0x0002001A, ///< ::ze_mutable_group_count_exp_desc_t ZE_STRUCTURE_TYPE_MUTABLE_GROUP_SIZE_EXP_DESC = 0x0002001B, ///< ::ze_mutable_group_size_exp_desc_t ZE_STRUCTURE_TYPE_MUTABLE_GLOBAL_OFFSET_EXP_DESC = 0x0002001C, ///< ::ze_mutable_global_offset_exp_desc_t ZE_STRUCTURE_TYPE_PITCHED_ALLOC_DEVICE_EXP_PROPERTIES = 0x0002001D, ///< ::ze_device_pitched_alloc_exp_properties_t ZE_STRUCTURE_TYPE_BINDLESS_IMAGE_EXP_DESC = 0x0002001E, ///< ::ze_image_bindless_exp_desc_t ZE_STRUCTURE_TYPE_PITCHED_IMAGE_EXP_DESC = 0x0002001F, ///< ::ze_image_pitched_exp_desc_t ZE_STRUCTURE_TYPE_MUTABLE_GRAPH_ARGUMENT_EXP_DESC = 0x00020020, ///< ::ze_mutable_graph_argument_exp_desc_t ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC = 0x00020021, ///< ::ze_init_driver_type_desc_t ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_EXT_DESC = 0x00020022, ///< ::ze_external_semaphore_ext_desc_t ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_WIN32_EXT_DESC = 0x00020023, ///< ::ze_external_semaphore_win32_ext_desc_t ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_FD_EXT_DESC = 0x00020024, ///< ::ze_external_semaphore_fd_ext_desc_t ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_EXT = 0x00020025, ///< ::ze_external_semaphore_signal_params_ext_t ZE_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_WAIT_PARAMS_EXT = 0x00020026, ///< ::ze_external_semaphore_wait_params_ext_t ZE_STRUCTURE_TYPE_DRIVER_DDI_HANDLES_EXT_PROPERTIES = 0x00020027, ///< ::ze_driver_ddi_handles_ext_properties_t ZE_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff } ze_structure_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief External memory type flags typedef uint32_t ze_external_memory_type_flags_t; typedef enum _ze_external_memory_type_flag_t { ZE_EXTERNAL_MEMORY_TYPE_FLAG_OPAQUE_FD = ZE_BIT(0), ///< an opaque POSIX file descriptor handle ZE_EXTERNAL_MEMORY_TYPE_FLAG_DMA_BUF = ZE_BIT(1), ///< a file descriptor handle for a Linux dma_buf ZE_EXTERNAL_MEMORY_TYPE_FLAG_OPAQUE_WIN32 = ZE_BIT(2), ///< an NT handle ZE_EXTERNAL_MEMORY_TYPE_FLAG_OPAQUE_WIN32_KMT = ZE_BIT(3), ///< a global share (KMT) handle ZE_EXTERNAL_MEMORY_TYPE_FLAG_D3D11_TEXTURE = ZE_BIT(4), ///< an NT handle referring to a Direct3D 10 or 11 texture resource ZE_EXTERNAL_MEMORY_TYPE_FLAG_D3D11_TEXTURE_KMT = ZE_BIT(5), ///< a global share (KMT) handle referring to a Direct3D 10 or 11 texture ///< resource ZE_EXTERNAL_MEMORY_TYPE_FLAG_D3D12_HEAP = ZE_BIT(6), ///< an NT handle referring to a Direct3D 12 heap resource ZE_EXTERNAL_MEMORY_TYPE_FLAG_D3D12_RESOURCE = ZE_BIT(7), ///< an NT handle referring to a Direct3D 12 committed resource ZE_EXTERNAL_MEMORY_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff } ze_external_memory_type_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Bandwidth unit typedef enum _ze_bandwidth_unit_t { ZE_BANDWIDTH_UNIT_UNKNOWN = 0, ///< The unit used for bandwidth is unknown ZE_BANDWIDTH_UNIT_BYTES_PER_NANOSEC = 1, ///< Bandwidth is provided in bytes/nanosec ZE_BANDWIDTH_UNIT_BYTES_PER_CLOCK = 2, ///< Bandwidth is provided in bytes/clock ZE_BANDWIDTH_UNIT_FORCE_UINT32 = 0x7fffffff } ze_bandwidth_unit_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Latency unit typedef enum _ze_latency_unit_t { ZE_LATENCY_UNIT_UNKNOWN = 0, ///< The unit used for latency is unknown ZE_LATENCY_UNIT_NANOSEC = 1, ///< Latency is provided in nanosecs ZE_LATENCY_UNIT_CLOCK = 2, ///< Latency is provided in clocks ZE_LATENCY_UNIT_HOP = 3, ///< Latency is provided in hops (normalized so that the lowest latency ///< link has a latency of 1 hop) ZE_LATENCY_UNIT_FORCE_UINT32 = 0x7fffffff } ze_latency_unit_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAX_UUID_SIZE /// @brief Maximum universal unique id (UUID) size in bytes #define ZE_MAX_UUID_SIZE 16 #endif // ZE_MAX_UUID_SIZE /////////////////////////////////////////////////////////////////////////////// /// @brief Universal unique id (UUID) typedef struct _ze_uuid_t { uint8_t id[ZE_MAX_UUID_SIZE]; ///< [out] opaque data representing a UUID } ze_uuid_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Base for all callback function parameter types typedef struct _ze_base_cb_params_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). } ze_base_cb_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Base for all properties types typedef struct _ze_base_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). } ze_base_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Base for all descriptor types typedef struct _ze_base_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). } ze_base_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forces driver to only report devices (and sub-devices) as specified by /// values /////////////////////////////////////////////////////////////////////////////// /// @brief Forces driver to report devices from lowest to highest PCI bus ID /////////////////////////////////////////////////////////////////////////////// /// @brief Forces all shared allocations into device memory /////////////////////////////////////////////////////////////////////////////// /// @brief Defines the device hierarchy model exposed by Level Zero driver /// implementation /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_ipc_mem_handle_t typedef struct _ze_ipc_mem_handle_t ze_ipc_mem_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_ipc_event_pool_handle_t typedef struct _ze_ipc_event_pool_handle_t ze_ipc_event_pool_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_uuid_t typedef struct _ze_uuid_t ze_uuid_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_base_cb_params_t typedef struct _ze_base_cb_params_t ze_base_cb_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_base_properties_t typedef struct _ze_base_properties_t ze_base_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_base_desc_t typedef struct _ze_base_desc_t ze_base_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_init_driver_type_desc_t typedef struct _ze_init_driver_type_desc_t ze_init_driver_type_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_driver_uuid_t typedef struct _ze_driver_uuid_t ze_driver_uuid_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_driver_properties_t typedef struct _ze_driver_properties_t ze_driver_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_driver_ipc_properties_t typedef struct _ze_driver_ipc_properties_t ze_driver_ipc_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_driver_extension_properties_t typedef struct _ze_driver_extension_properties_t ze_driver_extension_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_uuid_t typedef struct _ze_device_uuid_t ze_device_uuid_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_properties_t typedef struct _ze_device_properties_t ze_device_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_thread_t typedef struct _ze_device_thread_t ze_device_thread_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_compute_properties_t typedef struct _ze_device_compute_properties_t ze_device_compute_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_native_kernel_uuid_t typedef struct _ze_native_kernel_uuid_t ze_native_kernel_uuid_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_module_properties_t typedef struct _ze_device_module_properties_t ze_device_module_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_command_queue_group_properties_t typedef struct _ze_command_queue_group_properties_t ze_command_queue_group_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_memory_properties_t typedef struct _ze_device_memory_properties_t ze_device_memory_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_memory_access_properties_t typedef struct _ze_device_memory_access_properties_t ze_device_memory_access_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_cache_properties_t typedef struct _ze_device_cache_properties_t ze_device_cache_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_image_properties_t typedef struct _ze_device_image_properties_t ze_device_image_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_external_memory_properties_t typedef struct _ze_device_external_memory_properties_t ze_device_external_memory_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_p2p_properties_t typedef struct _ze_device_p2p_properties_t ze_device_p2p_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_context_desc_t typedef struct _ze_context_desc_t ze_context_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_command_queue_desc_t typedef struct _ze_command_queue_desc_t ze_command_queue_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_command_list_desc_t typedef struct _ze_command_list_desc_t ze_command_list_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_copy_region_t typedef struct _ze_copy_region_t ze_copy_region_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_image_region_t typedef struct _ze_image_region_t ze_image_region_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_event_pool_desc_t typedef struct _ze_event_pool_desc_t ze_event_pool_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_event_desc_t typedef struct _ze_event_desc_t ze_event_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_kernel_timestamp_data_t typedef struct _ze_kernel_timestamp_data_t ze_kernel_timestamp_data_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_kernel_timestamp_result_t typedef struct _ze_kernel_timestamp_result_t ze_kernel_timestamp_result_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_fence_desc_t typedef struct _ze_fence_desc_t ze_fence_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_image_format_t typedef struct _ze_image_format_t ze_image_format_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_image_desc_t typedef struct _ze_image_desc_t ze_image_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_image_properties_t typedef struct _ze_image_properties_t ze_image_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_mem_alloc_desc_t typedef struct _ze_device_mem_alloc_desc_t ze_device_mem_alloc_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_host_mem_alloc_desc_t typedef struct _ze_host_mem_alloc_desc_t ze_host_mem_alloc_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_memory_allocation_properties_t typedef struct _ze_memory_allocation_properties_t ze_memory_allocation_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_external_memory_export_desc_t typedef struct _ze_external_memory_export_desc_t ze_external_memory_export_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_external_memory_import_fd_t typedef struct _ze_external_memory_import_fd_t ze_external_memory_import_fd_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_external_memory_export_fd_t typedef struct _ze_external_memory_export_fd_t ze_external_memory_export_fd_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_external_memory_import_win32_handle_t typedef struct _ze_external_memory_import_win32_handle_t ze_external_memory_import_win32_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_external_memory_export_win32_handle_t typedef struct _ze_external_memory_export_win32_handle_t ze_external_memory_export_win32_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_module_constants_t typedef struct _ze_module_constants_t ze_module_constants_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_module_desc_t typedef struct _ze_module_desc_t ze_module_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_module_properties_t typedef struct _ze_module_properties_t ze_module_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_kernel_desc_t typedef struct _ze_kernel_desc_t ze_kernel_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_kernel_uuid_t typedef struct _ze_kernel_uuid_t ze_kernel_uuid_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_kernel_properties_t typedef struct _ze_kernel_properties_t ze_kernel_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_kernel_preferred_group_size_properties_t typedef struct _ze_kernel_preferred_group_size_properties_t ze_kernel_preferred_group_size_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_group_count_t typedef struct _ze_group_count_t ze_group_count_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_module_program_exp_desc_t typedef struct _ze_module_program_exp_desc_t ze_module_program_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_raytracing_ext_properties_t typedef struct _ze_device_raytracing_ext_properties_t ze_device_raytracing_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_raytracing_mem_alloc_ext_desc_t typedef struct _ze_raytracing_mem_alloc_ext_desc_t ze_raytracing_mem_alloc_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_sampler_desc_t typedef struct _ze_sampler_desc_t ze_sampler_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_physical_mem_desc_t typedef struct _ze_physical_mem_desc_t ze_physical_mem_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_float_atomic_ext_properties_t typedef struct _ze_float_atomic_ext_properties_t ze_float_atomic_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_relaxed_allocation_limits_exp_desc_t typedef struct _ze_relaxed_allocation_limits_exp_desc_t ze_relaxed_allocation_limits_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_driver_ddi_handles_ext_properties_t typedef struct _ze_driver_ddi_handles_ext_properties_t ze_driver_ddi_handles_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_external_semaphore_ext_desc_t typedef struct _ze_external_semaphore_ext_desc_t ze_external_semaphore_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_external_semaphore_win32_ext_desc_t typedef struct _ze_external_semaphore_win32_ext_desc_t ze_external_semaphore_win32_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_external_semaphore_fd_ext_desc_t typedef struct _ze_external_semaphore_fd_ext_desc_t ze_external_semaphore_fd_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_external_semaphore_signal_params_ext_t typedef struct _ze_external_semaphore_signal_params_ext_t ze_external_semaphore_signal_params_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_external_semaphore_wait_params_ext_t typedef struct _ze_external_semaphore_wait_params_ext_t ze_external_semaphore_wait_params_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_cache_reservation_ext_desc_t typedef struct _ze_cache_reservation_ext_desc_t ze_cache_reservation_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_image_memory_properties_exp_t typedef struct _ze_image_memory_properties_exp_t ze_image_memory_properties_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_image_view_planar_ext_desc_t typedef struct _ze_image_view_planar_ext_desc_t ze_image_view_planar_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_image_view_planar_exp_desc_t typedef struct _ze_image_view_planar_exp_desc_t ze_image_view_planar_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_scheduling_hint_exp_properties_t typedef struct _ze_scheduling_hint_exp_properties_t ze_scheduling_hint_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_scheduling_hint_exp_desc_t typedef struct _ze_scheduling_hint_exp_desc_t ze_scheduling_hint_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_context_power_saving_hint_exp_desc_t typedef struct _ze_context_power_saving_hint_exp_desc_t ze_context_power_saving_hint_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_eu_count_ext_t typedef struct _ze_eu_count_ext_t ze_eu_count_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_pci_address_ext_t typedef struct _ze_pci_address_ext_t ze_pci_address_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_pci_speed_ext_t typedef struct _ze_pci_speed_ext_t ze_pci_speed_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_pci_ext_properties_t typedef struct _ze_pci_ext_properties_t ze_pci_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_srgb_ext_desc_t typedef struct _ze_srgb_ext_desc_t ze_srgb_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_image_allocation_ext_properties_t typedef struct _ze_image_allocation_ext_properties_t ze_image_allocation_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_linkage_inspection_ext_desc_t typedef struct _ze_linkage_inspection_ext_desc_t ze_linkage_inspection_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_memory_compression_hints_ext_desc_t typedef struct _ze_memory_compression_hints_ext_desc_t ze_memory_compression_hints_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_driver_memory_free_ext_properties_t typedef struct _ze_driver_memory_free_ext_properties_t ze_driver_memory_free_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_memory_free_ext_desc_t typedef struct _ze_memory_free_ext_desc_t ze_memory_free_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_p2p_bandwidth_exp_properties_t typedef struct _ze_device_p2p_bandwidth_exp_properties_t ze_device_p2p_bandwidth_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_copy_bandwidth_exp_properties_t typedef struct _ze_copy_bandwidth_exp_properties_t ze_copy_bandwidth_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_luid_ext_t typedef struct _ze_device_luid_ext_t ze_device_luid_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_luid_ext_properties_t typedef struct _ze_device_luid_ext_properties_t ze_device_luid_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_fabric_vertex_pci_exp_address_t typedef struct _ze_fabric_vertex_pci_exp_address_t ze_fabric_vertex_pci_exp_address_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_fabric_vertex_exp_properties_t typedef struct _ze_fabric_vertex_exp_properties_t ze_fabric_vertex_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_fabric_edge_exp_properties_t typedef struct _ze_fabric_edge_exp_properties_t ze_fabric_edge_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_memory_ext_properties_t typedef struct _ze_device_memory_ext_properties_t ze_device_memory_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_ip_version_ext_t typedef struct _ze_device_ip_version_ext_t ze_device_ip_version_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_kernel_max_group_size_properties_ext_t typedef struct _ze_kernel_max_group_size_properties_ext_t ze_kernel_max_group_size_properties_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_sub_allocation_t typedef struct _ze_sub_allocation_t ze_sub_allocation_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_memory_sub_allocations_exp_properties_t typedef struct _ze_memory_sub_allocations_exp_properties_t ze_memory_sub_allocations_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_event_query_kernel_timestamps_ext_properties_t typedef struct _ze_event_query_kernel_timestamps_ext_properties_t ze_event_query_kernel_timestamps_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_synchronized_timestamp_data_ext_t typedef struct _ze_synchronized_timestamp_data_ext_t ze_synchronized_timestamp_data_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_synchronized_timestamp_result_ext_t typedef struct _ze_synchronized_timestamp_result_ext_t ze_synchronized_timestamp_result_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_event_query_kernel_timestamps_results_ext_properties_t typedef struct _ze_event_query_kernel_timestamps_results_ext_properties_t ze_event_query_kernel_timestamps_results_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_builder_exp_desc_t typedef struct _ze_rtas_builder_exp_desc_t ze_rtas_builder_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_builder_exp_properties_t typedef struct _ze_rtas_builder_exp_properties_t ze_rtas_builder_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_parallel_operation_exp_properties_t typedef struct _ze_rtas_parallel_operation_exp_properties_t ze_rtas_parallel_operation_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_device_exp_properties_t typedef struct _ze_rtas_device_exp_properties_t ze_rtas_device_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_float3_exp_t typedef struct _ze_rtas_float3_exp_t ze_rtas_float3_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_transform_float3x4_column_major_exp_t typedef struct _ze_rtas_transform_float3x4_column_major_exp_t ze_rtas_transform_float3x4_column_major_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_transform_float3x4_aligned_column_major_exp_t typedef struct _ze_rtas_transform_float3x4_aligned_column_major_exp_t ze_rtas_transform_float3x4_aligned_column_major_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_transform_float3x4_row_major_exp_t typedef struct _ze_rtas_transform_float3x4_row_major_exp_t ze_rtas_transform_float3x4_row_major_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_aabb_exp_t typedef struct _ze_rtas_aabb_exp_t ze_rtas_aabb_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_triangle_indices_uint32_exp_t typedef struct _ze_rtas_triangle_indices_uint32_exp_t ze_rtas_triangle_indices_uint32_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_quad_indices_uint32_exp_t typedef struct _ze_rtas_quad_indices_uint32_exp_t ze_rtas_quad_indices_uint32_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_builder_geometry_info_exp_t typedef struct _ze_rtas_builder_geometry_info_exp_t ze_rtas_builder_geometry_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_builder_triangles_geometry_info_exp_t typedef struct _ze_rtas_builder_triangles_geometry_info_exp_t ze_rtas_builder_triangles_geometry_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_builder_quads_geometry_info_exp_t typedef struct _ze_rtas_builder_quads_geometry_info_exp_t ze_rtas_builder_quads_geometry_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_geometry_aabbs_exp_cb_params_t typedef struct _ze_rtas_geometry_aabbs_exp_cb_params_t ze_rtas_geometry_aabbs_exp_cb_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_builder_procedural_geometry_info_exp_t typedef struct _ze_rtas_builder_procedural_geometry_info_exp_t ze_rtas_builder_procedural_geometry_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_builder_instance_geometry_info_exp_t typedef struct _ze_rtas_builder_instance_geometry_info_exp_t ze_rtas_builder_instance_geometry_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_rtas_builder_build_op_exp_desc_t typedef struct _ze_rtas_builder_build_op_exp_desc_t ze_rtas_builder_build_op_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_event_pool_counter_based_exp_desc_t typedef struct _ze_event_pool_counter_based_exp_desc_t ze_event_pool_counter_based_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_image_bindless_exp_desc_t typedef struct _ze_image_bindless_exp_desc_t ze_image_bindless_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_image_pitched_exp_desc_t typedef struct _ze_image_pitched_exp_desc_t ze_image_pitched_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_device_pitched_alloc_exp_properties_t typedef struct _ze_device_pitched_alloc_exp_properties_t ze_device_pitched_alloc_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_mutable_command_id_exp_desc_t typedef struct _ze_mutable_command_id_exp_desc_t ze_mutable_command_id_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_mutable_command_list_exp_properties_t typedef struct _ze_mutable_command_list_exp_properties_t ze_mutable_command_list_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_mutable_command_list_exp_desc_t typedef struct _ze_mutable_command_list_exp_desc_t ze_mutable_command_list_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_mutable_commands_exp_desc_t typedef struct _ze_mutable_commands_exp_desc_t ze_mutable_commands_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_mutable_kernel_argument_exp_desc_t typedef struct _ze_mutable_kernel_argument_exp_desc_t ze_mutable_kernel_argument_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_mutable_group_count_exp_desc_t typedef struct _ze_mutable_group_count_exp_desc_t ze_mutable_group_count_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_mutable_group_size_exp_desc_t typedef struct _ze_mutable_group_size_exp_desc_t ze_mutable_group_size_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_mutable_global_offset_exp_desc_t typedef struct _ze_mutable_global_offset_exp_desc_t ze_mutable_global_offset_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare ze_mutable_graph_argument_exp_desc_t typedef struct _ze_mutable_graph_argument_exp_desc_t ze_mutable_graph_argument_exp_desc_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs #if !defined(__GNUC__) #pragma region driver #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported initialization flags typedef uint32_t ze_init_flags_t; typedef enum _ze_init_flag_t { ZE_INIT_FLAG_GPU_ONLY = ZE_BIT(0), ///< only initialize GPU drivers ZE_INIT_FLAG_VPU_ONLY = ZE_BIT(1), ///< only initialize VPU drivers ZE_INIT_FLAG_FORCE_UINT32 = 0x7fffffff } ze_init_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Initialize the 'oneAPI' driver(s) /// /// @details /// - @deprecated since 1.10. Please use zeInitDrivers() /// - The application must call this function or zeInitDrivers before /// calling any other function. /// - If this function is not called then all other functions will return /// ::ZE_RESULT_ERROR_UNINITIALIZED. /// - Only one instance of each driver 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 driver(s) simultaneously. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < flags` ZE_APIEXPORT ze_result_t ZE_APICALL zeInit( ze_init_flags_t flags ///< [in] initialization flags. ///< must be 0 (default) or a combination of ::ze_init_flag_t. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves driver instances /// /// @details /// - @deprecated since 1.10. Please use zeInitDrivers() /// - Usage of zeInitDrivers and zeDriverGet is mutually exclusive and /// should not be used together. Usage of them together will result in /// undefined behavior. /// - A driver represents a collection of physical devices. /// - Multiple calls to this function will return identical driver handles, /// in the same order. /// - The application may pass nullptr for pDrivers when only querying the /// number of drivers. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clGetPlatformIDs /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeDriverGet( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported driver initialization type flags /// /// @details /// - Bit Field which details the driver types to be initialized and /// returned to the user. /// - Value Definition: /// - 0, do not init or retrieve any drivers. /// - ZE_INIT_DRIVER_TYPE_FLAG_GPU, GPU Drivers are Init and driver handles /// retrieved. /// - ZE_INIT_DRIVER_TYPE_FLAG_NPU, NPU Drivers are Init and driver handles /// retrieved. /// - ZE_INIT_DRIVER_TYPE_FLAG_GPU | ZE_INIT_DRIVER_TYPE_FLAG_NPU, NPU & GPU /// Drivers are Init and driver handles retrieved. /// - UINT32_MAX All Drivers of any type are Init and driver handles /// retrieved. typedef uint32_t ze_init_driver_type_flags_t; typedef enum _ze_init_driver_type_flag_t { ZE_INIT_DRIVER_TYPE_FLAG_GPU = ZE_BIT(0), ///< initialize and retrieve GPU drivers ZE_INIT_DRIVER_TYPE_FLAG_NPU = ZE_BIT(1), ///< initialize and retrieve NPU drivers ZE_INIT_DRIVER_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff } ze_init_driver_type_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Init Driver Type descriptor typedef struct _ze_init_driver_type_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_init_driver_type_flags_t flags; ///< [in] driver type init flags. ///< must be a valid combination of ::ze_init_driver_type_flag_t or UINT32_MAX; ///< driver types are init and retrieved based on these init flags in zeInitDrivers(). } ze_init_driver_type_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Initialize the 'oneAPI' driver(s) based on the driver types requested /// and retrieve the driver handles. /// /// @details /// - The application must call this function or zeInit before calling any /// other function. (zeInit is [Deprecated] and is replaced by /// zeInitDrivers) /// - Calls to zeInit[Deprecated] or InitDrivers will not alter the drivers /// retrieved thru either api. /// - Drivers init thru zeInit[Deprecated] or InitDrivers will not be /// reInitialized once init in an application. The Loader will determine /// if the already init driver needs to be delivered to the user thru the /// init type flags. /// - Already init Drivers will not be uninitialized if the call to /// InitDrivers does not include that driver's type. Those init drivers /// which don't match the init flags will not have their driver handles /// returned to the user in that InitDrivers call. /// - If this function or zeInit[Deprecated] is not called, then all other /// functions will return ::ZE_RESULT_ERROR_UNINITIALIZED. /// - Only one instance of each driver will be initialized per process. /// - A driver represents a collection of physical devices. /// - Multiple calls to this function will return identical driver handles, /// in the same order. /// - The drivers returned to the caller will be based on the init types /// which state the drivers to be included. /// - The application may pass nullptr for pDrivers when only querying the /// number of drivers. /// - 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 driver(s) simultaneously. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` /// + `nullptr == desc` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x0 == desc->flags` ZE_APIEXPORT ze_result_t ZE_APICALL zeInitDrivers( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers, ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ze_init_driver_type_desc_t* desc ///< [in] descriptor containing the driver type initialization details ///< including ::ze_init_driver_type_flag_t combinations. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported API versions /// /// @details /// - API versions contain major and minor attributes, use /// ::ZE_MAJOR_VERSION and ::ZE_MINOR_VERSION typedef enum _ze_api_version_t { ZE_API_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_API_VERSION_1_1 = ZE_MAKE_VERSION( 1, 1 ), ///< version 1.1 ZE_API_VERSION_1_2 = ZE_MAKE_VERSION( 1, 2 ), ///< version 1.2 ZE_API_VERSION_1_3 = ZE_MAKE_VERSION( 1, 3 ), ///< version 1.3 ZE_API_VERSION_1_4 = ZE_MAKE_VERSION( 1, 4 ), ///< version 1.4 ZE_API_VERSION_1_5 = ZE_MAKE_VERSION( 1, 5 ), ///< version 1.5 ZE_API_VERSION_1_6 = ZE_MAKE_VERSION( 1, 6 ), ///< version 1.6 ZE_API_VERSION_1_7 = ZE_MAKE_VERSION( 1, 7 ), ///< version 1.7 ZE_API_VERSION_1_8 = ZE_MAKE_VERSION( 1, 8 ), ///< version 1.8 ZE_API_VERSION_1_9 = ZE_MAKE_VERSION( 1, 9 ), ///< version 1.9 ZE_API_VERSION_1_10 = ZE_MAKE_VERSION( 1, 10 ), ///< version 1.10 ZE_API_VERSION_1_11 = ZE_MAKE_VERSION( 1, 11 ), ///< version 1.11 ZE_API_VERSION_1_12 = ZE_MAKE_VERSION( 1, 12 ), ///< version 1.12 ZE_API_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 12 ), ///< latest known version ZE_API_VERSION_FORCE_UINT32 = 0x7fffffff } ze_api_version_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_API_VERSION_CURRENT_M /// @brief Current API version as a macro #define ZE_API_VERSION_CURRENT_M ZE_MAKE_VERSION( 1, 12 ) #endif // ZE_API_VERSION_CURRENT_M /////////////////////////////////////////////////////////////////////////////// /// @brief Returns the API version supported by the specified driver /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == version` ZE_APIEXPORT ze_result_t ZE_APICALL zeDriverGetApiVersion( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_api_version_t* version ///< [out] api version ); /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAX_DRIVER_UUID_SIZE /// @brief Maximum driver universal unique id (UUID) size in bytes #define ZE_MAX_DRIVER_UUID_SIZE 16 #endif // ZE_MAX_DRIVER_UUID_SIZE /////////////////////////////////////////////////////////////////////////////// /// @brief Driver universal unique id (UUID) typedef struct _ze_driver_uuid_t { uint8_t id[ZE_MAX_DRIVER_UUID_SIZE]; ///< [out] opaque data representing a driver UUID } ze_driver_uuid_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Driver properties queried using ::zeDriverGetProperties typedef struct _ze_driver_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_driver_uuid_t uuid; ///< [out] universal unique identifier. uint32_t driverVersion; ///< [out] driver version ///< The driver version is a non-zero, monotonically increasing value where ///< higher values always indicate a more recent version. } ze_driver_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves properties of the driver. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clGetPlatformInfo** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pDriverProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeDriverGetProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_properties_t* pDriverProperties ///< [in,out] query result for driver properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported IPC property flags typedef uint32_t ze_ipc_property_flags_t; typedef enum _ze_ipc_property_flag_t { ZE_IPC_PROPERTY_FLAG_MEMORY = ZE_BIT(0), ///< Supports passing memory allocations between processes. See ///< ::zeMemGetIpcHandle. ZE_IPC_PROPERTY_FLAG_EVENT_POOL = ZE_BIT(1), ///< Supports passing event pools between processes. See ///< ::zeEventPoolGetIpcHandle. ZE_IPC_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff } ze_ipc_property_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief IPC properties queried using ::zeDriverGetIpcProperties typedef struct _ze_driver_ipc_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_ipc_property_flags_t flags; ///< [out] 0 (none) or a valid combination of ::ze_ipc_property_flag_t } ze_driver_ipc_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves IPC attributes of the driver /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pIpcProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeDriverGetIpcProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_ipc_properties_t* pIpcProperties ///< [in,out] query result for IPC properties ); /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAX_EXTENSION_NAME /// @brief Maximum extension name string size #define ZE_MAX_EXTENSION_NAME 256 #endif // ZE_MAX_EXTENSION_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Extension properties queried using ::zeDriverGetExtensionProperties typedef struct _ze_driver_extension_properties_t { char name[ZE_MAX_EXTENSION_NAME]; ///< [out] extension name uint32_t version; ///< [out] extension version using ::ZE_MAKE_VERSION } ze_driver_extension_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves extension properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **vkEnumerateInstanceExtensionProperties** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeDriverGetExtensionProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. ze_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves function pointer for vendor-specific or experimental /// extensions /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == name` /// + `nullptr == ppFunctionAddress` ZE_APIEXPORT ze_result_t ZE_APICALL zeDriverGetExtensionFunctionAddress( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves a string describing the last error code returned by the /// driver in the current thread. /// /// @details /// - String returned is thread local. /// - String is only updated on calls returning an error, i.e., not on calls /// returning ::ZE_RESULT_SUCCESS. /// - String may be empty if driver considers error code is already explicit /// enough to describe cause. /// - Memory pointed to by ppString is owned by the driver. /// - String returned is null-terminated. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ppString` ZE_APIEXPORT ze_result_t ZE_APICALL zeDriverGetLastErrorDescription( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char** ppString ///< [in,out] pointer to a null-terminated array of characters describing ///< cause of error. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Device #if !defined(__GNUC__) #pragma region device #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves devices within a driver /// /// @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 is /// affected by the ::ZE_AFFINITY_MASK and ::ZE_ENABLE_PCI_ID_DEVICE_ORDER /// environment variables. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGet( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of devices. ///< if count is zero, then the driver shall update the value with the ///< total number of devices available. ///< if count is greater than the number of devices available, then the ///< driver shall update the value with the correct number of devices available. ze_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of devices. ///< if count is less than the number of devices available, then driver ///< shall only retrieve that number of devices. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves the root-device of a device handle /// /// @details /// - When the device handle passed does not belong to any root-device, /// nullptr is returned. /// - Multiple calls to this function will return the same device handle. /// - The root-device handle returned by this function does not have access /// automatically to the resources /// created with the associated sub-device, unless those resources have /// been created with a context /// explicitly containing both handles. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phRootDevice` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetRootDevice( ze_device_handle_t hDevice, ///< [in] handle of the device object ze_device_handle_t* phRootDevice ///< [in,out] parent root device. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves a sub-device from a device /// /// @details /// - When the device handle passed does not contain any sub-device, a /// pCount of 0 is returned. /// - Multiple calls to this function will return identical device handles, /// in the same order. /// - The number of handles returned from this function is affected by the /// ::ZE_AFFINITY_MASK environment variable. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clCreateSubDevices /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetSubDevices( ze_device_handle_t hDevice, ///< [in] handle of the device object uint32_t* pCount, ///< [in,out] pointer to the number of sub-devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-devices available. ///< if count is greater than the number of sub-devices available, then the ///< driver shall update the value with the correct number of sub-devices available. ze_device_handle_t* phSubdevices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-devices. ///< if count is less than the number of sub-devices available, then driver ///< shall only retrieve that number of sub-devices. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported device types typedef enum _ze_device_type_t { ZE_DEVICE_TYPE_GPU = 1, ///< Graphics Processing Unit ZE_DEVICE_TYPE_CPU = 2, ///< Central Processing Unit ZE_DEVICE_TYPE_FPGA = 3, ///< Field Programmable Gate Array ZE_DEVICE_TYPE_MCA = 4, ///< Memory Copy Accelerator ZE_DEVICE_TYPE_VPU = 5, ///< Vision Processing Unit ZE_DEVICE_TYPE_FORCE_UINT32 = 0x7fffffff } ze_device_type_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAX_DEVICE_UUID_SIZE /// @brief Maximum device universal unique id (UUID) size in bytes #define ZE_MAX_DEVICE_UUID_SIZE 16 #endif // ZE_MAX_DEVICE_UUID_SIZE /////////////////////////////////////////////////////////////////////////////// /// @brief Device universal unique id (UUID) typedef struct _ze_device_uuid_t { uint8_t id[ZE_MAX_DEVICE_UUID_SIZE]; ///< [out] opaque data representing a device UUID } ze_device_uuid_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAX_DEVICE_NAME /// @brief Maximum device name string size #define ZE_MAX_DEVICE_NAME 256 #endif // ZE_MAX_DEVICE_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Supported device property flags typedef uint32_t ze_device_property_flags_t; typedef enum _ze_device_property_flag_t { ZE_DEVICE_PROPERTY_FLAG_INTEGRATED = ZE_BIT(0), ///< Device is integrated with the Host. ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE = ZE_BIT(1), ///< Device handle used for query represents a sub-device. ZE_DEVICE_PROPERTY_FLAG_ECC = ZE_BIT(2), ///< Device supports error correction memory access. ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING = ZE_BIT(3), ///< Device supports on-demand page-faulting. ZE_DEVICE_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff } ze_device_property_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device properties queried using ::zeDeviceGetProperties typedef struct _ze_device_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_device_type_t type; ///< [out] generic device type uint32_t vendorId; ///< [out] vendor id from PCI configuration uint32_t deviceId; ///< [out] device id from PCI configuration. ///< Note, the device id uses little-endian format. ze_device_property_flags_t flags; ///< [out] 0 (none) or a valid combination of ::ze_device_property_flag_t uint32_t subdeviceId; ///< [out] sub-device id. Only valid if ::ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE ///< is set. uint32_t coreClockRate; ///< [out] Clock rate for device core. uint64_t maxMemAllocSize; ///< [out] Maximum memory allocation size. uint32_t maxHardwareContexts; ///< [out] Maximum number of logical hardware contexts. uint32_t maxCommandQueuePriority; ///< [out] Maximum priority for command queues. Higher value is higher ///< priority. uint32_t numThreadsPerEU; ///< [out] Maximum number of threads per EU. uint32_t physicalEUSimdWidth; ///< [out] The physical EU simd width. uint32_t numEUsPerSubslice; ///< [out] Maximum number of EUs per sub-slice. uint32_t numSubslicesPerSlice; ///< [out] Maximum number of sub-slices per slice. uint32_t numSlices; ///< [out] Maximum number of slices. uint64_t timerResolution; ///< [out] Returns the resolution of device timer used for profiling, ///< timestamps, etc. When stype==::ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES the ///< units are in nanoseconds. When ///< stype==::ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2 units are in ///< cycles/sec uint32_t timestampValidBits; ///< [out] Returns the number of valid bits in the timestamp value. uint32_t kernelTimestampValidBits; ///< [out] Returns the number of valid bits in the kernel timestamp values ze_device_uuid_t uuid; ///< [out] universal unique identifier. Note: Subdevices will have their ///< own uuid. char name[ZE_MAX_DEVICE_NAME]; ///< [out] Device name } ze_device_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device thread identifier. typedef struct _ze_device_thread_t { uint32_t slice; ///< [in,out] the slice number. ///< Must be `UINT32_MAX` (all) or less than the `numSlices` member of ::ze_device_properties_t. uint32_t subslice; ///< [in,out] the sub-slice number within its slice. ///< Must be `UINT32_MAX` (all) or less than the `numSubslicesPerSlice` ///< member of ::ze_device_properties_t. uint32_t eu; ///< [in,out] the EU number within its sub-slice. ///< Must be `UINT32_MAX` (all) or less than the `numEUsPerSubslice` member ///< of ::ze_device_properties_t. uint32_t thread; ///< [in,out] the thread number within its EU. ///< Must be `UINT32_MAX` (all) or less than the `numThreadsPerEU` member ///< of ::ze_device_properties_t. } ze_device_thread_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves properties of the device. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clGetDeviceInfo /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pDeviceProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_properties_t* pDeviceProperties ///< [in,out] query result for device properties ); /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_SUBGROUPSIZE_COUNT /// @brief Maximum number of subgroup sizes supported. #define ZE_SUBGROUPSIZE_COUNT 8 #endif // ZE_SUBGROUPSIZE_COUNT /////////////////////////////////////////////////////////////////////////////// /// @brief Device compute properties queried using ::zeDeviceGetComputeProperties typedef struct _ze_device_compute_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t maxTotalGroupSize; ///< [out] Maximum items per compute group. (groupSizeX * groupSizeY * ///< groupSizeZ) <= maxTotalGroupSize uint32_t maxGroupSizeX; ///< [out] Maximum items for X dimension in group uint32_t maxGroupSizeY; ///< [out] Maximum items for Y dimension in group uint32_t maxGroupSizeZ; ///< [out] Maximum items for Z dimension in group uint32_t maxGroupCountX; ///< [out] Maximum groups that can be launched for x dimension uint32_t maxGroupCountY; ///< [out] Maximum groups that can be launched for y dimension uint32_t maxGroupCountZ; ///< [out] Maximum groups that can be launched for z dimension uint32_t maxSharedLocalMemory; ///< [out] Maximum shared local memory per group. uint32_t numSubGroupSizes; ///< [out] Number of subgroup sizes supported. This indicates number of ///< entries in subGroupSizes. uint32_t subGroupSizes[ZE_SUBGROUPSIZE_COUNT]; ///< [out] Size group sizes supported. } ze_device_compute_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves compute properties of the device. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clGetDeviceInfo /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pComputeProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetComputeProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_compute_properties_t* pComputeProperties ///< [in,out] query result for compute properties ); /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAX_NATIVE_KERNEL_UUID_SIZE /// @brief Maximum native kernel universal unique id (UUID) size in bytes #define ZE_MAX_NATIVE_KERNEL_UUID_SIZE 16 #endif // ZE_MAX_NATIVE_KERNEL_UUID_SIZE /////////////////////////////////////////////////////////////////////////////// /// @brief Native kernel universal unique id (UUID) typedef struct _ze_native_kernel_uuid_t { uint8_t id[ZE_MAX_NATIVE_KERNEL_UUID_SIZE]; ///< [out] opaque data representing a native kernel UUID } ze_native_kernel_uuid_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported device module flags typedef uint32_t ze_device_module_flags_t; typedef enum _ze_device_module_flag_t { ZE_DEVICE_MODULE_FLAG_FP16 = ZE_BIT(0), ///< Device supports 16-bit floating-point operations ZE_DEVICE_MODULE_FLAG_FP64 = ZE_BIT(1), ///< Device supports 64-bit floating-point operations ZE_DEVICE_MODULE_FLAG_INT64_ATOMICS = ZE_BIT(2), ///< Device supports 64-bit atomic operations ZE_DEVICE_MODULE_FLAG_DP4A = ZE_BIT(3), ///< Device supports four component dot product and accumulate operations ZE_DEVICE_MODULE_FLAG_FORCE_UINT32 = 0x7fffffff } ze_device_module_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported floating-Point capability flags typedef uint32_t ze_device_fp_flags_t; typedef enum _ze_device_fp_flag_t { ZE_DEVICE_FP_FLAG_DENORM = ZE_BIT(0), ///< Supports denorms ZE_DEVICE_FP_FLAG_INF_NAN = ZE_BIT(1), ///< Supports INF and quiet NaNs ZE_DEVICE_FP_FLAG_ROUND_TO_NEAREST = ZE_BIT(2), ///< Supports rounding to nearest even rounding mode ZE_DEVICE_FP_FLAG_ROUND_TO_ZERO = ZE_BIT(3), ///< Supports rounding to zero. ZE_DEVICE_FP_FLAG_ROUND_TO_INF = ZE_BIT(4), ///< Supports rounding to both positive and negative INF. ZE_DEVICE_FP_FLAG_FMA = ZE_BIT(5), ///< Supports IEEE754-2008 fused multiply-add. ZE_DEVICE_FP_FLAG_ROUNDED_DIVIDE_SQRT = ZE_BIT(6), ///< Supports rounding as defined by IEEE754 for divide and sqrt ///< operations. ZE_DEVICE_FP_FLAG_SOFT_FLOAT = ZE_BIT(7), ///< Uses software implementation for basic floating-point operations. ZE_DEVICE_FP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_device_fp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device module properties queried using ::zeDeviceGetModuleProperties typedef struct _ze_device_module_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t spirvVersionSupported; ///< [out] Maximum supported SPIR-V version. ///< Returns zero if SPIR-V is not supported. ///< Contains major and minor attributes, use ::ZE_MAJOR_VERSION and ::ZE_MINOR_VERSION. ze_device_module_flags_t flags; ///< [out] 0 or a valid combination of ::ze_device_module_flag_t ze_device_fp_flags_t fp16flags; ///< [out] Capabilities for half-precision floating-point operations. ///< returns 0 (if ::ZE_DEVICE_MODULE_FLAG_FP16 is not set) or a ///< combination of ::ze_device_fp_flag_t. ze_device_fp_flags_t fp32flags; ///< [out] Capabilities for single-precision floating-point operations. ///< returns a combination of ::ze_device_fp_flag_t. ze_device_fp_flags_t fp64flags; ///< [out] Capabilities for double-precision floating-point operations. ///< returns 0 (if ::ZE_DEVICE_MODULE_FLAG_FP64 is not set) or a ///< combination of ::ze_device_fp_flag_t. uint32_t maxArgumentsSize; ///< [out] Maximum kernel argument size that is supported. uint32_t printfBufferSize; ///< [out] Maximum size of internal buffer that holds output of printf ///< calls from kernel. ze_native_kernel_uuid_t nativeKernelSupported; ///< [out] Compatibility UUID of supported native kernel. ///< UUID may or may not be the same across driver release, devices, or ///< operating systems. ///< Application is responsible for ensuring UUID matches before creating ///< module using ///< previously created native kernel. } ze_device_module_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves module properties of the device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pModuleProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetModuleProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_module_properties_t* pModuleProperties ///< [in,out] query result for module properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported command queue group property flags typedef uint32_t ze_command_queue_group_property_flags_t; typedef enum _ze_command_queue_group_property_flag_t { ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE = ZE_BIT(0), ///< Command queue group supports enqueing compute commands. ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY = ZE_BIT(1), ///< Command queue group supports enqueing copy commands. ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COOPERATIVE_KERNELS = ZE_BIT(2), ///< Command queue group supports cooperative kernels. ///< See ::zeCommandListAppendLaunchCooperativeKernel for more details. ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_METRICS = ZE_BIT(3), ///< Command queue groups supports metric queries. ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff } ze_command_queue_group_property_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Command queue group properties queried using /// ::zeDeviceGetCommandQueueGroupProperties typedef struct _ze_command_queue_group_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_command_queue_group_property_flags_t flags; ///< [out] 0 (none) or a valid combination of ///< ::ze_command_queue_group_property_flag_t size_t maxMemoryFillPatternSize; ///< [out] maximum `pattern_size` supported by command queue group. ///< See ::zeCommandListAppendMemoryFill for more details. uint32_t numQueues; ///< [out] the number of physical engines within the group. } ze_command_queue_group_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves command queue group properties of the device. /// /// @details /// - Properties are reported for each physical command queue type supported /// by the device. /// - Multiple calls to this function will return properties in the same /// order. /// - The order in which the properties are returned defines the command /// queue group's ordinal. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **vkGetPhysicalDeviceQueueFamilyProperties** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetCommandQueueGroupProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of command queue group properties. ///< if count is zero, then the driver shall update the value with the ///< total number of command queue group properties available. ///< if count is greater than the number of command queue group properties ///< available, then the driver shall update the value with the correct ///< number of command queue group properties available. ze_command_queue_group_properties_t* pCommandQueueGroupProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< command queue group properties. ///< if count is less than the number of command queue group properties ///< available, then driver shall only retrieve that number of command ///< queue group properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported device memory property flags typedef uint32_t ze_device_memory_property_flags_t; typedef enum _ze_device_memory_property_flag_t { ZE_DEVICE_MEMORY_PROPERTY_FLAG_TBD = ZE_BIT(0), ///< reserved for future use ZE_DEVICE_MEMORY_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff } ze_device_memory_property_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device local memory properties queried using /// ::zeDeviceGetMemoryProperties typedef struct _ze_device_memory_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_device_memory_property_flags_t flags; ///< [out] 0 (none) or a valid combination of ///< ::ze_device_memory_property_flag_t uint32_t maxClockRate; ///< [out] Maximum clock rate for device memory. uint32_t maxBusWidth; ///< [out] Maximum bus width between device and memory. uint64_t totalSize; ///< [out] Total memory size in bytes that is available to the device. char name[ZE_MAX_DEVICE_NAME]; ///< [out] Memory name } ze_device_memory_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves local memory properties of the device. /// /// @details /// - Properties are reported for each physical memory type supported by the /// device. /// - Multiple calls to this function will return properties in the same /// order. /// - The order in which the properties are returned defines the device's /// local memory ordinal. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clGetDeviceInfo /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetMemoryProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of memory properties. ///< if count is zero, then the driver shall update the value with the ///< total number of memory properties available. ///< if count is greater than the number of memory properties available, ///< then the driver shall update the value with the correct number of ///< memory properties available. ze_device_memory_properties_t* pMemProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< memory properties. ///< if count is less than the number of memory properties available, then ///< driver shall only retrieve that number of memory properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Memory access capability flags /// /// @details /// - Supported access capabilities for different types of memory /// allocations typedef uint32_t ze_memory_access_cap_flags_t; typedef enum _ze_memory_access_cap_flag_t { ZE_MEMORY_ACCESS_CAP_FLAG_RW = ZE_BIT(0), ///< Supports load/store access ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC = ZE_BIT(1), ///< Supports atomic access ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT = ZE_BIT(2), ///< Supports concurrent access ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT_ATOMIC = ZE_BIT(3), ///< Supports concurrent atomic access ZE_MEMORY_ACCESS_CAP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_memory_access_cap_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device memory access properties queried using /// ::zeDeviceGetMemoryAccessProperties typedef struct _ze_device_memory_access_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_memory_access_cap_flags_t hostAllocCapabilities; ///< [out] host memory capabilities. ///< returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t. ze_memory_access_cap_flags_t deviceAllocCapabilities; ///< [out] device memory capabilities. ///< returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t. ze_memory_access_cap_flags_t sharedSingleDeviceAllocCapabilities; ///< [out] shared, single-device memory capabilities. ///< returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t. ze_memory_access_cap_flags_t sharedCrossDeviceAllocCapabilities; ///< [out] shared, cross-device memory capabilities. ///< returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t. ze_memory_access_cap_flags_t sharedSystemAllocCapabilities; ///< [out] shared, system memory capabilities. ///< returns 0 (unsupported) or a combination of ::ze_memory_access_cap_flag_t. } ze_device_memory_access_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves memory access properties of the device. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clGetDeviceInfo /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pMemAccessProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetMemoryAccessProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_memory_access_properties_t* pMemAccessProperties ///< [in,out] query result for memory access properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported cache control property flags typedef uint32_t ze_device_cache_property_flags_t; typedef enum _ze_device_cache_property_flag_t { ZE_DEVICE_CACHE_PROPERTY_FLAG_USER_CONTROL = ZE_BIT(0), ///< Device support User Cache Control (i.e. SLM section vs Generic Cache) ZE_DEVICE_CACHE_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff } ze_device_cache_property_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device cache properties queried using ::zeDeviceGetCacheProperties typedef struct _ze_device_cache_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_device_cache_property_flags_t flags; ///< [out] 0 (none) or a valid combination of ///< ::ze_device_cache_property_flag_t size_t cacheSize; ///< [out] Per-cache size, in bytes } ze_device_cache_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves cache properties of the device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clGetDeviceInfo /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetCacheProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of cache properties. ///< if count is zero, then the driver shall update the value with the ///< total number of cache properties available. ///< if count is greater than the number of cache properties available, ///< then the driver shall update the value with the correct number of ///< cache properties available. ze_device_cache_properties_t* pCacheProperties ///< [in,out][optional][range(0, *pCount)] array of query results for cache properties. ///< if count is less than the number of cache properties available, then ///< driver shall only retrieve that number of cache properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Device image properties queried using ::zeDeviceGetImageProperties typedef struct _ze_device_image_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t maxImageDims1D; ///< [out] Maximum image dimensions for 1D resources. if 0, then 1D images ///< are unsupported. uint32_t maxImageDims2D; ///< [out] Maximum image dimensions for 2D resources. if 0, then 2D images ///< are unsupported. uint32_t maxImageDims3D; ///< [out] Maximum image dimensions for 3D resources. if 0, then 3D images ///< are unsupported. uint64_t maxImageBufferSize; ///< [out] Maximum image buffer size in bytes. if 0, then buffer images are ///< unsupported. uint32_t maxImageArraySlices; ///< [out] Maximum image array slices. if 0, then image arrays are ///< unsupported. uint32_t maxSamplers; ///< [out] Max samplers that can be used in kernel. if 0, then sampling is ///< unsupported. uint32_t maxReadImageArgs; ///< [out] Returns the maximum number of simultaneous image objects that ///< can be read from by a kernel. if 0, then reading images is ///< unsupported. uint32_t maxWriteImageArgs; ///< [out] Returns the maximum number of simultaneous image objects that ///< can be written to by a kernel. if 0, then writing images is ///< unsupported. } ze_device_image_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves image properties of the device /// /// @details /// - See ::zeImageGetProperties for format-specific capabilities. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pImageProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetImageProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_image_properties_t* pImageProperties ///< [in,out] query result for image properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Device external memory import and export properties typedef struct _ze_device_external_memory_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_external_memory_type_flags_t memoryAllocationImportTypes; ///< [out] Supported external memory import types for memory allocations. ze_external_memory_type_flags_t memoryAllocationExportTypes; ///< [out] Supported external memory export types for memory allocations. ze_external_memory_type_flags_t imageImportTypes; ///< [out] Supported external memory import types for images. ze_external_memory_type_flags_t imageExportTypes; ///< [out] Supported external memory export types for images. } ze_device_external_memory_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves external memory import and export of the device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pExternalMemoryProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetExternalMemoryProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_external_memory_properties_t* pExternalMemoryProperties ///< [in,out] query result for external memory properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported device peer-to-peer property flags typedef uint32_t ze_device_p2p_property_flags_t; typedef enum _ze_device_p2p_property_flag_t { ZE_DEVICE_P2P_PROPERTY_FLAG_ACCESS = ZE_BIT(0), ///< Device supports access between peer devices. ZE_DEVICE_P2P_PROPERTY_FLAG_ATOMICS = ZE_BIT(1), ///< Device supports atomics between peer devices. ZE_DEVICE_P2P_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff } ze_device_p2p_property_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device peer-to-peer properties queried using /// ::zeDeviceGetP2PProperties typedef struct _ze_device_p2p_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_device_p2p_property_flags_t flags; ///< [out] 0 (none) or a valid combination of ///< ::ze_device_p2p_property_flag_t } ze_device_p2p_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves peer-to-peer properties between one device and a peer /// devices /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// + `nullptr == hPeerDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pP2PProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetP2PProperties( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_device_p2p_properties_t* pP2PProperties ///< [in,out] Peer-to-Peer properties between source and peer device ); /////////////////////////////////////////////////////////////////////////////// /// @brief Queries if one device can directly access peer device allocations /// /// @details /// - Any device can access any other device within a node through a /// scale-up fabric. /// - The following are conditions for CanAccessPeer query. /// + If both device and peer device are the same then return true. /// + If both sub-device and peer sub-device are the same then return /// true. /// + If both are sub-devices and share the same parent device then /// return true. /// + If both device and remote device are connected by a direct or /// indirect scale-up fabric or over PCIe (same root complex or shared /// PCIe switch) then true. /// + If both sub-device and remote parent device (and vice-versa) are /// connected by a direct or indirect scale-up fabric or over PCIe /// (same root complex or shared PCIe switch) then true. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// + `nullptr == hPeerDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == value` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceCanAccessPeer( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_bool_t* value ///< [out] returned access capability ); /////////////////////////////////////////////////////////////////////////////// /// @brief Returns current status of the device. /// /// @details /// - Once a device is reset, this call will update the OS handle attached /// to the device handle. /// - The application may call this function from simultaneous threads with /// the same device handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_SUCCESS /// + Device is available for use. /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// + Device is lost; must be reset for use. ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetStatus( ze_device_handle_t hDevice ///< [in] handle of the device ); /////////////////////////////////////////////////////////////////////////////// /// @brief Returns synchronized Host and device global timestamps. /// /// @details /// - The application may call this function from simultaneous threads with /// the same device handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == hostTimestamp` /// + `nullptr == deviceTimestamp` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + The feature is not supported by the underlying platform. ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetGlobalTimestamps( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the ///< Host's global timestamp value. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Context #if !defined(__GNUC__) #pragma region context #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported context creation flags typedef uint32_t ze_context_flags_t; typedef enum _ze_context_flag_t { ZE_CONTEXT_FLAG_TBD = ZE_BIT(0), ///< reserved for future use ZE_CONTEXT_FLAG_FORCE_UINT32 = 0x7fffffff } ze_context_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Context descriptor typedef struct _ze_context_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_context_flags_t flags; ///< [in] creation flags. ///< must be 0 (default) or a valid combination of ::ze_context_flag_t; ///< default behavior may use implicit driver-based heuristics. } ze_context_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a context for the driver. /// /// @details /// - The application must only use the context for the driver which was /// provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phContext` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x1 < desc->flags` ZE_APIEXPORT ze_result_t ZE_APICALL zeContextCreate( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a context for the driver. /// /// @details /// - The application must only use the context for the driver which was /// provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phContext` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x1 < desc->flags` /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phDevices) && (0 < numDevices)` ZE_APIEXPORT ze_result_t ZE_APICALL zeContextCreateEx( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< context has visibility. ///< if nullptr, then all devices and any sub-devices supported by the ///< driver instance are ///< visible to the context. ///< otherwise, the context only has visibility to the devices and any ///< sub-devices of the ///< devices in this array. ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a context. /// /// @details /// - The application must ensure the device is not currently referencing /// the context before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this context. /// - The application must **not** call this function from simultaneous /// threads with the same context handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeContextDestroy( ze_context_handle_t hContext ///< [in][release] handle of context object to destroy ); /////////////////////////////////////////////////////////////////////////////// /// @brief Returns current status of the context. /// /// @details /// - The application may call this function from simultaneous threads with /// the same context handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_SUCCESS /// + Context is available for use. /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// + Context is invalid; due to device lost or reset. ZE_APIEXPORT ze_result_t ZE_APICALL zeContextGetStatus( ze_context_handle_t hContext ///< [in] handle of context object ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Command Queue #if !defined(__GNUC__) #pragma region cmdqueue #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported command queue flags typedef uint32_t ze_command_queue_flags_t; typedef enum _ze_command_queue_flag_t { ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY = ZE_BIT(0), ///< command queue should be optimized for submission to a single device engine. ///< driver **must** disable any implicit optimizations for distributing ///< work across multiple engines. ///< this flag should be used when applications want full control over ///< multi-engine submission and scheduling. ZE_COMMAND_QUEUE_FLAG_IN_ORDER = ZE_BIT(1), ///< To be used only when creating immediate command lists. Commands ///< appended to the immediate command ///< list are executed in-order, with driver implementation enforcing ///< dependencies between them. ///< Application is not required to have the signal event of a given ///< command being the wait event of ///< the next to define an in-order list, and application is allowed to ///< pass signal and wait events ///< to each appended command to implement more complex dependency graphs. ZE_COMMAND_QUEUE_FLAG_FORCE_UINT32 = 0x7fffffff } ze_command_queue_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported command queue modes typedef enum _ze_command_queue_mode_t { ZE_COMMAND_QUEUE_MODE_DEFAULT = 0, ///< implicit default behavior; uses driver-based heuristics ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS = 1, ///< Device execution always completes immediately on execute; ///< Host thread is blocked using wait on implicit synchronization object ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS = 2, ///< Device execution is scheduled and will complete in future; ///< explicit synchronization object must be used to determine completeness ZE_COMMAND_QUEUE_MODE_FORCE_UINT32 = 0x7fffffff } ze_command_queue_mode_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported command queue priorities typedef enum _ze_command_queue_priority_t { ZE_COMMAND_QUEUE_PRIORITY_NORMAL = 0, ///< [default] normal priority ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW = 1, ///< lower priority than normal ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH = 2, ///< higher priority than normal ZE_COMMAND_QUEUE_PRIORITY_FORCE_UINT32 = 0x7fffffff } ze_command_queue_priority_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Command Queue descriptor typedef struct _ze_command_queue_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t ordinal; ///< [in] command queue group ordinal uint32_t index; ///< [in] command queue index within the group; ///< must be zero if ::ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY is not set ze_command_queue_flags_t flags; ///< [in] usage flags. ///< must be 0 (default) or a valid combination of ::ze_command_queue_flag_t; ///< default behavior may use implicit driver-based heuristics to balance ///< latency and throughput. ze_command_queue_mode_t mode; ///< [in] operation mode ze_command_queue_priority_t priority; ///< [in] priority } ze_command_queue_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a command queue on the context. /// /// @details /// - A command queue represents a logical input stream to the device, tied /// to a physical input stream. /// - The application must only use the command queue for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @remarks /// _Analogues_ /// - **clCreateCommandQueue** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phCommandQueue` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// + `::ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS < desc->mode` /// + `::ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH < desc->priority` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* desc, ///< [in] pointer to command queue descriptor ze_command_queue_handle_t* phCommandQueue ///< [out] pointer to handle of command queue object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a command queue. /// /// @details /// - The application must destroy all fence handles created from the /// command queue before destroying the command queue itself /// - The application must ensure the device is not currently referencing /// the command queue before it is deleted /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this command queue /// - The application must **not** call this function from simultaneous /// threads with the same command queue handle. /// - The implementation of this function must be thread-safe. /// /// @remarks /// _Analogues_ /// - **clReleaseCommandQueue** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandQueue` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueDestroy( ze_command_queue_handle_t hCommandQueue ///< [in][release] handle of command queue object to destroy ); /////////////////////////////////////////////////////////////////////////////// /// @brief Executes a command list in a command queue. /// /// @details /// - The command lists are submitted to the device in the order they are /// received, whether from multiple calls (on the same or different /// threads) or a single call with multiple command lists. /// - The application must ensure the command lists are accessible by the /// device on which the command queue was created. /// - The application must ensure the device is not currently referencing /// the command list since the implementation is allowed to modify the /// contents of the command list for submission. /// - The application must only execute command lists created with an /// identical command queue group ordinal to the command queue. /// - The application must use a fence created using the same command queue. /// - The application must ensure the command queue, command list and fence /// were created on the same context. /// - The application must ensure the command lists being executed are not /// immediate command lists. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - vkQueueSubmit /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandQueue` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phCommandLists` /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `0 == numCommandLists` /// - ::ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueExecuteCommandLists( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t numCommandLists, ///< [in] number of command lists to execute ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] list of handles of the command lists ///< to execute ze_fence_handle_t hFence ///< [in][optional] handle of the fence to signal on completion ); /////////////////////////////////////////////////////////////////////////////// /// @brief Synchronizes a command queue by waiting on the host. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandQueue` /// - ::ZE_RESULT_NOT_READY /// + timeout expired ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueSynchronize( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the command queue; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the command queue group ordinal. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandQueue` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOrdinal` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueGetOrdinal( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pOrdinal ///< [out] command queue group ordinal ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the command queue index within the group. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandQueue` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pIndex` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandQueueGetIndex( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pIndex ///< [out] command queue index within the group ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Command List #if !defined(__GNUC__) #pragma region cmdlist #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported command list creation flags typedef uint32_t ze_command_list_flags_t; typedef enum _ze_command_list_flag_t { ZE_COMMAND_LIST_FLAG_RELAXED_ORDERING = ZE_BIT(0), ///< driver may reorder commands (e.g., kernels, copies) between barriers ///< and synchronization primitives. ///< using this flag may increase Host overhead of ::zeCommandListClose. ///< therefore, this flag should **not** be set for low-latency usage-models. ZE_COMMAND_LIST_FLAG_MAXIMIZE_THROUGHPUT = ZE_BIT(1), ///< driver may perform additional optimizations that increase execution ///< throughput. ///< using this flag may increase Host overhead of ::zeCommandListClose and ::zeCommandQueueExecuteCommandLists. ///< therefore, this flag should **not** be set for low-latency usage-models. ZE_COMMAND_LIST_FLAG_EXPLICIT_ONLY = ZE_BIT(2), ///< command list should be optimized for submission to a single command ///< queue and device engine. ///< driver **must** disable any implicit optimizations for distributing ///< work across multiple engines. ///< this flag should be used when applications want full control over ///< multi-engine submission and scheduling. ZE_COMMAND_LIST_FLAG_IN_ORDER = ZE_BIT(3), ///< commands appended to this command list are executed in-order, with ///< driver implementation ///< enforcing dependencies between them. Application is not required to ///< have the signal event ///< of a given command being the wait event of the next to define an ///< in-order list, and ///< application is allowed to pass signal and wait events to each appended ///< command to implement ///< more complex dependency graphs. Cannot be combined with ::ZE_COMMAND_LIST_FLAG_RELAXED_ORDERING. ZE_COMMAND_LIST_FLAG_EXP_CLONEABLE = ZE_BIT(4), ///< this command list may be cloned using ::zeCommandListCreateCloneExp ///< after ::zeCommandListClose. ZE_COMMAND_LIST_FLAG_FORCE_UINT32 = 0x7fffffff } ze_command_list_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Command List descriptor typedef struct _ze_command_list_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t commandQueueGroupOrdinal; ///< [in] command queue group ordinal to which this command list will be ///< submitted ze_command_list_flags_t flags; ///< [in] usage flags. ///< must be 0 (default) or a valid combination of ::ze_command_list_flag_t; ///< default behavior may use implicit driver-based heuristics to balance ///< latency and throughput. } ze_command_list_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a command list on the context. /// /// @details /// - A command list represents a sequence of commands for execution on a /// command queue. /// - The command list is created in the 'open' state. /// - The application must only use the command list for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phCommandList` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x1f < desc->flags` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_list_desc_t* desc, ///< [in] pointer to command list descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Creates an immediate command list on the context. /// /// @details /// - An immediate command list is used for low-latency submission of /// commands. /// - An immediate command list creates an implicit command queue. /// - Immediate command lists must not be passed to /// ::zeCommandQueueExecuteCommandLists. /// - Commands appended into an immediate command list may execute /// synchronously, by blocking until the command is complete. /// - The command list is created in the 'open' state and never needs to be /// closed. /// - The application must only use the command list for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == altdesc` /// + `nullptr == phCommandList` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < altdesc->flags` /// + `::ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS < altdesc->mode` /// + `::ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH < altdesc->priority` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListCreateImmediate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* altdesc, ///< [in] pointer to command queue descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a command list. /// /// @details /// - The application must ensure the device is not currently referencing /// the command list before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this command list. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListDestroy( ze_command_list_handle_t hCommandList ///< [in][release] handle of command list object to destroy ); /////////////////////////////////////////////////////////////////////////////// /// @brief Closes a command list; ready to be executed by a command queue. /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListClose( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to close ); /////////////////////////////////////////////////////////////////////////////// /// @brief Reset a command list to initial (empty) state; ready for appending /// commands. /// /// @details /// - The application must ensure the device is not currently referencing /// the command list before it is reset /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListReset( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to reset ); /////////////////////////////////////////////////////////////////////////////// /// @brief Appends a memory write of the device's global timestamp value into a /// command list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The timestamp frequency can be queried from the `timerResolution` /// member of ::ze_device_properties_t. /// - The number of valid bits in the timestamp value can be queried from /// the `timestampValidBits` member of ::ze_device_properties_t. /// - The application must ensure the memory pointed to by dstptr is /// accessible by the device on which the command list was created. /// - The application must ensure the command list and events were created, /// and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendWriteGlobalTimestamp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t* dstptr, ///< [in,out] pointer to memory where timestamp value will be written; must ///< be 8byte-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ); /////////////////////////////////////////////////////////////////////////////// /// @brief Synchronizes an immediate command list by waiting on the host for the /// completion of all commands previously submitted to it. /// /// @details /// - The application must call this function only with command lists /// created with ::zeCommandListCreateImmediate. /// - Waiting on one immediate command list shall not block the concurrent /// execution of commands appended to other /// immediate command lists created with either a different ordinal or /// different index. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_NOT_READY /// + timeout expired /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + handle does not correspond to an immediate command list ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListHostSynchronize( ze_command_list_handle_t hCommandList, ///< [in] handle of the immediate command list uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the immediate command list; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the handle of the device on which the command list was created. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phDevice` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListGetDeviceHandle( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_device_handle_t* phDevice ///< [out] handle of the device on which the command list was created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the handle of the context on which the command list was created. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phContext` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListGetContextHandle( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_context_handle_t* phContext ///< [out] handle of the context on which the command list was created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the command queue group ordinal to which the command list is /// submitted. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOrdinal` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListGetOrdinal( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t* pOrdinal ///< [out] command queue group ordinal to which command list is submitted ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the command queue index within the group to which the immediate /// command list is submitted. /// /// @details /// - The application must call this function only with command lists /// created with ::zeCommandListCreateImmediate. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandListImmediate` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pIndex` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + handle does not correspond to an immediate command list ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListImmediateGetIndex( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t* pIndex ///< [out] command queue index within the group to which the immediate ///< command list is submitted ); /////////////////////////////////////////////////////////////////////////////// /// @brief Query whether a command list is an immediate command list. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pIsImmediate` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListIsImmediate( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_bool_t* pIsImmediate ///< [out] Boolean indicating whether the command list is an immediate ///< command list (true) or not (false) ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Barrier #if !defined(__GNUC__) #pragma region barrier #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Appends an execution and global memory barrier into a command list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - If numWaitEvents is zero, then all previous commands, enqueued on same /// command queue, must complete prior to the execution of the barrier. /// This is not the case when numWaitEvents is non-zero. /// - If numWaitEvents is non-zero, then only all phWaitEvents must be /// signaled prior to the execution of the barrier. /// - This command blocks all following commands from beginning until the /// execution of the barrier completes. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **vkCmdPipelineBarrier** /// - clEnqueueBarrierWithWaitList /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendBarrier( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ); /////////////////////////////////////////////////////////////////////////////// /// @brief Appends a global memory ranges barrier into a command list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - If numWaitEvents is zero, then all previous commands are completed /// prior to the execution of the barrier. /// - If numWaitEvents is non-zero, then then all phWaitEvents must be /// signaled prior to the execution of the barrier. /// - This command blocks all following commands from beginning until the /// execution of the barrier completes. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRangeSizes` /// + `nullptr == pRanges` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryRangesBarrier( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numRanges, ///< [in] number of memory ranges const size_t* pRangeSizes, ///< [in][range(0, numRanges)] array of sizes of memory range const void** pRanges, ///< [in][range(0, numRanges)] array of memory ranges ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ); /////////////////////////////////////////////////////////////////////////////// /// @brief Ensures in-bound writes to the device are globally observable. /// /// @details /// - This is a special-case system level barrier that can be used to ensure /// global observability of writes; /// typically needed after a producer (e.g., NIC) performs direct writes /// to the device's memory (e.g., Direct RDMA writes). /// This is typically required when the memory corresponding to the writes /// is subsequently accessed from a remote device. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` ZE_APIEXPORT ze_result_t ZE_APICALL zeContextSystemBarrier( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice ///< [in] handle of the device ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Copies #if !defined(__GNUC__) #pragma region copy #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Copies host, device, or shared memory. /// /// @details /// - The application must ensure the memory pointed to by dstptr and srcptr /// is accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by dstptr and /// srcptr as they are free to be modified by either the Host or device up /// until execution. /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the command list and events were created, /// and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clEnqueueCopyBuffer** /// - **clEnqueueReadBuffer** /// - **clEnqueueWriteBuffer** /// - **clEnqueueSVMMemcpy** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// + `nullptr == srcptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryCopy( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Initializes host, device, or shared memory. /// /// @details /// - The application must ensure the memory pointed to by dstptr is /// accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by dstptr as /// it is free to be modified by either the Host or device up until /// execution. /// - The value to initialize memory to is described by the pattern and the /// pattern size. /// - The pattern size must be a power-of-two and less than or equal to the /// `maxMemoryFillPatternSize` member of /// ::ze_command_queue_group_properties_t. /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the command list and events were created, /// and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clEnqueueFillBuffer** /// - **clEnqueueSVMMemFill** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// + `nullptr == pattern` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryFill( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* ptr, ///< [in] pointer to memory to initialize const void* pattern, ///< [in] pointer to value to initialize memory to size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to size_t size, ///< [in] size in bytes to initialize ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Copy region descriptor typedef struct _ze_copy_region_t { uint32_t originX; ///< [in] The origin x offset for region in bytes uint32_t originY; ///< [in] The origin y offset for region in rows uint32_t originZ; ///< [in] The origin z offset for region in slices uint32_t width; ///< [in] The region width relative to origin in bytes uint32_t height; ///< [in] The region height relative to origin in rows uint32_t depth; ///< [in] The region depth relative to origin in slices. Set this to 0 for ///< 2D copy. } ze_copy_region_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Copies a region from a 2D or 3D array of host, device, or shared /// memory. /// /// @details /// - The application must ensure the memory pointed to by dstptr and srcptr /// is accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by dstptr and /// srcptr as they are free to be modified by either the Host or device up /// until execution. /// - The region width, height, and depth for both src and dst must be same. /// The origins can be different. /// - The src and dst regions cannot be overlapping. /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the command list and events were created, /// and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// + `nullptr == dstRegion` /// + `nullptr == srcptr` /// + `nullptr == srcRegion` /// - ::ZE_RESULT_ERROR_OVERLAPPING_REGIONS /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const ze_copy_region_t* dstRegion, ///< [in] pointer to destination region to copy to uint32_t dstPitch, ///< [in] destination pitch in bytes uint32_t dstSlicePitch, ///< [in] destination slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. const void* srcptr, ///< [in] pointer to source memory to copy from const ze_copy_region_t* srcRegion, ///< [in] pointer to source region to copy from uint32_t srcPitch, ///< [in] source pitch in bytes uint32_t srcSlicePitch, ///< [in] source slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Copies host, device, or shared memory from another context. /// /// @details /// - The current active and source context must be from the same driver. /// - The application must ensure the memory pointed to by dstptr and srcptr /// is accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by dstptr and /// srcptr as they are free to be modified by either the Host or device up /// until execution. /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the command list and events were created, /// and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hContextSrc` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// + `nullptr == srcptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyFromContext( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_context_handle_t hContextSrc, ///< [in] handle of source context object const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Copies an image. /// /// @details /// - The application must ensure the image and events are accessible by the /// device on which the command list was created. /// - The application must ensure the image format descriptors for both /// source and destination images are the same. /// - The application must ensure the command list, images and events were /// created on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clEnqueueCopyImage** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hDstImage` /// + `nullptr == hSrcImage` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendImageCopy( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Region descriptor typedef struct _ze_image_region_t { uint32_t originX; ///< [in] The origin x offset for region in pixels uint32_t originY; ///< [in] The origin y offset for region in pixels uint32_t originZ; ///< [in] The origin z offset for region in pixels uint32_t width; ///< [in] The region width relative to origin in pixels uint32_t height; ///< [in] The region height relative to origin in pixels uint32_t depth; ///< [in] The region depth relative to origin. For 1D or 2D images, set ///< this to 1. } ze_image_region_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Copies a region of an image to another image. /// /// @details /// - The application must ensure the image and events are accessible by the /// device on which the command list was created. /// - The region width and height for both src and dst must be same. The /// origins can be different. /// - The src and dst regions cannot be overlapping. /// - The application must ensure the image format descriptors for both /// source and destination images are the same. /// - The application must ensure the command list, images and events were /// created, and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hDstImage` /// + `nullptr == hSrcImage` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_OVERLAPPING_REGIONS /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendImageCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Copies from an image to device or shared memory. /// /// @details /// - The application must ensure the memory pointed to by dstptr is /// accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by dstptr as /// it is free to be modified by either the Host or device up until /// execution. /// - The application must ensure the image and events are accessible by the /// device on which the command list was created. /// - The application must ensure the image format descriptor for the source /// image is a single-planar format. /// - The application must ensure the command list, image and events were /// created, and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clEnqueueReadImage /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hSrcImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemory( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Copies to an image from device or shared memory. /// /// @details /// - The application must ensure the memory pointed to by srcptr is /// accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by srcptr as /// it is free to be modified by either the Host or device up until /// execution. /// - The application must ensure the image and events are accessible by the /// device on which the command list was created. /// - The application must ensure the image format descriptor for the /// destination image is a single-planar format. /// - The application must ensure the command list, image and events were /// created, and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clEnqueueWriteImage /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hDstImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == srcptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendImageCopyFromMemory( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Asynchronously prefetches shared memory to the device associated with /// the specified command list /// /// @details /// - This is a hint to improve performance only and is not required for /// correctness. /// - Only prefetching to the device associated with the specified command /// list is supported. /// Prefetching to the host or to a peer device is not supported. /// - Prefetching may not be supported for all allocation types for all devices. /// If memory prefetching is not supported for the specified memory range /// the prefetch hint may be ignored. /// - Prefetching may only be supported at a device-specific granularity, /// such as at a page boundary. /// In this case, the memory range may be expanded such that the start and /// end of the range satisfy granularity requirements. /// - The application must ensure the memory pointed to by ptr is accessible /// by the device on which the command list was created. /// - The application must ensure the command list was created, and the /// memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clEnqueueSVMMigrateMem /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemoryPrefetch( ze_command_list_handle_t hCommandList, ///< [in] handle of command list const void* ptr, ///< [in] pointer to start of the memory range to prefetch size_t size ///< [in] size in bytes of the memory range to prefetch ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported memory advice hints typedef enum _ze_memory_advice_t { ZE_MEMORY_ADVICE_SET_READ_MOSTLY = 0, ///< hint that memory will be read from frequently and written to rarely ZE_MEMORY_ADVICE_CLEAR_READ_MOSTLY = 1, ///< removes the effect of ::ZE_MEMORY_ADVICE_SET_READ_MOSTLY ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION = 2, ///< hint that the preferred memory location is the specified device ZE_MEMORY_ADVICE_CLEAR_PREFERRED_LOCATION = 3, ///< removes the effect of ::ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION ZE_MEMORY_ADVICE_SET_NON_ATOMIC_MOSTLY = 4, ///< hints that memory will mostly be accessed non-atomically ZE_MEMORY_ADVICE_CLEAR_NON_ATOMIC_MOSTLY = 5, ///< removes the effect of ::ZE_MEMORY_ADVICE_SET_NON_ATOMIC_MOSTLY ZE_MEMORY_ADVICE_BIAS_CACHED = 6, ///< hints that memory should be cached ZE_MEMORY_ADVICE_BIAS_UNCACHED = 7, ///< hints that memory should be not be cached ZE_MEMORY_ADVICE_SET_SYSTEM_MEMORY_PREFERRED_LOCATION = 8, ///< hint that the preferred memory location is host memory ZE_MEMORY_ADVICE_CLEAR_SYSTEM_MEMORY_PREFERRED_LOCATION = 9, ///< removes the effect of ///< ::ZE_MEMORY_ADVICE_SET_SYSTEM_MEMORY_PREFERRED_LOCATION ZE_MEMORY_ADVICE_FORCE_UINT32 = 0x7fffffff } ze_memory_advice_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Provides advice about the use of a shared memory range /// /// @details /// - Memory advice is a performance hint only and is not required for /// functional correctness. /// - Memory advice can be used to override driver heuristics to explicitly /// control shared memory behavior. /// - Not all memory advice hints may be supported for all allocation types /// for all devices. /// If a memory advice hint is not supported by the device it will be ignored. /// - Memory advice may only be supported at a device-specific granularity, /// such as at a page boundary. /// In this case, the memory range may be expanded such that the start and /// end of the range satisfy granularity requirements. /// - The application must ensure the memory pointed to by ptr is accessible /// by the device on which the command list was created. /// - The application must ensure the command list was created, and memory /// was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle, and the memory was /// allocated. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_MEMORY_ADVICE_CLEAR_SYSTEM_MEMORY_PREFERRED_LOCATION < advice` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendMemAdvise( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_advice_t advice ///< [in] Memory advice for the memory range ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Event #if !defined(__GNUC__) #pragma region event #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported event pool creation flags typedef uint32_t ze_event_pool_flags_t; typedef enum _ze_event_pool_flag_t { ZE_EVENT_POOL_FLAG_HOST_VISIBLE = ZE_BIT(0), ///< signals and waits are also visible to host ZE_EVENT_POOL_FLAG_IPC = ZE_BIT(1), ///< signals and waits may be shared across processes ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP = ZE_BIT(2), ///< Indicates all events in pool will contain kernel timestamps ZE_EVENT_POOL_FLAG_KERNEL_MAPPED_TIMESTAMP = ZE_BIT(3), ///< Indicates all events in pool will contain kernel timestamps ///< synchronized to host time domain; cannot be combined with ///< ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP ZE_EVENT_POOL_FLAG_FORCE_UINT32 = 0x7fffffff } ze_event_pool_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Event pool descriptor typedef struct _ze_event_pool_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_event_pool_flags_t flags; ///< [in] creation flags. ///< must be 0 (default) or a valid combination of ::ze_event_pool_flag_t; ///< default behavior is signals and waits are visible to the entire device ///< and peer devices. uint32_t count; ///< [in] number of events within the pool; must be greater than 0 } ze_event_pool_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a pool of events on the context. /// /// @details /// - The application must only use events within the pool for the /// device(s), or their sub-devices, which were provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phEventPool` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xf < desc->flags` /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `0 == desc->count` /// + `(nullptr == phDevices) && (0 < numDevices)` ZE_APIEXPORT ze_result_t ZE_APICALL zeEventPoolCreate( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_event_pool_desc_t* desc, ///< [in] pointer to event pool descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< have visibility to the event pool. ///< if nullptr, then event pool is visible to all devices supported by the ///< driver instance. ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Deletes an event pool object. /// /// @details /// - The application must destroy all event handles created from the pool /// before destroying the pool itself. /// - The application must ensure the device is not currently referencing /// the any event within the pool before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this event pool. /// - The application must **not** call this function from simultaneous /// threads with the same event pool handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEventPool` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeEventPoolDestroy( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object to destroy ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported event scope flags typedef uint32_t ze_event_scope_flags_t; typedef enum _ze_event_scope_flag_t { ZE_EVENT_SCOPE_FLAG_SUBDEVICE = ZE_BIT(0), ///< cache hierarchies are flushed or invalidated sufficient for local ///< sub-device access ZE_EVENT_SCOPE_FLAG_DEVICE = ZE_BIT(1), ///< cache hierarchies are flushed or invalidated sufficient for global ///< device access and peer device access ZE_EVENT_SCOPE_FLAG_HOST = ZE_BIT(2), ///< cache hierarchies are flushed or invalidated sufficient for device and ///< host access ZE_EVENT_SCOPE_FLAG_FORCE_UINT32 = 0x7fffffff } ze_event_scope_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Event descriptor typedef struct _ze_event_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t index; ///< [in] index of the event within the pool; must be less than the count ///< specified during pool creation ze_event_scope_flags_t signal; ///< [in] defines the scope of relevant cache hierarchies to flush on a ///< signal action before the event is triggered. ///< must be 0 (default) or a valid combination of ::ze_event_scope_flag_t; ///< default behavior is synchronization within the command list only, no ///< additional cache hierarchies are flushed. ze_event_scope_flags_t wait; ///< [in] defines the scope of relevant cache hierarchies to invalidate on ///< a wait action after the event is complete. ///< must be 0 (default) or a valid combination of ::ze_event_scope_flag_t; ///< default behavior is synchronization within the command list only, no ///< additional cache hierarchies are invalidated. } ze_event_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates an event from the pool. /// /// @details /// - An event is used to communicate fine-grain host-to-device, /// device-to-host or device-to-device dependencies have completed. /// - The application must ensure the location in the pool is not being used /// by another event. /// - The application must **not** call this function from simultaneous /// threads with the same event pool handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clCreateUserEvent** /// - vkCreateEvent /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEventPool` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phEvent` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < desc->signal` /// + `0x7 < desc->wait` ZE_APIEXPORT ze_result_t ZE_APICALL zeEventCreate( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool const ze_event_desc_t* desc, ///< [in] pointer to event descriptor ze_event_handle_t* phEvent ///< [out] pointer to handle of event object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Deletes an event object. /// /// @details /// - The application must ensure the device is not currently referencing /// the event before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this event. /// - The application must **not** call this function from simultaneous /// threads with the same event handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clReleaseEvent** /// - vkDestroyEvent /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeEventDestroy( ze_event_handle_t hEvent ///< [in][release] handle of event object to destroy ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets an IPC event pool handle for the specified event handle that can /// be shared with another process. /// /// @details /// - Event pool must have been created with ::ZE_EVENT_POOL_FLAG_IPC. /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEventPool` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phIpc` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ZE_APIEXPORT ze_result_t ZE_APICALL zeEventPoolGetIpcHandle( ze_event_pool_handle_t hEventPool, ///< [in] handle of event pool object ze_ipc_event_pool_handle_t* phIpc ///< [out] Returned IPC event handle ); /////////////////////////////////////////////////////////////////////////////// /// @brief Returns an IPC event pool handle to the driver /// /// @details /// - This call must be used for IPC handles previously obtained with /// ::zeEventPoolGetIpcHandle. /// - Upon call, driver may release any underlying resources associated with /// the IPC handle. /// For instance, it may close the file descriptor contained in the IPC /// handle, if such type of handle is being used by the driver. /// - This call does not destroy the original event pool for which the IPC /// handle was created. /// - This function may **not** be called from simultaneous threads with the /// same IPC handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` ZE_APIEXPORT ze_result_t ZE_APICALL zeEventPoolPutIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object associated with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc ///< [in] IPC event pool handle ); /////////////////////////////////////////////////////////////////////////////// /// @brief Opens an IPC event pool handle to retrieve an event pool handle from /// another process. /// /// @details /// - Multiple calls to this function with the same IPC handle will return /// unique event pool handles. /// - The event handle in this process should not be freed with /// ::zeEventPoolDestroy, but rather with ::zeEventPoolCloseIpcHandle. /// - If the original event pool has been created for a device containing a /// number of sub-devices, then the event pool /// returned by this call may be used on a device containing the same /// number of sub-devices, or on any of /// those sub-devices. /// - However, if the original event pool has been created for a sub-device, /// then the event pool returned by this call /// cannot be used on a device containing any number of sub-devices, and /// must be used only in a sub-device. This ensures /// functional correctness for any implementation or optimizations the /// underlying Level Zero driver may do on /// event pools and events. /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phEventPool` ZE_APIEXPORT ze_result_t ZE_APICALL zeEventPoolOpenIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object to associate with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc, ///< [in] IPC event pool handle ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Closes an IPC event handle in the current process. /// /// @details /// - Closes an IPC event handle by destroying events that were opened in /// this process using ::zeEventPoolOpenIpcHandle. /// - The application must **not** call this function from simultaneous /// threads with the same event pool handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEventPool` ZE_APIEXPORT ze_result_t ZE_APICALL zeEventPoolCloseIpcHandle( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object ); /////////////////////////////////////////////////////////////////////////////// /// @brief Appends a signal of the event from the device into a command list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The duration of an event created from an event pool that was created /// using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP or /// ::ZE_EVENT_POOL_FLAG_KERNEL_MAPPED_TIMESTAMP flags is undefined. /// However, for consistency and orthogonality the event will report /// correctly as signaled when used by other event API functionality. /// - The application must ensure the command list and events were created /// on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clSetUserEventStatus** /// - vkCmdSetEvent /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendSignalEvent( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ); /////////////////////////////////////////////////////////////////////////////// /// @brief Appends wait on event(s) on the device into a command list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the command list and events were created /// on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phEvents` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendWaitOnEvents( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] number of events to wait on before continuing ze_event_handle_t* phEvents ///< [in][range(0, numEvents)] handles of the events to wait on before ///< continuing ); /////////////////////////////////////////////////////////////////////////////// /// @brief Signals a event from host. /// /// @details /// - The duration of an event created from an event pool that was created /// using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP or /// ::ZE_EVENT_POOL_FLAG_KERNEL_MAPPED_TIMESTAMP flags is undefined. /// However, for consistency and orthogonality the event will report /// correctly as signaled when used by other event API functionality. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clSetUserEventStatus /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ZE_APIEXPORT ze_result_t ZE_APICALL zeEventHostSignal( ze_event_handle_t hEvent ///< [in] handle of the event ); /////////////////////////////////////////////////////////////////////////////// /// @brief The current host thread waits on an event to be signaled. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clWaitForEvents /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_NOT_READY /// + timeout expired ZE_APIEXPORT ze_result_t ZE_APICALL zeEventHostSynchronize( ze_event_handle_t hEvent, ///< [in] handle of the event uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeEventQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Queries an event object's status on the host. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clGetEventInfo** /// - vkGetEventStatus /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_NOT_READY /// + not signaled ZE_APIEXPORT ze_result_t ZE_APICALL zeEventQueryStatus( ze_event_handle_t hEvent ///< [in] handle of the event ); /////////////////////////////////////////////////////////////////////////////// /// @brief Appends a reset of an event back to not signaled state into a command /// list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the command list and events were created /// on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - vkResetEvent /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendEventReset( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ); /////////////////////////////////////////////////////////////////////////////// /// @brief The current host thread resets an event back to not signaled state. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - vkResetEvent /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ZE_APIEXPORT ze_result_t ZE_APICALL zeEventHostReset( ze_event_handle_t hEvent ///< [in] handle of the event ); /////////////////////////////////////////////////////////////////////////////// /// @brief Kernel timestamp clock data /// /// @details /// - The timestamp frequency can be queried from the `timerResolution` /// member of ::ze_device_properties_t. /// - The number of valid bits in the timestamp value can be queried from /// the `kernelTimestampValidBits` member of ::ze_device_properties_t. typedef struct _ze_kernel_timestamp_data_t { uint64_t kernelStart; ///< [out] device clock at start of kernel execution uint64_t kernelEnd; ///< [out] device clock at end of kernel execution } ze_kernel_timestamp_data_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Kernel timestamp result typedef struct _ze_kernel_timestamp_result_t { ze_kernel_timestamp_data_t global; ///< [out] wall-clock data ze_kernel_timestamp_data_t context; ///< [out] context-active data; only includes clocks while device context ///< was actively executing. } ze_kernel_timestamp_result_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Queries an event's timestamp value on the host. /// /// @details /// - The application must ensure the event was created from an event pool /// that was created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP or /// ::ZE_EVENT_POOL_FLAG_KERNEL_MAPPED_TIMESTAMP flag. /// - The destination memory will be unmodified if the event has not been /// signaled. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_NOT_READY /// + not signaled ZE_APIEXPORT ze_result_t ZE_APICALL zeEventQueryKernelTimestamp( ze_event_handle_t hEvent, ///< [in] handle of the event ze_kernel_timestamp_result_t* dstptr ///< [in,out] pointer to memory for where timestamp result will be written. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Appends a query of an events' timestamp value(s) into a command list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the events were created from an event pool /// that was created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag. /// - The application must ensure the memory pointed to by both dstptr and /// pOffsets is accessible by the device on which the command list was /// created. /// - The value(s) written to the destination buffer are undefined if any /// timestamp event has not been signaled. /// - If pOffsets is nullptr, then multiple results will be appended /// sequentially into memory in the same order as phEvents. /// - The application must ensure the command list and events were created, /// and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phEvents` /// + `nullptr == dstptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendQueryKernelTimestamps( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] the number of timestamp events to query ze_event_handle_t* phEvents, ///< [in][range(0, numEvents)] handles of timestamp events to query void* dstptr, ///< [in,out] pointer to memory where ::ze_kernel_timestamp_result_t will ///< be written; must be size-aligned. const size_t* pOffsets, ///< [in][optional][range(0, numEvents)] offset, in bytes, to write ///< results; address must be 4byte-aligned and offsets must be ///< size-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the handle of the event pool for the event. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phEventPool` ZE_APIEXPORT ze_result_t ZE_APICALL zeEventGetEventPool( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_pool_handle_t* phEventPool ///< [out] handle of the event pool for the event ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the signal event scope. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSignalScope` ZE_APIEXPORT ze_result_t ZE_APICALL zeEventGetSignalScope( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pSignalScope ///< [out] signal event scope. This is the scope of relevant cache ///< hierarchies that are flushed on a signal action before the event is ///< triggered. May be 0 or a valid combination of ::ze_event_scope_flag_t. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the wait event scope. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pWaitScope` ZE_APIEXPORT ze_result_t ZE_APICALL zeEventGetWaitScope( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pWaitScope ///< [out] wait event scope. This is the scope of relevant cache ///< hierarchies invalidated on a wait action after the event is complete. ///< May be 0 or a valid combination of ::ze_event_scope_flag_t. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the handle of the context on which the event pool was created. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEventPool` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phContext` ZE_APIEXPORT ze_result_t ZE_APICALL zeEventPoolGetContextHandle( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_context_handle_t* phContext ///< [out] handle of the context on which the event pool was created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the creation flags used to create the event pool. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEventPool` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pFlags` ZE_APIEXPORT ze_result_t ZE_APICALL zeEventPoolGetFlags( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_event_pool_flags_t* pFlags ///< [out] creation flags used to create the event pool; may be 0 or a ///< valid combination of ::ze_event_pool_flag_t ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Fence #if !defined(__GNUC__) #pragma region fence #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported fence creation flags typedef uint32_t ze_fence_flags_t; typedef enum _ze_fence_flag_t { ZE_FENCE_FLAG_SIGNALED = ZE_BIT(0), ///< fence is created in the signaled state, otherwise not signaled. ZE_FENCE_FLAG_FORCE_UINT32 = 0x7fffffff } ze_fence_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fence descriptor typedef struct _ze_fence_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_fence_flags_t flags; ///< [in] creation flags. ///< must be 0 (default) or a valid combination of ::ze_fence_flag_t. } ze_fence_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a fence for the command queue. /// /// @details /// - A fence is a heavyweight synchronization primitive used to communicate /// to the host that command list execution has completed. /// - The application must only use the fence for the command queue which /// was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @remarks /// _Analogues_ /// - **vkCreateFence** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandQueue` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phFence` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x1 < desc->flags` ZE_APIEXPORT ze_result_t ZE_APICALL zeFenceCreate( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of command queue const ze_fence_desc_t* desc, ///< [in] pointer to fence descriptor ze_fence_handle_t* phFence ///< [out] pointer to handle of fence object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Deletes a fence object. /// /// @details /// - The application must ensure the device is not currently referencing /// the fence before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this fence. /// - The application must **not** call this function from simultaneous /// threads with the same fence handle. /// - The implementation of this function must be thread-safe. /// /// @remarks /// _Analogues_ /// - **vkDestroyFence** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFence` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeFenceDestroy( ze_fence_handle_t hFence ///< [in][release] handle of fence object to destroy ); /////////////////////////////////////////////////////////////////////////////// /// @brief The current host thread waits on a fence to be signaled. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **vkWaitForFences** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFence` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_NOT_READY /// + timeout expired ZE_APIEXPORT ze_result_t ZE_APICALL zeFenceHostSynchronize( ze_fence_handle_t hFence, ///< [in] handle of the fence uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeFenceQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Queries a fence object's status. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **vkGetFenceStatus** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFence` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_NOT_READY /// + not signaled ZE_APIEXPORT ze_result_t ZE_APICALL zeFenceQueryStatus( ze_fence_handle_t hFence ///< [in] handle of the fence ); /////////////////////////////////////////////////////////////////////////////// /// @brief Reset a fence back to the not signaled state. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **vkResetFences** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFence` ZE_APIEXPORT ze_result_t ZE_APICALL zeFenceReset( ze_fence_handle_t hFence ///< [in] handle of the fence ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Images #if !defined(__GNUC__) #pragma region image #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported image creation flags typedef uint32_t ze_image_flags_t; typedef enum _ze_image_flag_t { ZE_IMAGE_FLAG_KERNEL_WRITE = ZE_BIT(0), ///< kernels will write contents ZE_IMAGE_FLAG_BIAS_UNCACHED = ZE_BIT(1), ///< device should not cache contents ZE_IMAGE_FLAG_FORCE_UINT32 = 0x7fffffff } ze_image_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported image types typedef enum _ze_image_type_t { ZE_IMAGE_TYPE_1D = 0, ///< 1D ZE_IMAGE_TYPE_1DARRAY = 1, ///< 1D array ZE_IMAGE_TYPE_2D = 2, ///< 2D ZE_IMAGE_TYPE_2DARRAY = 3, ///< 2D array ZE_IMAGE_TYPE_3D = 4, ///< 3D ZE_IMAGE_TYPE_BUFFER = 5, ///< Buffer ZE_IMAGE_TYPE_FORCE_UINT32 = 0x7fffffff } ze_image_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported image format layouts typedef enum _ze_image_format_layout_t { ZE_IMAGE_FORMAT_LAYOUT_8 = 0, ///< 8-bit single component layout ZE_IMAGE_FORMAT_LAYOUT_16 = 1, ///< 16-bit single component layout ZE_IMAGE_FORMAT_LAYOUT_32 = 2, ///< 32-bit single component layout ZE_IMAGE_FORMAT_LAYOUT_8_8 = 3, ///< 2-component 8-bit layout ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8 = 4, ///< 4-component 8-bit layout ZE_IMAGE_FORMAT_LAYOUT_16_16 = 5, ///< 2-component 16-bit layout ZE_IMAGE_FORMAT_LAYOUT_16_16_16_16 = 6, ///< 4-component 16-bit layout ZE_IMAGE_FORMAT_LAYOUT_32_32 = 7, ///< 2-component 32-bit layout ZE_IMAGE_FORMAT_LAYOUT_32_32_32_32 = 8, ///< 4-component 32-bit layout ZE_IMAGE_FORMAT_LAYOUT_10_10_10_2 = 9, ///< 4-component 10_10_10_2 layout ZE_IMAGE_FORMAT_LAYOUT_11_11_10 = 10, ///< 3-component 11_11_10 layout ZE_IMAGE_FORMAT_LAYOUT_5_6_5 = 11, ///< 3-component 5_6_5 layout ZE_IMAGE_FORMAT_LAYOUT_5_5_5_1 = 12, ///< 4-component 5_5_5_1 layout ZE_IMAGE_FORMAT_LAYOUT_4_4_4_4 = 13, ///< 4-component 4_4_4_4 layout ZE_IMAGE_FORMAT_LAYOUT_Y8 = 14, ///< Media Format: Y8. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_NV12 = 15, ///< Media Format: NV12. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_YUYV = 16, ///< Media Format: YUYV. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_VYUY = 17, ///< Media Format: VYUY. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_YVYU = 18, ///< Media Format: YVYU. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_UYVY = 19, ///< Media Format: UYVY. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_AYUV = 20, ///< Media Format: AYUV. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_P010 = 21, ///< Media Format: P010. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_Y410 = 22, ///< Media Format: Y410. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_P012 = 23, ///< Media Format: P012. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_Y16 = 24, ///< Media Format: Y16. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_P016 = 25, ///< Media Format: P016. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_Y216 = 26, ///< Media Format: Y216. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_P216 = 27, ///< Media Format: P216. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_P8 = 28, ///< Media Format: P8. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_YUY2 = 29, ///< Media Format: YUY2. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_A8P8 = 30, ///< Media Format: A8P8. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_IA44 = 31, ///< Media Format: IA44. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_AI44 = 32, ///< Media Format: AI44. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_Y416 = 33, ///< Media Format: Y416. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_Y210 = 34, ///< Media Format: Y210. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_I420 = 35, ///< Media Format: I420. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_YV12 = 36, ///< Media Format: YV12. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_400P = 37, ///< Media Format: 400P. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_422H = 38, ///< Media Format: 422H. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_422V = 39, ///< Media Format: 422V. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_444P = 40, ///< Media Format: 444P. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_RGBP = 41, ///< Media Format: RGBP. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_BRGP = 42, ///< Media Format: BRGP. Format type and swizzle is ignored for this. ZE_IMAGE_FORMAT_LAYOUT_8_8_8 = 43, ///< 3-component 8-bit layout ZE_IMAGE_FORMAT_LAYOUT_16_16_16 = 44, ///< 3-component 16-bit layout ZE_IMAGE_FORMAT_LAYOUT_32_32_32 = 45, ///< 3-component 32-bit layout ZE_IMAGE_FORMAT_LAYOUT_FORCE_UINT32 = 0x7fffffff } ze_image_format_layout_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported image format types typedef enum _ze_image_format_type_t { ZE_IMAGE_FORMAT_TYPE_UINT = 0, ///< Unsigned integer ZE_IMAGE_FORMAT_TYPE_SINT = 1, ///< Signed integer ZE_IMAGE_FORMAT_TYPE_UNORM = 2, ///< Unsigned normalized integer ZE_IMAGE_FORMAT_TYPE_SNORM = 3, ///< Signed normalized integer ZE_IMAGE_FORMAT_TYPE_FLOAT = 4, ///< Float ZE_IMAGE_FORMAT_TYPE_FORCE_UINT32 = 0x7fffffff } ze_image_format_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported image format component swizzle into channel typedef enum _ze_image_format_swizzle_t { ZE_IMAGE_FORMAT_SWIZZLE_R = 0, ///< Red component ZE_IMAGE_FORMAT_SWIZZLE_G = 1, ///< Green component ZE_IMAGE_FORMAT_SWIZZLE_B = 2, ///< Blue component ZE_IMAGE_FORMAT_SWIZZLE_A = 3, ///< Alpha component ZE_IMAGE_FORMAT_SWIZZLE_0 = 4, ///< Zero ZE_IMAGE_FORMAT_SWIZZLE_1 = 5, ///< One ZE_IMAGE_FORMAT_SWIZZLE_X = 6, ///< Don't care ZE_IMAGE_FORMAT_SWIZZLE_FORCE_UINT32 = 0x7fffffff } ze_image_format_swizzle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Image format typedef struct _ze_image_format_t { ze_image_format_layout_t layout; ///< [in] image format component layout (e.g. N-component layouts and media ///< formats) ze_image_format_type_t type; ///< [in] image format type ze_image_format_swizzle_t x; ///< [in] image component swizzle into channel x ze_image_format_swizzle_t y; ///< [in] image component swizzle into channel y ze_image_format_swizzle_t z; ///< [in] image component swizzle into channel z ze_image_format_swizzle_t w; ///< [in] image component swizzle into channel w } ze_image_format_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Image descriptor typedef struct _ze_image_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_image_flags_t flags; ///< [in] creation flags. ///< must be 0 (default) or a valid combination of ::ze_image_flag_t; ///< default is read-only, cached access. ze_image_type_t type; ///< [in] image type. Media format layouts are unsupported for ///< ::ZE_IMAGE_TYPE_BUFFER ze_image_format_t format; ///< [in] image format uint64_t width; ///< [in] width dimension. ///< ::ZE_IMAGE_TYPE_BUFFER: size in bytes; see the `maxImageBufferSize` ///< member of ::ze_device_image_properties_t for limits. ///< ::ZE_IMAGE_TYPE_1D, ::ZE_IMAGE_TYPE_1DARRAY: width in pixels; see the ///< `maxImageDims1D` member of ::ze_device_image_properties_t for limits. ///< ::ZE_IMAGE_TYPE_2D, ::ZE_IMAGE_TYPE_2DARRAY: width in pixels; see the ///< `maxImageDims2D` member of ::ze_device_image_properties_t for limits. ///< ::ZE_IMAGE_TYPE_3D: width in pixels; see the `maxImageDims3D` member ///< of ::ze_device_image_properties_t for limits. uint32_t height; ///< [in] height dimension. ///< ::ZE_IMAGE_TYPE_2D, ::ZE_IMAGE_TYPE_2DARRAY: height in pixels; see the ///< `maxImageDims2D` member of ::ze_device_image_properties_t for limits. ///< ::ZE_IMAGE_TYPE_3D: height in pixels; see the `maxImageDims3D` member ///< of ::ze_device_image_properties_t for limits. ///< other: ignored. uint32_t depth; ///< [in] depth dimension. ///< ::ZE_IMAGE_TYPE_3D: depth in pixels; see the `maxImageDims3D` member ///< of ::ze_device_image_properties_t for limits. ///< other: ignored. uint32_t arraylevels; ///< [in] array levels. ///< ::ZE_IMAGE_TYPE_1DARRAY, ::ZE_IMAGE_TYPE_2DARRAY: see the ///< `maxImageArraySlices` member of ::ze_device_image_properties_t for limits. ///< other: ignored. uint32_t miplevels; ///< [in] mipmap levels (must be 0) } ze_image_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported sampler filtering flags typedef uint32_t ze_image_sampler_filter_flags_t; typedef enum _ze_image_sampler_filter_flag_t { ZE_IMAGE_SAMPLER_FILTER_FLAG_POINT = ZE_BIT(0), ///< device supports point filtering ZE_IMAGE_SAMPLER_FILTER_FLAG_LINEAR = ZE_BIT(1), ///< device supports linear filtering ZE_IMAGE_SAMPLER_FILTER_FLAG_FORCE_UINT32 = 0x7fffffff } ze_image_sampler_filter_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Image properties typedef struct _ze_image_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_image_sampler_filter_flags_t samplerFilterFlags; ///< [out] supported sampler filtering. ///< returns 0 (unsupported) or a combination of ::ze_image_sampler_filter_flag_t. } ze_image_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves supported properties of an image. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == pImageProperties` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// + `::ZE_IMAGE_TYPE_BUFFER < desc->type` ZE_APIEXPORT ze_result_t ZE_APICALL zeImageGetProperties( ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_properties_t* pImageProperties ///< [out] pointer to image properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Creates an image on the context. /// /// @details /// - The application must only use the image for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @remarks /// _Analogues_ /// - clCreateImage /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phImage` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// + `::ZE_IMAGE_TYPE_BUFFER < desc->type` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT ZE_APIEXPORT ze_result_t ZE_APICALL zeImageCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t* phImage ///< [out] pointer to handle of image object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Deletes an image object. /// /// @details /// - The application must ensure the device is not currently referencing /// the image before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this image. /// - The application must **not** call this function from simultaneous /// threads with the same image handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hImage` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeImageDestroy( ze_image_handle_t hImage ///< [in][release] handle of image object to destroy ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Memory #if !defined(__GNUC__) #pragma region memory #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported memory allocation flags typedef uint32_t ze_device_mem_alloc_flags_t; typedef enum _ze_device_mem_alloc_flag_t { ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_CACHED = ZE_BIT(0), ///< device should cache allocation ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_UNCACHED = ZE_BIT(1), ///< device should not cache allocation (UC) ZE_DEVICE_MEM_ALLOC_FLAG_BIAS_INITIAL_PLACEMENT = ZE_BIT(2), ///< optimize shared allocation for first access on the device ZE_DEVICE_MEM_ALLOC_FLAG_FORCE_UINT32 = 0x7fffffff } ze_device_mem_alloc_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device memory allocation descriptor typedef struct _ze_device_mem_alloc_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_device_mem_alloc_flags_t flags; ///< [in] flags specifying additional allocation controls. ///< must be 0 (default) or a valid combination of ::ze_device_mem_alloc_flag_t; ///< default behavior may use implicit driver-based heuristics. uint32_t ordinal; ///< [in] ordinal of the device's local memory to allocate from. ///< must be less than the count returned from ::zeDeviceGetMemoryProperties. } ze_device_mem_alloc_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported host memory allocation flags typedef uint32_t ze_host_mem_alloc_flags_t; typedef enum _ze_host_mem_alloc_flag_t { ZE_HOST_MEM_ALLOC_FLAG_BIAS_CACHED = ZE_BIT(0), ///< host should cache allocation ZE_HOST_MEM_ALLOC_FLAG_BIAS_UNCACHED = ZE_BIT(1), ///< host should not cache allocation (UC) ZE_HOST_MEM_ALLOC_FLAG_BIAS_WRITE_COMBINED = ZE_BIT(2), ///< host memory should be allocated write-combined (WC) ZE_HOST_MEM_ALLOC_FLAG_BIAS_INITIAL_PLACEMENT = ZE_BIT(3), ///< optimize shared allocation for first access on the host ZE_HOST_MEM_ALLOC_FLAG_FORCE_UINT32 = 0x7fffffff } ze_host_mem_alloc_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Host memory allocation descriptor typedef struct _ze_host_mem_alloc_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_host_mem_alloc_flags_t flags; ///< [in] flags specifying additional allocation controls. ///< must be 0 (default) or a valid combination of ::ze_host_mem_alloc_flag_t; ///< default behavior may use implicit driver-based heuristics. } ze_host_mem_alloc_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Allocates shared memory on the context. /// /// @details /// - Shared allocations share ownership between the host and one or more /// devices. /// - Shared allocations may optionally be associated with a device by /// passing a handle to the device. /// - Devices supporting only single-device shared access capabilities may /// access shared memory associated with the device. /// For these devices, ownership of the allocation is shared between the /// host and the associated device only. /// - Passing nullptr as the device handle does not associate the shared /// allocation with any device. /// For allocations with no associated device, ownership of the allocation /// is shared between the host and all devices supporting cross-device /// shared access capabilities. /// - The application must only use the memory allocation for the context /// and device, or its sub-devices, which was provided during allocation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == device_desc` /// + `nullptr == host_desc` /// + `nullptr == pptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < device_desc->flags` /// + `0xf < host_desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT /// + Must be zero or a power-of-two /// + `0 != (alignment & (alignment - 1))` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemAllocShared( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in][optional] device handle to associate with void** pptr ///< [out] pointer to shared allocation ); /////////////////////////////////////////////////////////////////////////////// /// @brief Allocates device memory on the context. /// /// @details /// - Device allocations are owned by a specific device. /// - In general, a device allocation may only be accessed by the device /// that owns it. /// - The application must only use the memory allocation for the context /// and device, or its sub-devices, which was provided during allocation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == device_desc` /// + `nullptr == pptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < device_desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT /// + Must be zero or a power-of-two /// + `0 != (alignment & (alignment - 1))` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemAllocDevice( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in] handle of the device void** pptr ///< [out] pointer to device allocation ); /////////////////////////////////////////////////////////////////////////////// /// @brief Allocates host memory on the context. /// /// @details /// - Host allocations are owned by the host process. /// - Host allocations are accessible by the host and all devices within the /// driver's context. /// - Host allocations are frequently used as staging areas to transfer data /// to or from devices. /// - The application must only use the memory allocation for the context /// which was provided during allocation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == host_desc` /// + `nullptr == pptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xf < host_desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT /// + Must be zero or a power-of-two /// + `0 != (alignment & (alignment - 1))` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemAllocHost( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two void** pptr ///< [out] pointer to host allocation ); /////////////////////////////////////////////////////////////////////////////// /// @brief Frees allocated host memory, device memory, or shared memory on the /// context. /// /// @details /// - The application must ensure the device is not currently referencing /// the memory before it is freed /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this memory /// - The application must **not** call this function from simultaneous /// threads with the same pointer. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemFree( ze_context_handle_t hContext, ///< [in] handle of the context object void* ptr ///< [in][release] pointer to memory to free ); /////////////////////////////////////////////////////////////////////////////// /// @brief Memory allocation type typedef enum _ze_memory_type_t { ZE_MEMORY_TYPE_UNKNOWN = 0, ///< the memory pointed to is of unknown type ZE_MEMORY_TYPE_HOST = 1, ///< the memory pointed to is a host allocation ZE_MEMORY_TYPE_DEVICE = 2, ///< the memory pointed to is a device allocation ZE_MEMORY_TYPE_SHARED = 3, ///< the memory pointed to is a shared ownership allocation ZE_MEMORY_TYPE_FORCE_UINT32 = 0x7fffffff } ze_memory_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Memory allocation properties queried using ::zeMemGetAllocProperties typedef struct _ze_memory_allocation_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_memory_type_t type; ///< [out] type of allocated memory uint64_t id; ///< [out] identifier for this allocation uint64_t pageSize; ///< [out] page size used for allocation } ze_memory_allocation_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves attributes of a memory allocation /// /// @details /// - The application may call this function from simultaneous threads. /// - The application may query attributes of a memory allocation unrelated /// to the context. /// When this occurs, the returned allocation type will be /// ::ZE_MEMORY_TYPE_UNKNOWN, and the returned identifier and associated /// device is unspecified. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// + `nullptr == pMemAllocProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemGetAllocProperties( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query ze_memory_allocation_properties_t* pMemAllocProperties, ///< [in,out] query result for memory allocation properties ze_device_handle_t* phDevice ///< [out][optional] device associated with this allocation ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves the base address and/or size of an allocation /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemGetAddressRange( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query void** pBase, ///< [in,out][optional] base address of the allocation size_t* pSize ///< [in,out][optional] size of the allocation ); /////////////////////////////////////////////////////////////////////////////// /// @brief Creates an IPC memory handle for the specified allocation /// /// @details /// - Takes a pointer to a device memory allocation and creates an IPC /// memory handle for exporting it for use in another process. /// - The pointer must be base pointer of a device or host memory /// allocation; i.e. the value returned from ::zeMemAllocDevice or from /// ::zeMemAllocHost, respectively. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// + `nullptr == pIpcHandle` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemGetIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to the device memory allocation ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ); /////////////////////////////////////////////////////////////////////////////// /// @brief Creates an IPC memory handle out of a file descriptor /// /// @details /// - Handle passed must be a valid file descriptor obtained with /// ::ze_external_memory_export_fd_t via ::zeMemGetAllocProperties. /// - Returned IPC handle may contain metadata in addition to the file /// descriptor. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pIpcHandle` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemGetIpcHandleFromFileDescriptorExp( ze_context_handle_t hContext, ///< [in] handle of the context object uint64_t handle, ///< [in] file descriptor ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ); /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the file descriptor contained in an IPC memory handle /// /// @details /// - IPC memory handle must be a valid handle obtained with /// ::zeMemGetIpcHandle. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pHandle` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemGetFileDescriptorFromIpcHandleExp( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t ipcHandle, ///< [in] IPC memory handle uint64_t* pHandle ///< [out] Returned file descriptor ); /////////////////////////////////////////////////////////////////////////////// /// @brief Returns an IPC memory handle to the driver /// /// @details /// - This call may be used for IPC handles previously obtained with either /// ::zeMemGetIpcHandle or with ::ze_external_memory_export_fd_t via ::zeMemGetAllocProperties. /// - Upon call, driver may release any underlying resources associated with /// the IPC handle. /// For instance, it may close the file descriptor contained in the IPC /// handle, if such type of handle is being used by the driver. /// - This call does not free the original allocation for which the IPC /// handle was created. /// - This function may **not** be called from simultaneous threads with the /// same IPC handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemPutIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t handle ///< [in] IPC memory handle ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported IPC memory flags typedef uint32_t ze_ipc_memory_flags_t; typedef enum _ze_ipc_memory_flag_t { ZE_IPC_MEMORY_FLAG_BIAS_CACHED = ZE_BIT(0), ///< device should cache allocation ZE_IPC_MEMORY_FLAG_BIAS_UNCACHED = ZE_BIT(1), ///< device should not cache allocation (UC) ZE_IPC_MEMORY_FLAG_FORCE_UINT32 = 0x7fffffff } ze_ipc_memory_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Opens an IPC memory handle to retrieve a device pointer on the /// context. /// /// @details /// - Takes an IPC memory handle from a remote process and associates it /// with a device pointer usable in this process. /// - The device pointer in this process should not be freed with /// ::zeMemFree, but rather with ::zeMemCloseIpcHandle. /// - Multiple calls to this function with the same IPC handle will return /// unique pointers. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < flags` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pptr` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemOpenIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device to associate with the IPC memory handle ze_ipc_mem_handle_t handle, ///< [in] IPC memory handle ze_ipc_memory_flags_t flags, ///< [in] flags controlling the operation. ///< must be 0 (default) or a valid combination of ::ze_ipc_memory_flag_t. void** pptr ///< [out] pointer to device allocation in this process ); /////////////////////////////////////////////////////////////////////////////// /// @brief Closes an IPC memory handle /// /// @details /// - Closes an IPC memory handle by unmapping memory that was opened in /// this process using ::zeMemOpenIpcHandle. /// - The application must **not** call this function from simultaneous /// threads with the same pointer. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemCloseIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr ///< [in][release] pointer to device allocation in this process ); /////////////////////////////////////////////////////////////////////////////// /// @brief Additional allocation descriptor for exporting external memory /// /// @details /// - This structure may be passed to ::zeMemAllocDevice and /// ::zeMemAllocHost, via the `pNext` member of /// ::ze_device_mem_alloc_desc_t or ::ze_host_mem_alloc_desc_t, /// respectively, to indicate an exportable memory allocation. /// - This structure may be passed to ::zeImageCreate, via the `pNext` /// member of ::ze_image_desc_t, to indicate an exportable image. typedef struct _ze_external_memory_export_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_external_memory_type_flags_t flags; ///< [in] flags specifying memory export types for this allocation. ///< must be 0 (default) or a valid combination of ::ze_external_memory_type_flags_t } ze_external_memory_export_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Additional allocation descriptor for importing external memory as a /// file descriptor /// /// @details /// - This structure may be passed to ::zeMemAllocDevice or /// ::zeMemAllocHost, via the `pNext` member of /// ::ze_device_mem_alloc_desc_t or of ::ze_host_mem_alloc_desc_t, /// respectively, to import memory from a file descriptor. /// - This structure may be passed to ::zeImageCreate, via the `pNext` /// member of ::ze_image_desc_t, to import memory from a file descriptor. typedef struct _ze_external_memory_import_fd_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_external_memory_type_flags_t flags; ///< [in] flags specifying the memory import type for the file descriptor. ///< must be 0 (default) or a valid combination of ::ze_external_memory_type_flags_t int fd; ///< [in] the file descriptor handle to import } ze_external_memory_import_fd_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exports an allocation as a file descriptor /// /// @details /// - This structure may be passed to ::zeMemGetAllocProperties, via the /// `pNext` member of ::ze_memory_allocation_properties_t, to export a /// memory allocation as a file descriptor. /// - This structure may be passed to ::zeImageGetAllocPropertiesExt, via /// the `pNext` member of ::ze_image_allocation_ext_properties_t, to /// export an image as a file descriptor. /// - The requested memory export type must have been specified when the /// allocation was made. typedef struct _ze_external_memory_export_fd_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_external_memory_type_flags_t flags; ///< [in] flags specifying the memory export type for the file descriptor. ///< must be 0 (default) or a valid combination of ::ze_external_memory_type_flags_t int fd; ///< [out] the exported file descriptor handle representing the allocation. } ze_external_memory_export_fd_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Additional allocation descriptor for importing external memory as a /// Win32 handle /// /// @details /// - When `handle` is `nullptr`, `name` must not be `nullptr`. /// - When `name` is `nullptr`, `handle` must not be `nullptr`. /// - When `flags` is ::ZE_EXTERNAL_MEMORY_TYPE_FLAG_OPAQUE_WIN32_KMT, /// `name` must be `nullptr`. /// - This structure may be passed to ::zeMemAllocDevice or /// ::zeMemAllocHost, via the `pNext` member of /// ::ze_device_mem_alloc_desc_t or of ::ze_host_mem_alloc_desc_t, /// respectively, to import memory from a Win32 handle. /// - This structure may be passed to ::zeImageCreate, via the `pNext` /// member of ::ze_image_desc_t, to import memory from a Win32 handle. typedef struct _ze_external_memory_import_win32_handle_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_external_memory_type_flags_t flags; ///< [in] flags specifying the memory import type for the Win32 handle. ///< must be 0 (default) or a valid combination of ::ze_external_memory_type_flags_t void* handle; ///< [in][optional] the Win32 handle to import const void* name; ///< [in][optional] name of a memory object to import } ze_external_memory_import_win32_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exports an allocation as a Win32 handle /// /// @details /// - This structure may be passed to ::zeMemGetAllocProperties, via the /// `pNext` member of ::ze_memory_allocation_properties_t, to export a /// memory allocation as a Win32 handle. /// - This structure may be passed to ::zeImageGetAllocPropertiesExt, via /// the `pNext` member of ::ze_image_allocation_ext_properties_t, to /// export an image as a Win32 handle. /// - The requested memory export type must have been specified when the /// allocation was made. typedef struct _ze_external_memory_export_win32_handle_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_external_memory_type_flags_t flags; ///< [in] flags specifying the memory export type for the Win32 handle. ///< must be 0 (default) or a valid combination of ::ze_external_memory_type_flags_t void* handle; ///< [out] the exported Win32 handle representing the allocation. } ze_external_memory_export_win32_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief atomic access attribute flags typedef uint32_t ze_memory_atomic_attr_exp_flags_t; typedef enum _ze_memory_atomic_attr_exp_flag_t { ZE_MEMORY_ATOMIC_ATTR_EXP_FLAG_NO_ATOMICS = ZE_BIT(0), ///< Atomics on the pointer are not allowed ZE_MEMORY_ATOMIC_ATTR_EXP_FLAG_NO_HOST_ATOMICS = ZE_BIT(1), ///< Host atomics on the pointer are not allowed ZE_MEMORY_ATOMIC_ATTR_EXP_FLAG_HOST_ATOMICS = ZE_BIT(2), ///< Host atomics on the pointer are allowed. Requires ///< ::ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC returned by ///< ::zeDeviceGetMemoryAccessProperties. ZE_MEMORY_ATOMIC_ATTR_EXP_FLAG_NO_DEVICE_ATOMICS = ZE_BIT(3), ///< Device atomics on the pointer are not allowed ZE_MEMORY_ATOMIC_ATTR_EXP_FLAG_DEVICE_ATOMICS = ZE_BIT(4), ///< Device atomics on the pointer are allowed. Requires ///< ::ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC returned by ///< ::zeDeviceGetMemoryAccessProperties. ZE_MEMORY_ATOMIC_ATTR_EXP_FLAG_NO_SYSTEM_ATOMICS = ZE_BIT(5), ///< Concurrent atomics on the pointer from both host and device are not ///< allowed ZE_MEMORY_ATOMIC_ATTR_EXP_FLAG_SYSTEM_ATOMICS = ZE_BIT(6), ///< Concurrent atomics on the pointer from both host and device are ///< allowed. Requires ::ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT_ATOMIC ///< returned by ::zeDeviceGetMemoryAccessProperties. ZE_MEMORY_ATOMIC_ATTR_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_memory_atomic_attr_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Sets atomic access attributes for a shared allocation /// /// @details /// - If the shared-allocation is owned by multiple devices (i.e. nullptr /// was passed to ::zeMemAllocShared when creating it), then hDevice may be /// passed to set the attributes in that specific device. If nullptr is /// passed in hDevice, then the atomic attributes are set in all devices /// associated with the allocation. /// - If the atomic access attribute select is not supported by the driver, /// ::ZE_RESULT_INVALID_ARGUMENT is returned. /// - The atomic access attribute may be only supported at a device-specific /// granularity, such as at a page boundary. In this case, the memory range /// may be expanded such that the start and end of the range satisfy granularity /// requirements. /// - When calling this function multiple times with different flags, only the /// attributes from last call are honored. /// - The application must not call this function for shared-allocations currently /// being used by the device. /// - The application must **not** call this function from simultaneous threads /// with the same pointer. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7f < attr` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemSetAtomicAccessAttributeExp( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t attr ///< [in] Atomic access attributes to set for the specified range. ///< Must be 0 (default) or a valid combination of ::ze_memory_atomic_attr_exp_flag_t. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves the atomic access attributes previously set for a shared /// allocation /// /// @details /// - The application may call this function from simultaneous threads /// with the same pointer. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// + `nullptr == pAttr` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemGetAtomicAccessAttributeExp( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t* pAttr ///< [out] Atomic access attributes for the specified range ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Module #if !defined(__GNUC__) #pragma region module #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported module creation input formats typedef enum _ze_module_format_t { ZE_MODULE_FORMAT_IL_SPIRV = 0, ///< Format is SPIRV IL format ZE_MODULE_FORMAT_NATIVE = 1, ///< Format is device native format ZE_MODULE_FORMAT_FORCE_UINT32 = 0x7fffffff } ze_module_format_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Specialization constants - User defined constants typedef struct _ze_module_constants_t { uint32_t numConstants; ///< [in] Number of specialization constants. const uint32_t* pConstantIds; ///< [in][range(0, numConstants)] Array of IDs that is sized to ///< numConstants. const void** pConstantValues; ///< [in][range(0, numConstants)] Array of pointers to values that is sized ///< to numConstants. } ze_module_constants_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Module descriptor typedef struct _ze_module_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_module_format_t format; ///< [in] Module format passed in with pInputModule size_t inputSize; ///< [in] size of input IL or ISA from pInputModule. const uint8_t* pInputModule; ///< [in] pointer to IL or ISA const char* pBuildFlags; ///< [in][optional] string containing one or more (comma-separated) ///< compiler flags. If unsupported, flag is ignored with a warning. ///< - "-ze-opt-disable" ///< - Disable optimizations ///< - "-ze-opt-level" ///< - Specifies optimization level for compiler. Levels are ///< implementation specific. ///< - 0 is no optimizations (equivalent to -ze-opt-disable) ///< - 1 is optimize minimally (may be the same as 2) ///< - 2 is optimize more (default) ///< - "-ze-opt-greater-than-4GB-buffer-required" ///< - Use 64-bit offset calculations for buffers. ///< - "-ze-opt-large-register-file" ///< - Increase number of registers available to threads. ///< - "-ze-opt-has-buffer-offset-arg" ///< - Extend stateless to stateful optimization to more ///< cases with the use of additional offset (e.g. 64-bit ///< pointer to binding table with 32-bit offset). ///< - "-g" ///< - Include debugging information. const ze_module_constants_t* pConstants; ///< [in][optional] pointer to specialization constants. Valid only for ///< SPIR-V input. This must be set to nullptr if no specialization ///< constants are provided. } ze_module_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a module on the context. /// /// @details /// - Compiles the module for execution on the device. /// - The application must only use the module for the device, or its /// sub-devices, which was provided during creation. /// - The module can be copied to other devices and contexts within the same /// driver instance by using ::zeModuleGetNativeBinary. /// - A build log can optionally be returned to the caller. The caller is /// responsible for destroying build log using ::zeModuleBuildLogDestroy. /// - The module descriptor constants are only supported for SPIR-V /// specialization constants. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == desc->pInputModule` /// + `nullptr == phModule` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_MODULE_FORMAT_NATIVE < desc->format` /// - ::ZE_RESULT_ERROR_INVALID_NATIVE_BINARY /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `0 == desc->inputSize` /// - ::ZE_RESULT_ERROR_MODULE_BUILD_FAILURE ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_module_desc_t* desc, ///< [in] pointer to module descriptor ze_module_handle_t* phModule, ///< [out] pointer to handle of module object created ze_module_build_log_handle_t* phBuildLog ///< [out][optional] pointer to handle of module's build log. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys module /// /// @details /// - The application must destroy all kernel handles created from the /// module before destroying the module itself. /// - The application must ensure the device is not currently referencing /// the module before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this module. /// - The application must **not** call this function from simultaneous /// threads with the same module handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleDestroy( ze_module_handle_t hModule ///< [in][release] handle of the module ); /////////////////////////////////////////////////////////////////////////////// /// @brief Dynamically link modules together that share import/export linkage /// dependencies. /// /// @details /// - Modules support SPIR-V import and export linkage types for functions /// and global variables. See the SPIR-V specification for linkage /// details. /// - Modules can have both import and export linkage. /// - Modules that do not have any imports or exports do not need to be /// linked. /// - All module import requirements must be satisfied via linking before /// kernel objects can be created from them. /// - Modules cannot be partially linked. Unsatisfiable import dependencies /// in the set of modules passed to ::zeModuleDynamicLink will result in /// ::ZE_RESULT_ERROR_MODULE_LINK_FAILURE being returned. /// - Modules will only be linked once. A module can be used in multiple /// link calls if it has exports but its imports will not be re-linked. /// - Ambiguous dependencies, where multiple modules satisfy the same import /// dependencies for a module, are not allowed. /// - The application must ensure the modules being linked were created on /// the same context. /// - The application may call this function from simultaneous threads as /// long as the import modules being linked are not the same. /// - ModuleGetNativeBinary can be called on any module regardless of /// whether it is linked or not. /// - A link log can optionally be returned to the caller. The caller is /// responsible for destroying the link log using /// ::zeModuleBuildLogDestroy. /// - The link log may contain a list of the unresolved import dependencies /// if present. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phModules` /// - ::ZE_RESULT_ERROR_MODULE_LINK_FAILURE ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleDynamicLink( uint32_t numModules, ///< [in] number of modules to be linked pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to ///< dynamically link together. ze_module_build_log_handle_t* phLinkLog ///< [out][optional] pointer to handle of dynamic link log. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys module build log object /// /// @details /// - The implementation of this function may immediately free all Host /// allocations associated with this object. /// - The application must **not** call this function from simultaneous /// threads with the same build log handle. /// - The implementation of this function should be lock-free. /// - This function can be called before or after ::zeModuleDestroy for the /// associated module. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModuleBuildLog` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleBuildLogDestroy( ze_module_build_log_handle_t hModuleBuildLog ///< [in][release] handle of the module build log object. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves text string for build log. /// /// @details /// - The caller can pass nullptr for pBuildLog when querying only for size. /// - The caller must provide memory for build log. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModuleBuildLog` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleBuildLogGetString( ze_module_build_log_handle_t hModuleBuildLog, ///< [in] handle of the module build log object. size_t* pSize, ///< [in,out] size of build log string. char* pBuildLog ///< [in,out][optional] pointer to null-terminated string of the log. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve native binary from Module. /// /// @details /// - The native binary output can be cached to disk and new modules can be /// later constructed from the cached copy. /// - The native binary will retain debugging information that is associated /// with a module. /// - The caller can pass nullptr for pModuleNativeBinary when querying only /// for size. /// - The implementation will copy the native binary into a buffer supplied /// by the caller. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleGetNativeBinary( ze_module_handle_t hModule, ///< [in] handle of the module size_t* pSize, ///< [in,out] size of native binary in bytes. uint8_t* pModuleNativeBinary ///< [in,out][optional] byte pointer to native binary ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve global variable pointer from Module. /// /// @details /// - The application may query global pointer from any module that either /// exports or imports it. /// - The application must dynamically link a module that imports a global /// before the global pointer can be queried from it. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pGlobalName` /// - ::ZE_RESULT_ERROR_INVALID_GLOBAL_NAME ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleGetGlobalPointer( ze_module_handle_t hModule, ///< [in] handle of the module const char* pGlobalName, ///< [in] name of global variable in module size_t* pSize, ///< [in,out][optional] size of global variable void** pptr ///< [in,out][optional] device visible pointer ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve all kernel names in the module. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleGetKernelNames( ze_module_handle_t hModule, ///< [in] handle of the module uint32_t* pCount, ///< [in,out] pointer to the number of names. ///< if count is zero, then the driver shall update the value with the ///< total number of names available. ///< if count is greater than the number of names available, then the ///< driver shall update the value with the correct number of names available. const char** pNames ///< [in,out][optional][range(0, *pCount)] array of names of functions. ///< if count is less than the number of names available, then driver shall ///< only retrieve that number of names. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported module property flags typedef uint32_t ze_module_property_flags_t; typedef enum _ze_module_property_flag_t { ZE_MODULE_PROPERTY_FLAG_IMPORTS = ZE_BIT(0), ///< Module has imports (i.e. imported global variables and/or kernels). ///< See ::zeModuleDynamicLink. ZE_MODULE_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff } ze_module_property_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Module properties typedef struct _ze_module_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_module_property_flags_t flags; ///< [out] 0 (none) or a valid combination of ::ze_module_property_flag_t } ze_module_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve module properties. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pModuleProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleGetProperties( ze_module_handle_t hModule, ///< [in] handle of the module ze_module_properties_t* pModuleProperties ///< [in,out] query result for module properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported kernel creation flags typedef uint32_t ze_kernel_flags_t; typedef enum _ze_kernel_flag_t { ZE_KERNEL_FLAG_FORCE_RESIDENCY = ZE_BIT(0), ///< force all device allocations to be resident during execution ZE_KERNEL_FLAG_EXPLICIT_RESIDENCY = ZE_BIT(1), ///< application is responsible for all residency of device allocations. ///< driver may disable implicit residency management. ZE_KERNEL_FLAG_FORCE_UINT32 = 0x7fffffff } ze_kernel_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Kernel descriptor typedef struct _ze_kernel_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_kernel_flags_t flags; ///< [in] creation flags. ///< must be 0 (default) or a valid combination of ::ze_kernel_flag_t; ///< default behavior may use driver-based residency. const char* pKernelName; ///< [in] null-terminated name of kernel in module } ze_kernel_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Create a kernel from the module. /// /// @details /// - Modules that have unresolved imports need to be dynamically linked /// before a kernel can be created from them. (See ::zeModuleDynamicLink) /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == desc->pKernelName` /// + `nullptr == phKernel` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// - ::ZE_RESULT_ERROR_INVALID_KERNEL_NAME /// - ::ZE_RESULT_ERROR_INVALID_MODULE_UNLINKED ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelCreate( ze_module_handle_t hModule, ///< [in] handle of the module const ze_kernel_desc_t* desc, ///< [in] pointer to kernel descriptor ze_kernel_handle_t* phKernel ///< [out] handle of the Function object ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a kernel object /// /// @details /// - The application must ensure the device is not currently referencing /// the kernel before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this kernel. /// - The application must **not** call this function from simultaneous /// threads with the same kernel handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelDestroy( ze_kernel_handle_t hKernel ///< [in][release] handle of the kernel object ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve a function pointer from a module by name /// /// @details /// - The function pointer is unique for the device on which the module was /// created. /// - The function pointer is no longer valid if module is destroyed. /// - The function name should only refer to callable functions within the /// module. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pFunctionName` /// + `nullptr == pfnFunction` /// - ::ZE_RESULT_ERROR_INVALID_FUNCTION_NAME ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleGetFunctionPointer( ze_module_handle_t hModule, ///< [in] handle of the module const char* pFunctionName, ///< [in] Name of function to retrieve function pointer for. void** pfnFunction ///< [out] pointer to function. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set group size for a kernel. /// /// @details /// - The group size will be used when a ::zeCommandListAppendLaunchKernel /// variant is called. /// - The application must **not** call this function from simultaneous /// threads with the same kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelSetGroupSize( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t groupSizeX, ///< [in] group size for X dimension to use for this kernel uint32_t groupSizeY, ///< [in] group size for Y dimension to use for this kernel uint32_t groupSizeZ ///< [in] group size for Z dimension to use for this kernel ); /////////////////////////////////////////////////////////////////////////////// /// @brief Query a suggested group size for a kernel given a global size for each /// dimension. /// /// @details /// - This function ignores the group size that is set using /// ::zeKernelSetGroupSize. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == groupSizeX` /// + `nullptr == groupSizeY` /// + `nullptr == groupSizeZ` /// - ::ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelSuggestGroupSize( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t globalSizeX, ///< [in] global width for X dimension uint32_t globalSizeY, ///< [in] global width for Y dimension uint32_t globalSizeZ, ///< [in] global width for Z dimension uint32_t* groupSizeX, ///< [out] recommended size of group for X dimension uint32_t* groupSizeY, ///< [out] recommended size of group for Y dimension uint32_t* groupSizeZ ///< [out] recommended size of group for Z dimension ); /////////////////////////////////////////////////////////////////////////////// /// @brief Query a suggested max group count for a cooperative kernel. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == totalGroupCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelSuggestMaxCooperativeGroupCount( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* totalGroupCount ///< [out] recommended total group count. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set kernel argument for a kernel. /// /// @details /// - The argument values will be used when a /// ::zeCommandListAppendLaunchKernel variant is called. /// - The application must **not** call this function from simultaneous /// threads with the same kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX /// - ::ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelSetArgumentValue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t argIndex, ///< [in] argument index in range [0, num args - 1] size_t argSize, ///< [in] size of argument type const void* pArgValue ///< [in][optional] argument value represented as matching arg type. If ///< null then argument value is considered null. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Kernel indirect access flags typedef uint32_t ze_kernel_indirect_access_flags_t; typedef enum _ze_kernel_indirect_access_flag_t { ZE_KERNEL_INDIRECT_ACCESS_FLAG_HOST = ZE_BIT(0), ///< Indicates that the kernel accesses host allocations indirectly. ZE_KERNEL_INDIRECT_ACCESS_FLAG_DEVICE = ZE_BIT(1), ///< Indicates that the kernel accesses device allocations indirectly. ZE_KERNEL_INDIRECT_ACCESS_FLAG_SHARED = ZE_BIT(2), ///< Indicates that the kernel accesses shared allocations indirectly. ZE_KERNEL_INDIRECT_ACCESS_FLAG_FORCE_UINT32 = 0x7fffffff } ze_kernel_indirect_access_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Sets kernel indirect access flags. /// /// @details /// - The application should specify which allocations will be indirectly /// accessed by the kernel to allow driver to optimize which allocations /// are made resident /// - This function may **not** be called from simultaneous threads with the /// same Kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < flags` ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelSetIndirectAccess( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t flags ///< [in] kernel indirect access flags ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve kernel indirect access flags. /// /// @details /// - This function may be called from simultaneous threads with the same /// Kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pFlags` ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelGetIndirectAccess( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t* pFlags ///< [out] query result for kernel indirect access flags. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve all declared kernel attributes (i.e. can be specified with /// __attribute__ in runtime language). /// /// @details /// - This function may be called from simultaneous threads with the same /// Kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelGetSourceAttributes( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* pSize, ///< [in,out] pointer to size of string in bytes, including ///< null-terminating character. char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including ///< a null-terminating character, is returned in pSize. ///< Otherwise, pString must point to valid application memory that is ///< greater than or equal to *pSize bytes in length, and on return the ///< pointed-to string will contain a space-separated list of kernel source attributes. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported Cache Config flags typedef uint32_t ze_cache_config_flags_t; typedef enum _ze_cache_config_flag_t { ZE_CACHE_CONFIG_FLAG_LARGE_SLM = ZE_BIT(0), ///< Large SLM size ZE_CACHE_CONFIG_FLAG_LARGE_DATA = ZE_BIT(1), ///< Large General Data size ZE_CACHE_CONFIG_FLAG_FORCE_UINT32 = 0x7fffffff } ze_cache_config_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Sets the preferred cache configuration. /// /// @details /// - The cache configuration will be used when a /// ::zeCommandListAppendLaunchKernel variant is called. /// - The application must **not** call this function from simultaneous /// threads with the same kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelSetCacheConfig( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_cache_config_flags_t flags ///< [in] cache configuration. ///< must be 0 (default configuration) or a valid combination of ::ze_cache_config_flag_t. ); /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAX_KERNEL_UUID_SIZE /// @brief Maximum kernel universal unique id (UUID) size in bytes #define ZE_MAX_KERNEL_UUID_SIZE 16 #endif // ZE_MAX_KERNEL_UUID_SIZE /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAX_MODULE_UUID_SIZE /// @brief Maximum module universal unique id (UUID) size in bytes #define ZE_MAX_MODULE_UUID_SIZE 16 #endif // ZE_MAX_MODULE_UUID_SIZE /////////////////////////////////////////////////////////////////////////////// /// @brief Kernel universal unique id (UUID) typedef struct _ze_kernel_uuid_t { uint8_t kid[ZE_MAX_KERNEL_UUID_SIZE]; ///< [out] opaque data representing a kernel UUID uint8_t mid[ZE_MAX_MODULE_UUID_SIZE]; ///< [out] opaque data representing the kernel's module UUID } ze_kernel_uuid_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Kernel properties typedef struct _ze_kernel_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t numKernelArgs; ///< [out] number of kernel arguments. uint32_t requiredGroupSizeX; ///< [out] required group size in the X dimension, ///< or zero if there is no required group size uint32_t requiredGroupSizeY; ///< [out] required group size in the Y dimension, ///< or zero if there is no required group size uint32_t requiredGroupSizeZ; ///< [out] required group size in the Z dimension, ///< or zero if there is no required group size uint32_t requiredNumSubGroups; ///< [out] required number of subgroups per thread group, ///< or zero if there is no required number of subgroups uint32_t requiredSubgroupSize; ///< [out] required subgroup size, ///< or zero if there is no required subgroup size uint32_t maxSubgroupSize; ///< [out] maximum subgroup size uint32_t maxNumSubgroups; ///< [out] maximum number of subgroups per thread group uint32_t localMemSize; ///< [out] local memory size used by each thread group uint32_t privateMemSize; ///< [out] private memory size allocated by compiler used by each thread uint32_t spillMemSize; ///< [out] spill memory size allocated by compiler ze_kernel_uuid_t uuid; ///< [out] universal unique identifier. } ze_kernel_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Additional kernel preferred group size properties /// /// @details /// - This structure may be passed to ::zeKernelGetProperties, via the /// `pNext` member of ::ze_kernel_properties_t, to query additional kernel /// preferred group size properties. typedef struct _ze_kernel_preferred_group_size_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t preferredMultiple; ///< [out] preferred group size multiple } ze_kernel_preferred_group_size_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve kernel properties. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pKernelProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelGetProperties( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_properties_t* pKernelProperties ///< [in,out] query result for kernel properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve kernel name from Kernel. /// /// @details /// - The caller can pass nullptr for pName when querying only for size. /// - The implementation will copy the kernel name into a buffer supplied by /// the caller. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelGetName( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object size_t* pSize, ///< [in,out] size of kernel name string, including null terminator, in ///< bytes. char* pName ///< [in,out][optional] char pointer to kernel name. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Kernel dispatch group count. typedef struct _ze_group_count_t { uint32_t groupCountX; ///< [in] number of thread groups in X dimension uint32_t groupCountY; ///< [in] number of thread groups in Y dimension uint32_t groupCountZ; ///< [in] number of thread groups in Z dimension } ze_group_count_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Launch kernel over one or more work groups. /// /// @details /// - The application must ensure the kernel and events are accessible by /// the device on which the command list was created. /// - This may **only** be called for a command list created with command /// queue group ordinal that supports compute. /// - The application must ensure the command list, kernel and events were /// created on the same context. /// - This function may **not** be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pLaunchFuncArgs` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendLaunchKernel( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Launch kernel cooperatively over one or more work groups. /// /// @details /// - The application must ensure the kernel and events are accessible by /// the device on which the command list was created. /// - This may **only** be called for a command list created with command /// queue group ordinal that supports compute. /// - This may only be used for a command list that are submitted to command /// queue with cooperative flag set. /// - The application must ensure the command list, kernel and events were /// created on the same context. /// - This function may **not** be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// - Use ::zeKernelSuggestMaxCooperativeGroupCount to recommend max group /// count for device for cooperative functions that device supports. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pLaunchFuncArgs` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendLaunchCooperativeKernel( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Launch kernel over one or more work groups using indirect arguments. /// /// @details /// - The application must ensure the kernel and events are accessible by /// the device on which the command list was created. /// - The application must ensure the launch arguments are visible to the /// device on which the command list was created. /// - The implementation must not access the contents of the launch /// arguments as they are free to be modified by either the Host or device /// up until execution. /// - This may **only** be called for a command list created with command /// queue group ordinal that supports compute. /// - The application must ensure the command list, kernel and events were /// created, and the memory was allocated, on the same context. /// - This function may **not** be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pLaunchArgumentsBuffer` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendLaunchKernelIndirect( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in] pointer to device buffer that will contain thread group launch ///< arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Launch multiple kernels over one or more work groups using an array of /// indirect arguments. /// /// @details /// - The application must ensure the kernel and events are accessible by /// the device on which the command list was created. /// - The application must ensure the array of launch arguments and count /// buffer are visible to the device on which the command list was /// created. /// - The implementation must not access the contents of the array of launch /// arguments or count buffer as they are free to be modified by either /// the Host or device up until execution. /// - This may **only** be called for a command list created with command /// queue group ordinal that supports compute. /// - The application must enusre the command list, kernel and events were /// created, and the memory was allocated, on the same context. /// - This function may **not** be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phKernels` /// + `nullptr == pCountBuffer` /// + `nullptr == pLaunchArgumentsBuffer` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendLaunchMultipleKernelsIndirect( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] maximum number of kernels to launch ze_kernel_handle_t* phKernels, ///< [in][range(0, numKernels)] handles of the kernel objects const uint32_t* pCountBuffer, ///< [in] pointer to device memory location that will contain the actual ///< number of kernels to launch; value must be less than or equal to ///< numKernels const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in][range(0, numKernels)] pointer to device buffer that will contain ///< a contiguous array of thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting module programs. #if !defined(__GNUC__) #pragma region program #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MODULE_PROGRAM_EXP_NAME /// @brief Module Program Extension Name #define ZE_MODULE_PROGRAM_EXP_NAME "ZE_experimental_module_program" #endif // ZE_MODULE_PROGRAM_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Module Program Extension Version(s) typedef enum _ze_module_program_exp_version_t { ZE_MODULE_PROGRAM_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_MODULE_PROGRAM_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_MODULE_PROGRAM_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_module_program_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Module extended descriptor to support multiple input modules. /// /// @details /// - Implementation must support ::ZE_experimental_module_program extension /// - Modules support import and export linkage for functions and global /// variables. /// - SPIR-V import and export linkage types are used. See SPIR-V /// specification for linkage details. /// - pInputModules, pBuildFlags, and pConstants from ::ze_module_desc_t is /// ignored. /// - Format in ::ze_module_desc_t needs to be set to /// ::ZE_MODULE_FORMAT_IL_SPIRV. typedef struct _ze_module_program_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t count; ///< [in] Count of input modules const size_t* inputSizes; ///< [in][range(0, count)] sizes of each input IL module in pInputModules. const uint8_t** pInputModules; ///< [in][range(0, count)] pointer to an array of IL (e.g. SPIR-V modules). ///< Valid only for SPIR-V input. const char** pBuildFlags; ///< [in][optional][range(0, count)] array of strings containing build ///< flags. See pBuildFlags in ::ze_module_desc_t. const ze_module_constants_t** pConstants; ///< [in][optional][range(0, count)] pointer to array of specialization ///< constant strings. Valid only for SPIR-V input. This must be set to ///< nullptr if no specialization constants are provided. } ze_module_program_exp_desc_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Raytracing #if !defined(__GNUC__) #pragma region raytracing #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_RAYTRACING_EXT_NAME /// @brief Raytracing Extension Name #define ZE_RAYTRACING_EXT_NAME "ZE_extension_raytracing" #endif // ZE_RAYTRACING_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Raytracing Extension Version(s) typedef enum _ze_raytracing_ext_version_t { ZE_RAYTRACING_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_RAYTRACING_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_RAYTRACING_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_raytracing_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported raytracing capability flags typedef uint32_t ze_device_raytracing_ext_flags_t; typedef enum _ze_device_raytracing_ext_flag_t { ZE_DEVICE_RAYTRACING_EXT_FLAG_RAYQUERY = ZE_BIT(0), ///< Supports rayquery ZE_DEVICE_RAYTRACING_EXT_FLAG_FORCE_UINT32 = 0x7fffffff } ze_device_raytracing_ext_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Raytracing properties queried using ::zeDeviceGetModuleProperties /// /// @details /// - This structure may be returned from ::zeDeviceGetModuleProperties, via /// the `pNext` member of ::ze_device_module_properties_t. typedef struct _ze_device_raytracing_ext_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_device_raytracing_ext_flags_t flags; ///< [out] 0 or a valid combination of ::ze_device_raytracing_ext_flags_t uint32_t maxBVHLevels; ///< [out] Maximum number of BVH levels supported } ze_device_raytracing_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported raytracing memory allocation flags typedef uint32_t ze_raytracing_mem_alloc_ext_flags_t; typedef enum _ze_raytracing_mem_alloc_ext_flag_t { ZE_RAYTRACING_MEM_ALLOC_EXT_FLAG_TBD = ZE_BIT(0), ///< reserved for future use ZE_RAYTRACING_MEM_ALLOC_EXT_FLAG_FORCE_UINT32 = 0x7fffffff } ze_raytracing_mem_alloc_ext_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Raytracing memory allocation descriptor /// /// @details /// - This structure must be passed to ::zeMemAllocShared or /// ::zeMemAllocDevice, via the `pNext` member of /// ::ze_device_mem_alloc_desc_t, for any memory allocation that is to be /// accessed by raytracing fixed-function of the device. typedef struct _ze_raytracing_mem_alloc_ext_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_raytracing_mem_alloc_ext_flags_t flags; ///< [in] flags specifying additional allocation controls. ///< must be 0 (default) or a valid combination of ::ze_raytracing_mem_alloc_ext_flag_t; ///< default behavior may use implicit driver-based heuristics. } ze_raytracing_mem_alloc_ext_desc_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Memory Residency #if !defined(__GNUC__) #pragma region residency #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Makes memory resident for the device. /// /// @details /// - The application must ensure the memory is resident before being /// referenced by the device /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + ptr is not recognized by the implementation ZE_APIEXPORT ze_result_t ZE_APICALL zeContextMakeMemoryResident( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to make resident size_t size ///< [in] size in bytes to make resident ); /////////////////////////////////////////////////////////////////////////////// /// @brief Allows memory to be evicted from the device. /// /// @details /// - The application must ensure the device is not currently referencing /// the memory before it is evicted /// - The application may free the memory without evicting; the memory is /// implicitly evicted when freed. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` ZE_APIEXPORT ze_result_t ZE_APICALL zeContextEvictMemory( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to evict size_t size ///< [in] size in bytes to evict ); /////////////////////////////////////////////////////////////////////////////// /// @brief Makes image resident for the device. /// /// @details /// - The application must ensure the image is resident before being /// referenced by the device /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// + `nullptr == hImage` ZE_APIEXPORT ze_result_t ZE_APICALL zeContextMakeImageResident( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make resident ); /////////////////////////////////////////////////////////////////////////////// /// @brief Allows image to be evicted from the device. /// /// @details /// - The application must ensure the device is not currently referencing /// the image before it is evicted /// - The application may destroy the image without evicting; the image is /// implicitly evicted when destroyed. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// + `nullptr == hImage` ZE_APIEXPORT ze_result_t ZE_APICALL zeContextEvictImage( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make evict ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Sampler #if !defined(__GNUC__) #pragma region sampler #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Sampler addressing modes typedef enum _ze_sampler_address_mode_t { ZE_SAMPLER_ADDRESS_MODE_NONE = 0, ///< No coordinate modifications for out-of-bounds image access. ZE_SAMPLER_ADDRESS_MODE_REPEAT = 1, ///< Out-of-bounds coordinates are wrapped back around. ZE_SAMPLER_ADDRESS_MODE_CLAMP = 2, ///< Out-of-bounds coordinates are clamped to edge. ZE_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, ///< Out-of-bounds coordinates are clamped to border color which is (0.0f, ///< 0.0f, 0.0f, 0.0f) if image format swizzle contains alpha, otherwise ///< (0.0f, 0.0f, 0.0f, 1.0f). ZE_SAMPLER_ADDRESS_MODE_MIRROR = 4, ///< Out-of-bounds coordinates are mirrored starting from edge. ZE_SAMPLER_ADDRESS_MODE_FORCE_UINT32 = 0x7fffffff } ze_sampler_address_mode_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Sampler filtering modes typedef enum _ze_sampler_filter_mode_t { ZE_SAMPLER_FILTER_MODE_NEAREST = 0, ///< No coordinate modifications for out of bounds image access. ZE_SAMPLER_FILTER_MODE_LINEAR = 1, ///< Out-of-bounds coordinates are wrapped back around. ZE_SAMPLER_FILTER_MODE_FORCE_UINT32 = 0x7fffffff } ze_sampler_filter_mode_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Sampler descriptor typedef struct _ze_sampler_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_sampler_address_mode_t addressMode; ///< [in] Sampler addressing mode to determine how out-of-bounds ///< coordinates are handled. ze_sampler_filter_mode_t filterMode; ///< [in] Sampler filter mode to determine how samples are filtered. ze_bool_t isNormalized; ///< [in] Are coordinates normalized [0, 1] or not. } ze_sampler_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates sampler on the context. /// /// @details /// - The application must only use the sampler for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phSampler` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_SAMPLER_ADDRESS_MODE_MIRROR < desc->addressMode` /// + `::ZE_SAMPLER_FILTER_MODE_LINEAR < desc->filterMode` ZE_APIEXPORT ze_result_t ZE_APICALL zeSamplerCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_sampler_desc_t* desc, ///< [in] pointer to sampler descriptor ze_sampler_handle_t* phSampler ///< [out] handle of the sampler ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys sampler object /// /// @details /// - The application must ensure the device is not currently referencing /// the sampler before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this sampler. /// - The application must **not** call this function from simultaneous /// threads with the same sampler handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hSampler` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeSamplerDestroy( ze_sampler_handle_t hSampler ///< [in][release] handle of the sampler ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero APIs for Virtual Memory Management #if !defined(__GNUC__) #pragma region virtual #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Virtual memory page access attributes typedef enum _ze_memory_access_attribute_t { ZE_MEMORY_ACCESS_ATTRIBUTE_NONE = 0, ///< Indicates the memory page is inaccessible. ZE_MEMORY_ACCESS_ATTRIBUTE_READWRITE = 1, ///< Indicates the memory page supports read write access. ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY = 2, ///< Indicates the memory page supports read-only access. ZE_MEMORY_ACCESS_ATTRIBUTE_FORCE_UINT32 = 0x7fffffff } ze_memory_access_attribute_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Reserves pages in virtual address space. /// /// @details /// - The application must only use the memory allocation on the context for /// which it was created. /// - The starting address and size must be page aligned. See /// ::zeVirtualMemQueryPageSize. /// - If pStart is not null then implementation will attempt to reserve /// starting from that address. If not available then will find another /// suitable starting address. /// - The application may call this function from simultaneous threads. /// - The access attributes will default to none to indicate reservation is /// inaccessible. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pptr` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` ZE_APIEXPORT ze_result_t ZE_APICALL zeVirtualMemReserve( ze_context_handle_t hContext, ///< [in] handle of the context object const void* pStart, ///< [in][optional] pointer to start of region to reserve. If nullptr then ///< implementation will choose a start address. size_t size, ///< [in] size in bytes to reserve; must be page aligned. void** pptr ///< [out] pointer to virtual reservation. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Free pages in a reserved virtual address range. /// /// @details /// - Any existing virtual mappings for the range will be unmapped. /// - Physical allocations objects that were mapped to this range will not /// be destroyed. These need to be destroyed explicitly. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT ZE_APIEXPORT ze_result_t ZE_APICALL zeVirtualMemFree( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to free. size_t size ///< [in] size in bytes to free; must be page aligned. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Queries page size to use for aligning virtual memory reservations and /// physical memory allocations. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pagesize` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` ZE_APIEXPORT ze_result_t ZE_APICALL zeVirtualMemQueryPageSize( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] unaligned allocation size in bytes size_t* pagesize ///< [out] pointer to page size to use for start address and size ///< alignments. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported physical memory creation flags typedef uint32_t ze_physical_mem_flags_t; typedef enum _ze_physical_mem_flag_t { ZE_PHYSICAL_MEM_FLAG_ALLOCATE_ON_DEVICE = ZE_BIT(0), ///< [default] allocate physical device memory. ZE_PHYSICAL_MEM_FLAG_ALLOCATE_ON_HOST = ZE_BIT(1), ///< Allocate physical host memory instead. ZE_PHYSICAL_MEM_FLAG_FORCE_UINT32 = 0x7fffffff } ze_physical_mem_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Physical memory descriptor typedef struct _ze_physical_mem_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_physical_mem_flags_t flags; ///< [in] creation flags. ///< must be 0 (default) or a valid combination of ///< ::ze_physical_mem_flag_t; default is to create physical device memory. size_t size; ///< [in] size in bytes to reserve; must be page aligned. } ze_physical_mem_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a physical memory object for the context. /// /// @details /// - The application must only use the physical memory object on the /// context for which it was created. /// - The size must be page aligned. For host memory, the operating system /// page size should be used. For device memory, see /// ::zeVirtualMemQueryPageSize. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phPhysicalMemory` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == desc->size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT ZE_APIEXPORT ze_result_t ZE_APICALL zePhysicalMemCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a physical memory object. /// /// @details /// - The application must ensure the device is not currently referencing /// the physical memory object before it is deleted /// - The application must **not** call this function from simultaneous /// threads with the same physical memory handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hPhysicalMemory` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zePhysicalMemDestroy( ze_context_handle_t hContext, ///< [in] handle of the context object ze_physical_mem_handle_t hPhysicalMemory ///< [in][release] handle of physical memory object to destroy ); /////////////////////////////////////////////////////////////////////////////// /// @brief Maps pages in virtual address space to pages from physical memory /// object. /// /// @details /// - The virtual address range must have been reserved using /// ::zeVirtualMemReserve. /// - The application must only use the mapped memory allocation on the /// context for which it was created. /// - The virtual start address and size must be page aligned. See /// ::zeVirtualMemQueryPageSize. /// - The application should use, for the starting address and size, the /// same size alignment used for the physical allocation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hPhysicalMemory` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY < access` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT ZE_APIEXPORT ze_result_t ZE_APICALL zeVirtualMemMap( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address range to map. size_t size, ///< [in] size in bytes of virtual address range to map; must be page ///< aligned. ze_physical_mem_handle_t hPhysicalMemory, ///< [in] handle to physical memory object. size_t offset, ///< [in] offset into physical memory allocation object; must be page ///< aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Unmaps pages in virtual address space from pages from a physical /// memory object. /// /// @details /// - The page access attributes for virtual address range will revert back /// to none. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT /// + Address must be page aligned /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// + Size must be page aligned ZE_APIEXPORT ze_result_t ZE_APICALL zeVirtualMemUnmap( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to unmap. size_t size ///< [in] size in bytes to unmap; must be page aligned. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set memory access attributes for a virtual address range. /// /// @details /// - This function may be called from simultaneous threads with the same /// function handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY < access` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT /// + Address must be page aligned /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// + Size must be page aligned ZE_APIEXPORT ze_result_t ZE_APICALL zeVirtualMemSetAccessAttribute( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of reserved virtual address region. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get memory access attribute for a virtual address range. /// /// @details /// - If size and outSize are equal then the pages in the specified virtual /// address range have the same access attributes. /// - This function may be called from simultaneous threads with the same /// function handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// + `nullptr == access` /// + `nullptr == outSize` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT /// + Address must be page aligned /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// + Size must be page aligned ZE_APIEXPORT ze_result_t ZE_APICALL zeVirtualMemGetAccessAttribute( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address region for query. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t* access, ///< [out] query result for page access attribute. size_t* outSize ///< [out] query result for size of virtual address range, starting at ptr, ///< that shares same access attribute. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Floating-Point Atomics #if !defined(__GNUC__) #pragma region floatAtomics #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_FLOAT_ATOMICS_EXT_NAME /// @brief Floating-Point Atomics Extension Name #define ZE_FLOAT_ATOMICS_EXT_NAME "ZE_extension_float_atomics" #endif // ZE_FLOAT_ATOMICS_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Floating-Point Atomics Extension Version(s) typedef enum _ze_float_atomics_ext_version_t { ZE_FLOAT_ATOMICS_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_FLOAT_ATOMICS_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_FLOAT_ATOMICS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_float_atomics_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported floating-point atomic capability flags typedef uint32_t ze_device_fp_atomic_ext_flags_t; typedef enum _ze_device_fp_atomic_ext_flag_t { ZE_DEVICE_FP_ATOMIC_EXT_FLAG_GLOBAL_LOAD_STORE = ZE_BIT(0), ///< Supports atomic load, store, and exchange ZE_DEVICE_FP_ATOMIC_EXT_FLAG_GLOBAL_ADD = ZE_BIT(1), ///< Supports atomic add and subtract ZE_DEVICE_FP_ATOMIC_EXT_FLAG_GLOBAL_MIN_MAX = ZE_BIT(2), ///< Supports atomic min and max ZE_DEVICE_FP_ATOMIC_EXT_FLAG_LOCAL_LOAD_STORE = ZE_BIT(16), ///< Supports atomic load, store, and exchange ZE_DEVICE_FP_ATOMIC_EXT_FLAG_LOCAL_ADD = ZE_BIT(17), ///< Supports atomic add and subtract ZE_DEVICE_FP_ATOMIC_EXT_FLAG_LOCAL_MIN_MAX = ZE_BIT(18), ///< Supports atomic min and max ZE_DEVICE_FP_ATOMIC_EXT_FLAG_FORCE_UINT32 = 0x7fffffff } ze_device_fp_atomic_ext_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device floating-point atomic properties queried using /// ::zeDeviceGetModuleProperties /// /// @details /// - This structure may be returned from ::zeDeviceGetModuleProperties, via /// the `pNext` member of ::ze_device_module_properties_t. typedef struct _ze_float_atomic_ext_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_device_fp_atomic_ext_flags_t fp16Flags; ///< [out] Capabilities for half-precision floating-point atomic operations ze_device_fp_atomic_ext_flags_t fp32Flags; ///< [out] Capabilities for single-precision floating-point atomic ///< operations ze_device_fp_atomic_ext_flags_t fp64Flags; ///< [out] Capabilities for double-precision floating-point atomic ///< operations } ze_float_atomic_ext_properties_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting kernel global work offset. #if !defined(__GNUC__) #pragma region globaloffset #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_GLOBAL_OFFSET_EXP_NAME /// @brief Global Offset Extension Name #define ZE_GLOBAL_OFFSET_EXP_NAME "ZE_experimental_global_offset" #endif // ZE_GLOBAL_OFFSET_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Global Offset Extension Version(s) typedef enum _ze_global_offset_exp_version_t { ZE_GLOBAL_OFFSET_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_GLOBAL_OFFSET_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_GLOBAL_OFFSET_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_global_offset_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Set global work offset for a kernel. /// /// @details /// - The global work offset will be used when a /// ::zeCommandListAppendLaunchKernel() variant is called. /// - The application must **not** call this function from simultaneous /// threads with the same kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelSetGlobalOffsetExp( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t offsetX, ///< [in] global offset for X dimension to use for this kernel uint32_t offsetY, ///< [in] global offset for Y dimension to use for this kernel uint32_t offsetZ ///< [in] global offset for Z dimension to use for this kernel ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting relaxed allocation limits. #if !defined(__GNUC__) #pragma region relaxedAllocLimits #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_RELAXED_ALLOCATION_LIMITS_EXP_NAME /// @brief Relaxed Allocation Limits Extension Name #define ZE_RELAXED_ALLOCATION_LIMITS_EXP_NAME "ZE_experimental_relaxed_allocation_limits" #endif // ZE_RELAXED_ALLOCATION_LIMITS_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Relaxed Allocation Limits Extension Version(s) typedef enum _ze_relaxed_allocation_limits_exp_version_t { ZE_RELAXED_ALLOCATION_LIMITS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_RELAXED_ALLOCATION_LIMITS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_RELAXED_ALLOCATION_LIMITS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_relaxed_allocation_limits_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported relaxed memory allocation flags typedef uint32_t ze_relaxed_allocation_limits_exp_flags_t; typedef enum _ze_relaxed_allocation_limits_exp_flag_t { ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE = ZE_BIT(0), ///< Allocation size may exceed the `maxMemAllocSize` member of ///< ::ze_device_properties_t. ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_relaxed_allocation_limits_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Relaxed limits memory allocation descriptor /// /// @details /// - This structure may be passed to ::zeMemAllocShared or /// ::zeMemAllocDevice, via the `pNext` member of /// ::ze_device_mem_alloc_desc_t. /// - This structure may also be passed to ::zeMemAllocHost, via the `pNext` /// member of ::ze_host_mem_alloc_desc_t. typedef struct _ze_relaxed_allocation_limits_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_relaxed_allocation_limits_exp_flags_t flags; ///< [in] flags specifying allocation limits to relax. ///< must be 0 (default) or a valid combination of ::ze_relaxed_allocation_limits_exp_flag_t; } ze_relaxed_allocation_limits_exp_desc_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for retrieving kernel binary program data. #if !defined(__GNUC__) #pragma region kernelBinary #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_GET_KERNEL_BINARY_EXP_NAME /// @brief Get Kernel Binary Extension Name #define ZE_GET_KERNEL_BINARY_EXP_NAME "ZE_extension_kernel_binary_exp" #endif // ZE_GET_KERNEL_BINARY_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Get Kernel Binary Extension Version(s) typedef enum _ze_kernel_get_binary_exp_version_t { ZE_KERNEL_GET_BINARY_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_KERNEL_GET_BINARY_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_KERNEL_GET_BINARY_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_kernel_get_binary_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves kernel binary program data (ISA GEN format). /// /// @details /// - A valid kernel handle must be created with ::zeKernelCreate. /// - Returns Intel Graphics Assembly (GEN ISA) format binary program data /// for kernel handle. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` /// + `nullptr == pKernelBinary` ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelGetBinaryExp( ze_kernel_handle_t hKernel, ///< [in] Kernel handle. size_t* pSize, ///< [in,out] pointer to variable with size of GEN ISA binary. uint8_t* pKernelBinary ///< [in,out] pointer to storage area for GEN ISA binary function. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for Driver Direct Device Interface (DDI) Handles #if !defined(__GNUC__) #pragma region driverDDIHandles #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_DRIVER_DDI_HANDLES_EXT_NAME /// @brief Driver Direct Device Interface (DDI) Handles Extension Name #define ZE_DRIVER_DDI_HANDLES_EXT_NAME "ZE_extension_driver_ddi_handles" #endif // ZE_DRIVER_DDI_HANDLES_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Driver Direct Device Interface (DDI) Handles Extension Version(s) typedef enum _ze_driver_ddi_handles_ext_version_t { ZE_DRIVER_DDI_HANDLES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_DRIVER_DDI_HANDLES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_DRIVER_DDI_HANDLES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_driver_ddi_handles_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Driver Direct Device Interface (DDI) Handle Extension Flags typedef uint32_t ze_driver_ddi_handle_ext_flags_t; typedef enum _ze_driver_ddi_handle_ext_flag_t { ZE_DRIVER_DDI_HANDLE_EXT_FLAG_DDI_HANDLE_EXT_SUPPORTED = ZE_BIT(0), ///< Driver Supports DDI Handles Extension ZE_DRIVER_DDI_HANDLE_EXT_FLAG_FORCE_UINT32 = 0x7fffffff } ze_driver_ddi_handle_ext_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Driver DDI Handles properties queried using ::zeDriverGetProperties /// /// @details /// - This structure may be returned from ::zeDriverGetProperties, via the /// `pNext` member of ::ze_driver_properties_t. typedef struct _ze_driver_ddi_handles_ext_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_driver_ddi_handle_ext_flags_t flags; ///< [out] 0 (none) or a valid combination of ::ze_driver_ddi_handle_ext_flags_t } ze_driver_ddi_handles_ext_properties_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for external semaphores #if !defined(__GNUC__) #pragma region externalSemaphores #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_EXTERNAL_SEMAPHORES_EXTENSION_NAME /// @brief External Semaphores Extension Name #define ZE_EXTERNAL_SEMAPHORES_EXTENSION_NAME "ZE_extension_external_semaphores" #endif // ZE_EXTERNAL_SEMAPHORES_EXTENSION_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief External Semaphores Extension Version typedef enum _ze_external_semaphore_ext_version_t { ZE_EXTERNAL_SEMAPHORE_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_EXTERNAL_SEMAPHORE_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_EXTERNAL_SEMAPHORE_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_external_semaphore_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of external semaphore object typedef struct _ze_external_semaphore_ext_handle_t *ze_external_semaphore_ext_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief External Semaphores Type Flags typedef uint32_t ze_external_semaphore_ext_flags_t; typedef enum _ze_external_semaphore_ext_flag_t { ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_OPAQUE_FD = ZE_BIT(0), ///< Semaphore is an Linux opaque file descriptor ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_OPAQUE_WIN32 = ZE_BIT(1), ///< Semaphore is an opaque Win32 handle for monitored fence ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_OPAQUE_WIN32_KMT = ZE_BIT(2), ///< Semaphore is an opaque Win32 KMT handle for monitored fence ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_D3D12_FENCE = ZE_BIT(3), ///< Semaphore is a D3D12 fence ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_D3D11_FENCE = ZE_BIT(4), ///< Semaphore is a D3D11 fence ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_KEYED_MUTEX = ZE_BIT(5), ///< Semaphore is a keyed mutex for Win32 ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_KEYED_MUTEX_KMT = ZE_BIT(6), ///< Semaphore is a keyed mutex for Win32 KMT ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_VK_TIMELINE_SEMAPHORE_FD = ZE_BIT(7), ///< Semaphore is a Vulkan Timeline semaphore for Linux ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_VK_TIMELINE_SEMAPHORE_WIN32 = ZE_BIT(8), ///< Semaphore is a Vulkan Timeline semaphore for Win32 ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_FORCE_UINT32 = 0x7fffffff } ze_external_semaphore_ext_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief External Semaphore Descriptor typedef struct _ze_external_semaphore_ext_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_external_semaphore_ext_flags_t flags; ///< [in] The flags describing the type of the semaphore. ///< must be 0 (default) or a valid combination of ::ze_external_semaphore_ext_flag_t. ///< When importing a semaphore, pNext should be pointing to one of the ///< following structures: ::ze_external_semaphore_win32_ext_desc_t or ::ze_external_semaphore_fd_ext_desc_t. } ze_external_semaphore_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief External Semaphore Win32 Descriptor typedef struct _ze_external_semaphore_win32_ext_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). void* handle; ///< [in] Win32 handle of the semaphore. ///< Must be a valid Win32 handle. const char* name; ///< [in] Name of the semaphore. ///< Must be a valid null-terminated string. } ze_external_semaphore_win32_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief External Semaphore FD Descriptor typedef struct _ze_external_semaphore_fd_ext_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). int fd; ///< [in] File descriptor of the semaphore. ///< Must be a valid file descriptor. } ze_external_semaphore_fd_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief External Semaphore Signal parameters typedef struct _ze_external_semaphore_signal_params_ext_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t value; ///< [in] [optional] Value to signal. ///< Specified by user as an expected value with some of semaphore types, ///< such as ::ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_D3D12_FENCE. } ze_external_semaphore_signal_params_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief External Semaphore Wait parameters typedef struct _ze_external_semaphore_wait_params_ext_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t value; ///< [in] [optional] Value to wait for. ///< Specified by user as an expected value with some of semaphore types, ///< such as ::ZE_EXTERNAL_SEMAPHORE_EXT_FLAG_D3D12_FENCE. } ze_external_semaphore_wait_params_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Import an external semaphore /// /// @details /// - Imports an external semaphore. /// - This function may be called from simultaneous threads with the same /// device handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phSemaphore` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x1ff < desc->flags` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceImportExternalSemaphoreExt( ze_device_handle_t hDevice, ///< [in] The device handle. const ze_external_semaphore_ext_desc_t* desc, ///< [in] The pointer to external semaphore descriptor. ze_external_semaphore_ext_handle_t* phSemaphore ///< [out] The handle of the external semaphore imported. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Release an external semaphore /// /// @details /// - The application must ensure the device is not currently referencing /// the semaphore before it is released. /// - The application must **not** call this function from simultaneous /// threads with the same semaphore handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hSemaphore` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceReleaseExternalSemaphoreExt( ze_external_semaphore_ext_handle_t hSemaphore ///< [in] The handle of the external semaphore. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Signal an external semaphore /// /// @details /// - Signals an external semaphore. /// - This function must only be used with an immediate command list. /// - This function may be called from simultaneous threads with the same /// command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phSemaphores` /// + `nullptr == signalParams` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` /// + `(nullptr == phSemaphores) && (0 < numSemaphores)` /// + `(nullptr == signalParams) && (0 < numSemaphores)` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + Commandlist handle does not correspond to an immediate command list ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendSignalExternalSemaphoreExt( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in][range(0, numSemaphores)] The vector of external semaphore handles ///< to be appended into command list. ze_external_semaphore_signal_params_ext_t* signalParams, ///< [in] Signal parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Wait on external semaphores /// /// @details /// - Waits on external semaphores. /// - This function must only be used with an immediate command list. /// - This function may be called from simultaneous threads with the same /// command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phSemaphores` /// + `nullptr == waitParams` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` /// + `(nullptr == phSemaphores) && (0 < numSemaphores)` /// + `(nullptr == waitParams) && (0 < numSemaphores)` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + Commandlist handle does not correspond to an immediate command list ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendWaitExternalSemaphoreExt( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in] [range(0,numSemaphores)] The vector of external semaphore handles ///< to append into command list. ze_external_semaphore_wait_params_ext_t* waitParams, ///< [in] Wait parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Cache Reservation #if !defined(__GNUC__) #pragma region cacheReservation #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_CACHE_RESERVATION_EXT_NAME /// @brief Cache_Reservation Extension Name #define ZE_CACHE_RESERVATION_EXT_NAME "ZE_extension_cache_reservation" #endif // ZE_CACHE_RESERVATION_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Cache_Reservation Extension Version(s) typedef enum _ze_cache_reservation_ext_version_t { ZE_CACHE_RESERVATION_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_CACHE_RESERVATION_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_CACHE_RESERVATION_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_cache_reservation_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Cache Reservation Region typedef enum _ze_cache_ext_region_t { ZE_CACHE_EXT_REGION_ZE_CACHE_REGION_DEFAULT = 0, ///< [DEPRECATED] utilize driver default scheme. Use ///< ::ZE_CACHE_EXT_REGION_DEFAULT. ZE_CACHE_EXT_REGION_ZE_CACHE_RESERVE_REGION = 1, ///< [DEPRECATED] utilize reserved region. Use ///< ::ZE_CACHE_EXT_REGION_RESERVED. ZE_CACHE_EXT_REGION_ZE_CACHE_NON_RESERVED_REGION = 2, ///< [DEPRECATED] utilize non-reserverd region. Use ///< ::ZE_CACHE_EXT_REGION_NON_RESERVED. ZE_CACHE_EXT_REGION_DEFAULT = 0, ///< utilize driver default scheme ZE_CACHE_EXT_REGION_RESERVED = 1, ///< utilize reserved region ZE_CACHE_EXT_REGION_NON_RESERVED = 2, ///< utilize non-reserverd region ZE_CACHE_EXT_REGION_FORCE_UINT32 = 0x7fffffff } ze_cache_ext_region_t; /////////////////////////////////////////////////////////////////////////////// /// @brief CacheReservation structure /// /// @details /// - This structure must be passed to ::zeDeviceGetCacheProperties via the /// `pNext` member of ::ze_device_cache_properties_t /// - Used for determining the max cache reservation allowed on device. Size /// of zero means no reservation available. typedef struct _ze_cache_reservation_ext_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). size_t maxCacheReservationSize; ///< [out] max cache reservation size } ze_cache_reservation_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Reserve Cache on Device /// /// @details /// - The application may call this function but may not be successful as /// some other application may have reserve prior /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceReserveCacheExt( ze_device_handle_t hDevice, ///< [in] handle of the device object size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the ///< driver shall default to last level of cache and attempt to reserve in ///< that cache. size_t cacheReservationSize ///< [in] value for reserving size, in bytes. If zero, then the driver ///< shall remove prior reservation ); /////////////////////////////////////////////////////////////////////////////// /// @brief Assign VA section to use reserved section /// /// @details /// - The application may call this function to assign VA to particular /// reservartion region /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_CACHE_EXT_REGION_NON_RESERVED < cacheRegion` ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceSetCacheAdviceExt( ze_device_handle_t hDevice, ///< [in] handle of the device object void* ptr, ///< [in] memory pointer to query size_t regionSize, ///< [in] region size, in pages ze_cache_ext_region_t cacheRegion ///< [in] reservation region ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting event query timestamps. #if !defined(__GNUC__) #pragma region eventquerytimestamps #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_EVENT_QUERY_TIMESTAMPS_EXP_NAME /// @brief Event Query Timestamps Extension Name #define ZE_EVENT_QUERY_TIMESTAMPS_EXP_NAME "ZE_experimental_event_query_timestamps" #endif // ZE_EVENT_QUERY_TIMESTAMPS_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Event Query Timestamps Extension Version(s) typedef enum _ze_event_query_timestamps_exp_version_t { ZE_EVENT_QUERY_TIMESTAMPS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_EVENT_QUERY_TIMESTAMPS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ),///< latest known version ZE_EVENT_QUERY_TIMESTAMPS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_event_query_timestamps_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Query event timestamps for a device or sub-device. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support /// ::ZE_experimental_event_query_timestamps. /// - The implementation must return all timestamps for the specified event /// and device pair. /// - The implementation must return all timestamps for all sub-devices when /// device handle is parent device. /// - The implementation may return all timestamps for sub-devices when /// device handle is sub-device or may return 0 for count. /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeEventQueryTimestampsExp( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of timestamp results. ///< if count is zero, then the driver shall update the value with the ///< total number of timestamps available. ///< if count is greater than the number of timestamps available, then the ///< driver shall update the value with the correct number of timestamps available. ze_kernel_timestamp_result_t* pTimestamps ///< [in,out][optional][range(0, *pCount)] array of timestamp results. ///< if count is less than the number of timestamps available, then driver ///< shall only retrieve that number of timestamps. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting image memory properties. #if !defined(__GNUC__) #pragma region imagememoryproperties #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_IMAGE_MEMORY_PROPERTIES_EXP_NAME /// @brief Image Memory Properties Extension Name #define ZE_IMAGE_MEMORY_PROPERTIES_EXP_NAME "ZE_experimental_image_memory_properties" #endif // ZE_IMAGE_MEMORY_PROPERTIES_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Image Memory Properties Extension Version(s) typedef enum _ze_image_memory_properties_exp_version_t { ZE_IMAGE_MEMORY_PROPERTIES_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_MEMORY_PROPERTIES_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_IMAGE_MEMORY_PROPERTIES_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_image_memory_properties_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Image memory properties typedef struct _ze_image_memory_properties_exp_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t size; ///< [out] size of image allocation in bytes. uint64_t rowPitch; ///< [out] size of image row in bytes. uint64_t slicePitch; ///< [out] size of image slice in bytes. } ze_image_memory_properties_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Query image memory properties. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support /// ::ZE_experimental_image_memory_properties extension. /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pMemoryProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeImageGetMemoryPropertiesExp( ze_image_handle_t hImage, ///< [in] handle of image object ze_image_memory_properties_exp_t* pMemoryProperties ///< [in,out] query result for image memory properties. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting image views. #if !defined(__GNUC__) #pragma region imageview #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_IMAGE_VIEW_EXT_NAME /// @brief Image View Extension Name #define ZE_IMAGE_VIEW_EXT_NAME "ZE_extension_image_view" #endif // ZE_IMAGE_VIEW_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Image View Extension Version(s) typedef enum _ze_image_view_ext_version_t { ZE_IMAGE_VIEW_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_VIEW_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_IMAGE_VIEW_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_image_view_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Create image view on the context. /// /// @details /// - The application must only use the image view for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support ::ZE_extension_image_view extension. /// - Image views are treated as images from the API. /// - Image views provide a mechanism to redescribe how an image is /// interpreted (e.g. different format). /// - Image views become disabled when their corresponding image resource is /// destroyed. /// - Use ::zeImageDestroy to destroy image view objects. /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// + `nullptr == hImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phImageView` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// + `::ZE_IMAGE_TYPE_BUFFER < desc->type` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT ZE_APIEXPORT ze_result_t ZE_APICALL zeImageViewCreateExt( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ); /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_IMAGE_VIEW_EXP_NAME /// @brief Image View Extension Name #define ZE_IMAGE_VIEW_EXP_NAME "ZE_experimental_image_view" #endif // ZE_IMAGE_VIEW_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Image View Extension Version(s) typedef enum _ze_image_view_exp_version_t { ZE_IMAGE_VIEW_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_VIEW_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_IMAGE_VIEW_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_image_view_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Create image view on the context. /// /// @details /// - The application must only use the image view for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support ::ZE_experimental_image_view /// extension. /// - Image views are treated as images from the API. /// - Image views provide a mechanism to redescribe how an image is /// interpreted (e.g. different format). /// - Image views become disabled when their corresponding image resource is /// destroyed. /// - Use ::zeImageDestroy to destroy image view objects. /// - Note: This function is deprecated and replaced by /// ::zeImageViewCreateExt. /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// + `nullptr == hImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phImageView` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// + `::ZE_IMAGE_TYPE_BUFFER < desc->type` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT ZE_APIEXPORT ze_result_t ZE_APICALL zeImageViewCreateExp( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting image views for planar images. #if !defined(__GNUC__) #pragma region imageviewplanar #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_IMAGE_VIEW_PLANAR_EXT_NAME /// @brief Image View Planar Extension Name #define ZE_IMAGE_VIEW_PLANAR_EXT_NAME "ZE_extension_image_view_planar" #endif // ZE_IMAGE_VIEW_PLANAR_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Image View Planar Extension Version(s) typedef enum _ze_image_view_planar_ext_version_t { ZE_IMAGE_VIEW_PLANAR_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_VIEW_PLANAR_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_IMAGE_VIEW_PLANAR_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_image_view_planar_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Image view planar descriptor typedef struct _ze_image_view_planar_ext_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t planeIndex; ///< [in] the 0-based plane index (e.g. NV12 is 0 = Y plane, 1 UV plane) } ze_image_view_planar_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_IMAGE_VIEW_PLANAR_EXP_NAME /// @brief Image View Planar Extension Name #define ZE_IMAGE_VIEW_PLANAR_EXP_NAME "ZE_experimental_image_view_planar" #endif // ZE_IMAGE_VIEW_PLANAR_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Image View Planar Extension Version(s) typedef enum _ze_image_view_planar_exp_version_t { ZE_IMAGE_VIEW_PLANAR_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_VIEW_PLANAR_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_IMAGE_VIEW_PLANAR_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_image_view_planar_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Image view planar descriptor typedef struct _ze_image_view_planar_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t planeIndex; ///< [in] the 0-based plane index (e.g. NV12 is 0 = Y plane, 1 UV plane) } ze_image_view_planar_exp_desc_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for specifying kernel scheduling hints. #if !defined(__GNUC__) #pragma region kernelSchedulingHints #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_KERNEL_SCHEDULING_HINTS_EXP_NAME /// @brief Kernel Scheduling Hints Extension Name #define ZE_KERNEL_SCHEDULING_HINTS_EXP_NAME "ZE_experimental_scheduling_hints" #endif // ZE_KERNEL_SCHEDULING_HINTS_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Kernel Scheduling Hints Extension Version(s) typedef enum _ze_scheduling_hints_exp_version_t { ZE_SCHEDULING_HINTS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_SCHEDULING_HINTS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_SCHEDULING_HINTS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_scheduling_hints_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported kernel scheduling hint flags typedef uint32_t ze_scheduling_hint_exp_flags_t; typedef enum _ze_scheduling_hint_exp_flag_t { ZE_SCHEDULING_HINT_EXP_FLAG_OLDEST_FIRST = ZE_BIT(0), ///< Hint that the kernel prefers oldest-first scheduling ZE_SCHEDULING_HINT_EXP_FLAG_ROUND_ROBIN = ZE_BIT(1), ///< Hint that the kernel prefers round-robin scheduling ZE_SCHEDULING_HINT_EXP_FLAG_STALL_BASED_ROUND_ROBIN = ZE_BIT(2), ///< Hint that the kernel prefers stall-based round-robin scheduling ZE_SCHEDULING_HINT_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_scheduling_hint_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device kernel scheduling hint properties queried using /// ::zeDeviceGetModuleProperties /// /// @details /// - This structure may be returned from ::zeDeviceGetModuleProperties, via /// the `pNext` member of ::ze_device_module_properties_t. typedef struct _ze_scheduling_hint_exp_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_scheduling_hint_exp_flags_t schedulingHintFlags; ///< [out] Supported kernel scheduling hints. ///< May be 0 (none) or a valid combination of ::ze_scheduling_hint_exp_flag_t. } ze_scheduling_hint_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Kernel scheduling hint descriptor /// /// @details /// - This structure may be passed to ::zeKernelSchedulingHintExp. typedef struct _ze_scheduling_hint_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_scheduling_hint_exp_flags_t flags; ///< [in] flags specifying kernel scheduling hints. ///< must be 0 (default) or a valid combination of ::ze_scheduling_hint_exp_flag_t. } ze_scheduling_hint_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Provide kernel scheduling hints that may improve performance /// /// @details /// - The scheduling hints may improve performance only and are not required /// for correctness. /// - If a specified scheduling hint is unsupported it will be silently /// ignored. /// - If two conflicting scheduling hints are specified there is no defined behavior; /// the hints may be ignored or one hint may be chosen arbitrarily. /// - The application must not call this function from simultaneous threads /// with the same kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pHint` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < pHint->flags` ZE_APIEXPORT ze_result_t ZE_APICALL zeKernelSchedulingHintExp( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_scheduling_hint_exp_desc_t* pHint ///< [in] pointer to kernel scheduling hint descriptor ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for One-Definition-Rule Linkage Types #if !defined(__GNUC__) #pragma region linkonceodr #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_LINKONCE_ODR_EXT_NAME /// @brief Linkonce ODR Extension Name #define ZE_LINKONCE_ODR_EXT_NAME "ZE_extension_linkonce_odr" #endif // ZE_LINKONCE_ODR_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Linkonce ODR Extension Version(s) typedef enum _ze_linkonce_odr_ext_version_t { ZE_LINKONCE_ODR_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_LINKONCE_ODR_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_LINKONCE_ODR_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_linkonce_odr_ext_version_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting power saving hint. #if !defined(__GNUC__) #pragma region powersavinghint #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_CONTEXT_POWER_SAVING_HINT_EXP_NAME /// @brief Power Saving Hint Extension Name #define ZE_CONTEXT_POWER_SAVING_HINT_EXP_NAME "ZE_experimental_power_saving_hint" #endif // ZE_CONTEXT_POWER_SAVING_HINT_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Power Saving Hint Extension Version(s) typedef enum _ze_power_saving_hint_exp_version_t { ZE_POWER_SAVING_HINT_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_POWER_SAVING_HINT_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_POWER_SAVING_HINT_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_power_saving_hint_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported device types typedef enum _ze_power_saving_hint_type_t { ZE_POWER_SAVING_HINT_TYPE_MIN = 0, ///< Minumum power savings. The device will make no attempt to save power ///< while executing work submitted to this context. ZE_POWER_SAVING_HINT_TYPE_MAX = 100, ///< Maximum power savings. The device will do everything to bring power to ///< a minimum while executing work submitted to this context. ZE_POWER_SAVING_HINT_TYPE_FORCE_UINT32 = 0x7fffffff } ze_power_saving_hint_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Extended context descriptor containing power saving hint. typedef struct _ze_context_power_saving_hint_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t hint; ///< [in] power saving hint (default value = 0). This is value from [0,100] ///< and can use pre-defined settings from ::ze_power_saving_hint_type_t. } ze_context_power_saving_hint_exp_desc_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Subgroups #if !defined(__GNUC__) #pragma region subgroups #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_SUBGROUPS_EXT_NAME /// @brief Subgroups Extension Name #define ZE_SUBGROUPS_EXT_NAME "ZE_extension_subgroups" #endif // ZE_SUBGROUPS_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Subgroups Extension Version(s) typedef enum _ze_subgroup_ext_version_t { ZE_SUBGROUP_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_SUBGROUP_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_SUBGROUP_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_subgroup_ext_version_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for EU Count #if !defined(__GNUC__) #pragma region EUCount #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_EU_COUNT_EXT_NAME /// @brief EU Count Extension Name #define ZE_EU_COUNT_EXT_NAME "ZE_extension_eu_count" #endif // ZE_EU_COUNT_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief EU Count Extension Version(s) typedef enum _ze_eu_count_ext_version_t { ZE_EU_COUNT_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_EU_COUNT_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_EU_COUNT_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_eu_count_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief EU count queried using ::zeDeviceGetProperties /// /// @details /// - This structure may be returned from ::zeDeviceGetProperties via the /// `pNext` member of ::ze_device_properties_t. /// - Used for determining the total number of EUs available on device. typedef struct _ze_eu_count_ext_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t numTotalEUs; ///< [out] Total number of EUs available } ze_eu_count_ext_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for PCI Properties #if !defined(__GNUC__) #pragma region PCIProperties #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_PCI_PROPERTIES_EXT_NAME /// @brief PCI Properties Extension Name #define ZE_PCI_PROPERTIES_EXT_NAME "ZE_extension_pci_properties" #endif // ZE_PCI_PROPERTIES_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief PCI Properties Extension Version(s) typedef enum _ze_pci_properties_ext_version_t { ZE_PCI_PROPERTIES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_PCI_PROPERTIES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_PCI_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_pci_properties_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device PCI address /// /// @details /// - This structure may be passed to ::zeDevicePciGetPropertiesExt as an /// attribute of ::ze_pci_ext_properties_t. /// - A PCI BDF address is the bus:device:function address of the device and /// is useful for locating the device in the PCI switch fabric. typedef struct _ze_pci_address_ext_t { uint32_t domain; ///< [out] PCI domain number uint32_t bus; ///< [out] PCI BDF bus number uint32_t device; ///< [out] PCI BDF device number uint32_t function; ///< [out] PCI BDF function number } ze_pci_address_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device PCI speed typedef struct _ze_pci_speed_ext_t { int32_t genVersion; ///< [out] The link generation. A value of -1 means that this property is ///< unknown. int32_t width; ///< [out] The number of lanes. A value of -1 means that this property is ///< unknown. int64_t maxBandwidth; ///< [out] The theoretical maximum bandwidth in bytes/sec (sum of all ///< lanes). A value of -1 means that this property is unknown. } ze_pci_speed_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Static PCI properties typedef struct _ze_pci_ext_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_pci_address_ext_t address; ///< [out] The BDF address ze_pci_speed_ext_t maxSpeed; ///< [out] Fastest port configuration supported by the device (sum of all ///< lanes) } ze_pci_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get PCI properties - address, max speed /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pPciProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeDevicePciGetPropertiesExt( ze_device_handle_t hDevice, ///< [in] handle of the device object. ze_pci_ext_properties_t* pPciProperties ///< [in,out] returns the PCI properties of the device. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for sRGB #if !defined(__GNUC__) #pragma region SRGB #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_SRGB_EXT_NAME /// @brief sRGB Extension Name #define ZE_SRGB_EXT_NAME "ZE_extension_srgb" #endif // ZE_SRGB_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief sRGB Extension Version(s) typedef enum _ze_srgb_ext_version_t { ZE_SRGB_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_SRGB_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_SRGB_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_srgb_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief sRGB image descriptor /// /// @details /// - This structure may be passed to ::zeImageCreate via the `pNext` member /// of ::ze_image_desc_t /// - Used for specifying that the image is in sRGB format. typedef struct _ze_srgb_ext_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t sRGB; ///< [in] Is sRGB. } ze_srgb_ext_desc_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Image Copy To/From Memory #if !defined(__GNUC__) #pragma region imageCopy #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_IMAGE_COPY_EXT_NAME /// @brief Image Copy Extension Name #define ZE_IMAGE_COPY_EXT_NAME "ZE_extension_image_copy" #endif // ZE_IMAGE_COPY_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Image Copy Extension Version(s) typedef enum _ze_image_copy_ext_version_t { ZE_IMAGE_COPY_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_COPY_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_IMAGE_COPY_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_image_copy_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Copies from an image to device or shared memory. /// /// @details /// - The application must ensure the memory pointed to by dstptr is /// accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by dstptr as /// it is free to be modified by either the Host or device up until /// execution. /// - The application must ensure the image and events are accessible by the /// device on which the command list was created. /// - The application must ensure the image format descriptor for the source /// image is a single-planar format. /// - The application must ensure that the rowPitch is set to 0 if image is /// a 1D image. Otherwise the rowPitch must be greater than or equal to /// the element size in bytes x width. /// - If rowPitch is set to 0, the appropriate row pitch is calculated based /// on the size of each element in bytes multiplied by width /// - The application must ensure that the slicePitch is set to 0 if image /// is a 1D or 2D image. Otherwise this value must be greater than or /// equal to rowPitch x height. /// - If slicePitch is set to 0, the appropriate slice pitch is calculated /// based on the rowPitch x height. /// - The application must ensure the command list, image and events were /// created, and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clEnqueueReadImage /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hSrcImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemoryExt( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor uint32_t destRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being written uint32_t destSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being written ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Copies to an image from device or shared memory. /// /// @details /// - The application must ensure the memory pointed to by srcptr is /// accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by srcptr as /// it is free to be modified by either the Host or device up until /// execution. /// - The application must ensure the image and events are accessible by the /// device on which the command list was created. /// - The application must ensure the image format descriptor for the /// destination image is a single-planar format. /// - The application must ensure that the rowPitch is set to 0 if image is /// a 1D image. Otherwise the rowPitch must be greater than or equal to /// the element size in bytes x width. /// - If rowPitch is set to 0, the appropriate row pitch is calculated based /// on the size of each element in bytes multiplied by width /// - The application must ensure that the slicePitch is set to 0 if image /// is a 1D or 2D image. Otherwise this value must be greater than or /// equal to rowPitch x height. /// - If slicePitch is set to 0, the appropriate slice pitch is calculated /// based on the rowPitch x height. /// - The application must ensure the command list, image and events were /// created, and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clEnqueueWriteImage /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hDstImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == srcptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListAppendImageCopyFromMemoryExt( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor uint32_t srcRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being read uint32_t srcSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being read ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for Querying Image Allocation Properties. #if !defined(__GNUC__) #pragma region imageQueryAllocProperties #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_NAME /// @brief Image Query Allocation Properties Extension Name #define ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_NAME "ZE_extension_image_query_alloc_properties" #endif // ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Image Query Allocation Properties Extension Version(s) typedef enum _ze_image_query_alloc_properties_ext_version_t { ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_IMAGE_QUERY_ALLOC_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_image_query_alloc_properties_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Image allocation properties queried using /// ::zeImageGetAllocPropertiesExt typedef struct _ze_image_allocation_ext_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t id; ///< [out] identifier for this allocation } ze_image_allocation_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves attributes of an image allocation /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pImageAllocProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeImageGetAllocPropertiesExt( ze_context_handle_t hContext, ///< [in] handle of the context object ze_image_handle_t hImage, ///< [in] handle of image object to query ze_image_allocation_ext_properties_t* pImageAllocProperties ///< [in,out] query result for image allocation properties ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Linkage Inspection #if !defined(__GNUC__) #pragma region linkageInspection #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_LINKAGE_INSPECTION_EXT_NAME /// @brief Linkage Inspection Extension Name #define ZE_LINKAGE_INSPECTION_EXT_NAME "ZE_extension_linkage_inspection" #endif // ZE_LINKAGE_INSPECTION_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Linkage Inspection Extension Version(s) typedef enum _ze_linkage_inspection_ext_version_t { ZE_LINKAGE_INSPECTION_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_LINKAGE_INSPECTION_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_LINKAGE_INSPECTION_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_linkage_inspection_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported module linkage inspection flags typedef uint32_t ze_linkage_inspection_ext_flags_t; typedef enum _ze_linkage_inspection_ext_flag_t { ZE_LINKAGE_INSPECTION_EXT_FLAG_IMPORTS = ZE_BIT(0), ///< List all imports of modules ZE_LINKAGE_INSPECTION_EXT_FLAG_UNRESOLVABLE_IMPORTS = ZE_BIT(1), ///< List all imports of modules that do not have a corresponding export ZE_LINKAGE_INSPECTION_EXT_FLAG_EXPORTS = ZE_BIT(2), ///< List all exports of modules ZE_LINKAGE_INSPECTION_EXT_FLAG_FORCE_UINT32 = 0x7fffffff } ze_linkage_inspection_ext_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Module linkage inspection descriptor /// /// @details /// - This structure may be passed to ::zeModuleInspectLinkageExt. typedef struct _ze_linkage_inspection_ext_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_linkage_inspection_ext_flags_t flags; ///< [in] flags specifying module linkage inspection. ///< must be 0 (default) or a valid combination of ::ze_linkage_inspection_ext_flag_t. } ze_linkage_inspection_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief List Imports & Exports /// /// @details /// - List all the import & unresolveable import dependencies & exports of a /// set of modules /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pInspectDesc` /// + `nullptr == phModules` /// + `nullptr == phLog` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < pInspectDesc->flags` ZE_APIEXPORT ze_result_t ZE_APICALL zeModuleInspectLinkageExt( ze_linkage_inspection_ext_desc_t* pInspectDesc, ///< [in] pointer to linkage inspection descriptor structure. uint32_t numModules, ///< [in] number of modules to be inspected pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to be ///< inspected for import dependencies. ze_module_build_log_handle_t* phLog ///< [out] pointer to handle of linkage inspection log. Log object will ///< contain separate lists of imports, un-resolvable imports, and exports. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting memory compression hints. #if !defined(__GNUC__) #pragma region memoryCompressionHints #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MEMORY_COMPRESSION_HINTS_EXT_NAME /// @brief Memory Compression Hints Extension Name #define ZE_MEMORY_COMPRESSION_HINTS_EXT_NAME "ZE_extension_memory_compression_hints" #endif // ZE_MEMORY_COMPRESSION_HINTS_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Memory Compression Hints Extension Version(s) typedef enum _ze_memory_compression_hints_ext_version_t { ZE_MEMORY_COMPRESSION_HINTS_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_MEMORY_COMPRESSION_HINTS_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_MEMORY_COMPRESSION_HINTS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_memory_compression_hints_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported memory compression hints flags typedef uint32_t ze_memory_compression_hints_ext_flags_t; typedef enum _ze_memory_compression_hints_ext_flag_t { ZE_MEMORY_COMPRESSION_HINTS_EXT_FLAG_COMPRESSED = ZE_BIT(0), ///< Hint Driver implementation to make allocation compressible ZE_MEMORY_COMPRESSION_HINTS_EXT_FLAG_UNCOMPRESSED = ZE_BIT(1), ///< Hint Driver implementation to make allocation not compressible ZE_MEMORY_COMPRESSION_HINTS_EXT_FLAG_FORCE_UINT32 = 0x7fffffff } ze_memory_compression_hints_ext_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Compression hints memory allocation descriptor /// /// @details /// - This structure may be passed to ::zeMemAllocShared or /// ::zeMemAllocDevice, via the `pNext` member of /// ::ze_device_mem_alloc_desc_t. /// - This structure may be passed to ::zeMemAllocHost, via the `pNext` /// member of ::ze_host_mem_alloc_desc_t. /// - This structure may be passed to ::zeImageCreate, via the `pNext` /// member of ::ze_image_desc_t. typedef struct _ze_memory_compression_hints_ext_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_memory_compression_hints_ext_flags_t flags; ///< [in] flags specifying if allocation should be compressible or not. ///< Must be set to one of the ::ze_memory_compression_hints_ext_flag_t; } ze_memory_compression_hints_ext_desc_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Memory Free Policies #if !defined(__GNUC__) #pragma region memoryFreePolicies #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MEMORY_FREE_POLICIES_EXT_NAME /// @brief Memory Free Policies Extension Name #define ZE_MEMORY_FREE_POLICIES_EXT_NAME "ZE_extension_memory_free_policies" #endif // ZE_MEMORY_FREE_POLICIES_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Memory Free Policies Extension Version(s) typedef enum _ze_memory_free_policies_ext_version_t { ZE_MEMORY_FREE_POLICIES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_MEMORY_FREE_POLICIES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_MEMORY_FREE_POLICIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_memory_free_policies_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported memory free policy capability flags typedef uint32_t ze_driver_memory_free_policy_ext_flags_t; typedef enum _ze_driver_memory_free_policy_ext_flag_t { ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_BLOCKING_FREE = ZE_BIT(0), ///< blocks until all commands using the memory are complete before freeing ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_DEFER_FREE = ZE_BIT(1), ///< schedules the memory to be freed but does not free immediately ZE_DRIVER_MEMORY_FREE_POLICY_EXT_FLAG_FORCE_UINT32 = 0x7fffffff } ze_driver_memory_free_policy_ext_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Driver memory free properties queried using ::zeDriverGetProperties /// /// @details /// - All drivers must support an immediate free policy, which is the /// default free policy. /// - This structure may be returned from ::zeDriverGetProperties, via the /// `pNext` member of ::ze_driver_properties_t. typedef struct _ze_driver_memory_free_ext_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_driver_memory_free_policy_ext_flags_t freePolicies; ///< [out] Supported memory free policies. ///< must be 0 or a combination of ::ze_driver_memory_free_policy_ext_flag_t. } ze_driver_memory_free_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Memory free descriptor with free policy typedef struct _ze_memory_free_ext_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_driver_memory_free_policy_ext_flags_t freePolicy; ///< [in] flags specifying the memory free policy. ///< must be 0 (default) or a supported ::ze_driver_memory_free_policy_ext_flag_t; ///< default behavior is to free immediately. } ze_memory_free_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Frees allocated host memory, device memory, or shared memory using the /// specified free policy. /// /// @details /// - The memory free policy is specified by the memory free descriptor. /// - The application must **not** call this function from simultaneous /// threads with the same pointer. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pMemFreeDesc` /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < pMemFreeDesc->freePolicy` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemFreeExt( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_memory_free_ext_desc_t* pMemFreeDesc, ///< [in] pointer to memory free descriptor void* ptr ///< [in][release] pointer to memory to free ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Bandwidth #if !defined(__GNUC__) #pragma region bandwidth #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_BANDWIDTH_PROPERTIES_EXP_NAME /// @brief Bandwidth Extension Name #define ZE_BANDWIDTH_PROPERTIES_EXP_NAME "ZE_experimental_bandwidth_properties" #endif // ZE_BANDWIDTH_PROPERTIES_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief P2P Bandwidth Properties /// /// @details /// - This structure may be passed to ::zeDeviceGetP2PProperties by having /// the pNext member of ::ze_device_p2p_properties_t point at this struct. typedef struct _ze_device_p2p_bandwidth_exp_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t logicalBandwidth; ///< [out] total logical design bandwidth for all links connecting the two ///< devices uint32_t physicalBandwidth; ///< [out] total physical design bandwidth for all links connecting the two ///< devices ze_bandwidth_unit_t bandwidthUnit; ///< [out] bandwidth unit uint32_t logicalLatency; ///< [out] average logical design latency for all links connecting the two ///< devices uint32_t physicalLatency; ///< [out] average physical design latency for all links connecting the two ///< devices ze_latency_unit_t latencyUnit; ///< [out] latency unit } ze_device_p2p_bandwidth_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Copy Bandwidth Properties /// /// @details /// - This structure may be passed to /// ::zeDeviceGetCommandQueueGroupProperties by having the pNext member of /// ::ze_command_queue_group_properties_t point at this struct. typedef struct _ze_copy_bandwidth_exp_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t copyBandwidth; ///< [out] design bandwidth supported by this engine type for copy ///< operations ze_bandwidth_unit_t copyBandwidthUnit; ///< [out] copy bandwidth unit } ze_copy_bandwidth_exp_properties_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Device Local Identifier (LUID) #if !defined(__GNUC__) #pragma region deviceLUID #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_DEVICE_LUID_EXT_NAME /// @brief Device Local Identifier (LUID) Extension Name #define ZE_DEVICE_LUID_EXT_NAME "ZE_extension_device_luid" #endif // ZE_DEVICE_LUID_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Device Local Identifier (LUID) Extension Version(s) typedef enum _ze_device_luid_ext_version_t { ZE_DEVICE_LUID_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_DEVICE_LUID_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_DEVICE_LUID_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_device_luid_ext_version_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAX_DEVICE_LUID_SIZE_EXT /// @brief Maximum device local identifier (LUID) size in bytes #define ZE_MAX_DEVICE_LUID_SIZE_EXT 8 #endif // ZE_MAX_DEVICE_LUID_SIZE_EXT /////////////////////////////////////////////////////////////////////////////// /// @brief Device local identifier (LUID) typedef struct _ze_device_luid_ext_t { uint8_t id[ZE_MAX_DEVICE_LUID_SIZE_EXT]; ///< [out] opaque data representing a device LUID } ze_device_luid_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device LUID properties queried using ::zeDeviceGetProperties /// /// @details /// - This structure may be returned from ::zeDeviceGetProperties, via the /// `pNext` member of ::ze_device_properties_t. typedef struct _ze_device_luid_ext_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_device_luid_ext_t luid; ///< [out] locally unique identifier (LUID). ///< The returned LUID can be cast to a LUID object and must be equal to ///< the locally ///< unique identifier of an IDXGIAdapter1 object that corresponds to the device. uint32_t nodeMask; ///< [out] node mask. ///< The returned node mask must contain exactly one bit. ///< If the device is running on an operating system that supports the ///< Direct3D 12 API ///< and the device corresponds to an individual device in a linked device ///< adapter, the ///< returned node mask identifies the Direct3D 12 node corresponding to ///< the device. ///< Otherwise, the returned node mask must be 1. } ze_device_luid_ext_properties_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Fabric Topology Discovery #if !defined(__GNUC__) #pragma region fabric #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_FABRIC_EXP_NAME /// @brief Fabric Topology Discovery Extension Name #define ZE_FABRIC_EXP_NAME "ZE_experimental_fabric" #endif // ZE_FABRIC_EXP_NAME /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAX_FABRIC_EDGE_MODEL_EXP_SIZE /// @brief Maximum fabric edge model string size #define ZE_MAX_FABRIC_EDGE_MODEL_EXP_SIZE 256 #endif // ZE_MAX_FABRIC_EDGE_MODEL_EXP_SIZE /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric Vertex types typedef enum _ze_fabric_vertex_exp_type_t { ZE_FABRIC_VERTEX_EXP_TYPE_UNKNOWN = 0, ///< Fabric vertex type is unknown ZE_FABRIC_VERTEX_EXP_TYPE_DEVICE = 1, ///< Fabric vertex represents a device ZE_FABRIC_VERTEX_EXP_TYPE_SUBDEVICE = 2, ///< Fabric vertex represents a subdevice ZE_FABRIC_VERTEX_EXP_TYPE_SWITCH = 3, ///< Fabric vertex represents a switch ZE_FABRIC_VERTEX_EXP_TYPE_FORCE_UINT32 = 0x7fffffff } ze_fabric_vertex_exp_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric edge duplexity typedef enum _ze_fabric_edge_exp_duplexity_t { ZE_FABRIC_EDGE_EXP_DUPLEXITY_UNKNOWN = 0, ///< Fabric edge duplexity is unknown ZE_FABRIC_EDGE_EXP_DUPLEXITY_HALF_DUPLEX = 1, ///< Fabric edge is half duplex, i.e. stated bandwidth is obtained in only ///< one direction at time ZE_FABRIC_EDGE_EXP_DUPLEXITY_FULL_DUPLEX = 2, ///< Fabric edge is full duplex, i.e. stated bandwidth is supported in both ///< directions simultaneously ZE_FABRIC_EDGE_EXP_DUPLEXITY_FORCE_UINT32 = 0x7fffffff } ze_fabric_edge_exp_duplexity_t; /////////////////////////////////////////////////////////////////////////////// /// @brief PCI address /// /// @details /// - A PCI BDF address is the bus:device:function address of the device and /// is useful for locating the device in the PCI switch fabric. typedef struct _ze_fabric_vertex_pci_exp_address_t { uint32_t domain; ///< [out] PCI domain number uint32_t bus; ///< [out] PCI BDF bus number uint32_t device; ///< [out] PCI BDF device number uint32_t function; ///< [out] PCI BDF function number } ze_fabric_vertex_pci_exp_address_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric Vertex properties typedef struct _ze_fabric_vertex_exp_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_uuid_t uuid; ///< [out] universal unique identifier. If the vertex is co-located with a ///< device/subdevice, then this uuid will match that of the corresponding ///< device/subdevice ze_fabric_vertex_exp_type_t type; ///< [out] does the fabric vertex represent a device, subdevice, or switch? ze_bool_t remote; ///< [out] does the fabric vertex live on the local node or on a remote ///< node? ze_fabric_vertex_pci_exp_address_t address; ///< [out] B/D/F address of fabric vertex & associated device/subdevice if ///< available } ze_fabric_vertex_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric Edge properties typedef struct _ze_fabric_edge_exp_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_uuid_t uuid; ///< [out] universal unique identifier. char model[ZE_MAX_FABRIC_EDGE_MODEL_EXP_SIZE]; ///< [out] Description of fabric edge technology. Will be set to the string ///< "unkown" if this cannot be determined for this edge uint32_t bandwidth; ///< [out] design bandwidth ze_bandwidth_unit_t bandwidthUnit; ///< [out] bandwidth unit uint32_t latency; ///< [out] design latency ze_latency_unit_t latencyUnit; ///< [out] latency unit ze_fabric_edge_exp_duplexity_t duplexity; ///< [out] Duplexity of the fabric edge } ze_fabric_edge_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves fabric vertices within a driver /// /// @details /// - A fabric vertex represents either a device or a switch connected to /// other fabric vertices. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeFabricVertexGetExp( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric vertices available. ///< if count is greater than the number of fabric vertices available, then ///< the driver shall update the value with the correct number of fabric ///< vertices available. ze_fabric_vertex_handle_t* phVertices ///< [in,out][optional][range(0, *pCount)] array of handle of fabric vertices. ///< if count is less than the number of fabric vertices available, then ///< driver shall only retrieve that number of fabric vertices. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves a fabric sub-vertex from a fabric vertex /// /// @details /// - Multiple calls to this function will return identical fabric vertex /// handles, in the same order. /// - The number of handles returned from this function is affected by the /// ::ZE_AFFINITY_MASK environment variable. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVertex` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeFabricVertexGetSubVerticesExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex object uint32_t* pCount, ///< [in,out] pointer to the number of sub-vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-vertices available. ///< if count is greater than the number of sub-vertices available, then ///< the driver shall update the value with the correct number of ///< sub-vertices available. ze_fabric_vertex_handle_t* phSubvertices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-vertices. ///< if count is less than the number of sub-vertices available, then ///< driver shall only retrieve that number of sub-vertices. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves properties of the fabric vertex. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVertex` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pVertexProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeFabricVertexGetPropertiesExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_fabric_vertex_exp_properties_t* pVertexProperties ///< [in,out] query result for fabric vertex properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Returns device handle from fabric vertex handle. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVertex` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phDevice` /// - ::ZE_RESULT_EXP_ERROR_VERTEX_IS_NOT_DEVICE /// + Provided fabric vertex handle does not correspond to a device or subdevice. /// - ::ZE_RESULT_EXP_ERROR_REMOTE_DEVICE /// + Provided fabric vertex handle corresponds to remote device or subdevice. ZE_APIEXPORT ze_result_t ZE_APICALL zeFabricVertexGetDeviceExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_device_handle_t* phDevice ///< [out] device handle corresponding to fabric vertex ); /////////////////////////////////////////////////////////////////////////////// /// @brief Returns fabric vertex handle from device handle. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phVertex` /// - ::ZE_RESULT_EXP_ERROR_DEVICE_IS_NOT_VERTEX /// + Provided device handle does not correspond to a fabric vertex. ZE_APIEXPORT ze_result_t ZE_APICALL zeDeviceGetFabricVertexExp( ze_device_handle_t hDevice, ///< [in] handle of the device ze_fabric_vertex_handle_t* phVertex ///< [out] fabric vertex handle corresponding to device ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves all fabric edges between provided pair of fabric vertices /// /// @details /// - A fabric edge represents one or more physical links between two fabric /// vertices. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVertexA` /// + `nullptr == hVertexB` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeFabricEdgeGetExp( ze_fabric_vertex_handle_t hVertexA, ///< [in] handle of first fabric vertex instance ze_fabric_vertex_handle_t hVertexB, ///< [in] handle of second fabric vertex instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric edges. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric edges available. ///< if count is greater than the number of fabric edges available, then ///< the driver shall update the value with the correct number of fabric ///< edges available. ze_fabric_edge_handle_t* phEdges ///< [in,out][optional][range(0, *pCount)] array of handle of fabric edges. ///< if count is less than the number of fabric edges available, then ///< driver shall only retrieve that number of fabric edges. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves fabric vertices connected by a fabric edge /// /// @details /// - A fabric vertex represents either a device or a switch connected to /// other fabric vertices via a fabric edge. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEdge` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phVertexA` /// + `nullptr == phVertexB` ZE_APIEXPORT ze_result_t ZE_APICALL zeFabricEdgeGetVerticesExp( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge instance ze_fabric_vertex_handle_t* phVertexA, ///< [out] fabric vertex connected to one end of the given fabric edge. ze_fabric_vertex_handle_t* phVertexB ///< [out] fabric vertex connected to other end of the given fabric edge. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves properties of the fabric edge. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEdge` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pEdgeProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeFabricEdgeGetPropertiesExp( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge ze_fabric_edge_exp_properties_t* pEdgeProperties ///< [in,out] query result for fabric edge properties ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Device Memory Properties #if !defined(__GNUC__) #pragma region memoryProperties #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_DEVICE_MEMORY_PROPERTIES_EXT_NAME /// @brief Device Memory Properties Extension Name #define ZE_DEVICE_MEMORY_PROPERTIES_EXT_NAME "ZE_extension_device_memory_properties" #endif // ZE_DEVICE_MEMORY_PROPERTIES_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Device Memory Properties Extension Version(s) typedef enum _ze_device_memory_properties_ext_version_t { ZE_DEVICE_MEMORY_PROPERTIES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_DEVICE_MEMORY_PROPERTIES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_DEVICE_MEMORY_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_device_memory_properties_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Memory module types typedef enum _ze_device_memory_ext_type_t { ZE_DEVICE_MEMORY_EXT_TYPE_HBM = 0, ///< HBM memory ZE_DEVICE_MEMORY_EXT_TYPE_HBM2 = 1, ///< HBM2 memory ZE_DEVICE_MEMORY_EXT_TYPE_DDR = 2, ///< DDR memory ZE_DEVICE_MEMORY_EXT_TYPE_DDR2 = 3, ///< DDR2 memory ZE_DEVICE_MEMORY_EXT_TYPE_DDR3 = 4, ///< DDR3 memory ZE_DEVICE_MEMORY_EXT_TYPE_DDR4 = 5, ///< DDR4 memory ZE_DEVICE_MEMORY_EXT_TYPE_DDR5 = 6, ///< DDR5 memory ZE_DEVICE_MEMORY_EXT_TYPE_LPDDR = 7, ///< LPDDR memory ZE_DEVICE_MEMORY_EXT_TYPE_LPDDR3 = 8, ///< LPDDR3 memory ZE_DEVICE_MEMORY_EXT_TYPE_LPDDR4 = 9, ///< LPDDR4 memory ZE_DEVICE_MEMORY_EXT_TYPE_LPDDR5 = 10, ///< LPDDR5 memory ZE_DEVICE_MEMORY_EXT_TYPE_SRAM = 11, ///< SRAM memory ZE_DEVICE_MEMORY_EXT_TYPE_L1 = 12, ///< L1 cache ZE_DEVICE_MEMORY_EXT_TYPE_L3 = 13, ///< L3 cache ZE_DEVICE_MEMORY_EXT_TYPE_GRF = 14, ///< Execution unit register file ZE_DEVICE_MEMORY_EXT_TYPE_SLM = 15, ///< Execution unit shared local memory ZE_DEVICE_MEMORY_EXT_TYPE_GDDR4 = 16, ///< GDDR4 memory ZE_DEVICE_MEMORY_EXT_TYPE_GDDR5 = 17, ///< GDDR5 memory ZE_DEVICE_MEMORY_EXT_TYPE_GDDR5X = 18, ///< GDDR5X memory ZE_DEVICE_MEMORY_EXT_TYPE_GDDR6 = 19, ///< GDDR6 memory ZE_DEVICE_MEMORY_EXT_TYPE_GDDR6X = 20, ///< GDDR6X memory ZE_DEVICE_MEMORY_EXT_TYPE_GDDR7 = 21, ///< GDDR7 memory ZE_DEVICE_MEMORY_EXT_TYPE_FORCE_UINT32 = 0x7fffffff } ze_device_memory_ext_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Memory properties /// /// @details /// - This structure may be returned from ::zeDeviceGetMemoryProperties via /// the `pNext` member of ::ze_device_memory_properties_t typedef struct _ze_device_memory_ext_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_device_memory_ext_type_t type; ///< [out] The memory type uint64_t physicalSize; ///< [out] Physical memory size in bytes. A value of 0 indicates that this ///< property is not known. However, a call to ::zesMemoryGetState() will ///< correctly return the total size of usable memory. uint32_t readBandwidth; ///< [out] Design bandwidth for reads uint32_t writeBandwidth; ///< [out] Design bandwidth for writes ze_bandwidth_unit_t bandwidthUnit; ///< [out] bandwidth unit } ze_device_memory_ext_properties_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Bfloat16 Conversions #if !defined(__GNUC__) #pragma region bfloat16conversions #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_BFLOAT16_CONVERSIONS_EXT_NAME /// @brief Bfloat16 Conversions Extension Name #define ZE_BFLOAT16_CONVERSIONS_EXT_NAME "ZE_extension_bfloat16_conversions" #endif // ZE_BFLOAT16_CONVERSIONS_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Bfloat16 Conversions Extension Version(s) typedef enum _ze_bfloat16_conversions_ext_version_t { ZE_BFLOAT16_CONVERSIONS_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_BFLOAT16_CONVERSIONS_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_BFLOAT16_CONVERSIONS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_bfloat16_conversions_ext_version_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Device IP Version #if !defined(__GNUC__) #pragma region deviceipversion #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_DEVICE_IP_VERSION_EXT_NAME /// @brief Device IP Version Extension Name #define ZE_DEVICE_IP_VERSION_EXT_NAME "ZE_extension_device_ip_version" #endif // ZE_DEVICE_IP_VERSION_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Device IP Version Extension Version(s) typedef enum _ze_device_ip_version_version_t { ZE_DEVICE_IP_VERSION_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_DEVICE_IP_VERSION_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_DEVICE_IP_VERSION_VERSION_FORCE_UINT32 = 0x7fffffff } ze_device_ip_version_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device IP version queried using ::zeDeviceGetProperties /// /// @details /// - This structure may be returned from ::zeDeviceGetProperties via the /// `pNext` member of ::ze_device_properties_t typedef struct _ze_device_ip_version_ext_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t ipVersion; ///< [out] Device IP version. The meaning of the device IP version is ///< implementation-defined, but newer devices should have a higher ///< version than older devices. } ze_device_ip_version_ext_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for querying kernel max group size properties. #if !defined(__GNUC__) #pragma region kernelMaxGroupSizeProperties #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_NAME /// @brief Kernel Max Group Size Properties Extension Name #define ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_NAME "ZE_extension_kernel_max_group_size_properties" #endif // ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Kernel Max Group Size Properties Extension Version(s) typedef enum _ze_kernel_max_group_size_properties_ext_version_t { ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_KERNEL_MAX_GROUP_SIZE_PROPERTIES_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_kernel_max_group_size_properties_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Additional kernel max group size properties /// /// @details /// - This structure may be passed to ::zeKernelGetProperties, via the /// `pNext` member of ::ze_kernel_properties_t, to query additional kernel /// max group size properties. typedef struct _ze_kernel_max_group_size_properties_ext_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t maxGroupSize; ///< [out] maximum group size that can be used to execute the kernel. This ///< value may be less than or equal to the `maxTotalGroupSize` member of ///< ::ze_device_compute_properties_t. } ze_kernel_max_group_size_properties_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief compiler-independent type typedef ze_kernel_max_group_size_properties_ext_t ze_kernel_max_group_size_ext_properties_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for querying sub-allocations properties. #if !defined(__GNUC__) #pragma region subAllocationsProperties #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_SUB_ALLOCATIONS_EXP_NAME /// @brief Sub-Allocations Properties Extension Name #define ZE_SUB_ALLOCATIONS_EXP_NAME "ZE_experimental_sub_allocations" #endif // ZE_SUB_ALLOCATIONS_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Sub-Allocations Properties Extension Version(s) typedef enum _ze_sub_allocations_exp_version_t { ZE_SUB_ALLOCATIONS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_SUB_ALLOCATIONS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_SUB_ALLOCATIONS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_sub_allocations_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Properties returned for a sub-allocation typedef struct _ze_sub_allocation_t { void* base; ///< [in,out][optional] base address of the sub-allocation size_t size; ///< [in,out][optional] size of the allocation } ze_sub_allocation_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Sub-Allocations Properties /// /// @details /// - This structure may be passed to ::zeMemGetAllocProperties, via the /// `pNext` member of ::ze_memory_allocation_properties_t. typedef struct _ze_memory_sub_allocations_exp_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t* pCount; ///< [in,out] pointer to the number of sub-allocations. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-allocations on which the allocation has been divided. ///< if count is greater than the number of sub-allocations, then the ///< driver shall update the value with the correct number of sub-allocations. ze_sub_allocation_t* pSubAllocations; ///< [in,out][optional][range(0, *pCount)] array of properties for sub-allocations. ///< if count is less than the number of sub-allocations available, then ///< driver shall only retrieve properties for that number of sub-allocations. } ze_memory_sub_allocations_exp_properties_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting the querying of synchronized event timestamps. #if !defined(__GNUC__) #pragma region eventQueryKernelTimestamps #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_NAME /// @brief Event Query Kernel Timestamps Extension Name #define ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_NAME "ZE_extension_event_query_kernel_timestamps" #endif // ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Event Query Kernel Timestamps Extension Version(s) typedef enum _ze_event_query_kernel_timestamps_ext_version_t { ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } ze_event_query_kernel_timestamps_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Event query kernel timestamps flags typedef uint32_t ze_event_query_kernel_timestamps_ext_flags_t; typedef enum _ze_event_query_kernel_timestamps_ext_flag_t { ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_FLAG_KERNEL = ZE_BIT(0), ///< Kernel timestamp results ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_FLAG_SYNCHRONIZED = ZE_BIT(1), ///< Device event timestamps synchronized to the host time domain ZE_EVENT_QUERY_KERNEL_TIMESTAMPS_EXT_FLAG_FORCE_UINT32 = 0x7fffffff } ze_event_query_kernel_timestamps_ext_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Event query kernel timestamps properties /// /// @details /// - This structure may be returned from ::zeDeviceGetProperties, via the /// `pNext` member of ::ze_device_properties_t. typedef struct _ze_event_query_kernel_timestamps_ext_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_event_query_kernel_timestamps_ext_flags_t flags; ///< [out] 0 or some combination of ///< ::ze_event_query_kernel_timestamps_ext_flag_t flags } ze_event_query_kernel_timestamps_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Kernel timestamp clock data synchronized to the host time domain typedef struct _ze_synchronized_timestamp_data_ext_t { uint64_t kernelStart; ///< [out] synchronized clock at start of kernel execution uint64_t kernelEnd; ///< [out] synchronized clock at end of kernel execution } ze_synchronized_timestamp_data_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Synchronized kernel timestamp result typedef struct _ze_synchronized_timestamp_result_ext_t { ze_synchronized_timestamp_data_ext_t global; ///< [out] wall-clock data ze_synchronized_timestamp_data_ext_t context; ///< [out] context-active data; only includes clocks while device context ///< was actively executing. } ze_synchronized_timestamp_result_ext_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Event query kernel timestamps results properties typedef struct _ze_event_query_kernel_timestamps_results_ext_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_kernel_timestamp_result_t* pKernelTimestampsBuffer; ///< [in,out][optional][range(0, *pCount)] pointer to destination buffer of ///< kernel timestamp results ze_synchronized_timestamp_result_ext_t* pSynchronizedTimestampsBuffer; ///< [in,out][optional][range(0, *pCount)] pointer to destination buffer of ///< synchronized timestamp results } ze_event_query_kernel_timestamps_results_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Query an event's timestamp value on the host, with domain preference. /// /// @details /// - For collecting *only* kernel timestamps, the application must ensure /// the event was created from an event pool that was created using /// ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag. /// - For collecting synchronized timestamps, the application must ensure /// the event was created from an event pool that was created using /// ::ZE_EVENT_POOL_FLAG_KERNEL_MAPPED_TIMESTAMP flag. Kernel timestamps /// are also available from this type of event pool, but there is a /// performance cost. /// - The destination memory will be unmodified if the event has not been /// signaled. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support /// ::ZE_extension_event_query_kernel_timestamps. /// - The implementation must return all timestamps for the specified event /// and device pair. /// - The implementation must return all timestamps for all sub-devices when /// device handle is parent device. /// - The implementation may return all timestamps for sub-devices when /// device handle is sub-device or may return 0 for count. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zeEventQueryKernelTimestampsExt( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of event packets available. ///< - This value is implementation specific. ///< - if `*pCount` is zero, then the driver shall update the value with ///< the total number of event packets available. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver shall update the value with the correct value. ///< - Buffer(s) for query results must be sized by the application to ///< accommodate a minimum of `*pCount` elements. ze_event_query_kernel_timestamps_results_ext_properties_t* pResults ///< [in,out][optional][range(0, *pCount)] pointer to event query ///< properties structure(s). ///< - This parameter may be null when `*pCount` is zero. ///< - if `*pCount` is less than the number of event packets available, ///< the driver may only update `*pCount` elements, starting at element zero. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver may only update the valid elements. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting ray tracing acceleration structure builder. #if !defined(__GNUC__) #pragma region RTASBuilder #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_RTAS_BUILDER_EXP_NAME /// @brief Ray Tracing Acceleration Structure Builder Extension Name #define ZE_RTAS_BUILDER_EXP_NAME "ZE_experimental_rtas_builder" #endif // ZE_RTAS_BUILDER_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Ray Tracing Acceleration Structure Builder Extension Version(s) typedef enum _ze_rtas_builder_exp_version_t { ZE_RTAS_BUILDER_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_RTAS_BUILDER_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_RTAS_BUILDER_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_rtas_builder_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure device flags typedef uint32_t ze_rtas_device_exp_flags_t; typedef enum _ze_rtas_device_exp_flag_t { ZE_RTAS_DEVICE_EXP_FLAG_RESERVED = ZE_BIT(0), ///< reserved for future use ZE_RTAS_DEVICE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_rtas_device_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure format /// /// @details /// - This is an opaque ray tracing acceleration structure format /// identifier. typedef enum _ze_rtas_format_exp_t { ZE_RTAS_FORMAT_EXP_INVALID = 0, ///< Invalid acceleration structure format ZE_RTAS_FORMAT_EXP_FORCE_UINT32 = 0x7fffffff } ze_rtas_format_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder flags typedef uint32_t ze_rtas_builder_exp_flags_t; typedef enum _ze_rtas_builder_exp_flag_t { ZE_RTAS_BUILDER_EXP_FLAG_RESERVED = ZE_BIT(0), ///< Reserved for future use ZE_RTAS_BUILDER_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_rtas_builder_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder parallel operation flags typedef uint32_t ze_rtas_parallel_operation_exp_flags_t; typedef enum _ze_rtas_parallel_operation_exp_flag_t { ZE_RTAS_PARALLEL_OPERATION_EXP_FLAG_RESERVED = ZE_BIT(0), ///< Reserved for future use ZE_RTAS_PARALLEL_OPERATION_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_rtas_parallel_operation_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder geometry flags typedef uint32_t ze_rtas_builder_geometry_exp_flags_t; typedef enum _ze_rtas_builder_geometry_exp_flag_t { ZE_RTAS_BUILDER_GEOMETRY_EXP_FLAG_NON_OPAQUE = ZE_BIT(0), ///< non-opaque geometries invoke an any-hit shader ZE_RTAS_BUILDER_GEOMETRY_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_rtas_builder_geometry_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Packed ray tracing acceleration structure builder geometry flags (see /// ::ze_rtas_builder_geometry_exp_flags_t) typedef uint8_t ze_rtas_builder_packed_geometry_exp_flags_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder instance flags typedef uint32_t ze_rtas_builder_instance_exp_flags_t; typedef enum _ze_rtas_builder_instance_exp_flag_t { ZE_RTAS_BUILDER_INSTANCE_EXP_FLAG_TRIANGLE_CULL_DISABLE = ZE_BIT(0), ///< disables culling of front-facing and back-facing triangles ZE_RTAS_BUILDER_INSTANCE_EXP_FLAG_TRIANGLE_FRONT_COUNTERCLOCKWISE = ZE_BIT(1), ///< reverses front and back face of triangles ZE_RTAS_BUILDER_INSTANCE_EXP_FLAG_TRIANGLE_FORCE_OPAQUE = ZE_BIT(2), ///< forces instanced geometry to be opaque, unless ray flag forces it to ///< be non-opaque ZE_RTAS_BUILDER_INSTANCE_EXP_FLAG_TRIANGLE_FORCE_NON_OPAQUE = ZE_BIT(3),///< forces instanced geometry to be non-opaque, unless ray flag forces it ///< to be opaque ZE_RTAS_BUILDER_INSTANCE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_rtas_builder_instance_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Packed ray tracing acceleration structure builder instance flags (see /// ::ze_rtas_builder_instance_exp_flags_t) typedef uint8_t ze_rtas_builder_packed_instance_exp_flags_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder build operation flags /// /// @details /// - These flags allow the application to tune the acceleration structure /// build operation. /// - The acceleration structure builder implementation might choose to use /// spatial splitting to split large or long primitives into smaller /// pieces. This may result in any-hit shaders being invoked multiple /// times for non-opaque primitives, unless /// ::ZE_RTAS_BUILDER_BUILD_OP_EXP_FLAG_NO_DUPLICATE_ANYHIT_INVOCATION is specified. /// - Usage of any of these flags may reduce ray tracing performance. typedef uint32_t ze_rtas_builder_build_op_exp_flags_t; typedef enum _ze_rtas_builder_build_op_exp_flag_t { ZE_RTAS_BUILDER_BUILD_OP_EXP_FLAG_COMPACT = ZE_BIT(0), ///< build more compact acceleration structure ZE_RTAS_BUILDER_BUILD_OP_EXP_FLAG_NO_DUPLICATE_ANYHIT_INVOCATION = ZE_BIT(1), ///< guarantees single any-hit shader invocation per primitive ZE_RTAS_BUILDER_BUILD_OP_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_rtas_builder_build_op_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder build quality hint /// /// @details /// - Depending on use case different quality modes for acceleration /// structure build are supported. /// - A low-quality build builds an acceleration structure fast, but at the /// cost of some reduction in ray tracing performance. This mode is /// recommended for dynamic content, such as animated characters. /// - A medium-quality build uses a compromise between build quality and ray /// tracing performance. This mode should be used by default. /// - Higher ray tracing performance can be achieved by using a high-quality /// build, but acceleration structure build performance might be /// significantly reduced. typedef enum _ze_rtas_builder_build_quality_hint_exp_t { ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_LOW = 0, ///< build low-quality acceleration structure (fast) ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_MEDIUM = 1, ///< build medium-quality acceleration structure (slower) ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH = 2, ///< build high-quality acceleration structure (slow) ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_FORCE_UINT32 = 0x7fffffff } ze_rtas_builder_build_quality_hint_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder geometry type typedef enum _ze_rtas_builder_geometry_type_exp_t { ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_TRIANGLES = 0, ///< triangle mesh geometry type ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_QUADS = 1, ///< quad mesh geometry type ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_PROCEDURAL = 2, ///< procedural geometry type ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_INSTANCE = 3, ///< instance geometry type ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_FORCE_UINT32 = 0x7fffffff } ze_rtas_builder_geometry_type_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Packed ray tracing acceleration structure builder geometry type (see /// ::ze_rtas_builder_geometry_type_exp_t) typedef uint8_t ze_rtas_builder_packed_geometry_type_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure data buffer element format /// /// @details /// - Specifies the format of data buffer elements. /// - Data buffers may contain instancing transform matrices, triangle/quad /// vertex indices, etc... typedef enum _ze_rtas_builder_input_data_format_exp_t { ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_FLOAT3 = 0, ///< 3-component float vector (see ::ze_rtas_float3_exp_t) ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_FLOAT3X4_COLUMN_MAJOR = 1, ///< 3x4 affine transformation in column-major format (see ///< ::ze_rtas_transform_float3x4_column_major_exp_t) ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_FLOAT3X4_ALIGNED_COLUMN_MAJOR = 2,///< 3x4 affine transformation in column-major format (see ///< ::ze_rtas_transform_float3x4_aligned_column_major_exp_t) ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_FLOAT3X4_ROW_MAJOR = 3, ///< 3x4 affine transformation in row-major format (see ///< ::ze_rtas_transform_float3x4_row_major_exp_t) ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_AABB = 4, ///< 3-dimensional axis-aligned bounding-box (see ::ze_rtas_aabb_exp_t) ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_TRIANGLE_INDICES_UINT32 = 5, ///< Unsigned 32-bit triangle indices (see ///< ::ze_rtas_triangle_indices_uint32_exp_t) ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_QUAD_INDICES_UINT32 = 6, ///< Unsigned 32-bit quad indices (see ::ze_rtas_quad_indices_uint32_exp_t) ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_FORCE_UINT32 = 0x7fffffff } ze_rtas_builder_input_data_format_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Packed ray tracing acceleration structure data buffer element format /// (see ::ze_rtas_builder_input_data_format_exp_t) typedef uint8_t ze_rtas_builder_packed_input_data_format_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of ray tracing acceleration structure builder object typedef struct _ze_rtas_builder_exp_handle_t *ze_rtas_builder_exp_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of ray tracing acceleration structure builder parallel /// operation object typedef struct _ze_rtas_parallel_operation_exp_handle_t *ze_rtas_parallel_operation_exp_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder descriptor typedef struct _ze_rtas_builder_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_rtas_builder_exp_version_t builderVersion; ///< [in] ray tracing acceleration structure builder version } ze_rtas_builder_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder properties typedef struct _ze_rtas_builder_exp_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_rtas_builder_exp_flags_t flags; ///< [out] ray tracing acceleration structure builder flags size_t rtasBufferSizeBytesExpected; ///< [out] expected size (in bytes) required for acceleration structure buffer ///< - When using an acceleration structure buffer of this size, the ///< build is expected to succeed; however, it is possible that the build ///< may fail with ::ZE_RESULT_EXP_RTAS_BUILD_RETRY size_t rtasBufferSizeBytesMaxRequired; ///< [out] worst-case size (in bytes) required for acceleration structure buffer ///< - When using an acceleration structure buffer of this size, the ///< build is guaranteed to not run out of memory. size_t scratchBufferSizeBytes; ///< [out] scratch buffer size (in bytes) required for acceleration ///< structure build. } ze_rtas_builder_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder parallel operation /// properties typedef struct _ze_rtas_parallel_operation_exp_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_rtas_parallel_operation_exp_flags_t flags; ///< [out] ray tracing acceleration structure builder parallel operation ///< flags uint32_t maxConcurrency; ///< [out] maximum number of threads that may join the parallel operation } ze_rtas_parallel_operation_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure device properties /// /// @details /// - This structure may be passed to ::zeDeviceGetProperties, via `pNext` /// member of ::ze_device_properties_t. /// - The implementation shall populate `format` with a value other than /// ::ZE_RTAS_FORMAT_EXP_INVALID when the device supports ray tracing. typedef struct _ze_rtas_device_exp_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_rtas_device_exp_flags_t flags; ///< [out] ray tracing acceleration structure device flags ze_rtas_format_exp_t rtasFormat; ///< [out] ray tracing acceleration structure format uint32_t rtasBufferAlignment; ///< [out] required alignment of acceleration structure buffer } ze_rtas_device_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief A 3-component vector type typedef struct _ze_rtas_float3_exp_t { float x; ///< [in] x-coordinate of float3 vector float y; ///< [in] y-coordinate of float3 vector float z; ///< [in] z-coordinate of float3 vector } ze_rtas_float3_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief 3x4 affine transformation in column-major layout /// /// @details /// - A 3x4 affine transformation in column major layout, consisting of vectors /// - vx=(vx_x, vx_y, vx_z), /// - vy=(vy_x, vy_y, vy_z), /// - vz=(vz_x, vz_y, vz_z), and /// - p=(p_x, p_y, p_z) /// - The transformation transforms a point (x, y, z) to: `x*vx + y*vy + /// z*vz + p`. typedef struct _ze_rtas_transform_float3x4_column_major_exp_t { float vx_x; ///< [in] element 0 of column 0 of 3x4 matrix float vx_y; ///< [in] element 1 of column 0 of 3x4 matrix float vx_z; ///< [in] element 2 of column 0 of 3x4 matrix float vy_x; ///< [in] element 0 of column 1 of 3x4 matrix float vy_y; ///< [in] element 1 of column 1 of 3x4 matrix float vy_z; ///< [in] element 2 of column 1 of 3x4 matrix float vz_x; ///< [in] element 0 of column 2 of 3x4 matrix float vz_y; ///< [in] element 1 of column 2 of 3x4 matrix float vz_z; ///< [in] element 2 of column 2 of 3x4 matrix float p_x; ///< [in] element 0 of column 3 of 3x4 matrix float p_y; ///< [in] element 1 of column 3 of 3x4 matrix float p_z; ///< [in] element 2 of column 3 of 3x4 matrix } ze_rtas_transform_float3x4_column_major_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief 3x4 affine transformation in column-major layout with aligned column /// vectors /// /// @details /// - A 3x4 affine transformation in column major layout, consisting of vectors /// - vx=(vx_x, vx_y, vx_z), /// - vy=(vy_x, vy_y, vy_z), /// - vz=(vz_x, vz_y, vz_z), and /// - p=(p_x, p_y, p_z) /// - The transformation transforms a point (x, y, z) to: `x*vx + y*vy + /// z*vz + p`. /// - The column vectors are aligned to 16-bytes and pad members are /// ignored. typedef struct _ze_rtas_transform_float3x4_aligned_column_major_exp_t { float vx_x; ///< [in] element 0 of column 0 of 3x4 matrix float vx_y; ///< [in] element 1 of column 0 of 3x4 matrix float vx_z; ///< [in] element 2 of column 0 of 3x4 matrix float pad0; ///< [in] ignored padding float vy_x; ///< [in] element 0 of column 1 of 3x4 matrix float vy_y; ///< [in] element 1 of column 1 of 3x4 matrix float vy_z; ///< [in] element 2 of column 1 of 3x4 matrix float pad1; ///< [in] ignored padding float vz_x; ///< [in] element 0 of column 2 of 3x4 matrix float vz_y; ///< [in] element 1 of column 2 of 3x4 matrix float vz_z; ///< [in] element 2 of column 2 of 3x4 matrix float pad2; ///< [in] ignored padding float p_x; ///< [in] element 0 of column 3 of 3x4 matrix float p_y; ///< [in] element 1 of column 3 of 3x4 matrix float p_z; ///< [in] element 2 of column 3 of 3x4 matrix float pad3; ///< [in] ignored padding } ze_rtas_transform_float3x4_aligned_column_major_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief 3x4 affine transformation in row-major layout /// /// @details /// - A 3x4 affine transformation in row-major layout, consisting of vectors /// - vx=(vx_x, vx_y, vx_z), /// - vy=(vy_x, vy_y, vy_z), /// - vz=(vz_x, vz_y, vz_z), and /// - p=(p_x, p_y, p_z) /// - The transformation transforms a point (x, y, z) to: `x*vx + y*vy + /// z*vz + p`. typedef struct _ze_rtas_transform_float3x4_row_major_exp_t { float vx_x; ///< [in] element 0 of row 0 of 3x4 matrix float vy_x; ///< [in] element 1 of row 0 of 3x4 matrix float vz_x; ///< [in] element 2 of row 0 of 3x4 matrix float p_x; ///< [in] element 3 of row 0 of 3x4 matrix float vx_y; ///< [in] element 0 of row 1 of 3x4 matrix float vy_y; ///< [in] element 1 of row 1 of 3x4 matrix float vz_y; ///< [in] element 2 of row 1 of 3x4 matrix float p_y; ///< [in] element 3 of row 1 of 3x4 matrix float vx_z; ///< [in] element 0 of row 2 of 3x4 matrix float vy_z; ///< [in] element 1 of row 2 of 3x4 matrix float vz_z; ///< [in] element 2 of row 2 of 3x4 matrix float p_z; ///< [in] element 3 of row 2 of 3x4 matrix } ze_rtas_transform_float3x4_row_major_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief A 3-dimensional axis-aligned bounding-box with lower and upper bounds /// in each dimension typedef struct _ze_rtas_aabb_exp_t { ze_rtas_float3_exp_t lower; ///< [in] lower bounds of AABB ze_rtas_float3_exp_t upper; ///< [in] upper bounds of AABB } ze_rtas_aabb_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Triangle represented using 3 vertex indices /// /// @details /// - Represents a triangle using 3 vertex indices that index into a vertex /// array that needs to be provided together with the index array. /// - The linear barycentric u/v parametrization of the triangle is defined as: /// - (u=0, v=0) at v0, /// - (u=1, v=0) at v1, and /// - (u=0, v=1) at v2 typedef struct _ze_rtas_triangle_indices_uint32_exp_t { uint32_t v0; ///< [in] first index pointing to the first triangle vertex in vertex array uint32_t v1; ///< [in] second index pointing to the second triangle vertex in vertex ///< array uint32_t v2; ///< [in] third index pointing to the third triangle vertex in vertex array } ze_rtas_triangle_indices_uint32_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Quad represented using 4 vertex indices /// /// @details /// - Represents a quad composed of 4 indices that index into a vertex array /// that needs to be provided together with the index array. /// - A quad is a triangle pair represented using 4 vertex indices v0, v1, /// v2, v3. /// The first triangle is made out of indices v0, v1, v3 and the second triangle /// from indices v2, v3, v1. The piecewise linear barycentric u/v parametrization /// of the quad is defined as: /// - (u=0, v=0) at v0, /// - (u=1, v=0) at v1, /// - (u=0, v=1) at v3, and /// - (u=1, v=1) at v2 /// This is achieved by correcting the u'/v' coordinates of the second /// triangle by /// *u = 1-u'* and *v = 1-v'*, yielding a piecewise linear parametrization. typedef struct _ze_rtas_quad_indices_uint32_exp_t { uint32_t v0; ///< [in] first index pointing to the first quad vertex in vertex array uint32_t v1; ///< [in] second index pointing to the second quad vertex in vertex array uint32_t v2; ///< [in] third index pointing to the third quad vertex in vertex array uint32_t v3; ///< [in] fourth index pointing to the fourth quad vertex in vertex array } ze_rtas_quad_indices_uint32_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder geometry info typedef struct _ze_rtas_builder_geometry_info_exp_t { ze_rtas_builder_packed_geometry_type_exp_t geometryType; ///< [in] geometry type } ze_rtas_builder_geometry_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder triangle mesh geometry info /// /// @details /// - The linear barycentric u/v parametrization of the triangle is defined as: /// - (u=0, v=0) at v0, /// - (u=1, v=0) at v1, and /// - (u=0, v=1) at v2 typedef struct _ze_rtas_builder_triangles_geometry_info_exp_t { ze_rtas_builder_packed_geometry_type_exp_t geometryType; ///< [in] geometry type, must be ///< ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_TRIANGLES ze_rtas_builder_packed_geometry_exp_flags_t geometryFlags; ///< [in] 0 or some combination of ::ze_rtas_builder_geometry_exp_flag_t ///< bits representing the geometry flags for all primitives of this ///< geometry uint8_t geometryMask; ///< [in] 8-bit geometry mask for ray masking ze_rtas_builder_packed_input_data_format_exp_t triangleFormat; ///< [in] format of triangle buffer data, must be ///< ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_TRIANGLE_INDICES_UINT32 ze_rtas_builder_packed_input_data_format_exp_t vertexFormat; ///< [in] format of vertex buffer data, must be ///< ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_FLOAT3 uint32_t triangleCount; ///< [in] number of triangles in triangle buffer uint32_t vertexCount; ///< [in] number of vertices in vertex buffer uint32_t triangleStride; ///< [in] stride (in bytes) of triangles in triangle buffer uint32_t vertexStride; ///< [in] stride (in bytes) of vertices in vertex buffer void* pTriangleBuffer; ///< [in] pointer to array of triangle indices in specified format void* pVertexBuffer; ///< [in] pointer to array of triangle vertices in specified format } ze_rtas_builder_triangles_geometry_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder quad mesh geometry info /// /// @details /// - A quad is a triangle pair represented using 4 vertex indices v0, v1, /// v2, v3. /// The first triangle is made out of indices v0, v1, v3 and the second triangle /// from indices v2, v3, v1. The piecewise linear barycentric u/v parametrization /// of the quad is defined as: /// - (u=0, v=0) at v0, /// - (u=1, v=0) at v1, /// - (u=0, v=1) at v3, and /// - (u=1, v=1) at v2 /// This is achieved by correcting the u'/v' coordinates of the second /// triangle by /// *u = 1-u'* and *v = 1-v'*, yielding a piecewise linear parametrization. typedef struct _ze_rtas_builder_quads_geometry_info_exp_t { ze_rtas_builder_packed_geometry_type_exp_t geometryType; ///< [in] geometry type, must be ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_QUADS ze_rtas_builder_packed_geometry_exp_flags_t geometryFlags; ///< [in] 0 or some combination of ::ze_rtas_builder_geometry_exp_flag_t ///< bits representing the geometry flags for all primitives of this ///< geometry uint8_t geometryMask; ///< [in] 8-bit geometry mask for ray masking ze_rtas_builder_packed_input_data_format_exp_t quadFormat; ///< [in] format of quad buffer data, must be ///< ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_QUAD_INDICES_UINT32 ze_rtas_builder_packed_input_data_format_exp_t vertexFormat; ///< [in] format of vertex buffer data, must be ///< ::ZE_RTAS_BUILDER_INPUT_DATA_FORMAT_EXP_FLOAT3 uint32_t quadCount; ///< [in] number of quads in quad buffer uint32_t vertexCount; ///< [in] number of vertices in vertex buffer uint32_t quadStride; ///< [in] stride (in bytes) of quads in quad buffer uint32_t vertexStride; ///< [in] stride (in bytes) of vertices in vertex buffer void* pQuadBuffer; ///< [in] pointer to array of quad indices in specified format void* pVertexBuffer; ///< [in] pointer to array of quad vertices in specified format } ze_rtas_builder_quads_geometry_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief AABB callback function parameters typedef struct _ze_rtas_geometry_aabbs_exp_cb_params_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t primID; ///< [in] first primitive to return bounds for uint32_t primIDCount; ///< [in] number of primitives to return bounds for void* pGeomUserPtr; ///< [in] pointer provided through geometry descriptor void* pBuildUserPtr; ///< [in] pointer provided through ::zeRTASBuilderBuildExp function ze_rtas_aabb_exp_t* pBoundsOut; ///< [out] destination buffer to write AABB bounds to } ze_rtas_geometry_aabbs_exp_cb_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function pointer type to return AABBs for a range of /// procedural primitives typedef void (*ze_rtas_geometry_aabbs_cb_exp_t)( ze_rtas_geometry_aabbs_exp_cb_params_t* params ///< [in] callback function parameters structure ); /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder procedural primitives /// geometry info /// /// @details /// - A host-side bounds callback function is invoked by the acceleration /// structure builder to query the bounds of procedural primitives on /// demand. The callback is passed some `pGeomUserPtr` that can point to /// an application-side representation of the procedural primitives. /// Further, a second `pBuildUserPtr`, which is set by a parameter to /// ::zeRTASBuilderBuildExp, is passed to the callback. This allows the /// build to change the bounds of the procedural geometry, for example, to /// build a BVH only over a short time range to implement multi-segment /// motion blur. typedef struct _ze_rtas_builder_procedural_geometry_info_exp_t { ze_rtas_builder_packed_geometry_type_exp_t geometryType; ///< [in] geometry type, must be ///< ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_PROCEDURAL ze_rtas_builder_packed_geometry_exp_flags_t geometryFlags; ///< [in] 0 or some combination of ::ze_rtas_builder_geometry_exp_flag_t ///< bits representing the geometry flags for all primitives of this ///< geometry uint8_t geometryMask; ///< [in] 8-bit geometry mask for ray masking uint8_t reserved; ///< [in] reserved for future use uint32_t primCount; ///< [in] number of primitives in geometry ze_rtas_geometry_aabbs_cb_exp_t pfnGetBoundsCb; ///< [in] pointer to callback function to get the axis-aligned bounding-box ///< for a range of primitives void* pGeomUserPtr; ///< [in] user data pointer passed to callback } ze_rtas_builder_procedural_geometry_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ray tracing acceleration structure builder instance geometry info typedef struct _ze_rtas_builder_instance_geometry_info_exp_t { ze_rtas_builder_packed_geometry_type_exp_t geometryType; ///< [in] geometry type, must be ///< ::ZE_RTAS_BUILDER_GEOMETRY_TYPE_EXP_INSTANCE ze_rtas_builder_packed_instance_exp_flags_t instanceFlags; ///< [in] 0 or some combination of ::ze_rtas_builder_geometry_exp_flag_t ///< bits representing the geometry flags for all primitives of this ///< geometry uint8_t geometryMask; ///< [in] 8-bit geometry mask for ray masking ze_rtas_builder_packed_input_data_format_exp_t transformFormat; ///< [in] format of the specified transformation uint32_t instanceUserID; ///< [in] user-specified identifier for the instance void* pTransform; ///< [in] object-to-world instance transformation in specified format ze_rtas_aabb_exp_t* pBounds; ///< [in] object-space axis-aligned bounding-box of the instanced ///< acceleration structure void* pAccelerationStructure; ///< [in] pointer to acceleration structure to instantiate } ze_rtas_builder_instance_geometry_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief typedef struct _ze_rtas_builder_build_op_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_rtas_format_exp_t rtasFormat; ///< [in] ray tracing acceleration structure format ze_rtas_builder_build_quality_hint_exp_t buildQuality; ///< [in] acceleration structure build quality hint ze_rtas_builder_build_op_exp_flags_t buildFlags; ///< [in] 0 or some combination of ::ze_rtas_builder_build_op_exp_flag_t ///< flags const ze_rtas_builder_geometry_info_exp_t** ppGeometries; ///< [in][optional][range(0, `numGeometries`)] NULL or a valid array of ///< pointers to geometry infos uint32_t numGeometries; ///< [in] number of geometries in geometry infos array, can be zero when ///< `ppGeometries` is NULL } ze_rtas_builder_build_op_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a ray tracing acceleration structure builder object /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support ::ZE_experimental_rtas_builder /// extension. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pDescriptor` /// + `nullptr == phBuilder` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_RTAS_BUILDER_EXP_VERSION_CURRENT < pDescriptor->builderVersion` ZE_APIEXPORT ze_result_t ZE_APICALL zeRTASBuilderCreateExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object const ze_rtas_builder_exp_desc_t* pDescriptor, ///< [in] pointer to builder descriptor ze_rtas_builder_exp_handle_t* phBuilder ///< [out] handle of builder object ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves ray tracing acceleration structure builder properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hBuilder` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pBuildOpDescriptor` /// + `nullptr == pProperties` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_RTAS_FORMAT_EXP_INVALID < pBuildOpDescriptor->rtasFormat` /// + `::ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH < pBuildOpDescriptor->buildQuality` /// + `0x3 < pBuildOpDescriptor->buildFlags` ZE_APIEXPORT ze_result_t ZE_APICALL zeRTASBuilderGetBuildPropertiesExp( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor ze_rtas_builder_exp_properties_t* pProperties ///< [in,out] query result for builder properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Checks ray tracing acceleration structure format compatibility /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_RTAS_FORMAT_EXP_INVALID < rtasFormatA` /// + `::ZE_RTAS_FORMAT_EXP_INVALID < rtasFormatB` /// - ::ZE_RESULT_SUCCESS /// + An acceleration structure built with `rtasFormatA` is compatible with devices that report `rtasFormatB`. /// - ::ZE_RESULT_EXP_ERROR_OPERANDS_INCOMPATIBLE /// + An acceleration structure built with `rtasFormatA` is **not** compatible with devices that report `rtasFormatB`. ZE_APIEXPORT ze_result_t ZE_APICALL zeDriverRTASFormatCompatibilityCheckExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_format_exp_t rtasFormatA, ///< [in] operand A ze_rtas_format_exp_t rtasFormatB ///< [in] operand B ); /////////////////////////////////////////////////////////////////////////////// /// @brief Build ray tracing acceleration structure /// /// @details /// - This function builds an acceleration structure of the scene consisting /// of the specified geometry information and writes the acceleration /// structure to the provided destination buffer. All types of geometries /// can get freely mixed inside a scene. /// - It is the user's responsibility to manage the acceleration structure /// buffer allocation, de-allocation, and potential prefetching to the /// device memory. The required size of the acceleration structure buffer /// can be queried with the ::zeRTASBuilderGetBuildPropertiesExp function. /// The acceleration structure buffer must be a shared USM allocation and /// should be present on the host at build time. The referenced scene data /// (index- and vertex- buffers) can be standard host allocations, and /// will not be referenced into by the build acceleration structure. /// - Before an acceleration structure can be built, the user must allocate /// the memory for the acceleration structure buffer and scratch buffer /// using sizes based on a query for the estimated size properties. /// - When using the "worst-case" size for the acceleration structure /// buffer, the acceleration structure construction will never fail with ::ZE_RESULT_EXP_RTAS_BUILD_RETRY. /// - When using the "expected" size for the acceleration structure buffer, /// the acceleration structure construction may fail with /// ::ZE_RESULT_EXP_RTAS_BUILD_RETRY. If this happens, the user may resize /// their acceleration structure buffer using the returned /// `*pRtasBufferSizeBytes` value, which will be updated with an improved /// size estimate that will likely result in a successful build. /// - The acceleration structure construction is run on the host and is /// synchronous, thus after the function returns with a successful result, /// the acceleration structure may be used. /// - All provided data buffers must be host-accessible. /// - The acceleration structure buffer must be a USM allocation. /// - A successfully constructed acceleration structure is entirely /// self-contained. There is no requirement for input data to persist /// beyond build completion. /// - A successfully constructed acceleration structure is non-copyable. /// - Acceleration structure construction may be parallelized by passing a /// valid handle to a parallel operation object and joining that parallel /// operation using ::zeRTASParallelOperationJoinExp with user-provided /// worker threads. /// - **Additional Notes** /// - "The geometry infos array, geometry infos, and scratch buffer must /// all be standard host memory allocations." /// - "A pointer to a geometry info can be a null pointer, in which case /// the geometry is treated as empty." /// - "If no parallel operation handle is provided, the build is run /// sequentially on the current thread." /// - "A parallel operation object may only be associated with a single /// acceleration structure build at a time." /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hBuilder` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pBuildOpDescriptor` /// + `nullptr == pScratchBuffer` /// + `nullptr == pRtasBuffer` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_RTAS_FORMAT_EXP_INVALID < pBuildOpDescriptor->rtasFormat` /// + `::ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH < pBuildOpDescriptor->buildQuality` /// + `0x3 < pBuildOpDescriptor->buildFlags` /// - ::ZE_RESULT_EXP_RTAS_BUILD_DEFERRED /// + Acceleration structure build completion is deferred to parallel operation join. /// - ::ZE_RESULT_EXP_RTAS_BUILD_RETRY /// + Acceleration structure build failed due to insufficient resources, retry the build operation with a larger acceleration structure buffer allocation. /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + Acceleration structure build failed due to parallel operation object participation in another build operation. ZE_APIEXPORT ze_result_t ZE_APICALL zeRTASBuilderBuildExp( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used ///< during acceleration structure construction size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes void* pRtasBuffer, ///< [in] pointer to destination buffer size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks ze_rtas_aabb_exp_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration ///< structure bounds size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in ///< bytes ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a ray tracing acceleration structure builder object /// /// @details /// - The implementation of this function may immediately release any /// internal Host and Device resources associated with this builder. /// - The application must **not** call this function from simultaneous /// threads with the same builder handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hBuilder` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zeRTASBuilderDestroyExp( ze_rtas_builder_exp_handle_t hBuilder ///< [in][release] handle of builder object to destroy ); /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a ray tracing acceleration structure builder parallel /// operation object /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support ::ZE_experimental_rtas_builder /// extension. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phParallelOperation` ZE_APIEXPORT ze_result_t ZE_APICALL zeRTASParallelOperationCreateExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_parallel_operation_exp_handle_t* phParallelOperation ///< [out] handle of parallel operation object ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves ray tracing acceleration structure builder parallel /// operation properties /// /// @details /// - The application must first bind the parallel operation object to a /// build operation before it may query the parallel operation properties. /// In other words, the application must first call /// ::zeRTASBuilderBuildExp with **hParallelOperation** before calling /// this function. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hParallelOperation` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zeRTASParallelOperationGetPropertiesExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in] handle of parallel operation object ze_rtas_parallel_operation_exp_properties_t* pProperties ///< [in,out] query result for parallel operation properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Joins a parallel build operation /// /// @details /// - All worker threads return the same error code for the parallel build /// operation upon build completion /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hParallelOperation` ZE_APIEXPORT ze_result_t ZE_APICALL zeRTASParallelOperationJoinExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in] handle of parallel operation object ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a ray tracing acceleration structure builder parallel /// operation object /// /// @details /// - The implementation of this function may immediately release any /// internal Host and Device resources associated with this parallel /// operation. /// - The application must **not** call this function from simultaneous /// threads with the same parallel operation handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hParallelOperation` ZE_APIEXPORT ze_result_t ZE_APICALL zeRTASParallelOperationDestroyExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension APIs for Counter-based Event Pools #if !defined(__GNUC__) #pragma region counterbasedeventpool #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_EVENT_POOL_COUNTER_BASED_EXP_NAME /// @brief Counter-based Event Pools Extension Name #define ZE_EVENT_POOL_COUNTER_BASED_EXP_NAME "ZE_experimental_event_pool_counter_based" #endif // ZE_EVENT_POOL_COUNTER_BASED_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Counter-based Event Pools Extension Version(s) typedef enum _ze_event_pool_counter_based_exp_version_t { ZE_EVENT_POOL_COUNTER_BASED_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_EVENT_POOL_COUNTER_BASED_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_EVENT_POOL_COUNTER_BASED_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_event_pool_counter_based_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported event flags for defining counter-based event pools. typedef uint32_t ze_event_pool_counter_based_exp_flags_t; typedef enum _ze_event_pool_counter_based_exp_flag_t { ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_IMMEDIATE = ZE_BIT(0), ///< Counter-based event pool is used for immediate command lists (default) ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_NON_IMMEDIATE = ZE_BIT(1), ///< Counter-based event pool is for non-immediate command lists ZE_EVENT_POOL_COUNTER_BASED_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_event_pool_counter_based_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Event pool descriptor for counter-based events. This structure may be /// passed to ::zeEventPoolCreate as pNext member of /// ::ze_event_pool_desc_t. typedef struct _ze_event_pool_counter_based_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_event_pool_counter_based_exp_flags_t flags; ///< [in] mode flags. ///< must be 0 (default) or a valid value of ::ze_event_pool_counter_based_exp_flag_t ///< default behavior is counter-based event pool is only used for ///< immediate command lists. } ze_event_pool_counter_based_exp_desc_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting bindless images. #if !defined(__GNUC__) #pragma region bindlessimages #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_BINDLESS_IMAGE_EXP_NAME /// @brief Image Memory Properties Extension Name #define ZE_BINDLESS_IMAGE_EXP_NAME "ZE_experimental_bindless_image" #endif // ZE_BINDLESS_IMAGE_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Bindless Image Extension Version(s) typedef enum _ze_bindless_image_exp_version_t { ZE_BINDLESS_IMAGE_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_BINDLESS_IMAGE_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_BINDLESS_IMAGE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_bindless_image_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Image flags for Bindless images typedef uint32_t ze_image_bindless_exp_flags_t; typedef enum _ze_image_bindless_exp_flag_t { ZE_IMAGE_BINDLESS_EXP_FLAG_BINDLESS = ZE_BIT(0), ///< Bindless images are created with ::zeImageCreate. The image handle ///< created with this flag is valid on both host and device. ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE = ZE_BIT(1), ///< Bindless sampled images are created with ::zeImageCreate by combining ///< BINDLESS and SAMPLED_IMAGE. ///< Create sampled image view from bindless unsampled image using SAMPLED_IMAGE. ZE_IMAGE_BINDLESS_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_image_bindless_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Image descriptor for bindless images. This structure may be passed to /// ::zeImageCreate via pNext member of ::ze_image_desc_t. typedef struct _ze_image_bindless_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_image_bindless_exp_flags_t flags; ///< [in] image flags. ///< must be 0 (default) or a valid value of ::ze_image_bindless_exp_flag_t ///< default behavior is bindless images are not used when creating handles ///< via ::zeImageCreate. ///< When the flag is passed to ::zeImageCreate, then only the memory for ///< the image is allocated. ///< Additional image handles can be created with ::zeImageViewCreateExt. ///< When ::ZE_IMAGE_BINDLESS_EXP_FLAG_SAMPLED_IMAGE flag is passed, ///< ::ze_sampler_desc_t must be attached via pNext member of ::ze_image_bindless_exp_desc_t. } ze_image_bindless_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Image descriptor for bindless images created from pitched allocations. /// This structure may be passed to ::zeImageCreate via pNext member of /// ::ze_image_desc_t. typedef struct _ze_image_pitched_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). void* ptr; ///< [in] pointer to pitched device allocation allocated using ::zeMemAllocDevice } ze_image_pitched_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device specific properties for pitched allocations /// /// @details /// - This structure may be passed to ::zeDeviceGetImageProperties via the /// pNext member of ::ze_device_image_properties_t. typedef struct _ze_device_pitched_alloc_exp_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). size_t maxImageLinearWidth; ///< [out] Maximum image linear width. size_t maxImageLinearHeight; ///< [out] Maximum image linear height. } ze_device_pitched_alloc_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Allocate pitched USM memory for images /// /// @details /// - Retrieves pitch for 2D image given the width, height and size in bytes /// - The memory is then allocated using ::zeMemAllocDevice by providing /// input size calculated as the returned pitch value multiplied by image height /// - The application may call this function from simultaneous threads /// - The implementation of this function must be thread-safe. /// - The implementation of this function should be lock-free. /// - The implementation must support ::ZE_experimental_bindless_image extension. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` ZE_APIEXPORT ze_result_t ZE_APICALL zeMemGetPitchFor2dImage( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device size_t imageWidth, ///< [in] imageWidth size_t imageHeight, ///< [in] imageHeight unsigned int elementSizeInBytes, ///< [in] Element size in bytes size_t * rowPitch ///< [out] rowPitch ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get bindless device offset for image /// /// @details /// - The application may call this function from simultaneous threads /// - The implementation of this function must be thread-safe. /// - The implementation of this function should be lock-free. /// - The implementation must support ::ZE_experimental_bindless_image /// extension. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pDeviceOffset` ZE_APIEXPORT ze_result_t ZE_APICALL zeImageGetDeviceOffsetExp( ze_image_handle_t hImage, ///< [in] handle of the image uint64_t* pDeviceOffset ///< [out] bindless device offset for image ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting compute graphs. #if !defined(__GNUC__) #pragma region commandListClone #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_COMMAND_LIST_CLONE_EXP_NAME /// @brief Command List Clone Extension Name #define ZE_COMMAND_LIST_CLONE_EXP_NAME "ZE_experimental_command_list_clone" #endif // ZE_COMMAND_LIST_CLONE_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Command List Clone Extension Version(s) typedef enum _ze_command_list_clone_exp_version_t { ZE_COMMAND_LIST_CLONE_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_COMMAND_LIST_CLONE_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_COMMAND_LIST_CLONE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_command_list_clone_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a command list as the clone of another command list. /// /// @details /// - The source command list must be created with the /// ::ZE_COMMAND_LIST_FLAG_EXP_CLONEABLE flag. /// - The source command list must be closed prior to cloning. /// - The source command list may be cloned while it is running on the /// device. /// - The cloned command list inherits all properties of the source command /// list. /// - The cloned command list must be destroyed prior to the source command /// list. /// - The application must only use the command list for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phClonedCommandList` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListCreateCloneExp( ze_command_list_handle_t hCommandList, ///< [in] handle to source command list (the command list to clone) ze_command_list_handle_t* phClonedCommandList ///< [out] pointer to handle of the cloned command list ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting compute graphs. #if !defined(__GNUC__) #pragma region immediateCommandListAppend #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_NAME /// @brief Immediate Command List Append Extension Name #define ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_NAME "ZE_experimental_immediate_command_list_append" #endif // ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Immediate Command List Append Extension Version(s) typedef enum _ze_immediate_command_list_append_exp_version_t { ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_immediate_command_list_append_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Appends command lists to dispatch from an immediate command list. /// /// @details /// - The application must call this function only with command lists /// created with ::zeCommandListCreateImmediate. /// - The command lists passed to this function in the `phCommandLists` /// argument must be regular command lists (i.e. not immediate command /// lists). /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandListImmediate` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phCommandLists` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListImmediateAppendCommandListsExp( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t numCommandLists, ///< [in] number of command lists ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion ///< - if not null, this event is signaled after the completion of all ///< appended command lists uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended ///< command lists; must be 0 if nullptr == phWaitEvents ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing appended command lists. ///< - if not null, all wait events must be satisfied prior to the start ///< of any appended command list(s) ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Extension for supporting compute graphs with dynamic properties. #if !defined(__GNUC__) #pragma region mutableCommandList #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MUTABLE_COMMAND_LIST_EXP_NAME /// @brief Mutable Command List Extension Name #define ZE_MUTABLE_COMMAND_LIST_EXP_NAME "ZE_experimental_mutable_command_list" #endif // ZE_MUTABLE_COMMAND_LIST_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Mutable Command List Extension Version(s) typedef enum _ze_mutable_command_list_exp_version_t { ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_1_1 = ZE_MAKE_VERSION( 1, 1 ), ///< version 1.1 ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 1 ), ///< latest known version ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_mutable_command_list_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Mutable command flags typedef uint32_t ze_mutable_command_exp_flags_t; typedef enum _ze_mutable_command_exp_flag_t { ZE_MUTABLE_COMMAND_EXP_FLAG_KERNEL_ARGUMENTS = ZE_BIT(0), ///< kernel arguments ZE_MUTABLE_COMMAND_EXP_FLAG_GROUP_COUNT = ZE_BIT(1), ///< kernel group count ZE_MUTABLE_COMMAND_EXP_FLAG_GROUP_SIZE = ZE_BIT(2), ///< kernel group size ZE_MUTABLE_COMMAND_EXP_FLAG_GLOBAL_OFFSET = ZE_BIT(3), ///< kernel global offset ZE_MUTABLE_COMMAND_EXP_FLAG_SIGNAL_EVENT = ZE_BIT(4), ///< command signal event ZE_MUTABLE_COMMAND_EXP_FLAG_WAIT_EVENTS = ZE_BIT(5), ///< command wait events ZE_MUTABLE_COMMAND_EXP_FLAG_KERNEL_INSTRUCTION = ZE_BIT(6), ///< command kernel ZE_MUTABLE_COMMAND_EXP_FLAG_GRAPH_ARGUMENTS = ZE_BIT(7), ///< graph arguments ZE_MUTABLE_COMMAND_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_mutable_command_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Mutable command identifier descriptor typedef struct _ze_mutable_command_id_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_mutable_command_exp_flags_t flags; ///< [in] mutable command flags. ///< - must be 0 (default, equivalent to setting all flags bar kernel ///< instruction), or a valid combination of ::ze_mutable_command_exp_flag_t ///< - in order to include kernel instruction mutation, ///< ::ZE_MUTABLE_COMMAND_EXP_FLAG_KERNEL_INSTRUCTION must be explictly included } ze_mutable_command_id_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Mutable command list flags typedef uint32_t ze_mutable_command_list_exp_flags_t; typedef enum _ze_mutable_command_list_exp_flag_t { ZE_MUTABLE_COMMAND_LIST_EXP_FLAG_RESERVED = ZE_BIT(0), ///< reserved ZE_MUTABLE_COMMAND_LIST_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } ze_mutable_command_list_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Mutable command list properties typedef struct _ze_mutable_command_list_exp_properties_t { ze_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_mutable_command_list_exp_flags_t mutableCommandListFlags; ///< [out] mutable command list flags ze_mutable_command_exp_flags_t mutableCommandFlags; ///< [out] mutable command flags } ze_mutable_command_list_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Mutable command list descriptor typedef struct _ze_mutable_command_list_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_mutable_command_list_exp_flags_t flags; ///< [in] mutable command list flags. ///< - must be 0 (default) or a valid combination of ::ze_mutable_command_list_exp_flag_t } ze_mutable_command_list_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Mutable commands descriptor typedef struct _ze_mutable_commands_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t flags; ///< [in] must be 0, this field is reserved for future use } ze_mutable_commands_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Mutable kernel argument descriptor typedef struct _ze_mutable_kernel_argument_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t commandId; ///< [in] command identifier uint32_t argIndex; ///< [in] kernel argument index size_t argSize; ///< [in] kernel argument size const void* pArgValue; ///< [in] pointer to kernel argument value } ze_mutable_kernel_argument_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Mutable kernel group count descriptor typedef struct _ze_mutable_group_count_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t commandId; ///< [in] command identifier const ze_group_count_t* pGroupCount; ///< [in] pointer to group count } ze_mutable_group_count_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Mutable kernel group size descriptor typedef struct _ze_mutable_group_size_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t commandId; ///< [in] command identifier uint32_t groupSizeX; ///< [in] group size for X dimension to use for the kernel uint32_t groupSizeY; ///< [in] group size for Y dimension to use for the kernel uint32_t groupSizeZ; ///< [in] group size for Z dimension to use for the kernel } ze_mutable_group_size_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Mutable kernel global offset descriptor typedef struct _ze_mutable_global_offset_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t commandId; ///< [in] command identifier uint32_t offsetX; ///< [in] global offset for X dimension to use for this kernel uint32_t offsetY; ///< [in] global offset for Y dimension to use for this kernel uint32_t offsetZ; ///< [in] global offset for Z dimension to use for this kernel } ze_mutable_global_offset_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Mutable graph argument descriptor typedef struct _ze_mutable_graph_argument_exp_desc_t { ze_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t commandId; ///< [in] command identifier uint32_t argIndex; ///< [in] graph argument index const void* pArgValue; ///< [in] pointer to graph argument value } ze_mutable_graph_argument_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Returns a unique command identifier for the next command to be /// appended to a command list. /// /// @details /// - This function may only be called for a mutable command list. /// - This function may not be called on a closed command list. /// - This function may be called from simultaneous threads with the same /// command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == pCommandId` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xff < desc->flags` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListGetNextCommandIdExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in] pointer to mutable command identifier descriptor uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ); /////////////////////////////////////////////////////////////////////////////// /// @brief Returns a unique command identifier for the next command to be /// appended to a command list. Provides possible kernel handles for /// kernel mutation when ::ZE_MUTABLE_COMMAND_EXP_FLAG_KERNEL_INSTRUCTION /// flag is present. /// /// @details /// - This function may only be called for a mutable command list. /// - This function may not be called on a closed command list. /// - This function may be called from simultaneous threads with the same /// command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == pCommandId` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xff < desc->flags` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListGetNextCommandIdWithKernelsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in][out] pointer to mutable command identifier descriptor uint32_t numKernels, ///< [in][optional] number of entries on phKernels list ze_kernel_handle_t* phKernels, ///< [in][optional][range(0, numKernels)] list of kernels that user can ///< switch between using ::zeCommandListUpdateMutableCommandKernelsExp ///< call uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ); /////////////////////////////////////////////////////////////////////////////// /// @brief Updates mutable commands. /// /// @details /// - This function may only be called for a mutable command list. /// - The application must synchronize mutable command list execution before /// calling this function. /// - The application must close a mutable command list after completing all /// updates. /// - This function must not be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + Invalid kernel argument or not matching update descriptor provided ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_commands_exp_desc_t* desc ///< [in] pointer to mutable commands descriptor; multiple descriptors may ///< be chained via `pNext` member ); /////////////////////////////////////////////////////////////////////////////// /// @brief Updates the signal event for a mutable command in a mutable command /// list. /// /// @details /// - This function may only be called for a mutable command list. /// - The type, scope and flags of the signal event must match those of the /// source command. /// - The application must synchronize mutable command list execution before /// calling this function. /// - The application must close a mutable command list after completing all /// updates. /// - This function must not be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandSignalEventExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier ze_event_handle_t hSignalEvent ///< [in][optional] handle of the event to signal on completion ); /////////////////////////////////////////////////////////////////////////////// /// @brief Updates the wait events for a mutable command in a mutable command /// list. /// /// @details /// - This function may only be called for a mutable command list. /// - The number of wait events must match that of the source command. /// - The type, scope and flags of the wait events must match those of the /// source command. /// - Passing `nullptr` as the wait events will update the command to not /// wait on any events prior to dispatch. /// - Passing `nullptr` as an event on event wait list will remove event /// dependency from this wait list slot. /// - The application must synchronize mutable command list execution before /// calling this function. /// - The application must close a mutable command list after completing all /// updates. /// - This function must not be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + The `numWaitEvents` parameter does not match that of the original command. ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandWaitEventsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier uint32_t numWaitEvents, ///< [in][optional] the number of wait events ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ); /////////////////////////////////////////////////////////////////////////////// /// @brief Updates the kernel for a mutable command in a mutable command list. /// /// @details /// - This function may only be called for a mutable command list. /// - The kernel handle must be from the provided list for given command id. /// - The application must synchronize mutable command list execution before /// calling this function. /// - The application must close a mutable command list after completing all /// updates. /// - This function must not be called from simultaneous threads with the /// same command list handle. /// - This function must be called before updating kernel arguments and /// dispatch parameters, when kernel is mutated. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCommandId` /// + `nullptr == phKernels` /// - ::ZE_RESULT_ERROR_INVALID_KERNEL_HANDLE /// + Invalid kernel handle provided for the mutation kernel instruction operation. ZE_APIEXPORT ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandKernelsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] the number of kernels to update uint64_t* pCommandId, ///< [in][range(0, numKernels)] command identifier ze_kernel_handle_t* phKernels ///< [in][range(0, numKernels)] handle of the kernel for a command ///< identifier to switch to ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero API Callbacks #if !defined(__GNUC__) #pragma region callbacks #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeInit /// @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 _ze_init_params_t { ze_init_flags_t* pflags; } ze_init_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeInit /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnInitCb_t)( ze_init_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Global callback functions pointers typedef struct _ze_global_callbacks_t { ze_pfnInitCb_t pfnInitCb; } ze_global_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDriverGet /// @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 _ze_driver_get_params_t { uint32_t** ppCount; ze_driver_handle_t** pphDrivers; } ze_driver_get_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDriverGet /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDriverGetCb_t)( ze_driver_get_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDriverGetApiVersion /// @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 _ze_driver_get_api_version_params_t { ze_driver_handle_t* phDriver; ze_api_version_t** pversion; } ze_driver_get_api_version_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDriverGetApiVersion /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDriverGetApiVersionCb_t)( ze_driver_get_api_version_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDriverGetProperties /// @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 _ze_driver_get_properties_params_t { ze_driver_handle_t* phDriver; ze_driver_properties_t** ppDriverProperties; } ze_driver_get_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDriverGetProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDriverGetPropertiesCb_t)( ze_driver_get_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDriverGetIpcProperties /// @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 _ze_driver_get_ipc_properties_params_t { ze_driver_handle_t* phDriver; ze_driver_ipc_properties_t** ppIpcProperties; } ze_driver_get_ipc_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDriverGetIpcProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDriverGetIpcPropertiesCb_t)( ze_driver_get_ipc_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDriverGetExtensionProperties /// @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 _ze_driver_get_extension_properties_params_t { ze_driver_handle_t* phDriver; uint32_t** ppCount; ze_driver_extension_properties_t** ppExtensionProperties; } ze_driver_get_extension_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDriverGetExtensionProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDriverGetExtensionPropertiesCb_t)( ze_driver_get_extension_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Driver callback functions pointers typedef struct _ze_driver_callbacks_t { ze_pfnDriverGetCb_t pfnGetCb; ze_pfnDriverGetApiVersionCb_t pfnGetApiVersionCb; ze_pfnDriverGetPropertiesCb_t pfnGetPropertiesCb; ze_pfnDriverGetIpcPropertiesCb_t pfnGetIpcPropertiesCb; ze_pfnDriverGetExtensionPropertiesCb_t pfnGetExtensionPropertiesCb; } ze_driver_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGet /// @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 _ze_device_get_params_t { ze_driver_handle_t* phDriver; uint32_t** ppCount; ze_device_handle_t** pphDevices; } ze_device_get_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGet /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetCb_t)( ze_device_get_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetSubDevices /// @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 _ze_device_get_sub_devices_params_t { ze_device_handle_t* phDevice; uint32_t** ppCount; ze_device_handle_t** pphSubdevices; } ze_device_get_sub_devices_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetSubDevices /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetSubDevicesCb_t)( ze_device_get_sub_devices_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetProperties /// @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 _ze_device_get_properties_params_t { ze_device_handle_t* phDevice; ze_device_properties_t** ppDeviceProperties; } ze_device_get_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetPropertiesCb_t)( ze_device_get_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetComputeProperties /// @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 _ze_device_get_compute_properties_params_t { ze_device_handle_t* phDevice; ze_device_compute_properties_t** ppComputeProperties; } ze_device_get_compute_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetComputeProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetComputePropertiesCb_t)( ze_device_get_compute_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetModuleProperties /// @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 _ze_device_get_module_properties_params_t { ze_device_handle_t* phDevice; ze_device_module_properties_t** ppModuleProperties; } ze_device_get_module_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetModuleProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetModulePropertiesCb_t)( ze_device_get_module_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetCommandQueueGroupProperties /// @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 _ze_device_get_command_queue_group_properties_params_t { ze_device_handle_t* phDevice; uint32_t** ppCount; ze_command_queue_group_properties_t** ppCommandQueueGroupProperties; } ze_device_get_command_queue_group_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetCommandQueueGroupProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetCommandQueueGroupPropertiesCb_t)( ze_device_get_command_queue_group_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetMemoryProperties /// @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 _ze_device_get_memory_properties_params_t { ze_device_handle_t* phDevice; uint32_t** ppCount; ze_device_memory_properties_t** ppMemProperties; } ze_device_get_memory_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetMemoryProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetMemoryPropertiesCb_t)( ze_device_get_memory_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetMemoryAccessProperties /// @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 _ze_device_get_memory_access_properties_params_t { ze_device_handle_t* phDevice; ze_device_memory_access_properties_t** ppMemAccessProperties; } ze_device_get_memory_access_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetMemoryAccessProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetMemoryAccessPropertiesCb_t)( ze_device_get_memory_access_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetCacheProperties /// @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 _ze_device_get_cache_properties_params_t { ze_device_handle_t* phDevice; uint32_t** ppCount; ze_device_cache_properties_t** ppCacheProperties; } ze_device_get_cache_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetCacheProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetCachePropertiesCb_t)( ze_device_get_cache_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetImageProperties /// @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 _ze_device_get_image_properties_params_t { ze_device_handle_t* phDevice; ze_device_image_properties_t** ppImageProperties; } ze_device_get_image_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetImageProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetImagePropertiesCb_t)( ze_device_get_image_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetExternalMemoryProperties /// @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 _ze_device_get_external_memory_properties_params_t { ze_device_handle_t* phDevice; ze_device_external_memory_properties_t** ppExternalMemoryProperties; } ze_device_get_external_memory_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetExternalMemoryProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetExternalMemoryPropertiesCb_t)( ze_device_get_external_memory_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetP2PProperties /// @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 _ze_device_get_p2_p_properties_params_t { ze_device_handle_t* phDevice; ze_device_handle_t* phPeerDevice; ze_device_p2p_properties_t** ppP2PProperties; } ze_device_get_p2_p_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetP2PProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetP2PPropertiesCb_t)( ze_device_get_p2_p_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceCanAccessPeer /// @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 _ze_device_can_access_peer_params_t { ze_device_handle_t* phDevice; ze_device_handle_t* phPeerDevice; ze_bool_t** pvalue; } ze_device_can_access_peer_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceCanAccessPeer /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceCanAccessPeerCb_t)( ze_device_can_access_peer_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeDeviceGetStatus /// @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 _ze_device_get_status_params_t { ze_device_handle_t* phDevice; } ze_device_get_status_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeDeviceGetStatus /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnDeviceGetStatusCb_t)( ze_device_get_status_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Device callback functions pointers typedef struct _ze_device_callbacks_t { ze_pfnDeviceGetCb_t pfnGetCb; ze_pfnDeviceGetSubDevicesCb_t pfnGetSubDevicesCb; ze_pfnDeviceGetPropertiesCb_t pfnGetPropertiesCb; ze_pfnDeviceGetComputePropertiesCb_t pfnGetComputePropertiesCb; ze_pfnDeviceGetModulePropertiesCb_t pfnGetModulePropertiesCb; ze_pfnDeviceGetCommandQueueGroupPropertiesCb_t pfnGetCommandQueueGroupPropertiesCb; ze_pfnDeviceGetMemoryPropertiesCb_t pfnGetMemoryPropertiesCb; ze_pfnDeviceGetMemoryAccessPropertiesCb_t pfnGetMemoryAccessPropertiesCb; ze_pfnDeviceGetCachePropertiesCb_t pfnGetCachePropertiesCb; ze_pfnDeviceGetImagePropertiesCb_t pfnGetImagePropertiesCb; ze_pfnDeviceGetExternalMemoryPropertiesCb_t pfnGetExternalMemoryPropertiesCb; ze_pfnDeviceGetP2PPropertiesCb_t pfnGetP2PPropertiesCb; ze_pfnDeviceCanAccessPeerCb_t pfnCanAccessPeerCb; ze_pfnDeviceGetStatusCb_t pfnGetStatusCb; } ze_device_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeContextCreate /// @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 _ze_context_create_params_t { ze_driver_handle_t* phDriver; const ze_context_desc_t** pdesc; ze_context_handle_t** pphContext; } ze_context_create_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeContextCreate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnContextCreateCb_t)( ze_context_create_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeContextDestroy /// @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 _ze_context_destroy_params_t { ze_context_handle_t* phContext; } ze_context_destroy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeContextDestroy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnContextDestroyCb_t)( ze_context_destroy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeContextGetStatus /// @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 _ze_context_get_status_params_t { ze_context_handle_t* phContext; } ze_context_get_status_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeContextGetStatus /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnContextGetStatusCb_t)( ze_context_get_status_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeContextSystemBarrier /// @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 _ze_context_system_barrier_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; } ze_context_system_barrier_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeContextSystemBarrier /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnContextSystemBarrierCb_t)( ze_context_system_barrier_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeContextMakeMemoryResident /// @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 _ze_context_make_memory_resident_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; void** pptr; size_t* psize; } ze_context_make_memory_resident_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeContextMakeMemoryResident /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnContextMakeMemoryResidentCb_t)( ze_context_make_memory_resident_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeContextEvictMemory /// @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 _ze_context_evict_memory_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; void** pptr; size_t* psize; } ze_context_evict_memory_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeContextEvictMemory /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnContextEvictMemoryCb_t)( ze_context_evict_memory_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeContextMakeImageResident /// @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 _ze_context_make_image_resident_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; ze_image_handle_t* phImage; } ze_context_make_image_resident_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeContextMakeImageResident /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnContextMakeImageResidentCb_t)( ze_context_make_image_resident_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeContextEvictImage /// @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 _ze_context_evict_image_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; ze_image_handle_t* phImage; } ze_context_evict_image_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeContextEvictImage /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnContextEvictImageCb_t)( ze_context_evict_image_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Context callback functions pointers typedef struct _ze_context_callbacks_t { ze_pfnContextCreateCb_t pfnCreateCb; ze_pfnContextDestroyCb_t pfnDestroyCb; ze_pfnContextGetStatusCb_t pfnGetStatusCb; ze_pfnContextSystemBarrierCb_t pfnSystemBarrierCb; ze_pfnContextMakeMemoryResidentCb_t pfnMakeMemoryResidentCb; ze_pfnContextEvictMemoryCb_t pfnEvictMemoryCb; ze_pfnContextMakeImageResidentCb_t pfnMakeImageResidentCb; ze_pfnContextEvictImageCb_t pfnEvictImageCb; } ze_context_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandQueueCreate /// @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 _ze_command_queue_create_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; const ze_command_queue_desc_t** pdesc; ze_command_queue_handle_t** pphCommandQueue; } ze_command_queue_create_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandQueueCreate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandQueueCreateCb_t)( ze_command_queue_create_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandQueueDestroy /// @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 _ze_command_queue_destroy_params_t { ze_command_queue_handle_t* phCommandQueue; } ze_command_queue_destroy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandQueueDestroy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandQueueDestroyCb_t)( ze_command_queue_destroy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandQueueExecuteCommandLists /// @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 _ze_command_queue_execute_command_lists_params_t { ze_command_queue_handle_t* phCommandQueue; uint32_t* pnumCommandLists; ze_command_list_handle_t** pphCommandLists; ze_fence_handle_t* phFence; } ze_command_queue_execute_command_lists_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandQueueExecuteCommandLists /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandQueueExecuteCommandListsCb_t)( ze_command_queue_execute_command_lists_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandQueueSynchronize /// @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 _ze_command_queue_synchronize_params_t { ze_command_queue_handle_t* phCommandQueue; uint64_t* ptimeout; } ze_command_queue_synchronize_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandQueueSynchronize /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandQueueSynchronizeCb_t)( ze_command_queue_synchronize_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of CommandQueue callback functions pointers typedef struct _ze_command_queue_callbacks_t { ze_pfnCommandQueueCreateCb_t pfnCreateCb; ze_pfnCommandQueueDestroyCb_t pfnDestroyCb; ze_pfnCommandQueueExecuteCommandListsCb_t pfnExecuteCommandListsCb; ze_pfnCommandQueueSynchronizeCb_t pfnSynchronizeCb; } ze_command_queue_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListCreate /// @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 _ze_command_list_create_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; const ze_command_list_desc_t** pdesc; ze_command_list_handle_t** pphCommandList; } ze_command_list_create_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListCreate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListCreateCb_t)( ze_command_list_create_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListCreateImmediate /// @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 _ze_command_list_create_immediate_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; const ze_command_queue_desc_t** paltdesc; ze_command_list_handle_t** pphCommandList; } ze_command_list_create_immediate_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListCreateImmediate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListCreateImmediateCb_t)( ze_command_list_create_immediate_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListDestroy /// @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 _ze_command_list_destroy_params_t { ze_command_list_handle_t* phCommandList; } ze_command_list_destroy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListDestroy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListDestroyCb_t)( ze_command_list_destroy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListClose /// @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 _ze_command_list_close_params_t { ze_command_list_handle_t* phCommandList; } ze_command_list_close_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListClose /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListCloseCb_t)( ze_command_list_close_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListReset /// @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 _ze_command_list_reset_params_t { ze_command_list_handle_t* phCommandList; } ze_command_list_reset_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListReset /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListResetCb_t)( ze_command_list_reset_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendWriteGlobalTimestamp /// @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 _ze_command_list_append_write_global_timestamp_params_t { ze_command_list_handle_t* phCommandList; uint64_t** pdstptr; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_write_global_timestamp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendWriteGlobalTimestamp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendWriteGlobalTimestampCb_t)( ze_command_list_append_write_global_timestamp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendBarrier /// @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 _ze_command_list_append_barrier_params_t { ze_command_list_handle_t* phCommandList; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_barrier_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendBarrier /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendBarrierCb_t)( ze_command_list_append_barrier_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendMemoryRangesBarrier /// @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 _ze_command_list_append_memory_ranges_barrier_params_t { ze_command_list_handle_t* phCommandList; uint32_t* pnumRanges; const size_t** ppRangeSizes; const void*** ppRanges; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_memory_ranges_barrier_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendMemoryRangesBarrier /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendMemoryRangesBarrierCb_t)( ze_command_list_append_memory_ranges_barrier_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendMemoryCopy /// @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 _ze_command_list_append_memory_copy_params_t { ze_command_list_handle_t* phCommandList; void** pdstptr; const void** psrcptr; size_t* psize; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_memory_copy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendMemoryCopy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendMemoryCopyCb_t)( ze_command_list_append_memory_copy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendMemoryFill /// @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 _ze_command_list_append_memory_fill_params_t { ze_command_list_handle_t* phCommandList; void** pptr; const void** ppattern; size_t* ppattern_size; size_t* psize; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_memory_fill_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendMemoryFill /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendMemoryFillCb_t)( ze_command_list_append_memory_fill_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendMemoryCopyRegion /// @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 _ze_command_list_append_memory_copy_region_params_t { ze_command_list_handle_t* phCommandList; void** pdstptr; const ze_copy_region_t** pdstRegion; uint32_t* pdstPitch; uint32_t* pdstSlicePitch; const void** psrcptr; const ze_copy_region_t** psrcRegion; uint32_t* psrcPitch; uint32_t* psrcSlicePitch; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_memory_copy_region_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendMemoryCopyRegion /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendMemoryCopyRegionCb_t)( ze_command_list_append_memory_copy_region_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendMemoryCopyFromContext /// @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 _ze_command_list_append_memory_copy_from_context_params_t { ze_command_list_handle_t* phCommandList; void** pdstptr; ze_context_handle_t* phContextSrc; const void** psrcptr; size_t* psize; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_memory_copy_from_context_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendMemoryCopyFromContext /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendMemoryCopyFromContextCb_t)( ze_command_list_append_memory_copy_from_context_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendImageCopy /// @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 _ze_command_list_append_image_copy_params_t { ze_command_list_handle_t* phCommandList; ze_image_handle_t* phDstImage; ze_image_handle_t* phSrcImage; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_image_copy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendImageCopy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendImageCopyCb_t)( ze_command_list_append_image_copy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendImageCopyRegion /// @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 _ze_command_list_append_image_copy_region_params_t { ze_command_list_handle_t* phCommandList; ze_image_handle_t* phDstImage; ze_image_handle_t* phSrcImage; const ze_image_region_t** ppDstRegion; const ze_image_region_t** ppSrcRegion; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_image_copy_region_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendImageCopyRegion /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendImageCopyRegionCb_t)( ze_command_list_append_image_copy_region_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendImageCopyToMemory /// @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 _ze_command_list_append_image_copy_to_memory_params_t { ze_command_list_handle_t* phCommandList; void** pdstptr; ze_image_handle_t* phSrcImage; const ze_image_region_t** ppSrcRegion; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_image_copy_to_memory_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendImageCopyToMemory /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendImageCopyToMemoryCb_t)( ze_command_list_append_image_copy_to_memory_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendImageCopyFromMemory /// @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 _ze_command_list_append_image_copy_from_memory_params_t { ze_command_list_handle_t* phCommandList; ze_image_handle_t* phDstImage; const void** psrcptr; const ze_image_region_t** ppDstRegion; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_image_copy_from_memory_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendImageCopyFromMemory /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendImageCopyFromMemoryCb_t)( ze_command_list_append_image_copy_from_memory_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendMemoryPrefetch /// @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 _ze_command_list_append_memory_prefetch_params_t { ze_command_list_handle_t* phCommandList; const void** pptr; size_t* psize; } ze_command_list_append_memory_prefetch_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendMemoryPrefetch /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendMemoryPrefetchCb_t)( ze_command_list_append_memory_prefetch_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendMemAdvise /// @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 _ze_command_list_append_mem_advise_params_t { ze_command_list_handle_t* phCommandList; ze_device_handle_t* phDevice; const void** pptr; size_t* psize; ze_memory_advice_t* padvice; } ze_command_list_append_mem_advise_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendMemAdvise /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendMemAdviseCb_t)( ze_command_list_append_mem_advise_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendSignalEvent /// @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 _ze_command_list_append_signal_event_params_t { ze_command_list_handle_t* phCommandList; ze_event_handle_t* phEvent; } ze_command_list_append_signal_event_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendSignalEvent /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendSignalEventCb_t)( ze_command_list_append_signal_event_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendWaitOnEvents /// @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 _ze_command_list_append_wait_on_events_params_t { ze_command_list_handle_t* phCommandList; uint32_t* pnumEvents; ze_event_handle_t** pphEvents; } ze_command_list_append_wait_on_events_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendWaitOnEvents /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendWaitOnEventsCb_t)( ze_command_list_append_wait_on_events_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendEventReset /// @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 _ze_command_list_append_event_reset_params_t { ze_command_list_handle_t* phCommandList; ze_event_handle_t* phEvent; } ze_command_list_append_event_reset_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendEventReset /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendEventResetCb_t)( ze_command_list_append_event_reset_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendQueryKernelTimestamps /// @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 _ze_command_list_append_query_kernel_timestamps_params_t { ze_command_list_handle_t* phCommandList; uint32_t* pnumEvents; ze_event_handle_t** pphEvents; void** pdstptr; const size_t** ppOffsets; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_query_kernel_timestamps_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendQueryKernelTimestamps /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendQueryKernelTimestampsCb_t)( ze_command_list_append_query_kernel_timestamps_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendLaunchKernel /// @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 _ze_command_list_append_launch_kernel_params_t { ze_command_list_handle_t* phCommandList; ze_kernel_handle_t* phKernel; const ze_group_count_t** ppLaunchFuncArgs; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_launch_kernel_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendLaunchKernel /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendLaunchKernelCb_t)( ze_command_list_append_launch_kernel_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendLaunchCooperativeKernel /// @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 _ze_command_list_append_launch_cooperative_kernel_params_t { ze_command_list_handle_t* phCommandList; ze_kernel_handle_t* phKernel; const ze_group_count_t** ppLaunchFuncArgs; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_launch_cooperative_kernel_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendLaunchCooperativeKernel /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendLaunchCooperativeKernelCb_t)( ze_command_list_append_launch_cooperative_kernel_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendLaunchKernelIndirect /// @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 _ze_command_list_append_launch_kernel_indirect_params_t { ze_command_list_handle_t* phCommandList; ze_kernel_handle_t* phKernel; const ze_group_count_t** ppLaunchArgumentsBuffer; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_launch_kernel_indirect_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendLaunchKernelIndirect /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendLaunchKernelIndirectCb_t)( ze_command_list_append_launch_kernel_indirect_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeCommandListAppendLaunchMultipleKernelsIndirect /// @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 _ze_command_list_append_launch_multiple_kernels_indirect_params_t { ze_command_list_handle_t* phCommandList; uint32_t* pnumKernels; ze_kernel_handle_t** pphKernels; const uint32_t** ppCountBuffer; const ze_group_count_t** ppLaunchArgumentsBuffer; ze_event_handle_t* phSignalEvent; uint32_t* pnumWaitEvents; ze_event_handle_t** pphWaitEvents; } ze_command_list_append_launch_multiple_kernels_indirect_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeCommandListAppendLaunchMultipleKernelsIndirect /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnCommandListAppendLaunchMultipleKernelsIndirectCb_t)( ze_command_list_append_launch_multiple_kernels_indirect_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of CommandList callback functions pointers typedef struct _ze_command_list_callbacks_t { ze_pfnCommandListCreateCb_t pfnCreateCb; ze_pfnCommandListCreateImmediateCb_t pfnCreateImmediateCb; ze_pfnCommandListDestroyCb_t pfnDestroyCb; ze_pfnCommandListCloseCb_t pfnCloseCb; ze_pfnCommandListResetCb_t pfnResetCb; ze_pfnCommandListAppendWriteGlobalTimestampCb_t pfnAppendWriteGlobalTimestampCb; ze_pfnCommandListAppendBarrierCb_t pfnAppendBarrierCb; ze_pfnCommandListAppendMemoryRangesBarrierCb_t pfnAppendMemoryRangesBarrierCb; ze_pfnCommandListAppendMemoryCopyCb_t pfnAppendMemoryCopyCb; ze_pfnCommandListAppendMemoryFillCb_t pfnAppendMemoryFillCb; ze_pfnCommandListAppendMemoryCopyRegionCb_t pfnAppendMemoryCopyRegionCb; ze_pfnCommandListAppendMemoryCopyFromContextCb_t pfnAppendMemoryCopyFromContextCb; ze_pfnCommandListAppendImageCopyCb_t pfnAppendImageCopyCb; ze_pfnCommandListAppendImageCopyRegionCb_t pfnAppendImageCopyRegionCb; ze_pfnCommandListAppendImageCopyToMemoryCb_t pfnAppendImageCopyToMemoryCb; ze_pfnCommandListAppendImageCopyFromMemoryCb_t pfnAppendImageCopyFromMemoryCb; ze_pfnCommandListAppendMemoryPrefetchCb_t pfnAppendMemoryPrefetchCb; ze_pfnCommandListAppendMemAdviseCb_t pfnAppendMemAdviseCb; ze_pfnCommandListAppendSignalEventCb_t pfnAppendSignalEventCb; ze_pfnCommandListAppendWaitOnEventsCb_t pfnAppendWaitOnEventsCb; ze_pfnCommandListAppendEventResetCb_t pfnAppendEventResetCb; ze_pfnCommandListAppendQueryKernelTimestampsCb_t pfnAppendQueryKernelTimestampsCb; ze_pfnCommandListAppendLaunchKernelCb_t pfnAppendLaunchKernelCb; ze_pfnCommandListAppendLaunchCooperativeKernelCb_t pfnAppendLaunchCooperativeKernelCb; ze_pfnCommandListAppendLaunchKernelIndirectCb_t pfnAppendLaunchKernelIndirectCb; ze_pfnCommandListAppendLaunchMultipleKernelsIndirectCb_t pfnAppendLaunchMultipleKernelsIndirectCb; } ze_command_list_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeImageGetProperties /// @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 _ze_image_get_properties_params_t { ze_device_handle_t* phDevice; const ze_image_desc_t** pdesc; ze_image_properties_t** ppImageProperties; } ze_image_get_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeImageGetProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnImageGetPropertiesCb_t)( ze_image_get_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeImageCreate /// @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 _ze_image_create_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; const ze_image_desc_t** pdesc; ze_image_handle_t** pphImage; } ze_image_create_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeImageCreate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnImageCreateCb_t)( ze_image_create_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeImageDestroy /// @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 _ze_image_destroy_params_t { ze_image_handle_t* phImage; } ze_image_destroy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeImageDestroy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnImageDestroyCb_t)( ze_image_destroy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Image callback functions pointers typedef struct _ze_image_callbacks_t { ze_pfnImageGetPropertiesCb_t pfnGetPropertiesCb; ze_pfnImageCreateCb_t pfnCreateCb; ze_pfnImageDestroyCb_t pfnDestroyCb; } ze_image_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemAllocShared /// @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 _ze_mem_alloc_shared_params_t { ze_context_handle_t* phContext; const ze_device_mem_alloc_desc_t** pdevice_desc; const ze_host_mem_alloc_desc_t** phost_desc; size_t* psize; size_t* palignment; ze_device_handle_t* phDevice; void*** ppptr; } ze_mem_alloc_shared_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemAllocShared /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemAllocSharedCb_t)( ze_mem_alloc_shared_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemAllocDevice /// @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 _ze_mem_alloc_device_params_t { ze_context_handle_t* phContext; const ze_device_mem_alloc_desc_t** pdevice_desc; size_t* psize; size_t* palignment; ze_device_handle_t* phDevice; void*** ppptr; } ze_mem_alloc_device_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemAllocDevice /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemAllocDeviceCb_t)( ze_mem_alloc_device_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemAllocHost /// @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 _ze_mem_alloc_host_params_t { ze_context_handle_t* phContext; const ze_host_mem_alloc_desc_t** phost_desc; size_t* psize; size_t* palignment; void*** ppptr; } ze_mem_alloc_host_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemAllocHost /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemAllocHostCb_t)( ze_mem_alloc_host_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemFree /// @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 _ze_mem_free_params_t { ze_context_handle_t* phContext; void** pptr; } ze_mem_free_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemFree /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemFreeCb_t)( ze_mem_free_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemGetAllocProperties /// @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 _ze_mem_get_alloc_properties_params_t { ze_context_handle_t* phContext; const void** pptr; ze_memory_allocation_properties_t** ppMemAllocProperties; ze_device_handle_t** pphDevice; } ze_mem_get_alloc_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemGetAllocProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemGetAllocPropertiesCb_t)( ze_mem_get_alloc_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemGetAddressRange /// @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 _ze_mem_get_address_range_params_t { ze_context_handle_t* phContext; const void** pptr; void*** ppBase; size_t** ppSize; } ze_mem_get_address_range_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemGetAddressRange /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemGetAddressRangeCb_t)( ze_mem_get_address_range_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemGetIpcHandle /// @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 _ze_mem_get_ipc_handle_params_t { ze_context_handle_t* phContext; const void** pptr; ze_ipc_mem_handle_t** ppIpcHandle; } ze_mem_get_ipc_handle_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemGetIpcHandle /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemGetIpcHandleCb_t)( ze_mem_get_ipc_handle_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemOpenIpcHandle /// @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 _ze_mem_open_ipc_handle_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; ze_ipc_mem_handle_t* phandle; ze_ipc_memory_flags_t* pflags; void*** ppptr; } ze_mem_open_ipc_handle_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemOpenIpcHandle /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemOpenIpcHandleCb_t)( ze_mem_open_ipc_handle_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeMemCloseIpcHandle /// @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 _ze_mem_close_ipc_handle_params_t { ze_context_handle_t* phContext; const void** pptr; } ze_mem_close_ipc_handle_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeMemCloseIpcHandle /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnMemCloseIpcHandleCb_t)( ze_mem_close_ipc_handle_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Mem callback functions pointers typedef struct _ze_mem_callbacks_t { ze_pfnMemAllocSharedCb_t pfnAllocSharedCb; ze_pfnMemAllocDeviceCb_t pfnAllocDeviceCb; ze_pfnMemAllocHostCb_t pfnAllocHostCb; ze_pfnMemFreeCb_t pfnFreeCb; ze_pfnMemGetAllocPropertiesCb_t pfnGetAllocPropertiesCb; ze_pfnMemGetAddressRangeCb_t pfnGetAddressRangeCb; ze_pfnMemGetIpcHandleCb_t pfnGetIpcHandleCb; ze_pfnMemOpenIpcHandleCb_t pfnOpenIpcHandleCb; ze_pfnMemCloseIpcHandleCb_t pfnCloseIpcHandleCb; } ze_mem_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeFenceCreate /// @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 _ze_fence_create_params_t { ze_command_queue_handle_t* phCommandQueue; const ze_fence_desc_t** pdesc; ze_fence_handle_t** pphFence; } ze_fence_create_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeFenceCreate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnFenceCreateCb_t)( ze_fence_create_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeFenceDestroy /// @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 _ze_fence_destroy_params_t { ze_fence_handle_t* phFence; } ze_fence_destroy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeFenceDestroy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnFenceDestroyCb_t)( ze_fence_destroy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeFenceHostSynchronize /// @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 _ze_fence_host_synchronize_params_t { ze_fence_handle_t* phFence; uint64_t* ptimeout; } ze_fence_host_synchronize_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeFenceHostSynchronize /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnFenceHostSynchronizeCb_t)( ze_fence_host_synchronize_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeFenceQueryStatus /// @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 _ze_fence_query_status_params_t { ze_fence_handle_t* phFence; } ze_fence_query_status_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeFenceQueryStatus /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnFenceQueryStatusCb_t)( ze_fence_query_status_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeFenceReset /// @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 _ze_fence_reset_params_t { ze_fence_handle_t* phFence; } ze_fence_reset_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeFenceReset /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnFenceResetCb_t)( ze_fence_reset_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Fence callback functions pointers typedef struct _ze_fence_callbacks_t { ze_pfnFenceCreateCb_t pfnCreateCb; ze_pfnFenceDestroyCb_t pfnDestroyCb; ze_pfnFenceHostSynchronizeCb_t pfnHostSynchronizeCb; ze_pfnFenceQueryStatusCb_t pfnQueryStatusCb; ze_pfnFenceResetCb_t pfnResetCb; } ze_fence_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventPoolCreate /// @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 _ze_event_pool_create_params_t { ze_context_handle_t* phContext; const ze_event_pool_desc_t** pdesc; uint32_t* pnumDevices; ze_device_handle_t** pphDevices; ze_event_pool_handle_t** pphEventPool; } ze_event_pool_create_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventPoolCreate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventPoolCreateCb_t)( ze_event_pool_create_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventPoolDestroy /// @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 _ze_event_pool_destroy_params_t { ze_event_pool_handle_t* phEventPool; } ze_event_pool_destroy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventPoolDestroy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventPoolDestroyCb_t)( ze_event_pool_destroy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventPoolGetIpcHandle /// @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 _ze_event_pool_get_ipc_handle_params_t { ze_event_pool_handle_t* phEventPool; ze_ipc_event_pool_handle_t** pphIpc; } ze_event_pool_get_ipc_handle_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventPoolGetIpcHandle /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventPoolGetIpcHandleCb_t)( ze_event_pool_get_ipc_handle_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventPoolOpenIpcHandle /// @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 _ze_event_pool_open_ipc_handle_params_t { ze_context_handle_t* phContext; ze_ipc_event_pool_handle_t* phIpc; ze_event_pool_handle_t** pphEventPool; } ze_event_pool_open_ipc_handle_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventPoolOpenIpcHandle /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventPoolOpenIpcHandleCb_t)( ze_event_pool_open_ipc_handle_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventPoolCloseIpcHandle /// @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 _ze_event_pool_close_ipc_handle_params_t { ze_event_pool_handle_t* phEventPool; } ze_event_pool_close_ipc_handle_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventPoolCloseIpcHandle /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventPoolCloseIpcHandleCb_t)( ze_event_pool_close_ipc_handle_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of EventPool callback functions pointers typedef struct _ze_event_pool_callbacks_t { ze_pfnEventPoolCreateCb_t pfnCreateCb; ze_pfnEventPoolDestroyCb_t pfnDestroyCb; ze_pfnEventPoolGetIpcHandleCb_t pfnGetIpcHandleCb; ze_pfnEventPoolOpenIpcHandleCb_t pfnOpenIpcHandleCb; ze_pfnEventPoolCloseIpcHandleCb_t pfnCloseIpcHandleCb; } ze_event_pool_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventCreate /// @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 _ze_event_create_params_t { ze_event_pool_handle_t* phEventPool; const ze_event_desc_t** pdesc; ze_event_handle_t** pphEvent; } ze_event_create_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventCreate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventCreateCb_t)( ze_event_create_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventDestroy /// @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 _ze_event_destroy_params_t { ze_event_handle_t* phEvent; } ze_event_destroy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventDestroy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventDestroyCb_t)( ze_event_destroy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventHostSignal /// @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 _ze_event_host_signal_params_t { ze_event_handle_t* phEvent; } ze_event_host_signal_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventHostSignal /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventHostSignalCb_t)( ze_event_host_signal_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventHostSynchronize /// @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 _ze_event_host_synchronize_params_t { ze_event_handle_t* phEvent; uint64_t* ptimeout; } ze_event_host_synchronize_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventHostSynchronize /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventHostSynchronizeCb_t)( ze_event_host_synchronize_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventQueryStatus /// @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 _ze_event_query_status_params_t { ze_event_handle_t* phEvent; } ze_event_query_status_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventQueryStatus /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventQueryStatusCb_t)( ze_event_query_status_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventHostReset /// @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 _ze_event_host_reset_params_t { ze_event_handle_t* phEvent; } ze_event_host_reset_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventHostReset /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventHostResetCb_t)( ze_event_host_reset_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeEventQueryKernelTimestamp /// @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 _ze_event_query_kernel_timestamp_params_t { ze_event_handle_t* phEvent; ze_kernel_timestamp_result_t** pdstptr; } ze_event_query_kernel_timestamp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeEventQueryKernelTimestamp /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnEventQueryKernelTimestampCb_t)( ze_event_query_kernel_timestamp_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Event callback functions pointers typedef struct _ze_event_callbacks_t { ze_pfnEventCreateCb_t pfnCreateCb; ze_pfnEventDestroyCb_t pfnDestroyCb; ze_pfnEventHostSignalCb_t pfnHostSignalCb; ze_pfnEventHostSynchronizeCb_t pfnHostSynchronizeCb; ze_pfnEventQueryStatusCb_t pfnQueryStatusCb; ze_pfnEventHostResetCb_t pfnHostResetCb; ze_pfnEventQueryKernelTimestampCb_t pfnQueryKernelTimestampCb; } ze_event_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeModuleCreate /// @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 _ze_module_create_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; const ze_module_desc_t** pdesc; ze_module_handle_t** pphModule; ze_module_build_log_handle_t** pphBuildLog; } ze_module_create_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeModuleCreate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnModuleCreateCb_t)( ze_module_create_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeModuleDestroy /// @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 _ze_module_destroy_params_t { ze_module_handle_t* phModule; } ze_module_destroy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeModuleDestroy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnModuleDestroyCb_t)( ze_module_destroy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeModuleDynamicLink /// @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 _ze_module_dynamic_link_params_t { uint32_t* pnumModules; ze_module_handle_t** pphModules; ze_module_build_log_handle_t** pphLinkLog; } ze_module_dynamic_link_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeModuleDynamicLink /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnModuleDynamicLinkCb_t)( ze_module_dynamic_link_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeModuleGetNativeBinary /// @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 _ze_module_get_native_binary_params_t { ze_module_handle_t* phModule; size_t** ppSize; uint8_t** ppModuleNativeBinary; } ze_module_get_native_binary_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeModuleGetNativeBinary /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnModuleGetNativeBinaryCb_t)( ze_module_get_native_binary_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeModuleGetGlobalPointer /// @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 _ze_module_get_global_pointer_params_t { ze_module_handle_t* phModule; const char** ppGlobalName; size_t** ppSize; void*** ppptr; } ze_module_get_global_pointer_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeModuleGetGlobalPointer /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnModuleGetGlobalPointerCb_t)( ze_module_get_global_pointer_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeModuleGetKernelNames /// @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 _ze_module_get_kernel_names_params_t { ze_module_handle_t* phModule; uint32_t** ppCount; const char*** ppNames; } ze_module_get_kernel_names_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeModuleGetKernelNames /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnModuleGetKernelNamesCb_t)( ze_module_get_kernel_names_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeModuleGetProperties /// @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 _ze_module_get_properties_params_t { ze_module_handle_t* phModule; ze_module_properties_t** ppModuleProperties; } ze_module_get_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeModuleGetProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnModuleGetPropertiesCb_t)( ze_module_get_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeModuleGetFunctionPointer /// @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 _ze_module_get_function_pointer_params_t { ze_module_handle_t* phModule; const char** ppFunctionName; void*** ppfnFunction; } ze_module_get_function_pointer_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeModuleGetFunctionPointer /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnModuleGetFunctionPointerCb_t)( ze_module_get_function_pointer_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Module callback functions pointers typedef struct _ze_module_callbacks_t { ze_pfnModuleCreateCb_t pfnCreateCb; ze_pfnModuleDestroyCb_t pfnDestroyCb; ze_pfnModuleDynamicLinkCb_t pfnDynamicLinkCb; ze_pfnModuleGetNativeBinaryCb_t pfnGetNativeBinaryCb; ze_pfnModuleGetGlobalPointerCb_t pfnGetGlobalPointerCb; ze_pfnModuleGetKernelNamesCb_t pfnGetKernelNamesCb; ze_pfnModuleGetPropertiesCb_t pfnGetPropertiesCb; ze_pfnModuleGetFunctionPointerCb_t pfnGetFunctionPointerCb; } ze_module_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeModuleBuildLogDestroy /// @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 _ze_module_build_log_destroy_params_t { ze_module_build_log_handle_t* phModuleBuildLog; } ze_module_build_log_destroy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeModuleBuildLogDestroy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnModuleBuildLogDestroyCb_t)( ze_module_build_log_destroy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeModuleBuildLogGetString /// @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 _ze_module_build_log_get_string_params_t { ze_module_build_log_handle_t* phModuleBuildLog; size_t** ppSize; char** ppBuildLog; } ze_module_build_log_get_string_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeModuleBuildLogGetString /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnModuleBuildLogGetStringCb_t)( ze_module_build_log_get_string_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of ModuleBuildLog callback functions pointers typedef struct _ze_module_build_log_callbacks_t { ze_pfnModuleBuildLogDestroyCb_t pfnDestroyCb; ze_pfnModuleBuildLogGetStringCb_t pfnGetStringCb; } ze_module_build_log_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelCreate /// @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 _ze_kernel_create_params_t { ze_module_handle_t* phModule; const ze_kernel_desc_t** pdesc; ze_kernel_handle_t** pphKernel; } ze_kernel_create_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelCreate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelCreateCb_t)( ze_kernel_create_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelDestroy /// @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 _ze_kernel_destroy_params_t { ze_kernel_handle_t* phKernel; } ze_kernel_destroy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelDestroy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelDestroyCb_t)( ze_kernel_destroy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelSetCacheConfig /// @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 _ze_kernel_set_cache_config_params_t { ze_kernel_handle_t* phKernel; ze_cache_config_flags_t* pflags; } ze_kernel_set_cache_config_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelSetCacheConfig /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelSetCacheConfigCb_t)( ze_kernel_set_cache_config_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelSetGroupSize /// @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 _ze_kernel_set_group_size_params_t { ze_kernel_handle_t* phKernel; uint32_t* pgroupSizeX; uint32_t* pgroupSizeY; uint32_t* pgroupSizeZ; } ze_kernel_set_group_size_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelSetGroupSize /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelSetGroupSizeCb_t)( ze_kernel_set_group_size_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelSuggestGroupSize /// @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 _ze_kernel_suggest_group_size_params_t { ze_kernel_handle_t* phKernel; uint32_t* pglobalSizeX; uint32_t* pglobalSizeY; uint32_t* pglobalSizeZ; uint32_t** pgroupSizeX; uint32_t** pgroupSizeY; uint32_t** pgroupSizeZ; } ze_kernel_suggest_group_size_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelSuggestGroupSize /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelSuggestGroupSizeCb_t)( ze_kernel_suggest_group_size_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelSuggestMaxCooperativeGroupCount /// @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 _ze_kernel_suggest_max_cooperative_group_count_params_t { ze_kernel_handle_t* phKernel; uint32_t** ptotalGroupCount; } ze_kernel_suggest_max_cooperative_group_count_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelSuggestMaxCooperativeGroupCount /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelSuggestMaxCooperativeGroupCountCb_t)( ze_kernel_suggest_max_cooperative_group_count_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelSetArgumentValue /// @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 _ze_kernel_set_argument_value_params_t { ze_kernel_handle_t* phKernel; uint32_t* pargIndex; size_t* pargSize; const void** ppArgValue; } ze_kernel_set_argument_value_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelSetArgumentValue /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelSetArgumentValueCb_t)( ze_kernel_set_argument_value_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelSetIndirectAccess /// @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 _ze_kernel_set_indirect_access_params_t { ze_kernel_handle_t* phKernel; ze_kernel_indirect_access_flags_t* pflags; } ze_kernel_set_indirect_access_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelSetIndirectAccess /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelSetIndirectAccessCb_t)( ze_kernel_set_indirect_access_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelGetIndirectAccess /// @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 _ze_kernel_get_indirect_access_params_t { ze_kernel_handle_t* phKernel; ze_kernel_indirect_access_flags_t** ppFlags; } ze_kernel_get_indirect_access_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelGetIndirectAccess /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelGetIndirectAccessCb_t)( ze_kernel_get_indirect_access_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelGetSourceAttributes /// @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 _ze_kernel_get_source_attributes_params_t { ze_kernel_handle_t* phKernel; uint32_t** ppSize; char*** ppString; } ze_kernel_get_source_attributes_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelGetSourceAttributes /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelGetSourceAttributesCb_t)( ze_kernel_get_source_attributes_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelGetProperties /// @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 _ze_kernel_get_properties_params_t { ze_kernel_handle_t* phKernel; ze_kernel_properties_t** ppKernelProperties; } ze_kernel_get_properties_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelGetProperties /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelGetPropertiesCb_t)( ze_kernel_get_properties_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeKernelGetName /// @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 _ze_kernel_get_name_params_t { ze_kernel_handle_t* phKernel; size_t** ppSize; char** ppName; } ze_kernel_get_name_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeKernelGetName /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnKernelGetNameCb_t)( ze_kernel_get_name_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Kernel callback functions pointers typedef struct _ze_kernel_callbacks_t { ze_pfnKernelCreateCb_t pfnCreateCb; ze_pfnKernelDestroyCb_t pfnDestroyCb; ze_pfnKernelSetCacheConfigCb_t pfnSetCacheConfigCb; ze_pfnKernelSetGroupSizeCb_t pfnSetGroupSizeCb; ze_pfnKernelSuggestGroupSizeCb_t pfnSuggestGroupSizeCb; ze_pfnKernelSuggestMaxCooperativeGroupCountCb_t pfnSuggestMaxCooperativeGroupCountCb; ze_pfnKernelSetArgumentValueCb_t pfnSetArgumentValueCb; ze_pfnKernelSetIndirectAccessCb_t pfnSetIndirectAccessCb; ze_pfnKernelGetIndirectAccessCb_t pfnGetIndirectAccessCb; ze_pfnKernelGetSourceAttributesCb_t pfnGetSourceAttributesCb; ze_pfnKernelGetPropertiesCb_t pfnGetPropertiesCb; ze_pfnKernelGetNameCb_t pfnGetNameCb; } ze_kernel_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeSamplerCreate /// @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 _ze_sampler_create_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; const ze_sampler_desc_t** pdesc; ze_sampler_handle_t** pphSampler; } ze_sampler_create_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeSamplerCreate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnSamplerCreateCb_t)( ze_sampler_create_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeSamplerDestroy /// @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 _ze_sampler_destroy_params_t { ze_sampler_handle_t* phSampler; } ze_sampler_destroy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeSamplerDestroy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnSamplerDestroyCb_t)( ze_sampler_destroy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Sampler callback functions pointers typedef struct _ze_sampler_callbacks_t { ze_pfnSamplerCreateCb_t pfnCreateCb; ze_pfnSamplerDestroyCb_t pfnDestroyCb; } ze_sampler_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zePhysicalMemCreate /// @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 _ze_physical_mem_create_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; ze_physical_mem_desc_t** pdesc; ze_physical_mem_handle_t** pphPhysicalMemory; } ze_physical_mem_create_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zePhysicalMemCreate /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnPhysicalMemCreateCb_t)( ze_physical_mem_create_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zePhysicalMemDestroy /// @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 _ze_physical_mem_destroy_params_t { ze_context_handle_t* phContext; ze_physical_mem_handle_t* phPhysicalMemory; } ze_physical_mem_destroy_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zePhysicalMemDestroy /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnPhysicalMemDestroyCb_t)( ze_physical_mem_destroy_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of PhysicalMem callback functions pointers typedef struct _ze_physical_mem_callbacks_t { ze_pfnPhysicalMemCreateCb_t pfnCreateCb; ze_pfnPhysicalMemDestroyCb_t pfnDestroyCb; } ze_physical_mem_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeVirtualMemReserve /// @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 _ze_virtual_mem_reserve_params_t { ze_context_handle_t* phContext; const void** ppStart; size_t* psize; void*** ppptr; } ze_virtual_mem_reserve_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeVirtualMemReserve /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnVirtualMemReserveCb_t)( ze_virtual_mem_reserve_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeVirtualMemFree /// @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 _ze_virtual_mem_free_params_t { ze_context_handle_t* phContext; const void** pptr; size_t* psize; } ze_virtual_mem_free_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeVirtualMemFree /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnVirtualMemFreeCb_t)( ze_virtual_mem_free_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeVirtualMemQueryPageSize /// @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 _ze_virtual_mem_query_page_size_params_t { ze_context_handle_t* phContext; ze_device_handle_t* phDevice; size_t* psize; size_t** ppagesize; } ze_virtual_mem_query_page_size_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeVirtualMemQueryPageSize /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnVirtualMemQueryPageSizeCb_t)( ze_virtual_mem_query_page_size_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeVirtualMemMap /// @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 _ze_virtual_mem_map_params_t { ze_context_handle_t* phContext; const void** pptr; size_t* psize; ze_physical_mem_handle_t* phPhysicalMemory; size_t* poffset; ze_memory_access_attribute_t* paccess; } ze_virtual_mem_map_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeVirtualMemMap /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnVirtualMemMapCb_t)( ze_virtual_mem_map_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeVirtualMemUnmap /// @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 _ze_virtual_mem_unmap_params_t { ze_context_handle_t* phContext; const void** pptr; size_t* psize; } ze_virtual_mem_unmap_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeVirtualMemUnmap /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnVirtualMemUnmapCb_t)( ze_virtual_mem_unmap_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeVirtualMemSetAccessAttribute /// @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 _ze_virtual_mem_set_access_attribute_params_t { ze_context_handle_t* phContext; const void** pptr; size_t* psize; ze_memory_access_attribute_t* paccess; } ze_virtual_mem_set_access_attribute_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeVirtualMemSetAccessAttribute /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnVirtualMemSetAccessAttributeCb_t)( ze_virtual_mem_set_access_attribute_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for zeVirtualMemGetAccessAttribute /// @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 _ze_virtual_mem_get_access_attribute_params_t { ze_context_handle_t* phContext; const void** pptr; size_t* psize; ze_memory_access_attribute_t** paccess; size_t** poutSize; } ze_virtual_mem_get_access_attribute_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for zeVirtualMemGetAccessAttribute /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (ZE_APICALL *ze_pfnVirtualMemGetAccessAttributeCb_t)( ze_virtual_mem_get_access_attribute_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of VirtualMem callback functions pointers typedef struct _ze_virtual_mem_callbacks_t { ze_pfnVirtualMemReserveCb_t pfnReserveCb; ze_pfnVirtualMemFreeCb_t pfnFreeCb; ze_pfnVirtualMemQueryPageSizeCb_t pfnQueryPageSizeCb; ze_pfnVirtualMemMapCb_t pfnMapCb; ze_pfnVirtualMemUnmapCb_t pfnUnmapCb; ze_pfnVirtualMemSetAccessAttributeCb_t pfnSetAccessAttributeCb; ze_pfnVirtualMemGetAccessAttributeCb_t pfnGetAccessAttributeCb; } ze_virtual_mem_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Container for all callbacks typedef struct _ze_callbacks_t { ze_global_callbacks_t Global; ze_driver_callbacks_t Driver; ze_device_callbacks_t Device; ze_context_callbacks_t Context; ze_command_queue_callbacks_t CommandQueue; ze_command_list_callbacks_t CommandList; ze_fence_callbacks_t Fence; ze_event_pool_callbacks_t EventPool; ze_event_callbacks_t Event; ze_image_callbacks_t Image; ze_module_callbacks_t Module; ze_module_build_log_callbacks_t ModuleBuildLog; ze_kernel_callbacks_t Kernel; ze_sampler_callbacks_t Sampler; ze_physical_mem_callbacks_t PhysicalMem; ze_mem_callbacks_t Mem; ze_virtual_mem_callbacks_t VirtualMem; } ze_callbacks_t; #if !defined(__GNUC__) #pragma endregion #endif #if defined(__cplusplus) } // extern "C" #endif #endif // _ZE_API_Hlevel-zero-1.20.6/include/ze_ddi.h000066400000000000000000003232731475521542100167360ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_ddi.h * @version v1.12-r1.12.15 * */ #ifndef _ZE_DDI_H #define _ZE_DDI_H #if defined(__cplusplus) #pragma once #endif #include "ze_api.h" #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeRTASBuilderCreateExp typedef ze_result_t (ZE_APICALL *ze_pfnRTASBuilderCreateExp_t)( ze_driver_handle_t, const ze_rtas_builder_exp_desc_t*, ze_rtas_builder_exp_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeRTASBuilderGetBuildPropertiesExp typedef ze_result_t (ZE_APICALL *ze_pfnRTASBuilderGetBuildPropertiesExp_t)( ze_rtas_builder_exp_handle_t, const ze_rtas_builder_build_op_exp_desc_t*, ze_rtas_builder_exp_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeRTASBuilderBuildExp typedef ze_result_t (ZE_APICALL *ze_pfnRTASBuilderBuildExp_t)( ze_rtas_builder_exp_handle_t, const ze_rtas_builder_build_op_exp_desc_t*, void*, size_t, void*, size_t, ze_rtas_parallel_operation_exp_handle_t, void*, ze_rtas_aabb_exp_t*, size_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeRTASBuilderDestroyExp typedef ze_result_t (ZE_APICALL *ze_pfnRTASBuilderDestroyExp_t)( ze_rtas_builder_exp_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of RTASBuilderExp functions pointers typedef struct _ze_rtas_builder_exp_dditable_t { ze_pfnRTASBuilderCreateExp_t pfnCreateExp; ze_pfnRTASBuilderGetBuildPropertiesExp_t pfnGetBuildPropertiesExp; ze_pfnRTASBuilderBuildExp_t pfnBuildExp; ze_pfnRTASBuilderDestroyExp_t pfnDestroyExp; } ze_rtas_builder_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASBuilderExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetRTASBuilderExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_rtas_builder_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetRTASBuilderExpProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetRTASBuilderExpProcAddrTable_t)( ze_api_version_t, ze_rtas_builder_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeRTASParallelOperationCreateExp typedef ze_result_t (ZE_APICALL *ze_pfnRTASParallelOperationCreateExp_t)( ze_driver_handle_t, ze_rtas_parallel_operation_exp_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeRTASParallelOperationGetPropertiesExp typedef ze_result_t (ZE_APICALL *ze_pfnRTASParallelOperationGetPropertiesExp_t)( ze_rtas_parallel_operation_exp_handle_t, ze_rtas_parallel_operation_exp_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeRTASParallelOperationJoinExp typedef ze_result_t (ZE_APICALL *ze_pfnRTASParallelOperationJoinExp_t)( ze_rtas_parallel_operation_exp_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeRTASParallelOperationDestroyExp typedef ze_result_t (ZE_APICALL *ze_pfnRTASParallelOperationDestroyExp_t)( ze_rtas_parallel_operation_exp_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of RTASParallelOperationExp functions pointers typedef struct _ze_rtas_parallel_operation_exp_dditable_t { ze_pfnRTASParallelOperationCreateExp_t pfnCreateExp; ze_pfnRTASParallelOperationGetPropertiesExp_t pfnGetPropertiesExp; ze_pfnRTASParallelOperationJoinExp_t pfnJoinExp; ze_pfnRTASParallelOperationDestroyExp_t pfnDestroyExp; } ze_rtas_parallel_operation_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASParallelOperationExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetRTASParallelOperationExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_rtas_parallel_operation_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetRTASParallelOperationExpProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetRTASParallelOperationExpProcAddrTable_t)( ze_api_version_t, ze_rtas_parallel_operation_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeInit typedef ze_result_t (ZE_APICALL *ze_pfnInit_t)( ze_init_flags_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeInitDrivers typedef ze_result_t (ZE_APICALL *ze_pfnInitDrivers_t)( uint32_t*, ze_driver_handle_t*, ze_init_driver_type_desc_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Global functions pointers typedef struct _ze_global_dditable_t { ze_pfnInit_t pfnInit; ze_pfnInitDrivers_t pfnInitDrivers; } ze_global_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Global table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetGlobalProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_global_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetGlobalProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetGlobalProcAddrTable_t)( ze_api_version_t, ze_global_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDriverGet typedef ze_result_t (ZE_APICALL *ze_pfnDriverGet_t)( uint32_t*, ze_driver_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDriverGetApiVersion typedef ze_result_t (ZE_APICALL *ze_pfnDriverGetApiVersion_t)( ze_driver_handle_t, ze_api_version_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDriverGetProperties typedef ze_result_t (ZE_APICALL *ze_pfnDriverGetProperties_t)( ze_driver_handle_t, ze_driver_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDriverGetIpcProperties typedef ze_result_t (ZE_APICALL *ze_pfnDriverGetIpcProperties_t)( ze_driver_handle_t, ze_driver_ipc_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDriverGetExtensionProperties typedef ze_result_t (ZE_APICALL *ze_pfnDriverGetExtensionProperties_t)( ze_driver_handle_t, uint32_t*, ze_driver_extension_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDriverGetExtensionFunctionAddress typedef ze_result_t (ZE_APICALL *ze_pfnDriverGetExtensionFunctionAddress_t)( ze_driver_handle_t, const char*, void** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDriverGetLastErrorDescription typedef ze_result_t (ZE_APICALL *ze_pfnDriverGetLastErrorDescription_t)( ze_driver_handle_t, const char** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Driver functions pointers typedef struct _ze_driver_dditable_t { ze_pfnDriverGet_t pfnGet; ze_pfnDriverGetApiVersion_t pfnGetApiVersion; ze_pfnDriverGetProperties_t pfnGetProperties; ze_pfnDriverGetIpcProperties_t pfnGetIpcProperties; ze_pfnDriverGetExtensionProperties_t pfnGetExtensionProperties; ze_pfnDriverGetExtensionFunctionAddress_t pfnGetExtensionFunctionAddress; ze_pfnDriverGetLastErrorDescription_t pfnGetLastErrorDescription; } ze_driver_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Driver table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDriverProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_driver_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetDriverProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetDriverProcAddrTable_t)( ze_api_version_t, ze_driver_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDriverRTASFormatCompatibilityCheckExp typedef ze_result_t (ZE_APICALL *ze_pfnDriverRTASFormatCompatibilityCheckExp_t)( ze_driver_handle_t, ze_rtas_format_exp_t, ze_rtas_format_exp_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of DriverExp functions pointers typedef struct _ze_driver_exp_dditable_t { ze_pfnDriverRTASFormatCompatibilityCheckExp_t pfnRTASFormatCompatibilityCheckExp; } ze_driver_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DriverExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDriverExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_driver_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetDriverExpProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetDriverExpProcAddrTable_t)( ze_api_version_t, ze_driver_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGet typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGet_t)( ze_driver_handle_t, uint32_t*, ze_device_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetSubDevices typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetSubDevices_t)( ze_device_handle_t, uint32_t*, ze_device_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetProperties typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetProperties_t)( ze_device_handle_t, ze_device_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetComputeProperties typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetComputeProperties_t)( ze_device_handle_t, ze_device_compute_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetModuleProperties typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetModuleProperties_t)( ze_device_handle_t, ze_device_module_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetCommandQueueGroupProperties typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetCommandQueueGroupProperties_t)( ze_device_handle_t, uint32_t*, ze_command_queue_group_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetMemoryProperties typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetMemoryProperties_t)( ze_device_handle_t, uint32_t*, ze_device_memory_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetMemoryAccessProperties typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetMemoryAccessProperties_t)( ze_device_handle_t, ze_device_memory_access_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetCacheProperties typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetCacheProperties_t)( ze_device_handle_t, uint32_t*, ze_device_cache_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetImageProperties typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetImageProperties_t)( ze_device_handle_t, ze_device_image_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetExternalMemoryProperties typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetExternalMemoryProperties_t)( ze_device_handle_t, ze_device_external_memory_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetP2PProperties typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetP2PProperties_t)( ze_device_handle_t, ze_device_handle_t, ze_device_p2p_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceCanAccessPeer typedef ze_result_t (ZE_APICALL *ze_pfnDeviceCanAccessPeer_t)( ze_device_handle_t, ze_device_handle_t, ze_bool_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetStatus typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetStatus_t)( ze_device_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetGlobalTimestamps typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetGlobalTimestamps_t)( ze_device_handle_t, uint64_t*, uint64_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceReserveCacheExt typedef ze_result_t (ZE_APICALL *ze_pfnDeviceReserveCacheExt_t)( ze_device_handle_t, size_t, size_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceSetCacheAdviceExt typedef ze_result_t (ZE_APICALL *ze_pfnDeviceSetCacheAdviceExt_t)( ze_device_handle_t, void*, size_t, ze_cache_ext_region_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDevicePciGetPropertiesExt typedef ze_result_t (ZE_APICALL *ze_pfnDevicePciGetPropertiesExt_t)( ze_device_handle_t, ze_pci_ext_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetRootDevice typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetRootDevice_t)( ze_device_handle_t, ze_device_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceImportExternalSemaphoreExt typedef ze_result_t (ZE_APICALL *ze_pfnDeviceImportExternalSemaphoreExt_t)( ze_device_handle_t, const ze_external_semaphore_ext_desc_t*, ze_external_semaphore_ext_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceReleaseExternalSemaphoreExt typedef ze_result_t (ZE_APICALL *ze_pfnDeviceReleaseExternalSemaphoreExt_t)( ze_external_semaphore_ext_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Device functions pointers typedef struct _ze_device_dditable_t { ze_pfnDeviceGet_t pfnGet; ze_pfnDeviceGetSubDevices_t pfnGetSubDevices; ze_pfnDeviceGetProperties_t pfnGetProperties; ze_pfnDeviceGetComputeProperties_t pfnGetComputeProperties; ze_pfnDeviceGetModuleProperties_t pfnGetModuleProperties; ze_pfnDeviceGetCommandQueueGroupProperties_t pfnGetCommandQueueGroupProperties; ze_pfnDeviceGetMemoryProperties_t pfnGetMemoryProperties; ze_pfnDeviceGetMemoryAccessProperties_t pfnGetMemoryAccessProperties; ze_pfnDeviceGetCacheProperties_t pfnGetCacheProperties; ze_pfnDeviceGetImageProperties_t pfnGetImageProperties; ze_pfnDeviceGetExternalMemoryProperties_t pfnGetExternalMemoryProperties; ze_pfnDeviceGetP2PProperties_t pfnGetP2PProperties; ze_pfnDeviceCanAccessPeer_t pfnCanAccessPeer; ze_pfnDeviceGetStatus_t pfnGetStatus; ze_pfnDeviceGetGlobalTimestamps_t pfnGetGlobalTimestamps; ze_pfnDeviceReserveCacheExt_t pfnReserveCacheExt; ze_pfnDeviceSetCacheAdviceExt_t pfnSetCacheAdviceExt; ze_pfnDevicePciGetPropertiesExt_t pfnPciGetPropertiesExt; ze_pfnDeviceGetRootDevice_t pfnGetRootDevice; ze_pfnDeviceImportExternalSemaphoreExt_t pfnImportExternalSemaphoreExt; ze_pfnDeviceReleaseExternalSemaphoreExt_t pfnReleaseExternalSemaphoreExt; } ze_device_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetDeviceProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetDeviceProcAddrTable_t)( ze_api_version_t, ze_device_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeDeviceGetFabricVertexExp typedef ze_result_t (ZE_APICALL *ze_pfnDeviceGetFabricVertexExp_t)( ze_device_handle_t, ze_fabric_vertex_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of DeviceExp functions pointers typedef struct _ze_device_exp_dditable_t { ze_pfnDeviceGetFabricVertexExp_t pfnGetFabricVertexExp; } ze_device_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetDeviceExpProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetDeviceExpProcAddrTable_t)( ze_api_version_t, ze_device_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeContextCreate typedef ze_result_t (ZE_APICALL *ze_pfnContextCreate_t)( ze_driver_handle_t, const ze_context_desc_t*, ze_context_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeContextDestroy typedef ze_result_t (ZE_APICALL *ze_pfnContextDestroy_t)( ze_context_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeContextGetStatus typedef ze_result_t (ZE_APICALL *ze_pfnContextGetStatus_t)( ze_context_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeContextSystemBarrier typedef ze_result_t (ZE_APICALL *ze_pfnContextSystemBarrier_t)( ze_context_handle_t, ze_device_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeContextMakeMemoryResident typedef ze_result_t (ZE_APICALL *ze_pfnContextMakeMemoryResident_t)( ze_context_handle_t, ze_device_handle_t, void*, size_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeContextEvictMemory typedef ze_result_t (ZE_APICALL *ze_pfnContextEvictMemory_t)( ze_context_handle_t, ze_device_handle_t, void*, size_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeContextMakeImageResident typedef ze_result_t (ZE_APICALL *ze_pfnContextMakeImageResident_t)( ze_context_handle_t, ze_device_handle_t, ze_image_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeContextEvictImage typedef ze_result_t (ZE_APICALL *ze_pfnContextEvictImage_t)( ze_context_handle_t, ze_device_handle_t, ze_image_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeContextCreateEx typedef ze_result_t (ZE_APICALL *ze_pfnContextCreateEx_t)( ze_driver_handle_t, const ze_context_desc_t*, uint32_t, ze_device_handle_t*, ze_context_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Context functions pointers typedef struct _ze_context_dditable_t { ze_pfnContextCreate_t pfnCreate; ze_pfnContextDestroy_t pfnDestroy; ze_pfnContextGetStatus_t pfnGetStatus; ze_pfnContextSystemBarrier_t pfnSystemBarrier; ze_pfnContextMakeMemoryResident_t pfnMakeMemoryResident; ze_pfnContextEvictMemory_t pfnEvictMemory; ze_pfnContextMakeImageResident_t pfnMakeImageResident; ze_pfnContextEvictImage_t pfnEvictImage; ze_pfnContextCreateEx_t pfnCreateEx; } ze_context_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Context table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetContextProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_context_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetContextProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetContextProcAddrTable_t)( ze_api_version_t, ze_context_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandQueueCreate typedef ze_result_t (ZE_APICALL *ze_pfnCommandQueueCreate_t)( ze_context_handle_t, ze_device_handle_t, const ze_command_queue_desc_t*, ze_command_queue_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandQueueDestroy typedef ze_result_t (ZE_APICALL *ze_pfnCommandQueueDestroy_t)( ze_command_queue_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandQueueExecuteCommandLists typedef ze_result_t (ZE_APICALL *ze_pfnCommandQueueExecuteCommandLists_t)( ze_command_queue_handle_t, uint32_t, ze_command_list_handle_t*, ze_fence_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandQueueSynchronize typedef ze_result_t (ZE_APICALL *ze_pfnCommandQueueSynchronize_t)( ze_command_queue_handle_t, uint64_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandQueueGetOrdinal typedef ze_result_t (ZE_APICALL *ze_pfnCommandQueueGetOrdinal_t)( ze_command_queue_handle_t, uint32_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandQueueGetIndex typedef ze_result_t (ZE_APICALL *ze_pfnCommandQueueGetIndex_t)( ze_command_queue_handle_t, uint32_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of CommandQueue functions pointers typedef struct _ze_command_queue_dditable_t { ze_pfnCommandQueueCreate_t pfnCreate; ze_pfnCommandQueueDestroy_t pfnDestroy; ze_pfnCommandQueueExecuteCommandLists_t pfnExecuteCommandLists; ze_pfnCommandQueueSynchronize_t pfnSynchronize; ze_pfnCommandQueueGetOrdinal_t pfnGetOrdinal; ze_pfnCommandQueueGetIndex_t pfnGetIndex; } ze_command_queue_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandQueue table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandQueueProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_queue_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetCommandQueueProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetCommandQueueProcAddrTable_t)( ze_api_version_t, ze_command_queue_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListCreate typedef ze_result_t (ZE_APICALL *ze_pfnCommandListCreate_t)( ze_context_handle_t, ze_device_handle_t, const ze_command_list_desc_t*, ze_command_list_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListCreateImmediate typedef ze_result_t (ZE_APICALL *ze_pfnCommandListCreateImmediate_t)( ze_context_handle_t, ze_device_handle_t, const ze_command_queue_desc_t*, ze_command_list_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListDestroy typedef ze_result_t (ZE_APICALL *ze_pfnCommandListDestroy_t)( ze_command_list_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListClose typedef ze_result_t (ZE_APICALL *ze_pfnCommandListClose_t)( ze_command_list_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListReset typedef ze_result_t (ZE_APICALL *ze_pfnCommandListReset_t)( ze_command_list_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendWriteGlobalTimestamp typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendWriteGlobalTimestamp_t)( ze_command_list_handle_t, uint64_t*, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendBarrier typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendBarrier_t)( ze_command_list_handle_t, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendMemoryRangesBarrier typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendMemoryRangesBarrier_t)( ze_command_list_handle_t, uint32_t, const size_t*, const void**, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendMemoryCopy typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendMemoryCopy_t)( ze_command_list_handle_t, void*, const void*, size_t, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendMemoryFill typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendMemoryFill_t)( ze_command_list_handle_t, void*, const void*, size_t, size_t, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendMemoryCopyRegion typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendMemoryCopyRegion_t)( ze_command_list_handle_t, void*, const ze_copy_region_t*, uint32_t, uint32_t, const void*, const ze_copy_region_t*, uint32_t, uint32_t, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendMemoryCopyFromContext typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendMemoryCopyFromContext_t)( ze_command_list_handle_t, void*, ze_context_handle_t, const void*, size_t, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendImageCopy typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendImageCopy_t)( ze_command_list_handle_t, ze_image_handle_t, ze_image_handle_t, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendImageCopyRegion typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendImageCopyRegion_t)( ze_command_list_handle_t, ze_image_handle_t, ze_image_handle_t, const ze_image_region_t*, const ze_image_region_t*, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendImageCopyToMemory typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendImageCopyToMemory_t)( ze_command_list_handle_t, void*, ze_image_handle_t, const ze_image_region_t*, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendImageCopyFromMemory typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendImageCopyFromMemory_t)( ze_command_list_handle_t, ze_image_handle_t, const void*, const ze_image_region_t*, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendMemoryPrefetch typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendMemoryPrefetch_t)( ze_command_list_handle_t, const void*, size_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendMemAdvise typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendMemAdvise_t)( ze_command_list_handle_t, ze_device_handle_t, const void*, size_t, ze_memory_advice_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendSignalEvent typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendSignalEvent_t)( ze_command_list_handle_t, ze_event_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendWaitOnEvents typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendWaitOnEvents_t)( ze_command_list_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendEventReset typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendEventReset_t)( ze_command_list_handle_t, ze_event_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendQueryKernelTimestamps typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendQueryKernelTimestamps_t)( ze_command_list_handle_t, uint32_t, ze_event_handle_t*, void*, const size_t*, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendLaunchKernel typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendLaunchKernel_t)( ze_command_list_handle_t, ze_kernel_handle_t, const ze_group_count_t*, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendLaunchCooperativeKernel typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendLaunchCooperativeKernel_t)( ze_command_list_handle_t, ze_kernel_handle_t, const ze_group_count_t*, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendLaunchKernelIndirect typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendLaunchKernelIndirect_t)( ze_command_list_handle_t, ze_kernel_handle_t, const ze_group_count_t*, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendLaunchMultipleKernelsIndirect typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendLaunchMultipleKernelsIndirect_t)( ze_command_list_handle_t, uint32_t, ze_kernel_handle_t*, const uint32_t*, const ze_group_count_t*, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendImageCopyToMemoryExt typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendImageCopyToMemoryExt_t)( ze_command_list_handle_t, void*, ze_image_handle_t, const ze_image_region_t*, uint32_t, uint32_t, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendImageCopyFromMemoryExt typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendImageCopyFromMemoryExt_t)( ze_command_list_handle_t, ze_image_handle_t, const void*, const ze_image_region_t*, uint32_t, uint32_t, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListHostSynchronize typedef ze_result_t (ZE_APICALL *ze_pfnCommandListHostSynchronize_t)( ze_command_list_handle_t, uint64_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListGetDeviceHandle typedef ze_result_t (ZE_APICALL *ze_pfnCommandListGetDeviceHandle_t)( ze_command_list_handle_t, ze_device_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListGetContextHandle typedef ze_result_t (ZE_APICALL *ze_pfnCommandListGetContextHandle_t)( ze_command_list_handle_t, ze_context_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListGetOrdinal typedef ze_result_t (ZE_APICALL *ze_pfnCommandListGetOrdinal_t)( ze_command_list_handle_t, uint32_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListImmediateGetIndex typedef ze_result_t (ZE_APICALL *ze_pfnCommandListImmediateGetIndex_t)( ze_command_list_handle_t, uint32_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListIsImmediate typedef ze_result_t (ZE_APICALL *ze_pfnCommandListIsImmediate_t)( ze_command_list_handle_t, ze_bool_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendSignalExternalSemaphoreExt typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendSignalExternalSemaphoreExt_t)( ze_command_list_handle_t, uint32_t, ze_external_semaphore_ext_handle_t*, ze_external_semaphore_signal_params_ext_t*, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListAppendWaitExternalSemaphoreExt typedef ze_result_t (ZE_APICALL *ze_pfnCommandListAppendWaitExternalSemaphoreExt_t)( ze_command_list_handle_t, uint32_t, ze_external_semaphore_ext_handle_t*, ze_external_semaphore_wait_params_ext_t*, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of CommandList functions pointers typedef struct _ze_command_list_dditable_t { ze_pfnCommandListCreate_t pfnCreate; ze_pfnCommandListCreateImmediate_t pfnCreateImmediate; ze_pfnCommandListDestroy_t pfnDestroy; ze_pfnCommandListClose_t pfnClose; ze_pfnCommandListReset_t pfnReset; ze_pfnCommandListAppendWriteGlobalTimestamp_t pfnAppendWriteGlobalTimestamp; ze_pfnCommandListAppendBarrier_t pfnAppendBarrier; ze_pfnCommandListAppendMemoryRangesBarrier_t pfnAppendMemoryRangesBarrier; ze_pfnCommandListAppendMemoryCopy_t pfnAppendMemoryCopy; ze_pfnCommandListAppendMemoryFill_t pfnAppendMemoryFill; ze_pfnCommandListAppendMemoryCopyRegion_t pfnAppendMemoryCopyRegion; ze_pfnCommandListAppendMemoryCopyFromContext_t pfnAppendMemoryCopyFromContext; ze_pfnCommandListAppendImageCopy_t pfnAppendImageCopy; ze_pfnCommandListAppendImageCopyRegion_t pfnAppendImageCopyRegion; ze_pfnCommandListAppendImageCopyToMemory_t pfnAppendImageCopyToMemory; ze_pfnCommandListAppendImageCopyFromMemory_t pfnAppendImageCopyFromMemory; ze_pfnCommandListAppendMemoryPrefetch_t pfnAppendMemoryPrefetch; ze_pfnCommandListAppendMemAdvise_t pfnAppendMemAdvise; ze_pfnCommandListAppendSignalEvent_t pfnAppendSignalEvent; ze_pfnCommandListAppendWaitOnEvents_t pfnAppendWaitOnEvents; ze_pfnCommandListAppendEventReset_t pfnAppendEventReset; ze_pfnCommandListAppendQueryKernelTimestamps_t pfnAppendQueryKernelTimestamps; ze_pfnCommandListAppendLaunchKernel_t pfnAppendLaunchKernel; ze_pfnCommandListAppendLaunchCooperativeKernel_t pfnAppendLaunchCooperativeKernel; ze_pfnCommandListAppendLaunchKernelIndirect_t pfnAppendLaunchKernelIndirect; ze_pfnCommandListAppendLaunchMultipleKernelsIndirect_t pfnAppendLaunchMultipleKernelsIndirect; ze_pfnCommandListAppendImageCopyToMemoryExt_t pfnAppendImageCopyToMemoryExt; ze_pfnCommandListAppendImageCopyFromMemoryExt_t pfnAppendImageCopyFromMemoryExt; ze_pfnCommandListHostSynchronize_t pfnHostSynchronize; ze_pfnCommandListGetDeviceHandle_t pfnGetDeviceHandle; ze_pfnCommandListGetContextHandle_t pfnGetContextHandle; ze_pfnCommandListGetOrdinal_t pfnGetOrdinal; ze_pfnCommandListImmediateGetIndex_t pfnImmediateGetIndex; ze_pfnCommandListIsImmediate_t pfnIsImmediate; ze_pfnCommandListAppendSignalExternalSemaphoreExt_t pfnAppendSignalExternalSemaphoreExt; ze_pfnCommandListAppendWaitExternalSemaphoreExt_t pfnAppendWaitExternalSemaphoreExt; } ze_command_list_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandList table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandListProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_list_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetCommandListProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetCommandListProcAddrTable_t)( ze_api_version_t, ze_command_list_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListCreateCloneExp typedef ze_result_t (ZE_APICALL *ze_pfnCommandListCreateCloneExp_t)( ze_command_list_handle_t, ze_command_list_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListImmediateAppendCommandListsExp typedef ze_result_t (ZE_APICALL *ze_pfnCommandListImmediateAppendCommandListsExp_t)( ze_command_list_handle_t, uint32_t, ze_command_list_handle_t*, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListGetNextCommandIdExp typedef ze_result_t (ZE_APICALL *ze_pfnCommandListGetNextCommandIdExp_t)( ze_command_list_handle_t, const ze_mutable_command_id_exp_desc_t*, uint64_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListUpdateMutableCommandsExp typedef ze_result_t (ZE_APICALL *ze_pfnCommandListUpdateMutableCommandsExp_t)( ze_command_list_handle_t, const ze_mutable_commands_exp_desc_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListUpdateMutableCommandSignalEventExp typedef ze_result_t (ZE_APICALL *ze_pfnCommandListUpdateMutableCommandSignalEventExp_t)( ze_command_list_handle_t, uint64_t, ze_event_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListUpdateMutableCommandWaitEventsExp typedef ze_result_t (ZE_APICALL *ze_pfnCommandListUpdateMutableCommandWaitEventsExp_t)( ze_command_list_handle_t, uint64_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListGetNextCommandIdWithKernelsExp typedef ze_result_t (ZE_APICALL *ze_pfnCommandListGetNextCommandIdWithKernelsExp_t)( ze_command_list_handle_t, const ze_mutable_command_id_exp_desc_t*, uint32_t, ze_kernel_handle_t*, uint64_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeCommandListUpdateMutableCommandKernelsExp typedef ze_result_t (ZE_APICALL *ze_pfnCommandListUpdateMutableCommandKernelsExp_t)( ze_command_list_handle_t, uint32_t, uint64_t*, ze_kernel_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of CommandListExp functions pointers typedef struct _ze_command_list_exp_dditable_t { ze_pfnCommandListCreateCloneExp_t pfnCreateCloneExp; ze_pfnCommandListImmediateAppendCommandListsExp_t pfnImmediateAppendCommandListsExp; ze_pfnCommandListGetNextCommandIdExp_t pfnGetNextCommandIdExp; ze_pfnCommandListUpdateMutableCommandsExp_t pfnUpdateMutableCommandsExp; ze_pfnCommandListUpdateMutableCommandSignalEventExp_t pfnUpdateMutableCommandSignalEventExp; ze_pfnCommandListUpdateMutableCommandWaitEventsExp_t pfnUpdateMutableCommandWaitEventsExp; ze_pfnCommandListGetNextCommandIdWithKernelsExp_t pfnGetNextCommandIdWithKernelsExp; ze_pfnCommandListUpdateMutableCommandKernelsExp_t pfnUpdateMutableCommandKernelsExp; } ze_command_list_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandListExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandListExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_list_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetCommandListExpProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetCommandListExpProcAddrTable_t)( ze_api_version_t, ze_command_list_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeImageGetProperties typedef ze_result_t (ZE_APICALL *ze_pfnImageGetProperties_t)( ze_device_handle_t, const ze_image_desc_t*, ze_image_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeImageCreate typedef ze_result_t (ZE_APICALL *ze_pfnImageCreate_t)( ze_context_handle_t, ze_device_handle_t, const ze_image_desc_t*, ze_image_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeImageDestroy typedef ze_result_t (ZE_APICALL *ze_pfnImageDestroy_t)( ze_image_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeImageGetAllocPropertiesExt typedef ze_result_t (ZE_APICALL *ze_pfnImageGetAllocPropertiesExt_t)( ze_context_handle_t, ze_image_handle_t, ze_image_allocation_ext_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeImageViewCreateExt typedef ze_result_t (ZE_APICALL *ze_pfnImageViewCreateExt_t)( ze_context_handle_t, ze_device_handle_t, const ze_image_desc_t*, ze_image_handle_t, ze_image_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Image functions pointers typedef struct _ze_image_dditable_t { ze_pfnImageGetProperties_t pfnGetProperties; ze_pfnImageCreate_t pfnCreate; ze_pfnImageDestroy_t pfnDestroy; ze_pfnImageGetAllocPropertiesExt_t pfnGetAllocPropertiesExt; ze_pfnImageViewCreateExt_t pfnViewCreateExt; } ze_image_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Image table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetImageProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_image_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetImageProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetImageProcAddrTable_t)( ze_api_version_t, ze_image_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeImageGetMemoryPropertiesExp typedef ze_result_t (ZE_APICALL *ze_pfnImageGetMemoryPropertiesExp_t)( ze_image_handle_t, ze_image_memory_properties_exp_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeImageViewCreateExp typedef ze_result_t (ZE_APICALL *ze_pfnImageViewCreateExp_t)( ze_context_handle_t, ze_device_handle_t, const ze_image_desc_t*, ze_image_handle_t, ze_image_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeImageGetDeviceOffsetExp typedef ze_result_t (ZE_APICALL *ze_pfnImageGetDeviceOffsetExp_t)( ze_image_handle_t, uint64_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of ImageExp functions pointers typedef struct _ze_image_exp_dditable_t { ze_pfnImageGetMemoryPropertiesExp_t pfnGetMemoryPropertiesExp; ze_pfnImageViewCreateExp_t pfnViewCreateExp; ze_pfnImageGetDeviceOffsetExp_t pfnGetDeviceOffsetExp; } ze_image_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ImageExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetImageExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_image_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetImageExpProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetImageExpProcAddrTable_t)( ze_api_version_t, ze_image_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemAllocShared typedef ze_result_t (ZE_APICALL *ze_pfnMemAllocShared_t)( ze_context_handle_t, const ze_device_mem_alloc_desc_t*, const ze_host_mem_alloc_desc_t*, size_t, size_t, ze_device_handle_t, void** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemAllocDevice typedef ze_result_t (ZE_APICALL *ze_pfnMemAllocDevice_t)( ze_context_handle_t, const ze_device_mem_alloc_desc_t*, size_t, size_t, ze_device_handle_t, void** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemAllocHost typedef ze_result_t (ZE_APICALL *ze_pfnMemAllocHost_t)( ze_context_handle_t, const ze_host_mem_alloc_desc_t*, size_t, size_t, void** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemFree typedef ze_result_t (ZE_APICALL *ze_pfnMemFree_t)( ze_context_handle_t, void* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemGetAllocProperties typedef ze_result_t (ZE_APICALL *ze_pfnMemGetAllocProperties_t)( ze_context_handle_t, const void*, ze_memory_allocation_properties_t*, ze_device_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemGetAddressRange typedef ze_result_t (ZE_APICALL *ze_pfnMemGetAddressRange_t)( ze_context_handle_t, const void*, void**, size_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemGetIpcHandle typedef ze_result_t (ZE_APICALL *ze_pfnMemGetIpcHandle_t)( ze_context_handle_t, const void*, ze_ipc_mem_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemOpenIpcHandle typedef ze_result_t (ZE_APICALL *ze_pfnMemOpenIpcHandle_t)( ze_context_handle_t, ze_device_handle_t, ze_ipc_mem_handle_t, ze_ipc_memory_flags_t, void** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemCloseIpcHandle typedef ze_result_t (ZE_APICALL *ze_pfnMemCloseIpcHandle_t)( ze_context_handle_t, const void* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemFreeExt typedef ze_result_t (ZE_APICALL *ze_pfnMemFreeExt_t)( ze_context_handle_t, const ze_memory_free_ext_desc_t*, void* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemPutIpcHandle typedef ze_result_t (ZE_APICALL *ze_pfnMemPutIpcHandle_t)( ze_context_handle_t, ze_ipc_mem_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemGetPitchFor2dImage typedef ze_result_t (ZE_APICALL *ze_pfnMemGetPitchFor2dImage_t)( ze_context_handle_t, ze_device_handle_t, size_t, size_t, unsigned int, size_t * ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Mem functions pointers typedef struct _ze_mem_dditable_t { ze_pfnMemAllocShared_t pfnAllocShared; ze_pfnMemAllocDevice_t pfnAllocDevice; ze_pfnMemAllocHost_t pfnAllocHost; ze_pfnMemFree_t pfnFree; ze_pfnMemGetAllocProperties_t pfnGetAllocProperties; ze_pfnMemGetAddressRange_t pfnGetAddressRange; ze_pfnMemGetIpcHandle_t pfnGetIpcHandle; ze_pfnMemOpenIpcHandle_t pfnOpenIpcHandle; ze_pfnMemCloseIpcHandle_t pfnCloseIpcHandle; ze_pfnMemFreeExt_t pfnFreeExt; ze_pfnMemPutIpcHandle_t pfnPutIpcHandle; ze_pfnMemGetPitchFor2dImage_t pfnGetPitchFor2dImage; } ze_mem_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Mem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetMemProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetMemProcAddrTable_t)( ze_api_version_t, ze_mem_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemGetIpcHandleFromFileDescriptorExp typedef ze_result_t (ZE_APICALL *ze_pfnMemGetIpcHandleFromFileDescriptorExp_t)( ze_context_handle_t, uint64_t, ze_ipc_mem_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemGetFileDescriptorFromIpcHandleExp typedef ze_result_t (ZE_APICALL *ze_pfnMemGetFileDescriptorFromIpcHandleExp_t)( ze_context_handle_t, ze_ipc_mem_handle_t, uint64_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemSetAtomicAccessAttributeExp typedef ze_result_t (ZE_APICALL *ze_pfnMemSetAtomicAccessAttributeExp_t)( ze_context_handle_t, ze_device_handle_t, const void*, size_t, ze_memory_atomic_attr_exp_flags_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeMemGetAtomicAccessAttributeExp typedef ze_result_t (ZE_APICALL *ze_pfnMemGetAtomicAccessAttributeExp_t)( ze_context_handle_t, ze_device_handle_t, const void*, size_t, ze_memory_atomic_attr_exp_flags_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of MemExp functions pointers typedef struct _ze_mem_exp_dditable_t { ze_pfnMemGetIpcHandleFromFileDescriptorExp_t pfnGetIpcHandleFromFileDescriptorExp; ze_pfnMemGetFileDescriptorFromIpcHandleExp_t pfnGetFileDescriptorFromIpcHandleExp; ze_pfnMemSetAtomicAccessAttributeExp_t pfnSetAtomicAccessAttributeExp; ze_pfnMemGetAtomicAccessAttributeExp_t pfnGetAtomicAccessAttributeExp; } ze_mem_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MemExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetMemExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_mem_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetMemExpProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetMemExpProcAddrTable_t)( ze_api_version_t, ze_mem_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeFenceCreate typedef ze_result_t (ZE_APICALL *ze_pfnFenceCreate_t)( ze_command_queue_handle_t, const ze_fence_desc_t*, ze_fence_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeFenceDestroy typedef ze_result_t (ZE_APICALL *ze_pfnFenceDestroy_t)( ze_fence_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeFenceHostSynchronize typedef ze_result_t (ZE_APICALL *ze_pfnFenceHostSynchronize_t)( ze_fence_handle_t, uint64_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeFenceQueryStatus typedef ze_result_t (ZE_APICALL *ze_pfnFenceQueryStatus_t)( ze_fence_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeFenceReset typedef ze_result_t (ZE_APICALL *ze_pfnFenceReset_t)( ze_fence_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Fence functions pointers typedef struct _ze_fence_dditable_t { ze_pfnFenceCreate_t pfnCreate; ze_pfnFenceDestroy_t pfnDestroy; ze_pfnFenceHostSynchronize_t pfnHostSynchronize; ze_pfnFenceQueryStatus_t pfnQueryStatus; ze_pfnFenceReset_t pfnReset; } ze_fence_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Fence table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFenceProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fence_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetFenceProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetFenceProcAddrTable_t)( ze_api_version_t, ze_fence_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventPoolCreate typedef ze_result_t (ZE_APICALL *ze_pfnEventPoolCreate_t)( ze_context_handle_t, const ze_event_pool_desc_t*, uint32_t, ze_device_handle_t*, ze_event_pool_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventPoolDestroy typedef ze_result_t (ZE_APICALL *ze_pfnEventPoolDestroy_t)( ze_event_pool_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventPoolGetIpcHandle typedef ze_result_t (ZE_APICALL *ze_pfnEventPoolGetIpcHandle_t)( ze_event_pool_handle_t, ze_ipc_event_pool_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventPoolOpenIpcHandle typedef ze_result_t (ZE_APICALL *ze_pfnEventPoolOpenIpcHandle_t)( ze_context_handle_t, ze_ipc_event_pool_handle_t, ze_event_pool_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventPoolCloseIpcHandle typedef ze_result_t (ZE_APICALL *ze_pfnEventPoolCloseIpcHandle_t)( ze_event_pool_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventPoolPutIpcHandle typedef ze_result_t (ZE_APICALL *ze_pfnEventPoolPutIpcHandle_t)( ze_context_handle_t, ze_ipc_event_pool_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventPoolGetContextHandle typedef ze_result_t (ZE_APICALL *ze_pfnEventPoolGetContextHandle_t)( ze_event_pool_handle_t, ze_context_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventPoolGetFlags typedef ze_result_t (ZE_APICALL *ze_pfnEventPoolGetFlags_t)( ze_event_pool_handle_t, ze_event_pool_flags_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of EventPool functions pointers typedef struct _ze_event_pool_dditable_t { ze_pfnEventPoolCreate_t pfnCreate; ze_pfnEventPoolDestroy_t pfnDestroy; ze_pfnEventPoolGetIpcHandle_t pfnGetIpcHandle; ze_pfnEventPoolOpenIpcHandle_t pfnOpenIpcHandle; ze_pfnEventPoolCloseIpcHandle_t pfnCloseIpcHandle; ze_pfnEventPoolPutIpcHandle_t pfnPutIpcHandle; ze_pfnEventPoolGetContextHandle_t pfnGetContextHandle; ze_pfnEventPoolGetFlags_t pfnGetFlags; } ze_event_pool_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's EventPool table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventPoolProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_pool_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetEventPoolProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetEventPoolProcAddrTable_t)( ze_api_version_t, ze_event_pool_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventCreate typedef ze_result_t (ZE_APICALL *ze_pfnEventCreate_t)( ze_event_pool_handle_t, const ze_event_desc_t*, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventDestroy typedef ze_result_t (ZE_APICALL *ze_pfnEventDestroy_t)( ze_event_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventHostSignal typedef ze_result_t (ZE_APICALL *ze_pfnEventHostSignal_t)( ze_event_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventHostSynchronize typedef ze_result_t (ZE_APICALL *ze_pfnEventHostSynchronize_t)( ze_event_handle_t, uint64_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventQueryStatus typedef ze_result_t (ZE_APICALL *ze_pfnEventQueryStatus_t)( ze_event_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventHostReset typedef ze_result_t (ZE_APICALL *ze_pfnEventHostReset_t)( ze_event_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventQueryKernelTimestamp typedef ze_result_t (ZE_APICALL *ze_pfnEventQueryKernelTimestamp_t)( ze_event_handle_t, ze_kernel_timestamp_result_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventQueryKernelTimestampsExt typedef ze_result_t (ZE_APICALL *ze_pfnEventQueryKernelTimestampsExt_t)( ze_event_handle_t, ze_device_handle_t, uint32_t*, ze_event_query_kernel_timestamps_results_ext_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventGetEventPool typedef ze_result_t (ZE_APICALL *ze_pfnEventGetEventPool_t)( ze_event_handle_t, ze_event_pool_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventGetSignalScope typedef ze_result_t (ZE_APICALL *ze_pfnEventGetSignalScope_t)( ze_event_handle_t, ze_event_scope_flags_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventGetWaitScope typedef ze_result_t (ZE_APICALL *ze_pfnEventGetWaitScope_t)( ze_event_handle_t, ze_event_scope_flags_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Event functions pointers typedef struct _ze_event_dditable_t { ze_pfnEventCreate_t pfnCreate; ze_pfnEventDestroy_t pfnDestroy; ze_pfnEventHostSignal_t pfnHostSignal; ze_pfnEventHostSynchronize_t pfnHostSynchronize; ze_pfnEventQueryStatus_t pfnQueryStatus; ze_pfnEventHostReset_t pfnHostReset; ze_pfnEventQueryKernelTimestamp_t pfnQueryKernelTimestamp; ze_pfnEventQueryKernelTimestampsExt_t pfnQueryKernelTimestampsExt; ze_pfnEventGetEventPool_t pfnGetEventPool; ze_pfnEventGetSignalScope_t pfnGetSignalScope; ze_pfnEventGetWaitScope_t pfnGetWaitScope; } ze_event_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Event table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetEventProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetEventProcAddrTable_t)( ze_api_version_t, ze_event_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeEventQueryTimestampsExp typedef ze_result_t (ZE_APICALL *ze_pfnEventQueryTimestampsExp_t)( ze_event_handle_t, ze_device_handle_t, uint32_t*, ze_kernel_timestamp_result_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of EventExp functions pointers typedef struct _ze_event_exp_dditable_t { ze_pfnEventQueryTimestampsExp_t pfnQueryTimestampsExp; } ze_event_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's EventExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetEventExpProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetEventExpProcAddrTable_t)( ze_api_version_t, ze_event_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeModuleCreate typedef ze_result_t (ZE_APICALL *ze_pfnModuleCreate_t)( ze_context_handle_t, ze_device_handle_t, const ze_module_desc_t*, ze_module_handle_t*, ze_module_build_log_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeModuleDestroy typedef ze_result_t (ZE_APICALL *ze_pfnModuleDestroy_t)( ze_module_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeModuleDynamicLink typedef ze_result_t (ZE_APICALL *ze_pfnModuleDynamicLink_t)( uint32_t, ze_module_handle_t*, ze_module_build_log_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeModuleGetNativeBinary typedef ze_result_t (ZE_APICALL *ze_pfnModuleGetNativeBinary_t)( ze_module_handle_t, size_t*, uint8_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeModuleGetGlobalPointer typedef ze_result_t (ZE_APICALL *ze_pfnModuleGetGlobalPointer_t)( ze_module_handle_t, const char*, size_t*, void** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeModuleGetKernelNames typedef ze_result_t (ZE_APICALL *ze_pfnModuleGetKernelNames_t)( ze_module_handle_t, uint32_t*, const char** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeModuleGetProperties typedef ze_result_t (ZE_APICALL *ze_pfnModuleGetProperties_t)( ze_module_handle_t, ze_module_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeModuleGetFunctionPointer typedef ze_result_t (ZE_APICALL *ze_pfnModuleGetFunctionPointer_t)( ze_module_handle_t, const char*, void** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeModuleInspectLinkageExt typedef ze_result_t (ZE_APICALL *ze_pfnModuleInspectLinkageExt_t)( ze_linkage_inspection_ext_desc_t*, uint32_t, ze_module_handle_t*, ze_module_build_log_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Module functions pointers typedef struct _ze_module_dditable_t { ze_pfnModuleCreate_t pfnCreate; ze_pfnModuleDestroy_t pfnDestroy; ze_pfnModuleDynamicLink_t pfnDynamicLink; ze_pfnModuleGetNativeBinary_t pfnGetNativeBinary; ze_pfnModuleGetGlobalPointer_t pfnGetGlobalPointer; ze_pfnModuleGetKernelNames_t pfnGetKernelNames; ze_pfnModuleGetProperties_t pfnGetProperties; ze_pfnModuleGetFunctionPointer_t pfnGetFunctionPointer; ze_pfnModuleInspectLinkageExt_t pfnInspectLinkageExt; } ze_module_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Module table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetModuleProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_module_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetModuleProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetModuleProcAddrTable_t)( ze_api_version_t, ze_module_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeModuleBuildLogDestroy typedef ze_result_t (ZE_APICALL *ze_pfnModuleBuildLogDestroy_t)( ze_module_build_log_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeModuleBuildLogGetString typedef ze_result_t (ZE_APICALL *ze_pfnModuleBuildLogGetString_t)( ze_module_build_log_handle_t, size_t*, char* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of ModuleBuildLog functions pointers typedef struct _ze_module_build_log_dditable_t { ze_pfnModuleBuildLogDestroy_t pfnDestroy; ze_pfnModuleBuildLogGetString_t pfnGetString; } ze_module_build_log_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ModuleBuildLog table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetModuleBuildLogProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_module_build_log_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetModuleBuildLogProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetModuleBuildLogProcAddrTable_t)( ze_api_version_t, ze_module_build_log_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelCreate typedef ze_result_t (ZE_APICALL *ze_pfnKernelCreate_t)( ze_module_handle_t, const ze_kernel_desc_t*, ze_kernel_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelDestroy typedef ze_result_t (ZE_APICALL *ze_pfnKernelDestroy_t)( ze_kernel_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelSetCacheConfig typedef ze_result_t (ZE_APICALL *ze_pfnKernelSetCacheConfig_t)( ze_kernel_handle_t, ze_cache_config_flags_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelSetGroupSize typedef ze_result_t (ZE_APICALL *ze_pfnKernelSetGroupSize_t)( ze_kernel_handle_t, uint32_t, uint32_t, uint32_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelSuggestGroupSize typedef ze_result_t (ZE_APICALL *ze_pfnKernelSuggestGroupSize_t)( ze_kernel_handle_t, uint32_t, uint32_t, uint32_t, uint32_t*, uint32_t*, uint32_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelSuggestMaxCooperativeGroupCount typedef ze_result_t (ZE_APICALL *ze_pfnKernelSuggestMaxCooperativeGroupCount_t)( ze_kernel_handle_t, uint32_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelSetArgumentValue typedef ze_result_t (ZE_APICALL *ze_pfnKernelSetArgumentValue_t)( ze_kernel_handle_t, uint32_t, size_t, const void* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelSetIndirectAccess typedef ze_result_t (ZE_APICALL *ze_pfnKernelSetIndirectAccess_t)( ze_kernel_handle_t, ze_kernel_indirect_access_flags_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelGetIndirectAccess typedef ze_result_t (ZE_APICALL *ze_pfnKernelGetIndirectAccess_t)( ze_kernel_handle_t, ze_kernel_indirect_access_flags_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelGetSourceAttributes typedef ze_result_t (ZE_APICALL *ze_pfnKernelGetSourceAttributes_t)( ze_kernel_handle_t, uint32_t*, char** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelGetProperties typedef ze_result_t (ZE_APICALL *ze_pfnKernelGetProperties_t)( ze_kernel_handle_t, ze_kernel_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelGetName typedef ze_result_t (ZE_APICALL *ze_pfnKernelGetName_t)( ze_kernel_handle_t, size_t*, char* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Kernel functions pointers typedef struct _ze_kernel_dditable_t { ze_pfnKernelCreate_t pfnCreate; ze_pfnKernelDestroy_t pfnDestroy; ze_pfnKernelSetCacheConfig_t pfnSetCacheConfig; ze_pfnKernelSetGroupSize_t pfnSetGroupSize; ze_pfnKernelSuggestGroupSize_t pfnSuggestGroupSize; ze_pfnKernelSuggestMaxCooperativeGroupCount_t pfnSuggestMaxCooperativeGroupCount; ze_pfnKernelSetArgumentValue_t pfnSetArgumentValue; ze_pfnKernelSetIndirectAccess_t pfnSetIndirectAccess; ze_pfnKernelGetIndirectAccess_t pfnGetIndirectAccess; ze_pfnKernelGetSourceAttributes_t pfnGetSourceAttributes; ze_pfnKernelGetProperties_t pfnGetProperties; ze_pfnKernelGetName_t pfnGetName; } ze_kernel_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Kernel table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetKernelProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_kernel_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetKernelProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetKernelProcAddrTable_t)( ze_api_version_t, ze_kernel_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelSetGlobalOffsetExp typedef ze_result_t (ZE_APICALL *ze_pfnKernelSetGlobalOffsetExp_t)( ze_kernel_handle_t, uint32_t, uint32_t, uint32_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelSchedulingHintExp typedef ze_result_t (ZE_APICALL *ze_pfnKernelSchedulingHintExp_t)( ze_kernel_handle_t, ze_scheduling_hint_exp_desc_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeKernelGetBinaryExp typedef ze_result_t (ZE_APICALL *ze_pfnKernelGetBinaryExp_t)( ze_kernel_handle_t, size_t*, uint8_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of KernelExp functions pointers typedef struct _ze_kernel_exp_dditable_t { ze_pfnKernelSetGlobalOffsetExp_t pfnSetGlobalOffsetExp; ze_pfnKernelSchedulingHintExp_t pfnSchedulingHintExp; ze_pfnKernelGetBinaryExp_t pfnGetBinaryExp; } ze_kernel_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's KernelExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetKernelExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_kernel_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetKernelExpProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetKernelExpProcAddrTable_t)( ze_api_version_t, ze_kernel_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeSamplerCreate typedef ze_result_t (ZE_APICALL *ze_pfnSamplerCreate_t)( ze_context_handle_t, ze_device_handle_t, const ze_sampler_desc_t*, ze_sampler_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeSamplerDestroy typedef ze_result_t (ZE_APICALL *ze_pfnSamplerDestroy_t)( ze_sampler_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Sampler functions pointers typedef struct _ze_sampler_dditable_t { ze_pfnSamplerCreate_t pfnCreate; ze_pfnSamplerDestroy_t pfnDestroy; } ze_sampler_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Sampler table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetSamplerProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_sampler_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetSamplerProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetSamplerProcAddrTable_t)( ze_api_version_t, ze_sampler_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zePhysicalMemCreate typedef ze_result_t (ZE_APICALL *ze_pfnPhysicalMemCreate_t)( ze_context_handle_t, ze_device_handle_t, ze_physical_mem_desc_t*, ze_physical_mem_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zePhysicalMemDestroy typedef ze_result_t (ZE_APICALL *ze_pfnPhysicalMemDestroy_t)( ze_context_handle_t, ze_physical_mem_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of PhysicalMem functions pointers typedef struct _ze_physical_mem_dditable_t { ze_pfnPhysicalMemCreate_t pfnCreate; ze_pfnPhysicalMemDestroy_t pfnDestroy; } ze_physical_mem_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's PhysicalMem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetPhysicalMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_physical_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetPhysicalMemProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetPhysicalMemProcAddrTable_t)( ze_api_version_t, ze_physical_mem_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeVirtualMemReserve typedef ze_result_t (ZE_APICALL *ze_pfnVirtualMemReserve_t)( ze_context_handle_t, const void*, size_t, void** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeVirtualMemFree typedef ze_result_t (ZE_APICALL *ze_pfnVirtualMemFree_t)( ze_context_handle_t, const void*, size_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeVirtualMemQueryPageSize typedef ze_result_t (ZE_APICALL *ze_pfnVirtualMemQueryPageSize_t)( ze_context_handle_t, ze_device_handle_t, size_t, size_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeVirtualMemMap typedef ze_result_t (ZE_APICALL *ze_pfnVirtualMemMap_t)( ze_context_handle_t, const void*, size_t, ze_physical_mem_handle_t, size_t, ze_memory_access_attribute_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeVirtualMemUnmap typedef ze_result_t (ZE_APICALL *ze_pfnVirtualMemUnmap_t)( ze_context_handle_t, const void*, size_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeVirtualMemSetAccessAttribute typedef ze_result_t (ZE_APICALL *ze_pfnVirtualMemSetAccessAttribute_t)( ze_context_handle_t, const void*, size_t, ze_memory_access_attribute_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeVirtualMemGetAccessAttribute typedef ze_result_t (ZE_APICALL *ze_pfnVirtualMemGetAccessAttribute_t)( ze_context_handle_t, const void*, size_t, ze_memory_access_attribute_t*, size_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of VirtualMem functions pointers typedef struct _ze_virtual_mem_dditable_t { ze_pfnVirtualMemReserve_t pfnReserve; ze_pfnVirtualMemFree_t pfnFree; ze_pfnVirtualMemQueryPageSize_t pfnQueryPageSize; ze_pfnVirtualMemMap_t pfnMap; ze_pfnVirtualMemUnmap_t pfnUnmap; ze_pfnVirtualMemSetAccessAttribute_t pfnSetAccessAttribute; ze_pfnVirtualMemGetAccessAttribute_t pfnGetAccessAttribute; } ze_virtual_mem_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's VirtualMem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetVirtualMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_virtual_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetVirtualMemProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetVirtualMemProcAddrTable_t)( ze_api_version_t, ze_virtual_mem_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeFabricVertexGetExp typedef ze_result_t (ZE_APICALL *ze_pfnFabricVertexGetExp_t)( ze_driver_handle_t, uint32_t*, ze_fabric_vertex_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeFabricVertexGetSubVerticesExp typedef ze_result_t (ZE_APICALL *ze_pfnFabricVertexGetSubVerticesExp_t)( ze_fabric_vertex_handle_t, uint32_t*, ze_fabric_vertex_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeFabricVertexGetPropertiesExp typedef ze_result_t (ZE_APICALL *ze_pfnFabricVertexGetPropertiesExp_t)( ze_fabric_vertex_handle_t, ze_fabric_vertex_exp_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeFabricVertexGetDeviceExp typedef ze_result_t (ZE_APICALL *ze_pfnFabricVertexGetDeviceExp_t)( ze_fabric_vertex_handle_t, ze_device_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of FabricVertexExp functions pointers typedef struct _ze_fabric_vertex_exp_dditable_t { ze_pfnFabricVertexGetExp_t pfnGetExp; ze_pfnFabricVertexGetSubVerticesExp_t pfnGetSubVerticesExp; ze_pfnFabricVertexGetPropertiesExp_t pfnGetPropertiesExp; ze_pfnFabricVertexGetDeviceExp_t pfnGetDeviceExp; } ze_fabric_vertex_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricVertexExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFabricVertexExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fabric_vertex_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetFabricVertexExpProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetFabricVertexExpProcAddrTable_t)( ze_api_version_t, ze_fabric_vertex_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeFabricEdgeGetExp typedef ze_result_t (ZE_APICALL *ze_pfnFabricEdgeGetExp_t)( ze_fabric_vertex_handle_t, ze_fabric_vertex_handle_t, uint32_t*, ze_fabric_edge_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeFabricEdgeGetVerticesExp typedef ze_result_t (ZE_APICALL *ze_pfnFabricEdgeGetVerticesExp_t)( ze_fabric_edge_handle_t, ze_fabric_vertex_handle_t*, ze_fabric_vertex_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeFabricEdgeGetPropertiesExp typedef ze_result_t (ZE_APICALL *ze_pfnFabricEdgeGetPropertiesExp_t)( ze_fabric_edge_handle_t, ze_fabric_edge_exp_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of FabricEdgeExp functions pointers typedef struct _ze_fabric_edge_exp_dditable_t { ze_pfnFabricEdgeGetExp_t pfnGetExp; ze_pfnFabricEdgeGetVerticesExp_t pfnGetVerticesExp; ze_pfnFabricEdgeGetPropertiesExp_t pfnGetPropertiesExp; } ze_fabric_edge_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricEdgeExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFabricEdgeExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fabric_edge_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zeGetFabricEdgeExpProcAddrTable typedef ze_result_t (ZE_APICALL *ze_pfnGetFabricEdgeExpProcAddrTable_t)( ze_api_version_t, ze_fabric_edge_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Container for all DDI tables typedef struct _ze_dditable_t { ze_rtas_builder_exp_dditable_t RTASBuilderExp; ze_rtas_parallel_operation_exp_dditable_t RTASParallelOperationExp; ze_global_dditable_t Global; ze_driver_dditable_t Driver; ze_driver_exp_dditable_t DriverExp; ze_device_dditable_t Device; ze_device_exp_dditable_t DeviceExp; ze_context_dditable_t Context; ze_command_queue_dditable_t CommandQueue; ze_command_list_dditable_t CommandList; ze_command_list_exp_dditable_t CommandListExp; ze_image_dditable_t Image; ze_image_exp_dditable_t ImageExp; ze_mem_dditable_t Mem; ze_mem_exp_dditable_t MemExp; ze_fence_dditable_t Fence; ze_event_pool_dditable_t EventPool; ze_event_dditable_t Event; ze_event_exp_dditable_t EventExp; ze_module_dditable_t Module; ze_module_build_log_dditable_t ModuleBuildLog; ze_kernel_dditable_t Kernel; ze_kernel_exp_dditable_t KernelExp; ze_sampler_dditable_t Sampler; ze_physical_mem_dditable_t PhysicalMem; ze_virtual_mem_dditable_t VirtualMem; ze_fabric_vertex_exp_dditable_t FabricVertexExp; ze_fabric_edge_exp_dditable_t FabricEdgeExp; } ze_dditable_t; /// @brief Container for all DDI tables with version and tables set by the Driver typedef struct _ze_dditable_driver_t { ze_api_version_t version; uint8_t isValidFlag; ze_rtas_builder_exp_dditable_t * RTASBuilderExp; ze_rtas_parallel_operation_exp_dditable_t * RTASParallelOperationExp; ze_global_dditable_t * Global; ze_driver_dditable_t * Driver; ze_driver_exp_dditable_t * DriverExp; ze_device_dditable_t * Device; ze_device_exp_dditable_t * DeviceExp; ze_context_dditable_t * Context; ze_command_queue_dditable_t * CommandQueue; ze_command_list_dditable_t * CommandList; ze_command_list_exp_dditable_t * CommandListExp; ze_image_dditable_t * Image; ze_image_exp_dditable_t * ImageExp; ze_mem_dditable_t * Mem; ze_mem_exp_dditable_t * MemExp; ze_fence_dditable_t * Fence; ze_event_pool_dditable_t * EventPool; ze_event_dditable_t * Event; ze_event_exp_dditable_t * EventExp; ze_module_dditable_t * Module; ze_module_build_log_dditable_t * ModuleBuildLog; ze_kernel_dditable_t * Kernel; ze_kernel_exp_dditable_t * KernelExp; ze_sampler_dditable_t * Sampler; ze_physical_mem_dditable_t * PhysicalMem; ze_virtual_mem_dditable_t * VirtualMem; ze_fabric_vertex_exp_dditable_t * FabricVertexExp; ze_fabric_edge_exp_dditable_t * FabricEdgeExp; } ze_dditable_driver_t; #if defined(__cplusplus) } // extern "C" #endif #endif // _ZE_DDI_Hlevel-zero-1.20.6/include/ze_ddi_common.h000066400000000000000000000015701475521542100202770ustar00rootroot00000000000000/* * * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_ddi_common.h * @version v1.12-r1.12.15 * */ #ifndef _ZE_DDI_COMMON_H #define _ZE_DDI_COMMON_H #if defined(__cplusplus) #pragma once #endif #include "ze_ddi.h" #include "zet_ddi.h" #include "zes_ddi.h" #if defined(__cplusplus) extern "C" { #endif /// @brief Handle with pointers to Dispatch Tables allocated by the driver at the beginning of every L0 object handle. typedef struct _ze_handle_t { ze_dditable_driver_t *pCore; // [in] pointer to _ze_dditable_t_ object related to this handle zet_dditable_driver_t *pTools; // [in] pointer to _zet_dditable_t_ object related to this handle zes_dditable_driver_t *pSysman; // [in] pointer to _zes_dditable_t_ object related to this handle } ze_handle_t; #if defined(__cplusplus) } // extern "C" #endif #endif // _ZE_DDI_COMMON_Hlevel-zero-1.20.6/include/zes.py000066400000000000000000011005771475521542100165030ustar00rootroot00000000000000""" Copyright (C) 2019-2021 Intel Corporation SPDX-License-Identifier: MIT @file zes.py @version v1.12-r1.12.15 """ import platform from ctypes import * from enum import * ############################################################################### __version__ = "1.0" ############################################################################### ## @brief Handle to a driver instance class zes_driver_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of device object class zes_device_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device scheduler queue class zes_sched_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device performance factors class zes_perf_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device power domain class zes_pwr_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device frequency domain class zes_freq_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device engine group class zes_engine_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device standby control class zes_standby_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device firmware class zes_firmware_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device memory module class zes_mem_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman fabric port class zes_fabric_port_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device temperature sensor class zes_temp_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device power supply class zes_psu_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device fan class zes_fan_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device LED class zes_led_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device RAS error set class zes_ras_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device diagnostics test suite class zes_diag_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman device overclock domain class zes_overclock_handle_t(c_void_p): pass ############################################################################### ## @brief Handle for a Sysman virtual function management domain class zes_vf_handle_t(c_void_p): pass ############################################################################### ## @brief Defines structure types class zes_structure_type_v(IntEnum): DEVICE_PROPERTIES = 0x1 ## ::zes_device_properties_t PCI_PROPERTIES = 0x2 ## ::zes_pci_properties_t PCI_BAR_PROPERTIES = 0x3 ## ::zes_pci_bar_properties_t DIAG_PROPERTIES = 0x4 ## ::zes_diag_properties_t ENGINE_PROPERTIES = 0x5 ## ::zes_engine_properties_t FABRIC_PORT_PROPERTIES = 0x6 ## ::zes_fabric_port_properties_t FAN_PROPERTIES = 0x7 ## ::zes_fan_properties_t FIRMWARE_PROPERTIES = 0x8 ## ::zes_firmware_properties_t FREQ_PROPERTIES = 0x9 ## ::zes_freq_properties_t LED_PROPERTIES = 0xa ## ::zes_led_properties_t MEM_PROPERTIES = 0xb ## ::zes_mem_properties_t PERF_PROPERTIES = 0xc ## ::zes_perf_properties_t POWER_PROPERTIES = 0xd ## ::zes_power_properties_t PSU_PROPERTIES = 0xe ## ::zes_psu_properties_t RAS_PROPERTIES = 0xf ## ::zes_ras_properties_t SCHED_PROPERTIES = 0x10 ## ::zes_sched_properties_t SCHED_TIMEOUT_PROPERTIES = 0x11 ## ::zes_sched_timeout_properties_t SCHED_TIMESLICE_PROPERTIES = 0x12 ## ::zes_sched_timeslice_properties_t STANDBY_PROPERTIES = 0x13 ## ::zes_standby_properties_t TEMP_PROPERTIES = 0x14 ## ::zes_temp_properties_t DEVICE_STATE = 0x15 ## ::zes_device_state_t PROCESS_STATE = 0x16 ## ::zes_process_state_t PCI_STATE = 0x17 ## ::zes_pci_state_t FABRIC_PORT_CONFIG = 0x18 ## ::zes_fabric_port_config_t FABRIC_PORT_STATE = 0x19 ## ::zes_fabric_port_state_t FAN_CONFIG = 0x1a ## ::zes_fan_config_t FREQ_STATE = 0x1b ## ::zes_freq_state_t OC_CAPABILITIES = 0x1c ## ::zes_oc_capabilities_t LED_STATE = 0x1d ## ::zes_led_state_t MEM_STATE = 0x1e ## ::zes_mem_state_t PSU_STATE = 0x1f ## ::zes_psu_state_t BASE_STATE = 0x20 ## ::zes_base_state_t RAS_CONFIG = 0x21 ## ::zes_ras_config_t RAS_STATE = 0x22 ## ::zes_ras_state_t TEMP_CONFIG = 0x23 ## ::zes_temp_config_t PCI_BAR_PROPERTIES_1_2 = 0x24 ## ::zes_pci_bar_properties_1_2_t DEVICE_ECC_DESC = 0x25 ## ::zes_device_ecc_desc_t DEVICE_ECC_PROPERTIES = 0x26 ## ::zes_device_ecc_properties_t POWER_LIMIT_EXT_DESC = 0x27 ## ::zes_power_limit_ext_desc_t POWER_EXT_PROPERTIES = 0x28 ## ::zes_power_ext_properties_t OVERCLOCK_PROPERTIES = 0x29 ## ::zes_overclock_properties_t FABRIC_PORT_ERROR_COUNTERS = 0x2a ## ::zes_fabric_port_error_counters_t ENGINE_EXT_PROPERTIES = 0x2b ## ::zes_engine_ext_properties_t RESET_PROPERTIES = 0x2c ## ::zes_reset_properties_t DEVICE_EXT_PROPERTIES = 0x2d ## ::zes_device_ext_properties_t DEVICE_UUID = 0x2e ## ::zes_uuid_t POWER_DOMAIN_EXP_PROPERTIES = 0x00020001 ## ::zes_power_domain_exp_properties_t MEM_BANDWIDTH_COUNTER_BITS_EXP_PROPERTIES = 0x00020002 ## ::zes_mem_bandwidth_counter_bits_exp_properties_t MEMORY_PAGE_OFFLINE_STATE_EXP = 0x00020003 ## ::zes_mem_page_offline_state_exp_t SUBDEVICE_EXP_PROPERTIES = 0x00020004 ## ::zes_subdevice_exp_properties_t VF_EXP_PROPERTIES = 0x00020005 ## ::zes_vf_exp_properties_t VF_UTIL_MEM_EXP = 0x00020006 ## ::zes_vf_util_mem_exp_t VF_UTIL_ENGINE_EXP = 0x00020007 ## ::zes_vf_util_engine_exp_t VF_EXP_CAPABILITIES = 0x00020008 ## ::zes_vf_exp_capabilities_t VF_UTIL_MEM_EXP2 = 0x00020009 ## ::zes_vf_util_mem_exp2_t VF_UTIL_ENGINE_EXP2 = 0x00020010 ## ::zes_vf_util_engine_exp2_t VF_EXP2_CAPABILITIES = 0x00020011 ## ::zes_vf_exp2_capabilities_t class zes_structure_type_t(c_int): def __str__(self): return str(zes_structure_type_v(self.value)) ############################################################################### ## @brief Base for all properties types class zes_base_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p) ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ] ############################################################################### ## @brief Base for all descriptor types class zes_base_desc_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p) ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ] ############################################################################### ## @brief Base for all state types class zes_base_state_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p) ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ] ############################################################################### ## @brief Base for all config types class zes_base_config_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p) ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ] ############################################################################### ## @brief Base for all capability types class zes_base_capability_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p) ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ] ############################################################################### ## @brief Supported sysman initialization flags class zes_init_flags_v(IntEnum): PLACEHOLDER = ZE_BIT(0) ## placeholder for future use class zes_init_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Maximum extension name string size ZES_MAX_EXTENSION_NAME = 256 ############################################################################### ## @brief Extension properties queried using ::zesDriverGetExtensionProperties class zes_driver_extension_properties_t(Structure): _fields_ = [ ("name", c_char * ZES_MAX_EXTENSION_NAME), ## [out] extension name ("version", c_ulong) ## [out] extension version using ::ZE_MAKE_VERSION ] ############################################################################### ## @brief Maximum number of characters in string properties. ZES_STRING_PROPERTY_SIZE = 64 ############################################################################### ## @brief Maximum device universal unique id (UUID) size in bytes. ZES_MAX_UUID_SIZE = 16 ############################################################################### ## @brief Types of accelerator engines class zes_engine_type_flags_v(IntEnum): OTHER = ZE_BIT(0) ## Undefined types of accelerators. COMPUTE = ZE_BIT(1) ## Engines that process compute kernels only (no 3D content). _3D = ZE_BIT(2) ## Engines that process 3D content only (no compute kernels). MEDIA = ZE_BIT(3) ## Engines that process media workloads. DMA = ZE_BIT(4) ## Engines that copy blocks of data. RENDER = ZE_BIT(5) ## Engines that can process both 3D content and compute kernels. class zes_engine_type_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device repair status class zes_repair_status_v(IntEnum): UNSUPPORTED = 0 ## The device does not support in-field repairs. NOT_PERFORMED = 1 ## The device has never been repaired. PERFORMED = 2 ## The device has been repaired. class zes_repair_status_t(c_int): def __str__(self): return str(zes_repair_status_v(self.value)) ############################################################################### ## @brief Device reset reasons class zes_reset_reason_flags_v(IntEnum): WEDGED = ZE_BIT(0) ## The device needs to be reset because one or more parts of the hardware ## is wedged REPAIR = ZE_BIT(1) ## The device needs to be reset in order to complete in-field repairs class zes_reset_reason_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device reset type class zes_reset_type_v(IntEnum): WARM = 0 ## Apply warm reset COLD = 1 ## Apply cold reset FLR = 2 ## Apply FLR reset class zes_reset_type_t(c_int): def __str__(self): return str(zes_reset_type_v(self.value)) ############################################################################### ## @brief Device state class zes_device_state_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("reset", zes_reset_reason_flags_t), ## [out] Indicates if the device needs to be reset and for what reasons. ## returns 0 (none) or combination of ::zes_reset_reason_flag_t ("repaired", zes_repair_status_t) ## [out] Indicates if the device has been repaired ] ############################################################################### ## @brief Device reset properties class zes_reset_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("force", ze_bool_t), ## [in] If set to true, all applications that are currently using the ## device will be forcibly killed. ("resetType", zes_reset_type_t) ## [in] Type of reset needs to be performed ] ############################################################################### ## @brief Device universal unique id (UUID) class zes_uuid_t(Structure): _fields_ = [ ("id", c_ubyte * ZES_MAX_UUID_SIZE) ## [out] opaque data representing a device UUID ] ############################################################################### ## @brief Supported device types class zes_device_type_v(IntEnum): GPU = 1 ## Graphics Processing Unit CPU = 2 ## Central Processing Unit FPGA = 3 ## Field Programmable Gate Array MCA = 4 ## Memory Copy Accelerator VPU = 5 ## Vision Processing Unit class zes_device_type_t(c_int): def __str__(self): return str(zes_device_type_v(self.value)) ############################################################################### ## @brief Supported device property flags class zes_device_property_flags_v(IntEnum): INTEGRATED = ZE_BIT(0) ## Device is integrated with the Host. SUBDEVICE = ZE_BIT(1) ## Device handle used for query represents a sub-device. ECC = ZE_BIT(2) ## Device supports error correction memory access. ONDEMANDPAGING = ZE_BIT(3) ## Device supports on-demand page-faulting. class zes_device_property_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device properties class zes_device_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("core", ze_device_properties_t), ## [out] (Deprecated, use ::zes_uuid_t in the extended structure) Core ## device properties ("numSubdevices", c_ulong), ## [out] Number of sub-devices. A value of 0 indicates that this device ## doesn't have sub-devices. ("serialNumber", c_char * ZES_STRING_PROPERTY_SIZE), ## [out] Manufacturing serial number (NULL terminated string value). This ## value is intended to reflect the Part ID/SoC ID assigned by ## manufacturer that is unique for a SoC. Will be set to the string ## "unknown" if this cannot be determined for the device. ("boardNumber", c_char * ZES_STRING_PROPERTY_SIZE), ## [out] Manufacturing board number (NULL terminated string value). ## Alternatively "boardSerialNumber", this value is intended to reflect ## the string printed on board label by manufacturer. Will be set to the ## string "unknown" if this cannot be determined for the device. ("brandName", c_char * ZES_STRING_PROPERTY_SIZE), ## [out] Brand name of the device (NULL terminated string value). Will be ## set to the string "unknown" if this cannot be determined for the ## device. ("modelName", c_char * ZES_STRING_PROPERTY_SIZE), ## [out] Model name of the device (NULL terminated string value). Will be ## set to the string "unknown" if this cannot be determined for the ## device. ("vendorName", c_char * ZES_STRING_PROPERTY_SIZE), ## [out] Vendor name of the device (NULL terminated string value). Will ## be set to the string "unknown" if this cannot be determined for the ## device. ("driverVersion", c_char * ZES_STRING_PROPERTY_SIZE) ## [out] Installed driver version (NULL terminated string value). Will be ## set to the string "unknown" if this cannot be determined for the ## device. ] ############################################################################### ## @brief Device properties class zes_device_ext_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("uuid", zes_uuid_t), ## [out] universal unique identifier. Note: uuid obtained from Sysman API ## is the same as from core API. Subdevices will have their own uuid. ("type", zes_device_type_t), ## [out] generic device type ("flags", zes_device_property_flags_t) ## [out] 0 (none) or a valid combination of ::zes_device_property_flag_t ] ############################################################################### ## @brief Contains information about a process that has an open connection with ## this device ## ## @details ## - The application can use the process ID to query the OS for the owner ## and the path to the executable. class zes_process_state_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("processId", c_ulong), ## [out] Host OS process ID. ("memSize", c_ulonglong), ## [out] Device memory size in bytes allocated by this process (may not ## necessarily be resident on the device at the time of reading). ("sharedSize", c_ulonglong), ## [out] The size of shared device memory mapped into this process (may ## not necessarily be resident on the device at the time of reading). ("engines", zes_engine_type_flags_t) ## [out] Bitfield of accelerator engine types being used by this process. ] ############################################################################### ## @brief PCI address class zes_pci_address_t(Structure): _fields_ = [ ("domain", c_ulong), ## [out] BDF domain ("bus", c_ulong), ## [out] BDF bus ("device", c_ulong), ## [out] BDF device ("function", c_ulong) ## [out] BDF function ] ############################################################################### ## @brief PCI speed class zes_pci_speed_t(Structure): _fields_ = [ ("gen", c_int32_t), ## [out] The link generation. A value of -1 means that this property is ## unknown. ("width", c_int32_t), ## [out] The number of lanes. A value of -1 means that this property is ## unknown. ("maxBandwidth", c_int64_t) ## [out] The maximum bandwidth in bytes/sec (sum of all lanes). A value ## of -1 means that this property is unknown. ] ############################################################################### ## @brief Static PCI properties class zes_pci_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("address", zes_pci_address_t), ## [out] The BDF address ("maxSpeed", zes_pci_speed_t), ## [out] Fastest port configuration supported by the device (sum of all ## lanes) ("haveBandwidthCounters", ze_bool_t), ## [out] Indicates whether the `rxCounter` and `txCounter` members of ## ::zes_pci_stats_t will have valid values ("havePacketCounters", ze_bool_t), ## [out] Indicates whether the `packetCounter` member of ## ::zes_pci_stats_t will have a valid value ("haveReplayCounters", ze_bool_t) ## [out] Indicates whether the `replayCounter` member of ## ::zes_pci_stats_t will have a valid value ] ############################################################################### ## @brief PCI link status class zes_pci_link_status_v(IntEnum): UNKNOWN = 0 ## The link status could not be determined GOOD = 1 ## The link is up and operating as expected QUALITY_ISSUES = 2 ## The link is up but has quality and/or bandwidth degradation STABILITY_ISSUES = 3 ## The link has stability issues and preventing workloads making forward ## progress class zes_pci_link_status_t(c_int): def __str__(self): return str(zes_pci_link_status_v(self.value)) ############################################################################### ## @brief PCI link quality degradation reasons class zes_pci_link_qual_issue_flags_v(IntEnum): REPLAYS = ZE_BIT(0) ## A significant number of replays are occurring SPEED = ZE_BIT(1) ## There is a degradation in the maximum bandwidth of the link class zes_pci_link_qual_issue_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief PCI link stability issues class zes_pci_link_stab_issue_flags_v(IntEnum): RETRAINING = ZE_BIT(0) ## Link retraining has occurred to deal with quality issues class zes_pci_link_stab_issue_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Dynamic PCI state class zes_pci_state_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("status", zes_pci_link_status_t), ## [out] The current status of the port ("qualityIssues", zes_pci_link_qual_issue_flags_t), ## [out] If status is ::ZES_PCI_LINK_STATUS_QUALITY_ISSUES, ## then this gives a combination of ::zes_pci_link_qual_issue_flag_t for ## quality issues that have been detected; ## otherwise, 0 indicates there are no quality issues with the link at ## this time." ("stabilityIssues", zes_pci_link_stab_issue_flags_t), ## [out] If status is ::ZES_PCI_LINK_STATUS_STABILITY_ISSUES, ## then this gives a combination of ::zes_pci_link_stab_issue_flag_t for ## reasons for the connection instability; ## otherwise, 0 indicates there are no connection stability issues at ## this time." ("speed", zes_pci_speed_t) ## [out] The current port configure speed ] ############################################################################### ## @brief PCI bar types class zes_pci_bar_type_v(IntEnum): MMIO = 0 ## MMIO registers ROM = 1 ## ROM aperture MEM = 2 ## Device memory class zes_pci_bar_type_t(c_int): def __str__(self): return str(zes_pci_bar_type_v(self.value)) ############################################################################### ## @brief Properties of a pci bar class zes_pci_bar_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zes_pci_bar_type_t), ## [out] The type of bar ("index", c_ulong), ## [out] The index of the bar ("base", c_ulonglong), ## [out] Base address of the bar. ("size", c_ulonglong) ## [out] Size of the bar. ] ############################################################################### ## @brief Properties of a pci bar, including the resizable bar. class zes_pci_bar_properties_1_2_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zes_pci_bar_type_t), ## [out] The type of bar ("index", c_ulong), ## [out] The index of the bar ("base", c_ulonglong), ## [out] Base address of the bar. ("size", c_ulonglong), ## [out] Size of the bar. ("resizableBarSupported", ze_bool_t), ## [out] Support for Resizable Bar on this device. ("resizableBarEnabled", ze_bool_t) ## [out] Resizable Bar enabled on this device ] ############################################################################### ## @brief PCI stats counters ## ## @details ## - Percent replays is calculated by taking two snapshots (s1, s2) and ## using the equation: %replay = 10^6 * (s2.replayCounter - ## s1.replayCounter) / (s2.maxBandwidth * (s2.timestamp - s1.timestamp)) ## - Percent throughput is calculated by taking two snapshots (s1, s2) and ## using the equation: %bw = 10^6 * ((s2.rxCounter - s1.rxCounter) + ## (s2.txCounter - s1.txCounter)) / (s2.maxBandwidth * (s2.timestamp - ## s1.timestamp)) class zes_pci_stats_t(Structure): _fields_ = [ ("timestamp", c_ulonglong), ## [out] Monotonic timestamp counter in microseconds when the measurement ## was made. ## This timestamp should only be used to calculate delta time between ## snapshots of this structure. ## Never take the delta of this timestamp with the timestamp from a ## different structure since they are not guaranteed to have the same base. ## The absolute value of the timestamp is only valid during within the ## application and may be different on the next execution. ("replayCounter", c_ulonglong), ## [out] Monotonic counter for the number of replay packets (sum of all ## lanes). Will always be 0 when the `haveReplayCounters` member of ## ::zes_pci_properties_t is FALSE. ("packetCounter", c_ulonglong), ## [out] Monotonic counter for the number of packets (sum of all lanes). ## Will always be 0 when the `havePacketCounters` member of ## ::zes_pci_properties_t is FALSE. ("rxCounter", c_ulonglong), ## [out] Monotonic counter for the number of bytes received (sum of all ## lanes). Will always be 0 when the `haveBandwidthCounters` member of ## ::zes_pci_properties_t is FALSE. ("txCounter", c_ulonglong), ## [out] Monotonic counter for the number of bytes transmitted (including ## replays) (sum of all lanes). Will always be 0 when the ## `haveBandwidthCounters` member of ::zes_pci_properties_t is FALSE. ("speed", zes_pci_speed_t) ## [out] The current speed of the link (sum of all lanes) ] ############################################################################### ## @brief Overclock domains. class zes_overclock_domain_v(IntEnum): CARD = 1 ## Overclocking card level properties such as temperature limits. PACKAGE = 2 ## Overclocking package level properties such as power limits. GPU_ALL = 4 ## Overclocking a GPU that has all accelerator assets on the same PLL/VR. GPU_RENDER_COMPUTE = 8 ## Overclocking a GPU with render and compute assets on the same PLL/VR. GPU_RENDER = 16 ## Overclocking a GPU with render assets on its own PLL/VR. GPU_COMPUTE = 32 ## Overclocking a GPU with compute assets on its own PLL/VR. GPU_MEDIA = 64 ## Overclocking a GPU with media assets on its own PLL/VR. VRAM = 128 ## Overclocking device local memory. ADM = 256 ## Overclocking LLC/L4 cache. class zes_overclock_domain_t(c_int): def __str__(self): return str(zes_overclock_domain_v(self.value)) ############################################################################### ## @brief Overclock controls. class zes_overclock_control_v(IntEnum): VF = 1 ## This control permits setting a custom V-F curve. FREQ_OFFSET = 2 ## The V-F curve of the overclock domain can be shifted up or down using ## this control. VMAX_OFFSET = 4 ## This control is used to increase the permitted voltage above the ## shipped voltage maximum. FREQ = 8 ## This control permits direct changes to the operating frequency. VOLT_LIMIT = 16 ## This control prevents frequencies that would push the voltage above ## this value, typically used by V-F scanners. POWER_SUSTAINED_LIMIT = 32 ## This control changes the sustained power limit (PL1). POWER_BURST_LIMIT = 64 ## This control changes the burst power limit (PL2). POWER_PEAK_LIMIT = 128 ## his control changes the peak power limit (PL4). ICCMAX_LIMIT = 256 ## This control changes the value of IccMax.. TEMP_LIMIT = 512 ## This control changes the value of TjMax. ITD_DISABLE = 1024 ## This control permits disabling the adaptive voltage feature ITD ACM_DISABLE = 2048 ## This control permits disabling the adaptive voltage feature ACM. class zes_overclock_control_t(c_int): def __str__(self): return str(zes_overclock_control_v(self.value)) ############################################################################### ## @brief Overclock modes. class zes_overclock_mode_v(IntEnum): MODE_OFF = 0 ## Overclock mode is off MODE_STOCK = 2 ## Stock (manufacturing settings) are being used. MODE_ON = 3 ## Overclock mode is on. MODE_UNAVAILABLE = 4 ## Overclocking is unavailable at this time since the system is running ## on battery. MODE_DISABLED = 5 ## Overclock mode is disabled. class zes_overclock_mode_t(c_int): def __str__(self): return str(zes_overclock_mode_v(self.value)) ############################################################################### ## @brief Overclock control states. class zes_control_state_v(IntEnum): STATE_UNSET = 0 ## No overclock control has not been changed by the driver since the last ## boot/reset. STATE_ACTIVE = 2 ## The overclock control has been set and it is active. STATE_DISABLED = 3 ## The overclock control value has been disabled due to the current power ## configuration (typically when running on DC). class zes_control_state_t(c_int): def __str__(self): return str(zes_control_state_v(self.value)) ############################################################################### ## @brief Overclock pending actions. class zes_pending_action_v(IntEnum): PENDING_NONE = 0 ## There no pending actions. . PENDING_IMMINENT = 1 ## The requested change is in progress and should complete soon. PENDING_COLD_RESET = 2 ## The requested change requires a device cold reset (hotplug, system ## boot). PENDING_WARM_RESET = 3 ## The requested change requires a device warm reset (PCIe FLR). class zes_pending_action_t(c_int): def __str__(self): return str(zes_pending_action_v(self.value)) ############################################################################### ## @brief Overclock V-F curve programing. class zes_vf_program_type_v(IntEnum): VF_ARBITRARY = 0 ## Can program an arbitrary number of V-F points up to the maximum number ## and each point can have arbitrary voltage and frequency values within ## the min/max/step limits VF_FREQ_FIXED = 1 ## Can only program the voltage for the V-F points that it reads back - ## the frequency of those points cannot be changed VF_VOLT_FIXED = 2 ## Can only program the frequency for the V-F points that is reads back - ## the voltage of each point cannot be changed. class zes_vf_program_type_t(c_int): def __str__(self): return str(zes_vf_program_type_v(self.value)) ############################################################################### ## @brief VF type class zes_vf_type_v(IntEnum): VOLT = 0 ## VF Voltage point FREQ = 1 ## VF Frequency point class zes_vf_type_t(c_int): def __str__(self): return str(zes_vf_type_v(self.value)) ############################################################################### ## @brief VF type class zes_vf_array_type_v(IntEnum): USER_VF_ARRAY = 0 ## User V-F array DEFAULT_VF_ARRAY = 1 ## Default V-F array LIVE_VF_ARRAY = 2 ## Live V-F array class zes_vf_array_type_t(c_int): def __str__(self): return str(zes_vf_array_type_v(self.value)) ############################################################################### ## @brief Overclock properties ## ## @details ## - Information on the overclock domain type and all the contols that are ## part of the domain. class zes_overclock_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("domainType", zes_overclock_domain_t), ## [out] The hardware block that this overclock domain controls (GPU, ## VRAM, ...) ("AvailableControls", c_ulong), ## [out] Returns the overclock controls that are supported (a bit for ## each of enum ::zes_overclock_control_t). If no bits are set, the ## domain doesn't support overclocking. ("VFProgramType", zes_vf_program_type_t), ## [out] Type of V-F curve programming that is permitted:. ("NumberOfVFPoints", c_ulong) ## [out] Number of VF points that can be programmed - max_num_points ] ############################################################################### ## @brief Overclock Control properties ## ## @details ## - Provides all the control capabilities supported by the device for the ## overclock domain. class zes_control_property_t(Structure): _fields_ = [ ("MinValue", c_double), ## [out] This provides information about the limits of the control value ## so that the driver can calculate the set of valid values. ("MaxValue", c_double), ## [out] This provides information about the limits of the control value ## so that the driver can calculate the set of valid values. ("StepValue", c_double), ## [out] This provides information about the limits of the control value ## so that the driver can calculate the set of valid values. ("RefValue", c_double), ## [out] The reference value provides the anchor point, UIs can combine ## this with the user offset request to show the anticipated improvement. ("DefaultValue", c_double) ## [out] The shipped out-of-box position of this control. Driver can ## request this value at any time to return to the out-of-box behavior. ] ############################################################################### ## @brief Overclock VF properties ## ## @details ## - Provides all the VF capabilities supported by the device for the ## overclock domain. class zes_vf_property_t(Structure): _fields_ = [ ("MinFreq", c_double), ## [out] Read the minimum frequency that can be be programmed in the ## custom V-F point.. ("MaxFreq", c_double), ## [out] Read the maximum frequency that can be be programmed in the ## custom V-F point.. ("StepFreq", c_double), ## [out] Read the frequency step that can be be programmed in the custom ## V-F point.. ("MinVolt", c_double), ## [out] Read the minimum voltage that can be be programmed in the custom ## V-F point.. ("MaxVolt", c_double), ## [out] Read the maximum voltage that can be be programmed in the custom ## V-F point.. ("StepVolt", c_double) ## [out] Read the voltage step that can be be programmed in the custom ## V-F point. ] ############################################################################### ## @brief Diagnostic results class zes_diag_result_v(IntEnum): NO_ERRORS = 0 ## Diagnostic completed without finding errors to repair ABORT = 1 ## Diagnostic had problems running tests FAIL_CANT_REPAIR = 2 ## Diagnostic had problems setting up repairs REBOOT_FOR_REPAIR = 3 ## Diagnostics found errors, setup for repair and reboot is required to ## complete the process class zes_diag_result_t(c_int): def __str__(self): return str(zes_diag_result_v(self.value)) ############################################################################### ## @brief Diagnostic test index to use for the very first test. ZES_DIAG_FIRST_TEST_INDEX = 0x0 ############################################################################### ## @brief Diagnostic test index to use for the very last test. ZES_DIAG_LAST_TEST_INDEX = 0xFFFFFFFF ############################################################################### ## @brief Diagnostic test class zes_diag_test_t(Structure): _fields_ = [ ("index", c_ulong), ## [out] Index of the test ("name", c_char * ZES_STRING_PROPERTY_SIZE) ## [out] Name of the test ] ############################################################################### ## @brief Diagnostics test suite properties class zes_diag_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("onSubdevice", ze_bool_t), ## [out] True if the resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong), ## [out] If onSubdevice is true, this gives the ID of the sub-device ("name", c_char * ZES_STRING_PROPERTY_SIZE), ## [out] Name of the diagnostics test suite ("haveTests", ze_bool_t) ## [out] Indicates if this test suite has individual tests which can be ## run separately (use the function ::zesDiagnosticsGetTests() to get the ## list of these tests) ] ############################################################################### ## @brief ECC State class zes_device_ecc_state_v(IntEnum): UNAVAILABLE = 0 ## None ENABLED = 1 ## ECC enabled. DISABLED = 2 ## ECC disabled. class zes_device_ecc_state_t(c_int): def __str__(self): return str(zes_device_ecc_state_v(self.value)) ############################################################################### ## @brief State Change Requirements class zes_device_action_v(IntEnum): NONE = 0 ## No action. WARM_CARD_RESET = 1 ## Warm reset of the card. COLD_CARD_RESET = 2 ## Cold reset of the card. COLD_SYSTEM_REBOOT = 3 ## Cold reboot of the system. class zes_device_action_t(c_int): def __str__(self): return str(zes_device_action_v(self.value)) ############################################################################### ## @brief ECC State Descriptor class zes_device_ecc_desc_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("state", zes_device_ecc_state_t) ## [out] ECC state ] ############################################################################### ## @brief ECC State class zes_device_ecc_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("currentState", zes_device_ecc_state_t), ## [out] Current ECC state ("pendingState", zes_device_ecc_state_t), ## [out] Pending ECC state ("pendingAction", zes_device_action_t) ## [out] Pending action ] ############################################################################### ## @brief Accelerator engine groups class zes_engine_group_v(IntEnum): ALL = 0 ## Access information about all engines combined. COMPUTE_ALL = 1 ## Access information about all compute engines combined. Compute engines ## can only process compute kernels (no 3D content). MEDIA_ALL = 2 ## Access information about all media engines combined. COPY_ALL = 3 ## Access information about all copy (blitter) engines combined. COMPUTE_SINGLE = 4 ## Access information about a single compute engine - this is an engine ## that can process compute kernels. Note that single engines may share ## the same underlying accelerator resources as other engines so activity ## of such an engine may not be indicative of the underlying resource ## utilization - use ::ZES_ENGINE_GROUP_3D_RENDER_COMPUTE_ALL for that. RENDER_SINGLE = 5 ## Access information about a single render engine - this is an engine ## that can process both 3D content and compute kernels. Note that single ## engines may share the same underlying accelerator resources as other ## engines so activity of such an engine may not be indicative of the ## underlying resource utilization - use ## ::ZES_ENGINE_GROUP_3D_RENDER_COMPUTE_ALL for that. MEDIA_DECODE_SINGLE = 6 ## [DEPRECATED] No longer supported. MEDIA_ENCODE_SINGLE = 7 ## [DEPRECATED] No longer supported. COPY_SINGLE = 8 ## Access information about a single media encode engine. Note that ## single engines may share the same underlying accelerator resources as ## other engines so activity of such an engine may not be indicative of ## the underlying resource utilization - use ::ZES_ENGINE_GROUP_COPY_ALL ## for that. MEDIA_ENHANCEMENT_SINGLE = 9 ## Access information about a single media enhancement engine. Note that ## single engines may share the same underlying accelerator resources as ## other engines so activity of such an engine may not be indicative of ## the underlying resource utilization - use ::ZES_ENGINE_GROUP_MEDIA_ALL ## for that. _3D_SINGLE = 10 ## [DEPRECATED] No longer supported. _3D_RENDER_COMPUTE_ALL = 11 ## [DEPRECATED] No longer supported. RENDER_ALL = 12 ## Access information about all render engines combined. Render engines ## are those than process both 3D content and compute kernels. _3D_ALL = 13 ## [DEPRECATED] No longer supported. MEDIA_CODEC_SINGLE = 14 ## Access information about a single media engine. Note that single ## engines may share the same underlying accelerator resources as other ## engines so activity of such an engine may not be indicative of the ## underlying resource utilization - use ::ZES_ENGINE_GROUP_MEDIA_ALL for ## that. class zes_engine_group_t(c_int): def __str__(self): return str(zes_engine_group_v(self.value)) ############################################################################### ## @brief Engine group properties class zes_engine_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zes_engine_group_t), ## [out] The engine group ("onSubdevice", ze_bool_t), ## [out] True if this resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong) ## [out] If onSubdevice is true, this gives the ID of the sub-device ] ############################################################################### ## @brief Engine activity counters ## ## @details ## - Percent utilization is calculated by taking two snapshots (s1, s2) and ## using the equation: %util = (s2.activeTime - s1.activeTime) / ## (s2.timestamp - s1.timestamp) ## - The `activeTime` time units are implementation-specific since the ## value is only intended to be used for calculating utilization ## percentage. ## - The `timestamp` should only be used to calculate delta between ## snapshots of this structure. ## - The application should never take the delta of `timestamp` with the ## timestamp from a different structure since they are not guaranteed to ## have the same base. ## - When taking the delta, the difference between `timestamp` samples ## could be `0`, if the frequency of sampling the snapshots is higher ## than the frequency of the timestamp update. ## - The absolute value of `timestamp` is only valid during within the ## application and may be different on the next execution. class zes_engine_stats_t(Structure): _fields_ = [ ("activeTime", c_ulonglong), ## [out] Monotonic counter where the resource is actively running ## workloads. ("timestamp", c_ulonglong) ## [out] Monotonic counter when activeTime counter was sampled. ] ############################################################################### ## @brief Event types class zes_event_type_flags_v(IntEnum): DEVICE_DETACH = ZE_BIT(0) ## Event is triggered when the device is no longer available (due to a ## reset or being disabled). DEVICE_ATTACH = ZE_BIT(1) ## Event is triggered after the device is available again. DEVICE_SLEEP_STATE_ENTER = ZE_BIT(2) ## Event is triggered when the driver is about to put the device into a ## deep sleep state DEVICE_SLEEP_STATE_EXIT = ZE_BIT(3) ## Event is triggered when the driver is waking the device up from a deep ## sleep state FREQ_THROTTLED = ZE_BIT(4) ## Event is triggered when the frequency starts being throttled ENERGY_THRESHOLD_CROSSED = ZE_BIT(5) ## Event is triggered when the energy consumption threshold is reached ## (use ::zesPowerSetEnergyThreshold() to configure). TEMP_CRITICAL = ZE_BIT(6) ## Event is triggered when the critical temperature is reached (use ## ::zesTemperatureSetConfig() to configure - disabled by default). TEMP_THRESHOLD1 = ZE_BIT(7) ## Event is triggered when the temperature crosses threshold 1 (use ## ::zesTemperatureSetConfig() to configure - disabled by default). TEMP_THRESHOLD2 = ZE_BIT(8) ## Event is triggered when the temperature crosses threshold 2 (use ## ::zesTemperatureSetConfig() to configure - disabled by default). MEM_HEALTH = ZE_BIT(9) ## Event is triggered when the health of device memory changes. FABRIC_PORT_HEALTH = ZE_BIT(10) ## Event is triggered when the health of fabric ports change. PCI_LINK_HEALTH = ZE_BIT(11) ## Event is triggered when the health of the PCI link changes. RAS_CORRECTABLE_ERRORS = ZE_BIT(12) ## Event is triggered when accelerator RAS correctable errors cross ## thresholds (use ::zesRasSetConfig() to configure - disabled by ## default). RAS_UNCORRECTABLE_ERRORS = ZE_BIT(13) ## Event is triggered when accelerator RAS uncorrectable errors cross ## thresholds (use ::zesRasSetConfig() to configure - disabled by ## default). DEVICE_RESET_REQUIRED = ZE_BIT(14) ## Event is triggered when the device needs to be reset (use ## ::zesDeviceGetState() to determine the reasons for the reset). SURVIVABILITY_MODE_DETECTED = ZE_BIT(15) ## Event is triggered when graphics driver encounter an error condition. class zes_event_type_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Maximum Fabric port model string size ZES_MAX_FABRIC_PORT_MODEL_SIZE = 256 ############################################################################### ## @brief Maximum size of the buffer that will return information about link ## types ZES_MAX_FABRIC_LINK_TYPE_SIZE = 256 ############################################################################### ## @brief Fabric port status class zes_fabric_port_status_v(IntEnum): UNKNOWN = 0 ## The port status cannot be determined HEALTHY = 1 ## The port is up and operating as expected DEGRADED = 2 ## The port is up but has quality and/or speed degradation FAILED = 3 ## Port connection instabilities are preventing workloads making forward ## progress DISABLED = 4 ## The port is configured down class zes_fabric_port_status_t(c_int): def __str__(self): return str(zes_fabric_port_status_v(self.value)) ############################################################################### ## @brief Fabric port quality degradation reasons class zes_fabric_port_qual_issue_flags_v(IntEnum): LINK_ERRORS = ZE_BIT(0) ## Excessive link errors are occurring SPEED = ZE_BIT(1) ## There is a degradation in the bitrate and/or width of the link class zes_fabric_port_qual_issue_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Fabric port failure reasons class zes_fabric_port_failure_flags_v(IntEnum): FAILED = ZE_BIT(0) ## A previously operating link has failed. Hardware will automatically ## retrain this port. This state will persist until either the physical ## connection is removed or the link trains successfully. TRAINING_TIMEOUT = ZE_BIT(1) ## A connection has not been established within an expected time. ## Hardware will continue to attempt port training. This status will ## persist until either the physical connection is removed or the link ## successfully trains. FLAPPING = ZE_BIT(2) ## Port has excessively trained and then transitioned down for some ## period of time. Driver will allow port to continue to train, but will ## not enable the port for use until the port has been disabled and ## subsequently re-enabled using ::zesFabricPortSetConfig(). class zes_fabric_port_failure_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Unique identifier for a fabric port ## ## @details ## - This not a universal identifier. The identified is garanteed to be ## unique for the current hardware configuration of the system. Changes ## in the hardware may result in a different identifier for a given port. ## - The main purpose of this identifier to build up an instantaneous ## topology map of system connectivity. An application should enumerate ## all fabric ports and match the `remotePortId` member of ## ::zes_fabric_port_state_t to the `portId` member of ## ::zes_fabric_port_properties_t. class zes_fabric_port_id_t(Structure): _fields_ = [ ("fabricId", c_ulong), ## [out] Unique identifier for the fabric end-point ("attachId", c_ulong), ## [out] Unique identifier for the device attachment point ("portNumber", c_ubyte) ## [out] The logical port number (this is typically marked somewhere on ## the physical device) ] ############################################################################### ## @brief Fabric port speed in one direction class zes_fabric_port_speed_t(Structure): _fields_ = [ ("bitRate", c_int64_t), ## [out] Bits/sec that the link is operating at. A value of -1 means that ## this property is unknown. ("width", c_int32_t) ## [out] The number of lanes. A value of -1 means that this property is ## unknown. ] ############################################################################### ## @brief Fabric port properties class zes_fabric_port_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("model", c_char * ZES_MAX_FABRIC_PORT_MODEL_SIZE), ## [out] Description of port technology. Will be set to the string ## "unkown" if this cannot be determined for this port. ("onSubdevice", ze_bool_t), ## [out] True if the port is located on a sub-device; false means that ## the port is on the device of the calling Sysman handle ("subdeviceId", c_ulong), ## [out] If onSubdevice is true, this gives the ID of the sub-device ("portId", zes_fabric_port_id_t), ## [out] The unique port identifier ("maxRxSpeed", zes_fabric_port_speed_t), ## [out] Maximum speed supported by the receive side of the port (sum of ## all lanes) ("maxTxSpeed", zes_fabric_port_speed_t) ## [out] Maximum speed supported by the transmit side of the port (sum of ## all lanes) ] ############################################################################### ## @brief Provides information about the fabric link attached to a port class zes_fabric_link_type_t(Structure): _fields_ = [ ("desc", c_char * ZES_MAX_FABRIC_LINK_TYPE_SIZE) ## [out] Description of link technology. Will be set to the string ## "unkown" if this cannot be determined for this link. ] ############################################################################### ## @brief Fabric port configuration class zes_fabric_port_config_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("enabled", ze_bool_t), ## [in,out] Port is configured up/down ("beaconing", ze_bool_t) ## [in,out] Beaconing is configured on/off ] ############################################################################### ## @brief Fabric port state class zes_fabric_port_state_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("status", zes_fabric_port_status_t), ## [out] The current status of the port ("qualityIssues", zes_fabric_port_qual_issue_flags_t), ## [out] If status is ::ZES_FABRIC_PORT_STATUS_DEGRADED, ## then this gives a combination of ::zes_fabric_port_qual_issue_flag_t ## for quality issues that have been detected; ## otherwise, 0 indicates there are no quality issues with the link at ## this time. ("failureReasons", zes_fabric_port_failure_flags_t), ## [out] If status is ::ZES_FABRIC_PORT_STATUS_FAILED, ## then this gives a combination of ::zes_fabric_port_failure_flag_t for ## reasons for the connection instability; ## otherwise, 0 indicates there are no connection stability issues at ## this time. ("remotePortId", zes_fabric_port_id_t), ## [out] The unique port identifier for the remote connection point if ## status is ::ZES_FABRIC_PORT_STATUS_HEALTHY, ## ::ZES_FABRIC_PORT_STATUS_DEGRADED or ::ZES_FABRIC_PORT_STATUS_FAILED ("rxSpeed", zes_fabric_port_speed_t), ## [out] Current maximum receive speed (sum of all lanes) ("txSpeed", zes_fabric_port_speed_t) ## [out] Current maximum transmit speed (sum of all lanes) ] ############################################################################### ## @brief Fabric port throughput. class zes_fabric_port_throughput_t(Structure): _fields_ = [ ("timestamp", c_ulonglong), ## [out] Monotonic timestamp counter in microseconds when the measurement ## was made. ## This timestamp should only be used to calculate delta time between ## snapshots of this structure. ## Never take the delta of this timestamp with the timestamp from a ## different structure since they are not guaranteed to have the same base. ## The absolute value of the timestamp is only valid during within the ## application and may be different on the next execution. ("rxCounter", c_ulonglong), ## [out] Monotonic counter for the number of bytes received (sum of all ## lanes). This includes all protocol overhead, not only the GPU traffic. ("txCounter", c_ulonglong) ## [out] Monotonic counter for the number of bytes transmitted (sum of ## all lanes). This includes all protocol overhead, not only the GPU ## traffic. ] ############################################################################### ## @brief Fabric Port Error Counters class zes_fabric_port_error_counters_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("linkFailureCount", c_ulonglong), ## [out] Link Failure Error Count reported per port ("fwCommErrorCount", c_ulonglong), ## [out] Firmware Communication Error Count reported per device ("fwErrorCount", c_ulonglong), ## [out] Firmware reported Error Count reported per device ("linkDegradeCount", c_ulonglong) ## [out] Link Degrade Error Count reported per port ] ############################################################################### ## @brief Fan resource speed mode class zes_fan_speed_mode_v(IntEnum): DEFAULT = 0 ## The fan speed is operating using the hardware default settings FIXED = 1 ## The fan speed is currently set to a fixed value TABLE = 2 ## The fan speed is currently controlled dynamically by hardware based on ## a temp/speed table class zes_fan_speed_mode_t(c_int): def __str__(self): return str(zes_fan_speed_mode_v(self.value)) ############################################################################### ## @brief Fan speed units class zes_fan_speed_units_v(IntEnum): RPM = 0 ## The fan speed is in units of revolutions per minute (rpm) PERCENT = 1 ## The fan speed is a percentage of the maximum speed of the fan class zes_fan_speed_units_t(c_int): def __str__(self): return str(zes_fan_speed_units_v(self.value)) ############################################################################### ## @brief Fan speed class zes_fan_speed_t(Structure): _fields_ = [ ("speed", c_int32_t), ## [in,out] The speed of the fan. On output, a value of -1 indicates that ## there is no fixed fan speed setting. ("units", zes_fan_speed_units_t) ## [in,out] The units that the fan speed is expressed in. On output, if ## fan speed is -1 then units should be ignored. ] ############################################################################### ## @brief Fan temperature/speed pair class zes_fan_temp_speed_t(Structure): _fields_ = [ ("temperature", c_ulong), ## [in,out] Temperature in degrees Celsius. ("speed", zes_fan_speed_t) ## [in,out] The speed of the fan ] ############################################################################### ## @brief Maximum number of fan temperature/speed pairs in the fan speed table. ZES_FAN_TEMP_SPEED_PAIR_COUNT = 32 ############################################################################### ## @brief Fan speed table class zes_fan_speed_table_t(Structure): _fields_ = [ ("numPoints", c_int32_t), ## [in,out] The number of valid points in the fan speed table. 0 means ## that there is no fan speed table configured. -1 means that a fan speed ## table is not supported by the hardware. ("table", zes_fan_temp_speed_t * ZES_FAN_TEMP_SPEED_PAIR_COUNT) ## [in,out] Array of temperature/fan speed pairs. The table is ordered ## based on temperature from lowest to highest. ] ############################################################################### ## @brief Fan properties class zes_fan_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("onSubdevice", ze_bool_t), ## [out] True if the resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong), ## [out] If onSubdevice is true, this gives the ID of the sub-device ("canControl", ze_bool_t), ## [out] Indicates if software can control the fan speed assuming the ## user has permissions ("supportedModes", c_ulong), ## [out] Bitfield of supported fan configuration modes ## (1<<::zes_fan_speed_mode_t) ("supportedUnits", c_ulong), ## [out] Bitfield of supported fan speed units ## (1<<::zes_fan_speed_units_t) ("maxRPM", c_int32_t), ## [out] The maximum RPM of the fan. A value of -1 means that this ## property is unknown. ("maxPoints", c_int32_t) ## [out] The maximum number of points in the fan temp/speed table. A ## value of -1 means that this fan doesn't support providing a temp/speed ## table. ] ############################################################################### ## @brief Fan configuration class zes_fan_config_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("mode", zes_fan_speed_mode_t), ## [in,out] The fan speed mode (fixed, temp-speed table) ("speedFixed", zes_fan_speed_t), ## [in,out] The current fixed fan speed setting ("speedTable", zes_fan_speed_table_t) ## [out] A table containing temperature/speed pairs ] ############################################################################### ## @brief Firmware properties class zes_firmware_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("onSubdevice", ze_bool_t), ## [out] True if the resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong), ## [out] If onSubdevice is true, this gives the ID of the sub-device ("canControl", ze_bool_t), ## [out] Indicates if software can flash the firmware assuming the user ## has permissions ("name", c_char * ZES_STRING_PROPERTY_SIZE), ## [out] NULL terminated string value. The string "unknown" will be ## returned if this property cannot be determined. ("version", c_char * ZES_STRING_PROPERTY_SIZE) ## [out] NULL terminated string value. The string "unknown" will be ## returned if this property cannot be determined. ] ############################################################################### ## @brief Frequency domains. class zes_freq_domain_v(IntEnum): GPU = 0 ## GPU Core Domain. MEMORY = 1 ## Local Memory Domain. MEDIA = 2 ## GPU Media Domain. class zes_freq_domain_t(c_int): def __str__(self): return str(zes_freq_domain_v(self.value)) ############################################################################### ## @brief Frequency properties ## ## @details ## - Indicates if this frequency domain can be overclocked (if true, ## functions such as ::zesFrequencyOcSetFrequencyTarget() are supported). ## - The min/max hardware frequencies are specified for non-overclock ## configurations. For overclock configurations, use ## ::zesFrequencyOcGetFrequencyTarget() to determine the maximum ## frequency that can be requested. class zes_freq_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zes_freq_domain_t), ## [out] The hardware block that this frequency domain controls (GPU, ## memory, ...) ("onSubdevice", ze_bool_t), ## [out] True if this resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong), ## [out] If onSubdevice is true, this gives the ID of the sub-device ("canControl", ze_bool_t), ## [out] Indicates if software can control the frequency of this domain ## assuming the user has permissions ("isThrottleEventSupported", ze_bool_t), ## [out] Indicates if software can register to receive event ## ::ZES_EVENT_TYPE_FLAG_FREQ_THROTTLED ("min", c_double), ## [out] The minimum hardware clock frequency in units of MHz. ("max", c_double) ## [out] The maximum non-overclock hardware clock frequency in units of ## MHz. ] ############################################################################### ## @brief Frequency range between which the hardware can operate. ## ## @details ## - When setting limits, they will be clamped to the hardware limits. ## - When setting limits, ensure that the max frequency is greater than or ## equal to the min frequency specified. ## - When setting limits to return to factory settings, specify -1 for both ## the min and max limit. class zes_freq_range_t(Structure): _fields_ = [ ("min", c_double), ## [in,out] The min frequency in MHz below which hardware frequency ## management will not request frequencies. On input, setting to 0 will ## permit the frequency to go down to the hardware minimum while setting ## to -1 will return the min frequency limit to the factory value (can be ## larger than the hardware min). On output, a negative value indicates ## that no external minimum frequency limit is in effect. ("max", c_double) ## [in,out] The max frequency in MHz above which hardware frequency ## management will not request frequencies. On input, setting to 0 or a ## very big number will permit the frequency to go all the way up to the ## hardware maximum while setting to -1 will return the max frequency to ## the factory value (which can be less than the hardware max). On ## output, a negative number indicates that no external maximum frequency ## limit is in effect. ] ############################################################################### ## @brief Frequency throttle reasons class zes_freq_throttle_reason_flags_v(IntEnum): AVE_PWR_CAP = ZE_BIT(0) ## frequency throttled due to average power excursion (PL1) BURST_PWR_CAP = ZE_BIT(1) ## frequency throttled due to burst power excursion (PL2) CURRENT_LIMIT = ZE_BIT(2) ## frequency throttled due to current excursion (PL4) THERMAL_LIMIT = ZE_BIT(3) ## frequency throttled due to thermal excursion (T > TjMax) PSU_ALERT = ZE_BIT(4) ## frequency throttled due to power supply assertion SW_RANGE = ZE_BIT(5) ## frequency throttled due to software supplied frequency range HW_RANGE = ZE_BIT(6) ## frequency throttled due to a sub block that has a lower frequency ## range when it receives clocks class zes_freq_throttle_reason_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Frequency state class zes_freq_state_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("currentVoltage", c_double), ## [out] Current voltage in Volts. A negative value indicates that this ## property is not known. ("request", c_double), ## [out] The current frequency request in MHz. A negative value indicates ## that this property is not known. ("tdp", c_double), ## [out] The maximum frequency in MHz supported under the current TDP ## conditions. This fluctuates dynamically based on the power and thermal ## limits of the part. A negative value indicates that this property is ## not known. ("efficient", c_double), ## [out] The efficient minimum frequency in MHz. A negative value ## indicates that this property is not known. ("actual", c_double), ## [out] The resolved frequency in MHz. A negative value indicates that ## this property is not known. ("throttleReasons", zes_freq_throttle_reason_flags_t) ## [out] The reasons that the frequency is being limited by the hardware. ## Returns 0 (frequency not throttled) or a combination of ::zes_freq_throttle_reason_flag_t. ] ############################################################################### ## @brief Frequency throttle time snapshot ## ## @details ## - Percent time throttled is calculated by taking two snapshots (s1, s2) ## and using the equation: %throttled = (s2.throttleTime - ## s1.throttleTime) / (s2.timestamp - s1.timestamp) class zes_freq_throttle_time_t(Structure): _fields_ = [ ("throttleTime", c_ulonglong), ## [out] The monotonic counter of time in microseconds that the frequency ## has been limited by the hardware. ("timestamp", c_ulonglong) ## [out] Microsecond timestamp when throttleTime was captured. ## This timestamp should only be used to calculate delta time between ## snapshots of this structure. ## Never take the delta of this timestamp with the timestamp from a ## different structure since they are not guaranteed to have the same base. ## The absolute value of the timestamp is only valid during within the ## application and may be different on the next execution. ] ############################################################################### ## @brief Overclocking modes ## ## @details ## - [DEPRECATED] No longer supported. class zes_oc_mode_v(IntEnum): OFF = 0 ## Overclocking if off - hardware is running using factory default ## voltages/frequencies. OVERRIDE = 1 ## Overclock override mode - In this mode, a fixed user-supplied voltage ## is applied independent of the frequency request. The maximum permitted ## frequency can also be increased. This mode disables INTERPOLATIVE and ## FIXED modes. INTERPOLATIVE = 2 ## Overclock interpolative mode - In this mode, the voltage/frequency ## curve can be extended with a new voltage/frequency point that will be ## interpolated. The existing voltage/frequency points can also be offset ## (up or down) by a fixed voltage. This mode disables FIXED and OVERRIDE ## modes. FIXED = 3 ## Overclocking fixed Mode - In this mode, hardware will disable most ## frequency throttling and lock the frequency and voltage at the ## specified overclock values. This mode disables OVERRIDE and ## INTERPOLATIVE modes. This mode can damage the part, most of the ## protections are disabled on this mode. class zes_oc_mode_t(c_int): def __str__(self): return str(zes_oc_mode_v(self.value)) ############################################################################### ## @brief Overclocking properties ## ## @details ## - Provides all the overclocking capabilities and properties supported by ## the device for the frequency domain. ## - [DEPRECATED] No longer supported. class zes_oc_capabilities_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("isOcSupported", ze_bool_t), ## [out] Indicates if any overclocking features are supported on this ## frequency domain. ("maxFactoryDefaultFrequency", c_double), ## [out] Factory default non-overclock maximum frequency in Mhz. ("maxFactoryDefaultVoltage", c_double), ## [out] Factory default voltage used for the non-overclock maximum ## frequency in MHz. ("maxOcFrequency", c_double), ## [out] Maximum hardware overclocking frequency limit in Mhz. ("minOcVoltageOffset", c_double), ## [out] The minimum voltage offset that can be applied to the ## voltage/frequency curve. Note that this number can be negative. ("maxOcVoltageOffset", c_double), ## [out] The maximum voltage offset that can be applied to the ## voltage/frequency curve. ("maxOcVoltage", c_double), ## [out] The maximum overclock voltage that hardware supports. ("isTjMaxSupported", ze_bool_t), ## [out] Indicates if the maximum temperature limit (TjMax) can be ## changed for this frequency domain. ("isIccMaxSupported", ze_bool_t), ## [out] Indicates if the maximum current (IccMax) can be changed for ## this frequency domain. ("isHighVoltModeCapable", ze_bool_t), ## [out] Indicates if this frequency domains supports a feature to set ## very high voltages. ("isHighVoltModeEnabled", ze_bool_t), ## [out] Indicates if very high voltages are permitted on this frequency ## domain. ("isExtendedModeSupported", ze_bool_t), ## [out] Indicates if the extended overclocking features are supported. ## If this is supported, increments are on 1 Mhz basis. ("isFixedModeSupported", ze_bool_t) ## [out] Indicates if the fixed mode is supported. In this mode, hardware ## will disable most frequency throttling and lock the frequency and ## voltage at the specified overclock values. ] ############################################################################### ## @brief LED properties class zes_led_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("onSubdevice", ze_bool_t), ## [out] True if the resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong), ## [out] If onSubdevice is true, this gives the ID of the sub-device ("canControl", ze_bool_t), ## [out] Indicates if software can control the LED assuming the user has ## permissions ("haveRGB", ze_bool_t) ## [out] Indicates if the LED is RGB capable ] ############################################################################### ## @brief LED color class zes_led_color_t(Structure): _fields_ = [ ("red", c_double), ## [in,out][range(0.0, 1.0)] The LED red value. On output, a value less ## than 0.0 indicates that the color is not known. ("green", c_double), ## [in,out][range(0.0, 1.0)] The LED green value. On output, a value less ## than 0.0 indicates that the color is not known. ("blue", c_double) ## [in,out][range(0.0, 1.0)] The LED blue value. On output, a value less ## than 0.0 indicates that the color is not known. ] ############################################################################### ## @brief LED state class zes_led_state_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("isOn", ze_bool_t), ## [out] Indicates if the LED is on or off ("color", zes_led_color_t) ## [out] Color of the LED ] ############################################################################### ## @brief Memory module types class zes_mem_type_v(IntEnum): HBM = 0 ## HBM memory DDR = 1 ## DDR memory DDR3 = 2 ## DDR3 memory DDR4 = 3 ## DDR4 memory DDR5 = 4 ## DDR5 memory LPDDR = 5 ## LPDDR memory LPDDR3 = 6 ## LPDDR3 memory LPDDR4 = 7 ## LPDDR4 memory LPDDR5 = 8 ## LPDDR5 memory SRAM = 9 ## SRAM memory L1 = 10 ## L1 cache L3 = 11 ## L3 cache GRF = 12 ## Execution unit register file SLM = 13 ## Execution unit shared local memory GDDR4 = 14 ## GDDR4 memory GDDR5 = 15 ## GDDR5 memory GDDR5X = 16 ## GDDR5X memory GDDR6 = 17 ## GDDR6 memory GDDR6X = 18 ## GDDR6X memory GDDR7 = 19 ## GDDR7 memory class zes_mem_type_t(c_int): def __str__(self): return str(zes_mem_type_v(self.value)) ############################################################################### ## @brief Memory module location class zes_mem_loc_v(IntEnum): SYSTEM = 0 ## System memory DEVICE = 1 ## On board local device memory class zes_mem_loc_t(c_int): def __str__(self): return str(zes_mem_loc_v(self.value)) ############################################################################### ## @brief Memory health class zes_mem_health_v(IntEnum): UNKNOWN = 0 ## The memory health cannot be determined. OK = 1 ## All memory channels are healthy. DEGRADED = 2 ## Excessive correctable errors have been detected on one or more ## channels. Device should be reset. CRITICAL = 3 ## Operating with reduced memory to cover banks with too many ## uncorrectable errors. REPLACE = 4 ## Device should be replaced due to excessive uncorrectable errors. class zes_mem_health_t(c_int): def __str__(self): return str(zes_mem_health_v(self.value)) ############################################################################### ## @brief Memory properties class zes_mem_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zes_mem_type_t), ## [out] The memory type ("onSubdevice", ze_bool_t), ## [out] True if this resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong), ## [out] If onSubdevice is true, this gives the ID of the sub-device ("location", zes_mem_loc_t), ## [out] Location of this memory (system, device) ("physicalSize", c_ulonglong), ## [out] Physical memory size in bytes. A value of 0 indicates that this ## property is not known. However, a call to ::zesMemoryGetState() will ## correctly return the total size of usable memory. ("busWidth", c_int32_t), ## [out] Width of the memory bus. A value of -1 means that this property ## is unknown. ("numChannels", c_int32_t) ## [out] The number of memory channels. A value of -1 means that this ## property is unknown. ] ############################################################################### ## @brief Memory state - health, allocated ## ## @details ## - Percent allocation is given by 100 * (size - free / size. ## - Percent free is given by 100 * free / size. class zes_mem_state_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("health", zes_mem_health_t), ## [out] Indicates the health of the memory ("free", c_ulonglong), ## [out] The free memory in bytes ("size", c_ulonglong) ## [out] The total allocatable memory in bytes (can be less than the ## `physicalSize` member of ::zes_mem_properties_t) ] ############################################################################### ## @brief Memory bandwidth ## ## @details ## - Percent bandwidth is calculated by taking two snapshots (s1, s2) and ## using the equation: %bw = 10^6 * ((s2.readCounter - s1.readCounter) + ## (s2.writeCounter - s1.writeCounter)) / (s2.maxBandwidth * ## (s2.timestamp - s1.timestamp)) ## - Counter can roll over and rollover needs to be handled by comparing ## the current read against the previous read ## - Counter is a 32 byte transaction count, which means the calculated ## delta (delta = current_value - previous_value or delta = 2^32 - ## previous_value + current_value in case of rollover) needs to be ## multiplied by 32 to get delta between samples in actual byte count class zes_mem_bandwidth_t(Structure): _fields_ = [ ("readCounter", c_ulonglong), ## [out] Total bytes read from memory ("writeCounter", c_ulonglong), ## [out] Total bytes written to memory ("maxBandwidth", c_ulonglong), ## [out] Current maximum bandwidth in units of bytes/sec ("timestamp", c_ulonglong) ## [out] The timestamp in microseconds when these measurements were sampled. ## This timestamp should only be used to calculate delta time between ## snapshots of this structure. ## Never take the delta of this timestamp with the timestamp from a ## different structure since they are not guaranteed to have the same base. ## The absolute value of the timestamp is only valid during within the ## application and may be different on the next execution. ] ############################################################################### ## @brief Extension properties for Memory bandwidth ## ## @details ## - Number of counter bits ## - [DEPRECATED] No longer supported. class zes_mem_ext_bandwidth_t(Structure): _fields_ = [ ("memoryTimestampValidBits", c_ulong) ## [out] Returns the number of valid bits in the timestamp values ] ############################################################################### ## @brief Static information about a Performance Factor domain class zes_perf_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("onSubdevice", ze_bool_t), ## [out] True if this Performance Factor affects accelerators located on ## a sub-device ("subdeviceId", c_ulong), ## [out] If onSubdevice is true, this gives the ID of the sub-device ("engines", zes_engine_type_flags_t) ## [out] Bitfield of accelerator engine types that are affected by this ## Performance Factor. ] ############################################################################### ## @brief Power Domain class zes_power_domain_v(IntEnum): UNKNOWN = 0 ## The PUnit power domain level cannot be determined. CARD = 1 ## The PUnit power domain is a card-level power domain. PACKAGE = 2 ## The PUnit power domain is a package-level power domain. STACK = 3 ## The PUnit power domain is a stack-level power domain. MEMORY = 4 ## The PUnit power domain is a memory-level power domain. GPU = 5 ## The PUnit power domain is a GPU-level power domain. class zes_power_domain_t(c_int): def __str__(self): return str(zes_power_domain_v(self.value)) ############################################################################### ## @brief Power Level Type class zes_power_level_v(IntEnum): UNKNOWN = 0 ## The PUnit power monitoring duration cannot be determined. SUSTAINED = 1 ## The PUnit determines effective power draw by computing a moving ## average of the actual power draw over a time interval (longer than ## BURST). BURST = 2 ## The PUnit determines effective power draw by computing a moving ## average of the actual power draw over a time interval (longer than ## PEAK). PEAK = 3 ## The PUnit determines effective power draw by computing a moving ## average of the actual power draw over a very short time interval. INSTANTANEOUS = 4 ## The PUnit predicts effective power draw using the current device ## configuration (frequency, voltage, etc...) & throttles proactively to ## stay within the specified limit. class zes_power_level_t(c_int): def __str__(self): return str(zes_power_level_v(self.value)) ############################################################################### ## @brief Power Source Type class zes_power_source_v(IntEnum): ANY = 0 ## Limit active no matter whether the power source is mains powered or ## battery powered. MAINS = 1 ## Limit active only when the device is mains powered. BATTERY = 2 ## Limit active only when the device is battery powered. class zes_power_source_t(c_int): def __str__(self): return str(zes_power_source_v(self.value)) ############################################################################### ## @brief Limit Unit class zes_limit_unit_v(IntEnum): UNKNOWN = 0 ## The PUnit power monitoring unit cannot be determined. CURRENT = 1 ## The limit is specified in milliamperes of current drawn. POWER = 2 ## The limit is specified in milliwatts of power generated. class zes_limit_unit_t(c_int): def __str__(self): return str(zes_limit_unit_v(self.value)) ############################################################################### ## @brief Properties related to device power settings class zes_power_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("onSubdevice", ze_bool_t), ## [out] True if this resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong), ## [out] If onSubdevice is true, this gives the ID of the sub-device ("canControl", ze_bool_t), ## [out] Software can change the power limits of this domain assuming the ## user has permissions. ("isEnergyThresholdSupported", ze_bool_t), ## [out] Indicates if this power domain supports the energy threshold ## event (::ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED). ("defaultLimit", c_int32_t), ## [out] (Deprecated) The factory default TDP power limit of the part in ## milliwatts. A value of -1 means that this is not known. ("minLimit", c_int32_t), ## [out] (Deprecated) The minimum power limit in milliwatts that can be ## requested. A value of -1 means that this is not known. ("maxLimit", c_int32_t) ## [out] (Deprecated) The maximum power limit in milliwatts that can be ## requested. A value of -1 means that this is not known. ] ############################################################################### ## @brief Energy counter snapshot ## ## @details ## - Average power is calculated by taking two snapshots (s1, s2) and using ## the equation: PowerWatts = (s2.energy - s1.energy) / (s2.timestamp - ## s1.timestamp) class zes_power_energy_counter_t(Structure): _fields_ = [ ("energy", c_ulonglong), ## [out] The monotonic energy counter in microjoules. ("timestamp", c_ulonglong) ## [out] Microsecond timestamp when energy was captured. ## This timestamp should only be used to calculate delta time between ## snapshots of this structure. ## Never take the delta of this timestamp with the timestamp from a ## different structure since they are not guaranteed to have the same base. ## The absolute value of the timestamp is only valid during within the ## application and may be different on the next execution. ] ############################################################################### ## @brief Sustained power limits ## ## @details ## - The power controller (Punit) will throttle the operating frequency if ## the power averaged over a window (typically seconds) exceeds this ## limit. ## - [DEPRECATED] No longer supported. class zes_power_sustained_limit_t(Structure): _fields_ = [ ("enabled", ze_bool_t), ## [in,out] indicates if the limit is enabled (true) or ignored (false) ("power", c_int32_t), ## [in,out] power limit in milliwatts ("interval", c_int32_t) ## [in,out] power averaging window (Tau) in milliseconds ] ############################################################################### ## @brief Burst power limit ## ## @details ## - The power controller (Punit) will throttle the operating frequency of ## the device if the power averaged over a few milliseconds exceeds a ## limit known as PL2. Typically PL2 > PL1 so that it permits the ## frequency to burst higher for short periods than would be otherwise ## permitted by PL1. ## - [DEPRECATED] No longer supported. class zes_power_burst_limit_t(Structure): _fields_ = [ ("enabled", ze_bool_t), ## [in,out] indicates if the limit is enabled (true) or ignored (false) ("power", c_int32_t) ## [in,out] power limit in milliwatts ] ############################################################################### ## @brief Peak power limit ## ## @details ## - The power controller (Punit) will reactively/proactively throttle the ## operating frequency of the device when the instantaneous/100usec power ## exceeds this limit. The limit is known as PL4 or Psys. It expresses ## the maximum power that can be drawn from the power supply. ## - If this power limit is removed or set too high, the power supply will ## generate an interrupt when it detects an overcurrent condition and the ## power controller will throttle the device frequencies down to min. It ## is thus better to tune the PL4 value in order to avoid such ## excursions. ## - [DEPRECATED] No longer supported. class zes_power_peak_limit_t(Structure): _fields_ = [ ("powerAC", c_int32_t), ## [in,out] power limit in milliwatts for the AC power source. ("powerDC", c_int32_t) ## [in,out] power limit in milliwatts for the DC power source. On input, ## this is ignored if the product does not have a battery. On output, ## this will be -1 if the product does not have a battery. ] ############################################################################### ## @brief Energy threshold ## ## @details ## - . class zes_energy_threshold_t(Structure): _fields_ = [ ("enable", ze_bool_t), ## [in,out] Indicates if the energy threshold is enabled. ("threshold", c_double), ## [in,out] The energy threshold in Joules. Will be 0.0 if no threshold ## has been set. ("processId", c_ulong) ## [in,out] The host process ID that set the energy threshold. Will be ## 0xFFFFFFFF if no threshold has been set. ] ############################################################################### ## @brief PSU voltage status class zes_psu_voltage_status_v(IntEnum): UNKNOWN = 0 ## The status of the power supply voltage controllers cannot be ## determined NORMAL = 1 ## No unusual voltages have been detected OVER = 2 ## Over-voltage has occurred UNDER = 3 ## Under-voltage has occurred class zes_psu_voltage_status_t(c_int): def __str__(self): return str(zes_psu_voltage_status_v(self.value)) ############################################################################### ## @brief Static properties of the power supply class zes_psu_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("onSubdevice", ze_bool_t), ## [out] True if the resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong), ## [out] If onSubdevice is true, this gives the ID of the sub-device ("haveFan", ze_bool_t), ## [out] True if the power supply has a fan ("ampLimit", c_int32_t) ## [out] The maximum electrical current in milliamperes that can be ## drawn. A value of -1 indicates that this property cannot be ## determined. ] ############################################################################### ## @brief Dynamic state of the power supply class zes_psu_state_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("voltStatus", zes_psu_voltage_status_t), ## [out] The current PSU voltage status ("fanFailed", ze_bool_t), ## [out] Indicates if the fan has failed ("temperature", c_int32_t), ## [out] Read the current heatsink temperature in degrees Celsius. A ## value of -1 indicates that this property cannot be determined. ("current", c_int32_t) ## [out] The amps being drawn in milliamperes. A value of -1 indicates ## that this property cannot be determined. ] ############################################################################### ## @brief RAS error type class zes_ras_error_type_v(IntEnum): CORRECTABLE = 0 ## Errors were corrected by hardware UNCORRECTABLE = 1 ## Error were not corrected class zes_ras_error_type_t(c_int): def __str__(self): return str(zes_ras_error_type_v(self.value)) ############################################################################### ## @brief RAS error categories class zes_ras_error_cat_v(IntEnum): RESET = 0 ## The number of accelerator engine resets attempted by the driver PROGRAMMING_ERRORS = 1 ## The number of hardware exceptions generated by the way workloads have ## programmed the hardware DRIVER_ERRORS = 2 ## The number of low level driver communication errors have occurred COMPUTE_ERRORS = 3 ## The number of errors that have occurred in the compute accelerator ## hardware NON_COMPUTE_ERRORS = 4 ## The number of errors that have occurred in the fixed-function ## accelerator hardware CACHE_ERRORS = 5 ## The number of errors that have occurred in caches (L1/L3/register ## file/shared local memory/sampler) DISPLAY_ERRORS = 6 ## The number of errors that have occurred in the display class zes_ras_error_cat_t(c_int): def __str__(self): return str(zes_ras_error_cat_v(self.value)) ############################################################################### ## @brief The maximum number of categories ZES_MAX_RAS_ERROR_CATEGORY_COUNT = 7 ############################################################################### ## @brief RAS properties class zes_ras_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zes_ras_error_type_t), ## [out] The type of RAS error ("onSubdevice", ze_bool_t), ## [out] True if the resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong) ## [out] If onSubdevice is true, this gives the ID of the sub-device ] ############################################################################### ## @brief RAS error details class zes_ras_state_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("category", c_ulonglong * ZES_MAX_RAS_ERROR_CATEGORY_COUNT) ## [in][out] Breakdown of error by category ] ############################################################################### ## @brief RAS error configuration - thresholds used for triggering RAS events ## (::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS, ## ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS) ## ## @details ## - The driver maintains a total counter which is updated every time a ## hardware block covered by the corresponding RAS error set notifies ## that an error has occurred. When this total count goes above the ## totalThreshold specified below, a RAS event is triggered. ## - The driver also maintains a counter for each category of RAS error ## (see ::zes_ras_state_t for a breakdown). Each time a hardware block of ## that category notifies that an error has occurred, that corresponding ## category counter is updated. When it goes above the threshold ## specified in detailedThresholds, a RAS event is triggered. class zes_ras_config_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("totalThreshold", c_ulonglong), ## [in,out] If the total RAS errors exceeds this threshold, the event ## will be triggered. A value of 0ULL disables triggering the event based ## on the total counter. ("detailedThresholds", zes_ras_state_t) ## [in,out] If the RAS errors for each category exceed the threshold for ## that category, the event will be triggered. A value of 0ULL will ## disable an event being triggered for that category. ] ############################################################################### ## @brief Scheduler mode class zes_sched_mode_v(IntEnum): TIMEOUT = 0 ## Multiple applications or contexts are submitting work to the hardware. ## When higher priority work arrives, the scheduler attempts to pause the ## current executing work within some timeout interval, then submits the ## other work. TIMESLICE = 1 ## The scheduler attempts to fairly timeslice hardware execution time ## between multiple contexts submitting work to the hardware ## concurrently. EXCLUSIVE = 2 ## Any application or context can run indefinitely on the hardware ## without being preempted or terminated. All pending work for other ## contexts must wait until the running context completes with no further ## submitted work. COMPUTE_UNIT_DEBUG = 3 ## [DEPRECATED] No longer supported. class zes_sched_mode_t(c_int): def __str__(self): return str(zes_sched_mode_v(self.value)) ############################################################################### ## @brief Properties related to scheduler component class zes_sched_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("onSubdevice", ze_bool_t), ## [out] True if this resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong), ## [out] If onSubdevice is true, this gives the ID of the sub-device ("canControl", ze_bool_t), ## [out] Software can change the scheduler component configuration ## assuming the user has permissions. ("engines", zes_engine_type_flags_t), ## [out] Bitfield of accelerator engine types that are managed by this ## scheduler component. Note that there can be more than one scheduler ## component for the same type of accelerator engine. ("supportedModes", c_ulong) ## [out] Bitfield of scheduler modes that can be configured for this ## scheduler component (bitfield of 1<<::zes_sched_mode_t). ] ############################################################################### ## @brief Disable forward progress guard timeout. ZES_SCHED_WATCHDOG_DISABLE = (~(0ULL)) ############################################################################### ## @brief Configuration for timeout scheduler mode (::ZES_SCHED_MODE_TIMEOUT) class zes_sched_timeout_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("watchdogTimeout", c_ulonglong) ## [in,out] The maximum time in microseconds that the scheduler will wait ## for a batch of work submitted to a hardware engine to complete or to ## be preempted so as to run another context. ## If this time is exceeded, the hardware engine is reset and the context terminated. ## If set to ::ZES_SCHED_WATCHDOG_DISABLE, a running workload can run as ## long as it wants without being terminated, but preemption attempts to ## run other contexts are permitted but not enforced. ] ############################################################################### ## @brief Configuration for timeslice scheduler mode ## (::ZES_SCHED_MODE_TIMESLICE) class zes_sched_timeslice_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("interval", c_ulonglong), ## [in,out] The average interval in microseconds that a submission for a ## context will run on a hardware engine before being preempted out to ## run a pending submission for another context. ("yieldTimeout", c_ulonglong) ## [in,out] The maximum time in microseconds that the scheduler will wait ## to preempt a workload running on an engine before deciding to reset ## the hardware engine and terminating the associated context. ] ############################################################################### ## @brief Standby hardware components class zes_standby_type_v(IntEnum): GLOBAL = 0 ## Control the overall standby policy of the device/sub-device class zes_standby_type_t(c_int): def __str__(self): return str(zes_standby_type_v(self.value)) ############################################################################### ## @brief Standby hardware component properties class zes_standby_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zes_standby_type_t), ## [out] Which standby hardware component this controls ("onSubdevice", ze_bool_t), ## [out] True if the resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong) ## [out] If onSubdevice is true, this gives the ID of the sub-device ] ############################################################################### ## @brief Standby promotion modes class zes_standby_promo_mode_v(IntEnum): DEFAULT = 0 ## Best compromise between performance and energy savings. NEVER = 1 ## The device/component will never shutdown. This can improve performance ## but uses more energy. class zes_standby_promo_mode_t(c_int): def __str__(self): return str(zes_standby_promo_mode_v(self.value)) ############################################################################### ## @brief Temperature sensors class zes_temp_sensors_v(IntEnum): GLOBAL = 0 ## The maximum temperature across all device sensors GPU = 1 ## The maximum temperature across all sensors in the GPU MEMORY = 2 ## The maximum temperature across all sensors in the local memory GLOBAL_MIN = 3 ## The minimum temperature across all device sensors GPU_MIN = 4 ## The minimum temperature across all sensors in the GPU MEMORY_MIN = 5 ## The minimum temperature across all sensors in the local device memory GPU_BOARD = 6 ## The maximum temperature across all sensors in the GPU Board GPU_BOARD_MIN = 7 ## The minimum temperature across all sensors in the GPU Board VOLTAGE_REGULATOR = 8 ## The maximum temperature across all sensors in the Voltage Regulator class zes_temp_sensors_t(c_int): def __str__(self): return str(zes_temp_sensors_v(self.value)) ############################################################################### ## @brief Temperature sensor properties class zes_temp_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zes_temp_sensors_t), ## [out] Which part of the device the temperature sensor measures ("onSubdevice", ze_bool_t), ## [out] True if the resource is located on a sub-device; false means ## that the resource is on the device of the calling Sysman handle ("subdeviceId", c_ulong), ## [out] If onSubdevice is true, this gives the ID of the sub-device ("maxTemperature", c_double), ## [out] Will contain the maximum temperature for the specific device in ## degrees Celsius. ("isCriticalTempSupported", ze_bool_t), ## [out] Indicates if the critical temperature event ## ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL is supported ("isThreshold1Supported", ze_bool_t), ## [out] Indicates if the temperature threshold 1 event ## ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 is supported ("isThreshold2Supported", ze_bool_t) ## [out] Indicates if the temperature threshold 2 event ## ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 is supported ] ############################################################################### ## @brief Temperature sensor threshold class zes_temp_threshold_t(Structure): _fields_ = [ ("enableLowToHigh", ze_bool_t), ## [in,out] Trigger an event when the temperature crosses from below the ## threshold to above. ("enableHighToLow", ze_bool_t), ## [in,out] Trigger an event when the temperature crosses from above the ## threshold to below. ("threshold", c_double) ## [in,out] The threshold in degrees Celsius. ] ############################################################################### ## @brief Temperature configuration - which events should be triggered and the ## trigger conditions. class zes_temp_config_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("enableCritical", ze_bool_t), ## [in,out] Indicates if event ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL should ## be triggered by the driver. ("threshold1", zes_temp_threshold_t), ## [in,out] Configuration controlling if and when event ## ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 should be triggered by the ## driver. ("threshold2", zes_temp_threshold_t) ## [in,out] Configuration controlling if and when event ## ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 should be triggered by the ## driver. ] ############################################################################### ## @brief Power Limits Extension Name ZES_POWER_LIMITS_EXT_NAME = "ZES_extension_power_limits" ############################################################################### ## @brief Power Limits Extension Version(s) class zes_power_limits_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class zes_power_limits_ext_version_t(c_int): def __str__(self): return str(zes_power_limits_ext_version_v(self.value)) ############################################################################### ## @brief Device power/current limit descriptor. class zes_power_limit_ext_desc_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("level", zes_power_level_t), ## [in,out] duration type over which the power draw is measured, i.e. ## sustained, burst, peak, or critical. ("source", zes_power_source_t), ## [out] source of power used by the system, i.e. AC or DC. ("limitUnit", zes_limit_unit_t), ## [out] unit used for specifying limit, i.e. current units (milliamps) ## or power units (milliwatts). ("enabledStateLocked", ze_bool_t), ## [out] indicates if the power limit state (enabled/ignored) can be set ## (false) or is locked (true). ("enabled", ze_bool_t), ## [in,out] indicates if the limit is enabled (true) or ignored (false). ## If enabledStateIsLocked is True, this value is ignored. ("intervalValueLocked", ze_bool_t), ## [out] indicates if the interval can be modified (false) or is fixed ## (true). ("interval", c_int32_t), ## [in,out] power averaging window in milliseconds. If ## intervalValueLocked is true, this value is ignored. ("limitValueLocked", ze_bool_t), ## [out] indicates if the limit can be set (false) or if the limit is ## fixed (true). ("limit", c_int32_t) ## [in,out] limit value. If limitValueLocked is true, this value is ## ignored. The value should be provided in the unit specified by ## limitUnit. ] ############################################################################### ## @brief Extension properties related to device power settings ## ## @details ## - This structure may be returned from ::zesPowerGetProperties via the ## `pNext` member of ::zes_power_properties_t. ## - This structure may also be returned from ::zesPowerGetProperties via ## the `pNext` member of ::zes_power_ext_properties_t ## - Used for determining the power domain level, i.e. card-level v/s ## package-level v/s stack-level & the factory default power limits. class zes_power_ext_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("domain", zes_power_domain_t), ## [out] domain that the power limit belongs to. ("defaultLimit", POINTER(zes_power_limit_ext_desc_t)) ## [out] the factory default limit of the part. ] ############################################################################### ## @brief Engine Activity Extension Name ZES_ENGINE_ACTIVITY_EXT_NAME = "ZES_extension_engine_activity" ############################################################################### ## @brief Engine Activity Extension Version(s) class zes_engine_activity_ext_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class zes_engine_activity_ext_version_t(c_int): def __str__(self): return str(zes_engine_activity_ext_version_v(self.value)) ############################################################################### ## @brief Extension properties related to Engine Groups ## ## @details ## - This structure may be passed to ::zesEngineGetProperties by having the ## pNext member of ::zes_engine_properties_t point at this struct. ## - Used for SRIOV per Virtual Function device utilization by ## ::zes_engine_group_t class zes_engine_ext_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("countOfVirtualFunctionInstance", c_ulong) ## [out] Number of Virtual Function(VF) instances associated with engine ## to monitor the utilization of hardware across all Virtual Function ## from a Physical Function (PF) instance. ## These VF-by-VF views should provide engine group and individual engine ## level granularity. ## This count represents the number of VF instances that are actively ## using the resource represented by the engine handle. ] ############################################################################### ## @brief RAS Get State Extension Name ZES_RAS_GET_STATE_EXP_NAME = "ZES_extension_ras_state" ############################################################################### ## @brief RAS Get State Extension Version(s) class zes_ras_state_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class zes_ras_state_exp_version_t(c_int): def __str__(self): return str(zes_ras_state_exp_version_v(self.value)) ############################################################################### ## @brief RAS error categories class zes_ras_error_category_exp_v(IntEnum): RESET = 0 ## The number of accelerator engine resets attempted by the driver PROGRAMMING_ERRORS = 1 ## The number of hardware exceptions generated by the way workloads have ## programmed the hardware DRIVER_ERRORS = 2 ## The number of low level driver communication errors have occurred COMPUTE_ERRORS = 3 ## The number of errors that have occurred in the compute accelerator ## hardware NON_COMPUTE_ERRORS = 4 ## The number of errors that have occurred in the fixed-function ## accelerator hardware CACHE_ERRORS = 5 ## The number of errors that have occurred in caches (L1/L3/register ## file/shared local memory/sampler) DISPLAY_ERRORS = 6 ## The number of errors that have occurred in the display MEMORY_ERRORS = 7 ## The number of errors that have occurred in Memory SCALE_ERRORS = 8 ## The number of errors that have occurred in Scale Fabric L3FABRIC_ERRORS = 9 ## The number of errors that have occurred in L3 Fabric class zes_ras_error_category_exp_t(c_int): def __str__(self): return str(zes_ras_error_category_exp_v(self.value)) ############################################################################### ## @brief Extension structure for providing RAS error counters for different ## error sets class zes_ras_state_exp_t(Structure): _fields_ = [ ("category", zes_ras_error_category_exp_t), ## [out] category for which error counter is provided. ("errorCounter", c_ulonglong) ## [out] Current value of RAS counter for specific error category. ] ############################################################################### ## @brief Memory State Extension Name ZES_MEM_PAGE_OFFLINE_STATE_EXP_NAME = "ZES_extension_mem_state" ############################################################################### ## @brief Memory State Extension Version(s) class zes_mem_page_offline_state_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class zes_mem_page_offline_state_exp_version_t(c_int): def __str__(self): return str(zes_mem_page_offline_state_exp_version_v(self.value)) ############################################################################### ## @brief Extension properties for Memory State ## ## @details ## - This structure may be returned from ::zesMemoryGetState via the ## `pNext` member of ::zes_mem_state_t ## - These additional parameters get Memory Page Offline Metrics class zes_mem_page_offline_state_exp_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("memoryPageOffline", c_ulong), ## [out] Returns the number of Memory Pages Offline ("maxMemoryPageOffline", c_ulong) ## [out] Returns the Allowed Memory Pages Offline ] ############################################################################### ## @brief Memory Bandwidth Counter Valid Bits Extension Name ZES_MEMORY_BANDWIDTH_COUNTER_BITS_EXP_PROPERTIES_NAME = "ZES_extension_mem_bandwidth_counter_bits_properties" ############################################################################### ## @brief Memory Bandwidth Counter Valid Bits Extension Version(s) class zes_mem_bandwidth_counter_bits_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class zes_mem_bandwidth_counter_bits_exp_version_t(c_int): def __str__(self): return str(zes_mem_bandwidth_counter_bits_exp_version_v(self.value)) ############################################################################### ## @brief Extension properties for reporting valid bit count for memory ## bandwidth counter value ## ## @details ## - Number of valid read and write counter bits of memory bandwidth ## - This structure may be returned from ::zesMemoryGetProperties via the ## `pNext` member of ::zes_mem_properties_t. ## - Used for denoting number of valid bits in the counter value returned ## in ::zes_mem_bandwidth_t. class zes_mem_bandwidth_counter_bits_exp_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("validBitsCount", c_ulong) ## [out] Returns the number of valid bits in the counter values ] ############################################################################### ## @brief Power Domain Properties Name ZES_POWER_DOMAIN_PROPERTIES_EXP_NAME = "ZES_extension_power_domain_properties" ############################################################################### ## @brief Power Domain Properties Extension Version(s) class zes_power_domain_properties_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class zes_power_domain_properties_exp_version_t(c_int): def __str__(self): return str(zes_power_domain_properties_exp_version_v(self.value)) ############################################################################### ## @brief Extension structure for providing power domain information associated ## with a power handle ## ## @details ## - This structure may be returned from ::zesPowerGetProperties via the ## `pNext` member of ::zes_power_properties_t. ## - Used for associating a power handle with a power domain. class zes_power_domain_exp_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("powerDomain", zes_power_domain_t) ## [out] Power domain associated with the power handle. ] ############################################################################### ## @brief Firmware security version ZES_FIRMWARE_SECURITY_VERSION_EXP_NAME = "ZES_experimental_firmware_security_version" ############################################################################### ## @brief Firmware security version Extension Version(s) class zes_firmware_security_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class zes_firmware_security_exp_version_t(c_int): def __str__(self): return str(zes_firmware_security_exp_version_v(self.value)) ############################################################################### ## @brief Sysman Device Mapping Extension Name ZES_SYSMAN_DEVICE_MAPPING_EXP_NAME = "ZES_experimental_sysman_device_mapping" ############################################################################### ## @brief Sysman Device Mapping Extension Version(s) class zes_sysman_device_mapping_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class zes_sysman_device_mapping_exp_version_t(c_int): def __str__(self): return str(zes_sysman_device_mapping_exp_version_v(self.value)) ############################################################################### ## @brief Sub Device Properties class zes_subdevice_exp_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("subdeviceId", c_ulong), ## [out] this gives the ID of the sub device ("uuid", zes_uuid_t) ## [out] universal unique identifier of the sub device. ] ############################################################################### ## @brief Virtual Function Management Extension Name ZES_VIRTUAL_FUNCTION_MANAGEMENT_EXP_NAME = "ZES_experimental_virtual_function_management" ############################################################################### ## @brief Virtual Function Management Extension Version(s) class zes_vf_management_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 (deprecated) _1_1 = ZE_MAKE_VERSION( 1, 1 ) ## version 1.1 (deprecated) _1_2 = ZE_MAKE_VERSION( 1, 2 ) ## version 1.2 CURRENT = ZE_MAKE_VERSION( 1, 2 ) ## latest known version class zes_vf_management_exp_version_t(c_int): def __str__(self): return str(zes_vf_management_exp_version_v(self.value)) ############################################################################### ## @brief Virtual function memory types (deprecated) class zes_vf_info_mem_type_exp_flags_v(IntEnum): MEM_TYPE_SYSTEM = ZE_BIT(0) ## System memory MEM_TYPE_DEVICE = ZE_BIT(1) ## Device local memory class zes_vf_info_mem_type_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Virtual function utilization flag bit fields (deprecated) class zes_vf_info_util_exp_flags_v(IntEnum): INFO_NONE = ZE_BIT(0) ## No info associated with virtual function INFO_MEM_CPU = ZE_BIT(1) ## System memory utilization associated with virtual function INFO_MEM_GPU = ZE_BIT(2) ## Device memory utilization associated with virtual function INFO_ENGINE = ZE_BIT(3) ## Engine utilization associated with virtual function class zes_vf_info_util_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Virtual function management properties (deprecated) class zes_vf_exp_properties_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("address", zes_pci_address_t), ## [out] Virtual function BDF address ("uuid", zes_uuid_t), ## [out] universal unique identifier of the device ("flags", zes_vf_info_util_exp_flags_t) ## [out] utilization flags available. May be 0 or a valid combination of ## ::zes_vf_info_util_exp_flag_t. ] ############################################################################### ## @brief Provides memory utilization values for a virtual function (deprecated) class zes_vf_util_mem_exp_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("memTypeFlags", zes_vf_info_mem_type_exp_flags_t), ## [out] Memory type flags. ("free", c_ulonglong), ## [out] Free memory size in bytes. ("size", c_ulonglong), ## [out] Total allocatable memory in bytes. ("timestamp", c_ulonglong) ## [out] Wall clock time from VF when value was sampled. ] ############################################################################### ## @brief Provides engine utilization values for a virtual function (deprecated) class zes_vf_util_engine_exp_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zes_engine_group_t), ## [out] The engine group. ("activeCounterValue", c_ulonglong), ## [out] Represents active counter. ("samplingCounterValue", c_ulonglong), ## [out] Represents counter value when activeCounterValue was sampled. ("timestamp", c_ulonglong) ## [out] Wall clock time when the activeCounterValue was sampled. ] ############################################################################### ## @brief Virtual function management capabilities (deprecated) class zes_vf_exp_capabilities_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("address", zes_pci_address_t), ## [out] Virtual function BDF address ("vfDeviceMemSize", c_ulong), ## [out] Virtual function memory size in kilo bytes ("vfID", c_ulong) ## [out] Virtual Function ID ] ############################################################################### ## @brief Virtual function management capabilities class zes_vf_exp2_capabilities_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("address", zes_pci_address_t), ## [out] Virtual function BDF address ("vfDeviceMemSize", c_ulonglong), ## [out] Virtual function memory size in bytes ("vfID", c_ulong) ## [out] Virtual Function ID ] ############################################################################### ## @brief Provides memory utilization values for a virtual function class zes_vf_util_mem_exp2_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("vfMemLocation", zes_mem_loc_t), ## [out] Location of this memory (system, device) ("vfMemUtilized", c_ulonglong) ## [out] Utilized memory size in bytes. ] ############################################################################### ## @brief Provides engine utilization values for a virtual function ## ## @details ## - Percent utilization is calculated by taking two snapshots (s1, s2) and ## using the equation: %util = (s2.activeCounterValue - ## s1.activeCounterValue) / (s2.samplingCounterValue - ## s1.samplingCounterValue) class zes_vf_util_engine_exp2_t(Structure): _fields_ = [ ("stype", zes_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("vfEngineType", zes_engine_group_t), ## [out] The engine group. ("activeCounterValue", c_ulonglong), ## [out] Represents active counter. ("samplingCounterValue", c_ulonglong) ## [out] Represents counter value when activeCounterValue was sampled. ## Refer to the formulae above for calculating the utilization percent ] ############################################################################### __use_win_types = "Windows" == platform.uname()[0] ############################################################################### ## @brief Function-pointer for zesInit if __use_win_types: _zesInit_t = WINFUNCTYPE( ze_result_t, zes_init_flags_t ) else: _zesInit_t = CFUNCTYPE( ze_result_t, zes_init_flags_t ) ############################################################################### ## @brief Table of Global functions pointers class _zes_global_dditable_t(Structure): _fields_ = [ ("pfnInit", c_void_p) ## _zesInit_t ] ############################################################################### ## @brief Function-pointer for zesDeviceGetProperties if __use_win_types: _zesDeviceGetProperties_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_device_properties_t) ) else: _zesDeviceGetProperties_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_device_properties_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceGetState if __use_win_types: _zesDeviceGetState_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_device_state_t) ) else: _zesDeviceGetState_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_device_state_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceReset if __use_win_types: _zesDeviceReset_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, ze_bool_t ) else: _zesDeviceReset_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, ze_bool_t ) ############################################################################### ## @brief Function-pointer for zesDeviceProcessesGetState if __use_win_types: _zesDeviceProcessesGetState_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_process_state_t) ) else: _zesDeviceProcessesGetState_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_process_state_t) ) ############################################################################### ## @brief Function-pointer for zesDevicePciGetProperties if __use_win_types: _zesDevicePciGetProperties_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_pci_properties_t) ) else: _zesDevicePciGetProperties_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_pci_properties_t) ) ############################################################################### ## @brief Function-pointer for zesDevicePciGetState if __use_win_types: _zesDevicePciGetState_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_pci_state_t) ) else: _zesDevicePciGetState_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_pci_state_t) ) ############################################################################### ## @brief Function-pointer for zesDevicePciGetBars if __use_win_types: _zesDevicePciGetBars_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_pci_bar_properties_t) ) else: _zesDevicePciGetBars_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_pci_bar_properties_t) ) ############################################################################### ## @brief Function-pointer for zesDevicePciGetStats if __use_win_types: _zesDevicePciGetStats_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_pci_stats_t) ) else: _zesDevicePciGetStats_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_pci_stats_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumDiagnosticTestSuites if __use_win_types: _zesDeviceEnumDiagnosticTestSuites_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_diag_handle_t) ) else: _zesDeviceEnumDiagnosticTestSuites_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_diag_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumEngineGroups if __use_win_types: _zesDeviceEnumEngineGroups_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_engine_handle_t) ) else: _zesDeviceEnumEngineGroups_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_engine_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEventRegister if __use_win_types: _zesDeviceEventRegister_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, zes_event_type_flags_t ) else: _zesDeviceEventRegister_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, zes_event_type_flags_t ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumFabricPorts if __use_win_types: _zesDeviceEnumFabricPorts_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_fabric_port_handle_t) ) else: _zesDeviceEnumFabricPorts_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_fabric_port_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumFans if __use_win_types: _zesDeviceEnumFans_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_fan_handle_t) ) else: _zesDeviceEnumFans_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_fan_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumFirmwares if __use_win_types: _zesDeviceEnumFirmwares_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_firmware_handle_t) ) else: _zesDeviceEnumFirmwares_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_firmware_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumFrequencyDomains if __use_win_types: _zesDeviceEnumFrequencyDomains_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_freq_handle_t) ) else: _zesDeviceEnumFrequencyDomains_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_freq_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumLeds if __use_win_types: _zesDeviceEnumLeds_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_led_handle_t) ) else: _zesDeviceEnumLeds_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_led_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumMemoryModules if __use_win_types: _zesDeviceEnumMemoryModules_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_mem_handle_t) ) else: _zesDeviceEnumMemoryModules_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_mem_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumPerformanceFactorDomains if __use_win_types: _zesDeviceEnumPerformanceFactorDomains_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_perf_handle_t) ) else: _zesDeviceEnumPerformanceFactorDomains_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_perf_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumPowerDomains if __use_win_types: _zesDeviceEnumPowerDomains_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_pwr_handle_t) ) else: _zesDeviceEnumPowerDomains_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_pwr_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceGetCardPowerDomain if __use_win_types: _zesDeviceGetCardPowerDomain_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_pwr_handle_t) ) else: _zesDeviceGetCardPowerDomain_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_pwr_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumPsus if __use_win_types: _zesDeviceEnumPsus_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_psu_handle_t) ) else: _zesDeviceEnumPsus_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_psu_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumRasErrorSets if __use_win_types: _zesDeviceEnumRasErrorSets_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_ras_handle_t) ) else: _zesDeviceEnumRasErrorSets_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_ras_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumSchedulers if __use_win_types: _zesDeviceEnumSchedulers_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_sched_handle_t) ) else: _zesDeviceEnumSchedulers_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_sched_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumStandbyDomains if __use_win_types: _zesDeviceEnumStandbyDomains_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_standby_handle_t) ) else: _zesDeviceEnumStandbyDomains_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_standby_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumTemperatureSensors if __use_win_types: _zesDeviceEnumTemperatureSensors_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_temp_handle_t) ) else: _zesDeviceEnumTemperatureSensors_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_temp_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEccAvailable if __use_win_types: _zesDeviceEccAvailable_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(ze_bool_t) ) else: _zesDeviceEccAvailable_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(ze_bool_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEccConfigurable if __use_win_types: _zesDeviceEccConfigurable_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(ze_bool_t) ) else: _zesDeviceEccConfigurable_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(ze_bool_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceGetEccState if __use_win_types: _zesDeviceGetEccState_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_device_ecc_properties_t) ) else: _zesDeviceGetEccState_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_device_ecc_properties_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceSetEccState if __use_win_types: _zesDeviceSetEccState_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_device_ecc_desc_t), POINTER(zes_device_ecc_properties_t) ) else: _zesDeviceSetEccState_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_device_ecc_desc_t), POINTER(zes_device_ecc_properties_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceGet if __use_win_types: _zesDeviceGet_t = WINFUNCTYPE( ze_result_t, zes_driver_handle_t, POINTER(c_ulong), POINTER(zes_device_handle_t) ) else: _zesDeviceGet_t = CFUNCTYPE( ze_result_t, zes_driver_handle_t, POINTER(c_ulong), POINTER(zes_device_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceSetOverclockWaiver if __use_win_types: _zesDeviceSetOverclockWaiver_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t ) else: _zesDeviceSetOverclockWaiver_t = CFUNCTYPE( ze_result_t, zes_device_handle_t ) ############################################################################### ## @brief Function-pointer for zesDeviceGetOverclockDomains if __use_win_types: _zesDeviceGetOverclockDomains_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong) ) else: _zesDeviceGetOverclockDomains_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong) ) ############################################################################### ## @brief Function-pointer for zesDeviceGetOverclockControls if __use_win_types: _zesDeviceGetOverclockControls_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, zes_overclock_domain_t, POINTER(c_ulong) ) else: _zesDeviceGetOverclockControls_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, zes_overclock_domain_t, POINTER(c_ulong) ) ############################################################################### ## @brief Function-pointer for zesDeviceResetOverclockSettings if __use_win_types: _zesDeviceResetOverclockSettings_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, ze_bool_t ) else: _zesDeviceResetOverclockSettings_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, ze_bool_t ) ############################################################################### ## @brief Function-pointer for zesDeviceReadOverclockState if __use_win_types: _zesDeviceReadOverclockState_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_overclock_mode_t), POINTER(ze_bool_t), POINTER(ze_bool_t), POINTER(zes_pending_action_t), POINTER(ze_bool_t) ) else: _zesDeviceReadOverclockState_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_overclock_mode_t), POINTER(ze_bool_t), POINTER(ze_bool_t), POINTER(zes_pending_action_t), POINTER(ze_bool_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumOverclockDomains if __use_win_types: _zesDeviceEnumOverclockDomains_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_overclock_handle_t) ) else: _zesDeviceEnumOverclockDomains_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_overclock_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceResetExt if __use_win_types: _zesDeviceResetExt_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_reset_properties_t) ) else: _zesDeviceResetExt_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(zes_reset_properties_t) ) ############################################################################### ## @brief Table of Device functions pointers class _zes_device_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesDeviceGetProperties_t ("pfnGetState", c_void_p), ## _zesDeviceGetState_t ("pfnReset", c_void_p), ## _zesDeviceReset_t ("pfnProcessesGetState", c_void_p), ## _zesDeviceProcessesGetState_t ("pfnPciGetProperties", c_void_p), ## _zesDevicePciGetProperties_t ("pfnPciGetState", c_void_p), ## _zesDevicePciGetState_t ("pfnPciGetBars", c_void_p), ## _zesDevicePciGetBars_t ("pfnPciGetStats", c_void_p), ## _zesDevicePciGetStats_t ("pfnEnumDiagnosticTestSuites", c_void_p), ## _zesDeviceEnumDiagnosticTestSuites_t ("pfnEnumEngineGroups", c_void_p), ## _zesDeviceEnumEngineGroups_t ("pfnEventRegister", c_void_p), ## _zesDeviceEventRegister_t ("pfnEnumFabricPorts", c_void_p), ## _zesDeviceEnumFabricPorts_t ("pfnEnumFans", c_void_p), ## _zesDeviceEnumFans_t ("pfnEnumFirmwares", c_void_p), ## _zesDeviceEnumFirmwares_t ("pfnEnumFrequencyDomains", c_void_p), ## _zesDeviceEnumFrequencyDomains_t ("pfnEnumLeds", c_void_p), ## _zesDeviceEnumLeds_t ("pfnEnumMemoryModules", c_void_p), ## _zesDeviceEnumMemoryModules_t ("pfnEnumPerformanceFactorDomains", c_void_p), ## _zesDeviceEnumPerformanceFactorDomains_t ("pfnEnumPowerDomains", c_void_p), ## _zesDeviceEnumPowerDomains_t ("pfnGetCardPowerDomain", c_void_p), ## _zesDeviceGetCardPowerDomain_t ("pfnEnumPsus", c_void_p), ## _zesDeviceEnumPsus_t ("pfnEnumRasErrorSets", c_void_p), ## _zesDeviceEnumRasErrorSets_t ("pfnEnumSchedulers", c_void_p), ## _zesDeviceEnumSchedulers_t ("pfnEnumStandbyDomains", c_void_p), ## _zesDeviceEnumStandbyDomains_t ("pfnEnumTemperatureSensors", c_void_p), ## _zesDeviceEnumTemperatureSensors_t ("pfnEccAvailable", c_void_p), ## _zesDeviceEccAvailable_t ("pfnEccConfigurable", c_void_p), ## _zesDeviceEccConfigurable_t ("pfnGetEccState", c_void_p), ## _zesDeviceGetEccState_t ("pfnSetEccState", c_void_p), ## _zesDeviceSetEccState_t ("pfnGet", c_void_p), ## _zesDeviceGet_t ("pfnSetOverclockWaiver", c_void_p), ## _zesDeviceSetOverclockWaiver_t ("pfnGetOverclockDomains", c_void_p), ## _zesDeviceGetOverclockDomains_t ("pfnGetOverclockControls", c_void_p), ## _zesDeviceGetOverclockControls_t ("pfnResetOverclockSettings", c_void_p), ## _zesDeviceResetOverclockSettings_t ("pfnReadOverclockState", c_void_p), ## _zesDeviceReadOverclockState_t ("pfnEnumOverclockDomains", c_void_p), ## _zesDeviceEnumOverclockDomains_t ("pfnResetExt", c_void_p) ## _zesDeviceResetExt_t ] ############################################################################### ## @brief Function-pointer for zesDeviceGetSubDevicePropertiesExp if __use_win_types: _zesDeviceGetSubDevicePropertiesExp_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_subdevice_exp_properties_t) ) else: _zesDeviceGetSubDevicePropertiesExp_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_subdevice_exp_properties_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumActiveVFExp if __use_win_types: _zesDeviceEnumActiveVFExp_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_vf_handle_t) ) else: _zesDeviceEnumActiveVFExp_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_vf_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDeviceEnumEnabledVFExp if __use_win_types: _zesDeviceEnumEnabledVFExp_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_vf_handle_t) ) else: _zesDeviceEnumEnabledVFExp_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, POINTER(c_ulong), POINTER(zes_vf_handle_t) ) ############################################################################### ## @brief Table of DeviceExp functions pointers class _zes_device_exp_dditable_t(Structure): _fields_ = [ ("pfnGetSubDevicePropertiesExp", c_void_p), ## _zesDeviceGetSubDevicePropertiesExp_t ("pfnEnumActiveVFExp", c_void_p), ## _zesDeviceEnumActiveVFExp_t ("pfnEnumEnabledVFExp", c_void_p) ## _zesDeviceEnumEnabledVFExp_t ] ############################################################################### ## @brief Function-pointer for zesDriverEventListen if __use_win_types: _zesDriverEventListen_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, c_ulong, c_ulong, POINTER(zes_device_handle_t), POINTER(c_ulong), POINTER(zes_event_type_flags_t) ) else: _zesDriverEventListen_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, c_ulong, c_ulong, POINTER(zes_device_handle_t), POINTER(c_ulong), POINTER(zes_event_type_flags_t) ) ############################################################################### ## @brief Function-pointer for zesDriverEventListenEx if __use_win_types: _zesDriverEventListenEx_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, c_ulonglong, c_ulong, POINTER(zes_device_handle_t), POINTER(c_ulong), POINTER(zes_event_type_flags_t) ) else: _zesDriverEventListenEx_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, c_ulonglong, c_ulong, POINTER(zes_device_handle_t), POINTER(c_ulong), POINTER(zes_event_type_flags_t) ) ############################################################################### ## @brief Function-pointer for zesDriverGet if __use_win_types: _zesDriverGet_t = WINFUNCTYPE( ze_result_t, POINTER(c_ulong), POINTER(zes_driver_handle_t) ) else: _zesDriverGet_t = CFUNCTYPE( ze_result_t, POINTER(c_ulong), POINTER(zes_driver_handle_t) ) ############################################################################### ## @brief Function-pointer for zesDriverGetExtensionProperties if __use_win_types: _zesDriverGetExtensionProperties_t = WINFUNCTYPE( ze_result_t, zes_driver_handle_t, POINTER(c_ulong), POINTER(zes_driver_extension_properties_t) ) else: _zesDriverGetExtensionProperties_t = CFUNCTYPE( ze_result_t, zes_driver_handle_t, POINTER(c_ulong), POINTER(zes_driver_extension_properties_t) ) ############################################################################### ## @brief Function-pointer for zesDriverGetExtensionFunctionAddress if __use_win_types: _zesDriverGetExtensionFunctionAddress_t = WINFUNCTYPE( ze_result_t, zes_driver_handle_t, c_char_p, POINTER(c_void_p) ) else: _zesDriverGetExtensionFunctionAddress_t = CFUNCTYPE( ze_result_t, zes_driver_handle_t, c_char_p, POINTER(c_void_p) ) ############################################################################### ## @brief Table of Driver functions pointers class _zes_driver_dditable_t(Structure): _fields_ = [ ("pfnEventListen", c_void_p), ## _zesDriverEventListen_t ("pfnEventListenEx", c_void_p), ## _zesDriverEventListenEx_t ("pfnGet", c_void_p), ## _zesDriverGet_t ("pfnGetExtensionProperties", c_void_p), ## _zesDriverGetExtensionProperties_t ("pfnGetExtensionFunctionAddress", c_void_p) ## _zesDriverGetExtensionFunctionAddress_t ] ############################################################################### ## @brief Function-pointer for zesDriverGetDeviceByUuidExp if __use_win_types: _zesDriverGetDeviceByUuidExp_t = WINFUNCTYPE( ze_result_t, zes_driver_handle_t, zes_uuid_t, POINTER(zes_device_handle_t), POINTER(ze_bool_t), POINTER(c_ulong) ) else: _zesDriverGetDeviceByUuidExp_t = CFUNCTYPE( ze_result_t, zes_driver_handle_t, zes_uuid_t, POINTER(zes_device_handle_t), POINTER(ze_bool_t), POINTER(c_ulong) ) ############################################################################### ## @brief Table of DriverExp functions pointers class _zes_driver_exp_dditable_t(Structure): _fields_ = [ ("pfnGetDeviceByUuidExp", c_void_p) ## _zesDriverGetDeviceByUuidExp_t ] ############################################################################### ## @brief Function-pointer for zesOverclockGetDomainProperties if __use_win_types: _zesOverclockGetDomainProperties_t = WINFUNCTYPE( ze_result_t, zes_overclock_handle_t, POINTER(zes_overclock_properties_t) ) else: _zesOverclockGetDomainProperties_t = CFUNCTYPE( ze_result_t, zes_overclock_handle_t, POINTER(zes_overclock_properties_t) ) ############################################################################### ## @brief Function-pointer for zesOverclockGetDomainVFProperties if __use_win_types: _zesOverclockGetDomainVFProperties_t = WINFUNCTYPE( ze_result_t, zes_overclock_handle_t, POINTER(zes_vf_property_t) ) else: _zesOverclockGetDomainVFProperties_t = CFUNCTYPE( ze_result_t, zes_overclock_handle_t, POINTER(zes_vf_property_t) ) ############################################################################### ## @brief Function-pointer for zesOverclockGetDomainControlProperties if __use_win_types: _zesOverclockGetDomainControlProperties_t = WINFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_overclock_control_t, POINTER(zes_control_property_t) ) else: _zesOverclockGetDomainControlProperties_t = CFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_overclock_control_t, POINTER(zes_control_property_t) ) ############################################################################### ## @brief Function-pointer for zesOverclockGetControlCurrentValue if __use_win_types: _zesOverclockGetControlCurrentValue_t = WINFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_overclock_control_t, POINTER(c_double) ) else: _zesOverclockGetControlCurrentValue_t = CFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_overclock_control_t, POINTER(c_double) ) ############################################################################### ## @brief Function-pointer for zesOverclockGetControlPendingValue if __use_win_types: _zesOverclockGetControlPendingValue_t = WINFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_overclock_control_t, POINTER(c_double) ) else: _zesOverclockGetControlPendingValue_t = CFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_overclock_control_t, POINTER(c_double) ) ############################################################################### ## @brief Function-pointer for zesOverclockSetControlUserValue if __use_win_types: _zesOverclockSetControlUserValue_t = WINFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_overclock_control_t, c_double, POINTER(zes_pending_action_t) ) else: _zesOverclockSetControlUserValue_t = CFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_overclock_control_t, c_double, POINTER(zes_pending_action_t) ) ############################################################################### ## @brief Function-pointer for zesOverclockGetControlState if __use_win_types: _zesOverclockGetControlState_t = WINFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_overclock_control_t, POINTER(zes_control_state_t), POINTER(zes_pending_action_t) ) else: _zesOverclockGetControlState_t = CFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_overclock_control_t, POINTER(zes_control_state_t), POINTER(zes_pending_action_t) ) ############################################################################### ## @brief Function-pointer for zesOverclockGetVFPointValues if __use_win_types: _zesOverclockGetVFPointValues_t = WINFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_vf_type_t, zes_vf_array_type_t, c_ulong, POINTER(c_ulong) ) else: _zesOverclockGetVFPointValues_t = CFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_vf_type_t, zes_vf_array_type_t, c_ulong, POINTER(c_ulong) ) ############################################################################### ## @brief Function-pointer for zesOverclockSetVFPointValues if __use_win_types: _zesOverclockSetVFPointValues_t = WINFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_vf_type_t, c_ulong, c_ulong ) else: _zesOverclockSetVFPointValues_t = CFUNCTYPE( ze_result_t, zes_overclock_handle_t, zes_vf_type_t, c_ulong, c_ulong ) ############################################################################### ## @brief Table of Overclock functions pointers class _zes_overclock_dditable_t(Structure): _fields_ = [ ("pfnGetDomainProperties", c_void_p), ## _zesOverclockGetDomainProperties_t ("pfnGetDomainVFProperties", c_void_p), ## _zesOverclockGetDomainVFProperties_t ("pfnGetDomainControlProperties", c_void_p), ## _zesOverclockGetDomainControlProperties_t ("pfnGetControlCurrentValue", c_void_p), ## _zesOverclockGetControlCurrentValue_t ("pfnGetControlPendingValue", c_void_p), ## _zesOverclockGetControlPendingValue_t ("pfnSetControlUserValue", c_void_p), ## _zesOverclockSetControlUserValue_t ("pfnGetControlState", c_void_p), ## _zesOverclockGetControlState_t ("pfnGetVFPointValues", c_void_p), ## _zesOverclockGetVFPointValues_t ("pfnSetVFPointValues", c_void_p) ## _zesOverclockSetVFPointValues_t ] ############################################################################### ## @brief Function-pointer for zesSchedulerGetProperties if __use_win_types: _zesSchedulerGetProperties_t = WINFUNCTYPE( ze_result_t, zes_sched_handle_t, POINTER(zes_sched_properties_t) ) else: _zesSchedulerGetProperties_t = CFUNCTYPE( ze_result_t, zes_sched_handle_t, POINTER(zes_sched_properties_t) ) ############################################################################### ## @brief Function-pointer for zesSchedulerGetCurrentMode if __use_win_types: _zesSchedulerGetCurrentMode_t = WINFUNCTYPE( ze_result_t, zes_sched_handle_t, POINTER(zes_sched_mode_t) ) else: _zesSchedulerGetCurrentMode_t = CFUNCTYPE( ze_result_t, zes_sched_handle_t, POINTER(zes_sched_mode_t) ) ############################################################################### ## @brief Function-pointer for zesSchedulerGetTimeoutModeProperties if __use_win_types: _zesSchedulerGetTimeoutModeProperties_t = WINFUNCTYPE( ze_result_t, zes_sched_handle_t, ze_bool_t, POINTER(zes_sched_timeout_properties_t) ) else: _zesSchedulerGetTimeoutModeProperties_t = CFUNCTYPE( ze_result_t, zes_sched_handle_t, ze_bool_t, POINTER(zes_sched_timeout_properties_t) ) ############################################################################### ## @brief Function-pointer for zesSchedulerGetTimesliceModeProperties if __use_win_types: _zesSchedulerGetTimesliceModeProperties_t = WINFUNCTYPE( ze_result_t, zes_sched_handle_t, ze_bool_t, POINTER(zes_sched_timeslice_properties_t) ) else: _zesSchedulerGetTimesliceModeProperties_t = CFUNCTYPE( ze_result_t, zes_sched_handle_t, ze_bool_t, POINTER(zes_sched_timeslice_properties_t) ) ############################################################################### ## @brief Function-pointer for zesSchedulerSetTimeoutMode if __use_win_types: _zesSchedulerSetTimeoutMode_t = WINFUNCTYPE( ze_result_t, zes_sched_handle_t, POINTER(zes_sched_timeout_properties_t), POINTER(ze_bool_t) ) else: _zesSchedulerSetTimeoutMode_t = CFUNCTYPE( ze_result_t, zes_sched_handle_t, POINTER(zes_sched_timeout_properties_t), POINTER(ze_bool_t) ) ############################################################################### ## @brief Function-pointer for zesSchedulerSetTimesliceMode if __use_win_types: _zesSchedulerSetTimesliceMode_t = WINFUNCTYPE( ze_result_t, zes_sched_handle_t, POINTER(zes_sched_timeslice_properties_t), POINTER(ze_bool_t) ) else: _zesSchedulerSetTimesliceMode_t = CFUNCTYPE( ze_result_t, zes_sched_handle_t, POINTER(zes_sched_timeslice_properties_t), POINTER(ze_bool_t) ) ############################################################################### ## @brief Function-pointer for zesSchedulerSetExclusiveMode if __use_win_types: _zesSchedulerSetExclusiveMode_t = WINFUNCTYPE( ze_result_t, zes_sched_handle_t, POINTER(ze_bool_t) ) else: _zesSchedulerSetExclusiveMode_t = CFUNCTYPE( ze_result_t, zes_sched_handle_t, POINTER(ze_bool_t) ) ############################################################################### ## @brief Function-pointer for zesSchedulerSetComputeUnitDebugMode if __use_win_types: _zesSchedulerSetComputeUnitDebugMode_t = WINFUNCTYPE( ze_result_t, zes_sched_handle_t, POINTER(ze_bool_t) ) else: _zesSchedulerSetComputeUnitDebugMode_t = CFUNCTYPE( ze_result_t, zes_sched_handle_t, POINTER(ze_bool_t) ) ############################################################################### ## @brief Table of Scheduler functions pointers class _zes_scheduler_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesSchedulerGetProperties_t ("pfnGetCurrentMode", c_void_p), ## _zesSchedulerGetCurrentMode_t ("pfnGetTimeoutModeProperties", c_void_p), ## _zesSchedulerGetTimeoutModeProperties_t ("pfnGetTimesliceModeProperties", c_void_p), ## _zesSchedulerGetTimesliceModeProperties_t ("pfnSetTimeoutMode", c_void_p), ## _zesSchedulerSetTimeoutMode_t ("pfnSetTimesliceMode", c_void_p), ## _zesSchedulerSetTimesliceMode_t ("pfnSetExclusiveMode", c_void_p), ## _zesSchedulerSetExclusiveMode_t ("pfnSetComputeUnitDebugMode", c_void_p) ## _zesSchedulerSetComputeUnitDebugMode_t ] ############################################################################### ## @brief Function-pointer for zesPerformanceFactorGetProperties if __use_win_types: _zesPerformanceFactorGetProperties_t = WINFUNCTYPE( ze_result_t, zes_perf_handle_t, POINTER(zes_perf_properties_t) ) else: _zesPerformanceFactorGetProperties_t = CFUNCTYPE( ze_result_t, zes_perf_handle_t, POINTER(zes_perf_properties_t) ) ############################################################################### ## @brief Function-pointer for zesPerformanceFactorGetConfig if __use_win_types: _zesPerformanceFactorGetConfig_t = WINFUNCTYPE( ze_result_t, zes_perf_handle_t, POINTER(c_double) ) else: _zesPerformanceFactorGetConfig_t = CFUNCTYPE( ze_result_t, zes_perf_handle_t, POINTER(c_double) ) ############################################################################### ## @brief Function-pointer for zesPerformanceFactorSetConfig if __use_win_types: _zesPerformanceFactorSetConfig_t = WINFUNCTYPE( ze_result_t, zes_perf_handle_t, c_double ) else: _zesPerformanceFactorSetConfig_t = CFUNCTYPE( ze_result_t, zes_perf_handle_t, c_double ) ############################################################################### ## @brief Table of PerformanceFactor functions pointers class _zes_performance_factor_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesPerformanceFactorGetProperties_t ("pfnGetConfig", c_void_p), ## _zesPerformanceFactorGetConfig_t ("pfnSetConfig", c_void_p) ## _zesPerformanceFactorSetConfig_t ] ############################################################################### ## @brief Function-pointer for zesPowerGetProperties if __use_win_types: _zesPowerGetProperties_t = WINFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(zes_power_properties_t) ) else: _zesPowerGetProperties_t = CFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(zes_power_properties_t) ) ############################################################################### ## @brief Function-pointer for zesPowerGetEnergyCounter if __use_win_types: _zesPowerGetEnergyCounter_t = WINFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(zes_power_energy_counter_t) ) else: _zesPowerGetEnergyCounter_t = CFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(zes_power_energy_counter_t) ) ############################################################################### ## @brief Function-pointer for zesPowerGetLimits if __use_win_types: _zesPowerGetLimits_t = WINFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(zes_power_sustained_limit_t), POINTER(zes_power_burst_limit_t), POINTER(zes_power_peak_limit_t) ) else: _zesPowerGetLimits_t = CFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(zes_power_sustained_limit_t), POINTER(zes_power_burst_limit_t), POINTER(zes_power_peak_limit_t) ) ############################################################################### ## @brief Function-pointer for zesPowerSetLimits if __use_win_types: _zesPowerSetLimits_t = WINFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(zes_power_sustained_limit_t), POINTER(zes_power_burst_limit_t), POINTER(zes_power_peak_limit_t) ) else: _zesPowerSetLimits_t = CFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(zes_power_sustained_limit_t), POINTER(zes_power_burst_limit_t), POINTER(zes_power_peak_limit_t) ) ############################################################################### ## @brief Function-pointer for zesPowerGetEnergyThreshold if __use_win_types: _zesPowerGetEnergyThreshold_t = WINFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(zes_energy_threshold_t) ) else: _zesPowerGetEnergyThreshold_t = CFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(zes_energy_threshold_t) ) ############################################################################### ## @brief Function-pointer for zesPowerSetEnergyThreshold if __use_win_types: _zesPowerSetEnergyThreshold_t = WINFUNCTYPE( ze_result_t, zes_pwr_handle_t, c_double ) else: _zesPowerSetEnergyThreshold_t = CFUNCTYPE( ze_result_t, zes_pwr_handle_t, c_double ) ############################################################################### ## @brief Function-pointer for zesPowerGetLimitsExt if __use_win_types: _zesPowerGetLimitsExt_t = WINFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(c_ulong), POINTER(zes_power_limit_ext_desc_t) ) else: _zesPowerGetLimitsExt_t = CFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(c_ulong), POINTER(zes_power_limit_ext_desc_t) ) ############################################################################### ## @brief Function-pointer for zesPowerSetLimitsExt if __use_win_types: _zesPowerSetLimitsExt_t = WINFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(c_ulong), POINTER(zes_power_limit_ext_desc_t) ) else: _zesPowerSetLimitsExt_t = CFUNCTYPE( ze_result_t, zes_pwr_handle_t, POINTER(c_ulong), POINTER(zes_power_limit_ext_desc_t) ) ############################################################################### ## @brief Table of Power functions pointers class _zes_power_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesPowerGetProperties_t ("pfnGetEnergyCounter", c_void_p), ## _zesPowerGetEnergyCounter_t ("pfnGetLimits", c_void_p), ## _zesPowerGetLimits_t ("pfnSetLimits", c_void_p), ## _zesPowerSetLimits_t ("pfnGetEnergyThreshold", c_void_p), ## _zesPowerGetEnergyThreshold_t ("pfnSetEnergyThreshold", c_void_p), ## _zesPowerSetEnergyThreshold_t ("pfnGetLimitsExt", c_void_p), ## _zesPowerGetLimitsExt_t ("pfnSetLimitsExt", c_void_p) ## _zesPowerSetLimitsExt_t ] ############################################################################### ## @brief Function-pointer for zesFrequencyGetProperties if __use_win_types: _zesFrequencyGetProperties_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_freq_properties_t) ) else: _zesFrequencyGetProperties_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_freq_properties_t) ) ############################################################################### ## @brief Function-pointer for zesFrequencyGetAvailableClocks if __use_win_types: _zesFrequencyGetAvailableClocks_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(c_ulong), POINTER(c_double) ) else: _zesFrequencyGetAvailableClocks_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(c_ulong), POINTER(c_double) ) ############################################################################### ## @brief Function-pointer for zesFrequencyGetRange if __use_win_types: _zesFrequencyGetRange_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_freq_range_t) ) else: _zesFrequencyGetRange_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_freq_range_t) ) ############################################################################### ## @brief Function-pointer for zesFrequencySetRange if __use_win_types: _zesFrequencySetRange_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_freq_range_t) ) else: _zesFrequencySetRange_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_freq_range_t) ) ############################################################################### ## @brief Function-pointer for zesFrequencyGetState if __use_win_types: _zesFrequencyGetState_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_freq_state_t) ) else: _zesFrequencyGetState_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_freq_state_t) ) ############################################################################### ## @brief Function-pointer for zesFrequencyGetThrottleTime if __use_win_types: _zesFrequencyGetThrottleTime_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_freq_throttle_time_t) ) else: _zesFrequencyGetThrottleTime_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_freq_throttle_time_t) ) ############################################################################### ## @brief Function-pointer for zesFrequencyOcGetCapabilities if __use_win_types: _zesFrequencyOcGetCapabilities_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_oc_capabilities_t) ) else: _zesFrequencyOcGetCapabilities_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_oc_capabilities_t) ) ############################################################################### ## @brief Function-pointer for zesFrequencyOcGetFrequencyTarget if __use_win_types: _zesFrequencyOcGetFrequencyTarget_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(c_double) ) else: _zesFrequencyOcGetFrequencyTarget_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(c_double) ) ############################################################################### ## @brief Function-pointer for zesFrequencyOcSetFrequencyTarget if __use_win_types: _zesFrequencyOcSetFrequencyTarget_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, c_double ) else: _zesFrequencyOcSetFrequencyTarget_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, c_double ) ############################################################################### ## @brief Function-pointer for zesFrequencyOcGetVoltageTarget if __use_win_types: _zesFrequencyOcGetVoltageTarget_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(c_double), POINTER(c_double) ) else: _zesFrequencyOcGetVoltageTarget_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(c_double), POINTER(c_double) ) ############################################################################### ## @brief Function-pointer for zesFrequencyOcSetVoltageTarget if __use_win_types: _zesFrequencyOcSetVoltageTarget_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, c_double, c_double ) else: _zesFrequencyOcSetVoltageTarget_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, c_double, c_double ) ############################################################################### ## @brief Function-pointer for zesFrequencyOcSetMode if __use_win_types: _zesFrequencyOcSetMode_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, zes_oc_mode_t ) else: _zesFrequencyOcSetMode_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, zes_oc_mode_t ) ############################################################################### ## @brief Function-pointer for zesFrequencyOcGetMode if __use_win_types: _zesFrequencyOcGetMode_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_oc_mode_t) ) else: _zesFrequencyOcGetMode_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(zes_oc_mode_t) ) ############################################################################### ## @brief Function-pointer for zesFrequencyOcGetIccMax if __use_win_types: _zesFrequencyOcGetIccMax_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(c_double) ) else: _zesFrequencyOcGetIccMax_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(c_double) ) ############################################################################### ## @brief Function-pointer for zesFrequencyOcSetIccMax if __use_win_types: _zesFrequencyOcSetIccMax_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, c_double ) else: _zesFrequencyOcSetIccMax_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, c_double ) ############################################################################### ## @brief Function-pointer for zesFrequencyOcGetTjMax if __use_win_types: _zesFrequencyOcGetTjMax_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(c_double) ) else: _zesFrequencyOcGetTjMax_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, POINTER(c_double) ) ############################################################################### ## @brief Function-pointer for zesFrequencyOcSetTjMax if __use_win_types: _zesFrequencyOcSetTjMax_t = WINFUNCTYPE( ze_result_t, zes_freq_handle_t, c_double ) else: _zesFrequencyOcSetTjMax_t = CFUNCTYPE( ze_result_t, zes_freq_handle_t, c_double ) ############################################################################### ## @brief Table of Frequency functions pointers class _zes_frequency_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesFrequencyGetProperties_t ("pfnGetAvailableClocks", c_void_p), ## _zesFrequencyGetAvailableClocks_t ("pfnGetRange", c_void_p), ## _zesFrequencyGetRange_t ("pfnSetRange", c_void_p), ## _zesFrequencySetRange_t ("pfnGetState", c_void_p), ## _zesFrequencyGetState_t ("pfnGetThrottleTime", c_void_p), ## _zesFrequencyGetThrottleTime_t ("pfnOcGetCapabilities", c_void_p), ## _zesFrequencyOcGetCapabilities_t ("pfnOcGetFrequencyTarget", c_void_p), ## _zesFrequencyOcGetFrequencyTarget_t ("pfnOcSetFrequencyTarget", c_void_p), ## _zesFrequencyOcSetFrequencyTarget_t ("pfnOcGetVoltageTarget", c_void_p), ## _zesFrequencyOcGetVoltageTarget_t ("pfnOcSetVoltageTarget", c_void_p), ## _zesFrequencyOcSetVoltageTarget_t ("pfnOcSetMode", c_void_p), ## _zesFrequencyOcSetMode_t ("pfnOcGetMode", c_void_p), ## _zesFrequencyOcGetMode_t ("pfnOcGetIccMax", c_void_p), ## _zesFrequencyOcGetIccMax_t ("pfnOcSetIccMax", c_void_p), ## _zesFrequencyOcSetIccMax_t ("pfnOcGetTjMax", c_void_p), ## _zesFrequencyOcGetTjMax_t ("pfnOcSetTjMax", c_void_p) ## _zesFrequencyOcSetTjMax_t ] ############################################################################### ## @brief Function-pointer for zesEngineGetProperties if __use_win_types: _zesEngineGetProperties_t = WINFUNCTYPE( ze_result_t, zes_engine_handle_t, POINTER(zes_engine_properties_t) ) else: _zesEngineGetProperties_t = CFUNCTYPE( ze_result_t, zes_engine_handle_t, POINTER(zes_engine_properties_t) ) ############################################################################### ## @brief Function-pointer for zesEngineGetActivity if __use_win_types: _zesEngineGetActivity_t = WINFUNCTYPE( ze_result_t, zes_engine_handle_t, POINTER(zes_engine_stats_t) ) else: _zesEngineGetActivity_t = CFUNCTYPE( ze_result_t, zes_engine_handle_t, POINTER(zes_engine_stats_t) ) ############################################################################### ## @brief Function-pointer for zesEngineGetActivityExt if __use_win_types: _zesEngineGetActivityExt_t = WINFUNCTYPE( ze_result_t, zes_engine_handle_t, POINTER(c_ulong), POINTER(zes_engine_stats_t) ) else: _zesEngineGetActivityExt_t = CFUNCTYPE( ze_result_t, zes_engine_handle_t, POINTER(c_ulong), POINTER(zes_engine_stats_t) ) ############################################################################### ## @brief Table of Engine functions pointers class _zes_engine_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesEngineGetProperties_t ("pfnGetActivity", c_void_p), ## _zesEngineGetActivity_t ("pfnGetActivityExt", c_void_p) ## _zesEngineGetActivityExt_t ] ############################################################################### ## @brief Function-pointer for zesStandbyGetProperties if __use_win_types: _zesStandbyGetProperties_t = WINFUNCTYPE( ze_result_t, zes_standby_handle_t, POINTER(zes_standby_properties_t) ) else: _zesStandbyGetProperties_t = CFUNCTYPE( ze_result_t, zes_standby_handle_t, POINTER(zes_standby_properties_t) ) ############################################################################### ## @brief Function-pointer for zesStandbyGetMode if __use_win_types: _zesStandbyGetMode_t = WINFUNCTYPE( ze_result_t, zes_standby_handle_t, POINTER(zes_standby_promo_mode_t) ) else: _zesStandbyGetMode_t = CFUNCTYPE( ze_result_t, zes_standby_handle_t, POINTER(zes_standby_promo_mode_t) ) ############################################################################### ## @brief Function-pointer for zesStandbySetMode if __use_win_types: _zesStandbySetMode_t = WINFUNCTYPE( ze_result_t, zes_standby_handle_t, zes_standby_promo_mode_t ) else: _zesStandbySetMode_t = CFUNCTYPE( ze_result_t, zes_standby_handle_t, zes_standby_promo_mode_t ) ############################################################################### ## @brief Table of Standby functions pointers class _zes_standby_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesStandbyGetProperties_t ("pfnGetMode", c_void_p), ## _zesStandbyGetMode_t ("pfnSetMode", c_void_p) ## _zesStandbySetMode_t ] ############################################################################### ## @brief Function-pointer for zesFirmwareGetProperties if __use_win_types: _zesFirmwareGetProperties_t = WINFUNCTYPE( ze_result_t, zes_firmware_handle_t, POINTER(zes_firmware_properties_t) ) else: _zesFirmwareGetProperties_t = CFUNCTYPE( ze_result_t, zes_firmware_handle_t, POINTER(zes_firmware_properties_t) ) ############################################################################### ## @brief Function-pointer for zesFirmwareFlash if __use_win_types: _zesFirmwareFlash_t = WINFUNCTYPE( ze_result_t, zes_firmware_handle_t, c_void_p, c_ulong ) else: _zesFirmwareFlash_t = CFUNCTYPE( ze_result_t, zes_firmware_handle_t, c_void_p, c_ulong ) ############################################################################### ## @brief Function-pointer for zesFirmwareGetFlashProgress if __use_win_types: _zesFirmwareGetFlashProgress_t = WINFUNCTYPE( ze_result_t, zes_firmware_handle_t, POINTER(c_ulong) ) else: _zesFirmwareGetFlashProgress_t = CFUNCTYPE( ze_result_t, zes_firmware_handle_t, POINTER(c_ulong) ) ############################################################################### ## @brief Function-pointer for zesFirmwareGetConsoleLogs if __use_win_types: _zesFirmwareGetConsoleLogs_t = WINFUNCTYPE( ze_result_t, zes_firmware_handle_t, POINTER(c_size_t), c_char_p ) else: _zesFirmwareGetConsoleLogs_t = CFUNCTYPE( ze_result_t, zes_firmware_handle_t, POINTER(c_size_t), c_char_p ) ############################################################################### ## @brief Table of Firmware functions pointers class _zes_firmware_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesFirmwareGetProperties_t ("pfnFlash", c_void_p), ## _zesFirmwareFlash_t ("pfnGetFlashProgress", c_void_p), ## _zesFirmwareGetFlashProgress_t ("pfnGetConsoleLogs", c_void_p) ## _zesFirmwareGetConsoleLogs_t ] ############################################################################### ## @brief Function-pointer for zesFirmwareGetSecurityVersionExp if __use_win_types: _zesFirmwareGetSecurityVersionExp_t = WINFUNCTYPE( ze_result_t, zes_firmware_handle_t, c_char_p ) else: _zesFirmwareGetSecurityVersionExp_t = CFUNCTYPE( ze_result_t, zes_firmware_handle_t, c_char_p ) ############################################################################### ## @brief Function-pointer for zesFirmwareSetSecurityVersionExp if __use_win_types: _zesFirmwareSetSecurityVersionExp_t = WINFUNCTYPE( ze_result_t, zes_firmware_handle_t ) else: _zesFirmwareSetSecurityVersionExp_t = CFUNCTYPE( ze_result_t, zes_firmware_handle_t ) ############################################################################### ## @brief Table of FirmwareExp functions pointers class _zes_firmware_exp_dditable_t(Structure): _fields_ = [ ("pfnGetSecurityVersionExp", c_void_p), ## _zesFirmwareGetSecurityVersionExp_t ("pfnSetSecurityVersionExp", c_void_p) ## _zesFirmwareSetSecurityVersionExp_t ] ############################################################################### ## @brief Function-pointer for zesMemoryGetProperties if __use_win_types: _zesMemoryGetProperties_t = WINFUNCTYPE( ze_result_t, zes_mem_handle_t, POINTER(zes_mem_properties_t) ) else: _zesMemoryGetProperties_t = CFUNCTYPE( ze_result_t, zes_mem_handle_t, POINTER(zes_mem_properties_t) ) ############################################################################### ## @brief Function-pointer for zesMemoryGetState if __use_win_types: _zesMemoryGetState_t = WINFUNCTYPE( ze_result_t, zes_mem_handle_t, POINTER(zes_mem_state_t) ) else: _zesMemoryGetState_t = CFUNCTYPE( ze_result_t, zes_mem_handle_t, POINTER(zes_mem_state_t) ) ############################################################################### ## @brief Function-pointer for zesMemoryGetBandwidth if __use_win_types: _zesMemoryGetBandwidth_t = WINFUNCTYPE( ze_result_t, zes_mem_handle_t, POINTER(zes_mem_bandwidth_t) ) else: _zesMemoryGetBandwidth_t = CFUNCTYPE( ze_result_t, zes_mem_handle_t, POINTER(zes_mem_bandwidth_t) ) ############################################################################### ## @brief Table of Memory functions pointers class _zes_memory_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesMemoryGetProperties_t ("pfnGetState", c_void_p), ## _zesMemoryGetState_t ("pfnGetBandwidth", c_void_p) ## _zesMemoryGetBandwidth_t ] ############################################################################### ## @brief Function-pointer for zesFabricPortGetProperties if __use_win_types: _zesFabricPortGetProperties_t = WINFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_port_properties_t) ) else: _zesFabricPortGetProperties_t = CFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_port_properties_t) ) ############################################################################### ## @brief Function-pointer for zesFabricPortGetLinkType if __use_win_types: _zesFabricPortGetLinkType_t = WINFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_link_type_t) ) else: _zesFabricPortGetLinkType_t = CFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_link_type_t) ) ############################################################################### ## @brief Function-pointer for zesFabricPortGetConfig if __use_win_types: _zesFabricPortGetConfig_t = WINFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_port_config_t) ) else: _zesFabricPortGetConfig_t = CFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_port_config_t) ) ############################################################################### ## @brief Function-pointer for zesFabricPortSetConfig if __use_win_types: _zesFabricPortSetConfig_t = WINFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_port_config_t) ) else: _zesFabricPortSetConfig_t = CFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_port_config_t) ) ############################################################################### ## @brief Function-pointer for zesFabricPortGetState if __use_win_types: _zesFabricPortGetState_t = WINFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_port_state_t) ) else: _zesFabricPortGetState_t = CFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_port_state_t) ) ############################################################################### ## @brief Function-pointer for zesFabricPortGetThroughput if __use_win_types: _zesFabricPortGetThroughput_t = WINFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_port_throughput_t) ) else: _zesFabricPortGetThroughput_t = CFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_port_throughput_t) ) ############################################################################### ## @brief Function-pointer for zesFabricPortGetFabricErrorCounters if __use_win_types: _zesFabricPortGetFabricErrorCounters_t = WINFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_port_error_counters_t) ) else: _zesFabricPortGetFabricErrorCounters_t = CFUNCTYPE( ze_result_t, zes_fabric_port_handle_t, POINTER(zes_fabric_port_error_counters_t) ) ############################################################################### ## @brief Function-pointer for zesFabricPortGetMultiPortThroughput if __use_win_types: _zesFabricPortGetMultiPortThroughput_t = WINFUNCTYPE( ze_result_t, zes_device_handle_t, c_ulong, POINTER(zes_fabric_port_handle_t), POINTER(zes_fabric_port_throughput_t*) ) else: _zesFabricPortGetMultiPortThroughput_t = CFUNCTYPE( ze_result_t, zes_device_handle_t, c_ulong, POINTER(zes_fabric_port_handle_t), POINTER(zes_fabric_port_throughput_t*) ) ############################################################################### ## @brief Table of FabricPort functions pointers class _zes_fabric_port_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesFabricPortGetProperties_t ("pfnGetLinkType", c_void_p), ## _zesFabricPortGetLinkType_t ("pfnGetConfig", c_void_p), ## _zesFabricPortGetConfig_t ("pfnSetConfig", c_void_p), ## _zesFabricPortSetConfig_t ("pfnGetState", c_void_p), ## _zesFabricPortGetState_t ("pfnGetThroughput", c_void_p), ## _zesFabricPortGetThroughput_t ("pfnGetFabricErrorCounters", c_void_p), ## _zesFabricPortGetFabricErrorCounters_t ("pfnGetMultiPortThroughput", c_void_p) ## _zesFabricPortGetMultiPortThroughput_t ] ############################################################################### ## @brief Function-pointer for zesTemperatureGetProperties if __use_win_types: _zesTemperatureGetProperties_t = WINFUNCTYPE( ze_result_t, zes_temp_handle_t, POINTER(zes_temp_properties_t) ) else: _zesTemperatureGetProperties_t = CFUNCTYPE( ze_result_t, zes_temp_handle_t, POINTER(zes_temp_properties_t) ) ############################################################################### ## @brief Function-pointer for zesTemperatureGetConfig if __use_win_types: _zesTemperatureGetConfig_t = WINFUNCTYPE( ze_result_t, zes_temp_handle_t, POINTER(zes_temp_config_t) ) else: _zesTemperatureGetConfig_t = CFUNCTYPE( ze_result_t, zes_temp_handle_t, POINTER(zes_temp_config_t) ) ############################################################################### ## @brief Function-pointer for zesTemperatureSetConfig if __use_win_types: _zesTemperatureSetConfig_t = WINFUNCTYPE( ze_result_t, zes_temp_handle_t, POINTER(zes_temp_config_t) ) else: _zesTemperatureSetConfig_t = CFUNCTYPE( ze_result_t, zes_temp_handle_t, POINTER(zes_temp_config_t) ) ############################################################################### ## @brief Function-pointer for zesTemperatureGetState if __use_win_types: _zesTemperatureGetState_t = WINFUNCTYPE( ze_result_t, zes_temp_handle_t, POINTER(c_double) ) else: _zesTemperatureGetState_t = CFUNCTYPE( ze_result_t, zes_temp_handle_t, POINTER(c_double) ) ############################################################################### ## @brief Table of Temperature functions pointers class _zes_temperature_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesTemperatureGetProperties_t ("pfnGetConfig", c_void_p), ## _zesTemperatureGetConfig_t ("pfnSetConfig", c_void_p), ## _zesTemperatureSetConfig_t ("pfnGetState", c_void_p) ## _zesTemperatureGetState_t ] ############################################################################### ## @brief Function-pointer for zesPsuGetProperties if __use_win_types: _zesPsuGetProperties_t = WINFUNCTYPE( ze_result_t, zes_psu_handle_t, POINTER(zes_psu_properties_t) ) else: _zesPsuGetProperties_t = CFUNCTYPE( ze_result_t, zes_psu_handle_t, POINTER(zes_psu_properties_t) ) ############################################################################### ## @brief Function-pointer for zesPsuGetState if __use_win_types: _zesPsuGetState_t = WINFUNCTYPE( ze_result_t, zes_psu_handle_t, POINTER(zes_psu_state_t) ) else: _zesPsuGetState_t = CFUNCTYPE( ze_result_t, zes_psu_handle_t, POINTER(zes_psu_state_t) ) ############################################################################### ## @brief Table of Psu functions pointers class _zes_psu_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesPsuGetProperties_t ("pfnGetState", c_void_p) ## _zesPsuGetState_t ] ############################################################################### ## @brief Function-pointer for zesFanGetProperties if __use_win_types: _zesFanGetProperties_t = WINFUNCTYPE( ze_result_t, zes_fan_handle_t, POINTER(zes_fan_properties_t) ) else: _zesFanGetProperties_t = CFUNCTYPE( ze_result_t, zes_fan_handle_t, POINTER(zes_fan_properties_t) ) ############################################################################### ## @brief Function-pointer for zesFanGetConfig if __use_win_types: _zesFanGetConfig_t = WINFUNCTYPE( ze_result_t, zes_fan_handle_t, POINTER(zes_fan_config_t) ) else: _zesFanGetConfig_t = CFUNCTYPE( ze_result_t, zes_fan_handle_t, POINTER(zes_fan_config_t) ) ############################################################################### ## @brief Function-pointer for zesFanSetDefaultMode if __use_win_types: _zesFanSetDefaultMode_t = WINFUNCTYPE( ze_result_t, zes_fan_handle_t ) else: _zesFanSetDefaultMode_t = CFUNCTYPE( ze_result_t, zes_fan_handle_t ) ############################################################################### ## @brief Function-pointer for zesFanSetFixedSpeedMode if __use_win_types: _zesFanSetFixedSpeedMode_t = WINFUNCTYPE( ze_result_t, zes_fan_handle_t, POINTER(zes_fan_speed_t) ) else: _zesFanSetFixedSpeedMode_t = CFUNCTYPE( ze_result_t, zes_fan_handle_t, POINTER(zes_fan_speed_t) ) ############################################################################### ## @brief Function-pointer for zesFanSetSpeedTableMode if __use_win_types: _zesFanSetSpeedTableMode_t = WINFUNCTYPE( ze_result_t, zes_fan_handle_t, POINTER(zes_fan_speed_table_t) ) else: _zesFanSetSpeedTableMode_t = CFUNCTYPE( ze_result_t, zes_fan_handle_t, POINTER(zes_fan_speed_table_t) ) ############################################################################### ## @brief Function-pointer for zesFanGetState if __use_win_types: _zesFanGetState_t = WINFUNCTYPE( ze_result_t, zes_fan_handle_t, zes_fan_speed_units_t, POINTER(c_int32_t) ) else: _zesFanGetState_t = CFUNCTYPE( ze_result_t, zes_fan_handle_t, zes_fan_speed_units_t, POINTER(c_int32_t) ) ############################################################################### ## @brief Table of Fan functions pointers class _zes_fan_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesFanGetProperties_t ("pfnGetConfig", c_void_p), ## _zesFanGetConfig_t ("pfnSetDefaultMode", c_void_p), ## _zesFanSetDefaultMode_t ("pfnSetFixedSpeedMode", c_void_p), ## _zesFanSetFixedSpeedMode_t ("pfnSetSpeedTableMode", c_void_p), ## _zesFanSetSpeedTableMode_t ("pfnGetState", c_void_p) ## _zesFanGetState_t ] ############################################################################### ## @brief Function-pointer for zesLedGetProperties if __use_win_types: _zesLedGetProperties_t = WINFUNCTYPE( ze_result_t, zes_led_handle_t, POINTER(zes_led_properties_t) ) else: _zesLedGetProperties_t = CFUNCTYPE( ze_result_t, zes_led_handle_t, POINTER(zes_led_properties_t) ) ############################################################################### ## @brief Function-pointer for zesLedGetState if __use_win_types: _zesLedGetState_t = WINFUNCTYPE( ze_result_t, zes_led_handle_t, POINTER(zes_led_state_t) ) else: _zesLedGetState_t = CFUNCTYPE( ze_result_t, zes_led_handle_t, POINTER(zes_led_state_t) ) ############################################################################### ## @brief Function-pointer for zesLedSetState if __use_win_types: _zesLedSetState_t = WINFUNCTYPE( ze_result_t, zes_led_handle_t, ze_bool_t ) else: _zesLedSetState_t = CFUNCTYPE( ze_result_t, zes_led_handle_t, ze_bool_t ) ############################################################################### ## @brief Function-pointer for zesLedSetColor if __use_win_types: _zesLedSetColor_t = WINFUNCTYPE( ze_result_t, zes_led_handle_t, POINTER(zes_led_color_t) ) else: _zesLedSetColor_t = CFUNCTYPE( ze_result_t, zes_led_handle_t, POINTER(zes_led_color_t) ) ############################################################################### ## @brief Table of Led functions pointers class _zes_led_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesLedGetProperties_t ("pfnGetState", c_void_p), ## _zesLedGetState_t ("pfnSetState", c_void_p), ## _zesLedSetState_t ("pfnSetColor", c_void_p) ## _zesLedSetColor_t ] ############################################################################### ## @brief Function-pointer for zesRasGetProperties if __use_win_types: _zesRasGetProperties_t = WINFUNCTYPE( ze_result_t, zes_ras_handle_t, POINTER(zes_ras_properties_t) ) else: _zesRasGetProperties_t = CFUNCTYPE( ze_result_t, zes_ras_handle_t, POINTER(zes_ras_properties_t) ) ############################################################################### ## @brief Function-pointer for zesRasGetConfig if __use_win_types: _zesRasGetConfig_t = WINFUNCTYPE( ze_result_t, zes_ras_handle_t, POINTER(zes_ras_config_t) ) else: _zesRasGetConfig_t = CFUNCTYPE( ze_result_t, zes_ras_handle_t, POINTER(zes_ras_config_t) ) ############################################################################### ## @brief Function-pointer for zesRasSetConfig if __use_win_types: _zesRasSetConfig_t = WINFUNCTYPE( ze_result_t, zes_ras_handle_t, POINTER(zes_ras_config_t) ) else: _zesRasSetConfig_t = CFUNCTYPE( ze_result_t, zes_ras_handle_t, POINTER(zes_ras_config_t) ) ############################################################################### ## @brief Function-pointer for zesRasGetState if __use_win_types: _zesRasGetState_t = WINFUNCTYPE( ze_result_t, zes_ras_handle_t, ze_bool_t, POINTER(zes_ras_state_t) ) else: _zesRasGetState_t = CFUNCTYPE( ze_result_t, zes_ras_handle_t, ze_bool_t, POINTER(zes_ras_state_t) ) ############################################################################### ## @brief Table of Ras functions pointers class _zes_ras_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesRasGetProperties_t ("pfnGetConfig", c_void_p), ## _zesRasGetConfig_t ("pfnSetConfig", c_void_p), ## _zesRasSetConfig_t ("pfnGetState", c_void_p) ## _zesRasGetState_t ] ############################################################################### ## @brief Function-pointer for zesRasGetStateExp if __use_win_types: _zesRasGetStateExp_t = WINFUNCTYPE( ze_result_t, zes_ras_handle_t, POINTER(c_ulong), POINTER(zes_ras_state_exp_t) ) else: _zesRasGetStateExp_t = CFUNCTYPE( ze_result_t, zes_ras_handle_t, POINTER(c_ulong), POINTER(zes_ras_state_exp_t) ) ############################################################################### ## @brief Function-pointer for zesRasClearStateExp if __use_win_types: _zesRasClearStateExp_t = WINFUNCTYPE( ze_result_t, zes_ras_handle_t, zes_ras_error_category_exp_t ) else: _zesRasClearStateExp_t = CFUNCTYPE( ze_result_t, zes_ras_handle_t, zes_ras_error_category_exp_t ) ############################################################################### ## @brief Table of RasExp functions pointers class _zes_ras_exp_dditable_t(Structure): _fields_ = [ ("pfnGetStateExp", c_void_p), ## _zesRasGetStateExp_t ("pfnClearStateExp", c_void_p) ## _zesRasClearStateExp_t ] ############################################################################### ## @brief Function-pointer for zesDiagnosticsGetProperties if __use_win_types: _zesDiagnosticsGetProperties_t = WINFUNCTYPE( ze_result_t, zes_diag_handle_t, POINTER(zes_diag_properties_t) ) else: _zesDiagnosticsGetProperties_t = CFUNCTYPE( ze_result_t, zes_diag_handle_t, POINTER(zes_diag_properties_t) ) ############################################################################### ## @brief Function-pointer for zesDiagnosticsGetTests if __use_win_types: _zesDiagnosticsGetTests_t = WINFUNCTYPE( ze_result_t, zes_diag_handle_t, POINTER(c_ulong), POINTER(zes_diag_test_t) ) else: _zesDiagnosticsGetTests_t = CFUNCTYPE( ze_result_t, zes_diag_handle_t, POINTER(c_ulong), POINTER(zes_diag_test_t) ) ############################################################################### ## @brief Function-pointer for zesDiagnosticsRunTests if __use_win_types: _zesDiagnosticsRunTests_t = WINFUNCTYPE( ze_result_t, zes_diag_handle_t, c_ulong, c_ulong, POINTER(zes_diag_result_t) ) else: _zesDiagnosticsRunTests_t = CFUNCTYPE( ze_result_t, zes_diag_handle_t, c_ulong, c_ulong, POINTER(zes_diag_result_t) ) ############################################################################### ## @brief Table of Diagnostics functions pointers class _zes_diagnostics_dditable_t(Structure): _fields_ = [ ("pfnGetProperties", c_void_p), ## _zesDiagnosticsGetProperties_t ("pfnGetTests", c_void_p), ## _zesDiagnosticsGetTests_t ("pfnRunTests", c_void_p) ## _zesDiagnosticsRunTests_t ] ############################################################################### ## @brief Function-pointer for zesVFManagementGetVFPropertiesExp if __use_win_types: _zesVFManagementGetVFPropertiesExp_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp_properties_t) ) else: _zesVFManagementGetVFPropertiesExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp_properties_t) ) ############################################################################### ## @brief Function-pointer for zesVFManagementGetVFMemoryUtilizationExp if __use_win_types: _zesVFManagementGetVFMemoryUtilizationExp_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_mem_exp_t) ) else: _zesVFManagementGetVFMemoryUtilizationExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_mem_exp_t) ) ############################################################################### ## @brief Function-pointer for zesVFManagementGetVFEngineUtilizationExp if __use_win_types: _zesVFManagementGetVFEngineUtilizationExp_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_engine_exp_t) ) else: _zesVFManagementGetVFEngineUtilizationExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_engine_exp_t) ) ############################################################################### ## @brief Function-pointer for zesVFManagementSetVFTelemetryModeExp if __use_win_types: _zesVFManagementSetVFTelemetryModeExp_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, zes_vf_info_util_exp_flags_t, ze_bool_t ) else: _zesVFManagementSetVFTelemetryModeExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, zes_vf_info_util_exp_flags_t, ze_bool_t ) ############################################################################### ## @brief Function-pointer for zesVFManagementSetVFTelemetrySamplingIntervalExp if __use_win_types: _zesVFManagementSetVFTelemetrySamplingIntervalExp_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, zes_vf_info_util_exp_flags_t, c_ulonglong ) else: _zesVFManagementSetVFTelemetrySamplingIntervalExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, zes_vf_info_util_exp_flags_t, c_ulonglong ) ############################################################################### ## @brief Function-pointer for zesVFManagementGetVFCapabilitiesExp if __use_win_types: _zesVFManagementGetVFCapabilitiesExp_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp_capabilities_t) ) else: _zesVFManagementGetVFCapabilitiesExp_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp_capabilities_t) ) ############################################################################### ## @brief Function-pointer for zesVFManagementGetVFMemoryUtilizationExp2 if __use_win_types: _zesVFManagementGetVFMemoryUtilizationExp2_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_mem_exp2_t) ) else: _zesVFManagementGetVFMemoryUtilizationExp2_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_mem_exp2_t) ) ############################################################################### ## @brief Function-pointer for zesVFManagementGetVFEngineUtilizationExp2 if __use_win_types: _zesVFManagementGetVFEngineUtilizationExp2_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_engine_exp2_t) ) else: _zesVFManagementGetVFEngineUtilizationExp2_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(c_ulong), POINTER(zes_vf_util_engine_exp2_t) ) ############################################################################### ## @brief Function-pointer for zesVFManagementGetVFCapabilitiesExp2 if __use_win_types: _zesVFManagementGetVFCapabilitiesExp2_t = WINFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp2_capabilities_t) ) else: _zesVFManagementGetVFCapabilitiesExp2_t = CFUNCTYPE( ze_result_t, zes_vf_handle_t, POINTER(zes_vf_exp2_capabilities_t) ) ############################################################################### ## @brief Table of VFManagementExp functions pointers class _zes_vf_management_exp_dditable_t(Structure): _fields_ = [ ("pfnGetVFPropertiesExp", c_void_p), ## _zesVFManagementGetVFPropertiesExp_t ("pfnGetVFMemoryUtilizationExp", c_void_p), ## _zesVFManagementGetVFMemoryUtilizationExp_t ("pfnGetVFEngineUtilizationExp", c_void_p), ## _zesVFManagementGetVFEngineUtilizationExp_t ("pfnSetVFTelemetryModeExp", c_void_p), ## _zesVFManagementSetVFTelemetryModeExp_t ("pfnSetVFTelemetrySamplingIntervalExp", c_void_p), ## _zesVFManagementSetVFTelemetrySamplingIntervalExp_t ("pfnGetVFCapabilitiesExp", c_void_p), ## _zesVFManagementGetVFCapabilitiesExp_t ("pfnGetVFMemoryUtilizationExp2", c_void_p), ## _zesVFManagementGetVFMemoryUtilizationExp2_t ("pfnGetVFEngineUtilizationExp2", c_void_p), ## _zesVFManagementGetVFEngineUtilizationExp2_t ("pfnGetVFCapabilitiesExp2", c_void_p) ## _zesVFManagementGetVFCapabilitiesExp2_t ] ############################################################################### class _zes_dditable_t(Structure): _fields_ = [ ("Global", _zes_global_dditable_t), ("Device", _zes_device_dditable_t), ("DeviceExp", _zes_device_exp_dditable_t), ("Driver", _zes_driver_dditable_t), ("DriverExp", _zes_driver_exp_dditable_t), ("Overclock", _zes_overclock_dditable_t), ("Scheduler", _zes_scheduler_dditable_t), ("PerformanceFactor", _zes_performance_factor_dditable_t), ("Power", _zes_power_dditable_t), ("Frequency", _zes_frequency_dditable_t), ("Engine", _zes_engine_dditable_t), ("Standby", _zes_standby_dditable_t), ("Firmware", _zes_firmware_dditable_t), ("FirmwareExp", _zes_firmware_exp_dditable_t), ("Memory", _zes_memory_dditable_t), ("FabricPort", _zes_fabric_port_dditable_t), ("Temperature", _zes_temperature_dditable_t), ("Psu", _zes_psu_dditable_t), ("Fan", _zes_fan_dditable_t), ("Led", _zes_led_dditable_t), ("Ras", _zes_ras_dditable_t), ("RasExp", _zes_ras_exp_dditable_t), ("Diagnostics", _zes_diagnostics_dditable_t), ("VFManagementExp", _zes_vf_management_exp_dditable_t) ] ############################################################################### ## @brief zes device-driver interfaces class ZES_DDI: def __init__(self, version : ze_api_version_t): # load the ze_loader library if "Windows" == platform.uname()[0]: self.__dll = WinDLL("ze_loader.dll") else: self.__dll = CDLL("ze_loader.so") # fill the ddi tables self.__dditable = _zes_dditable_t() # call driver to get function pointers _Global = _zes_global_dditable_t() r = ze_result_v(self.__dll.zesGetGlobalProcAddrTable(version, byref(_Global))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Global = _Global # attach function interface to function address self.zesInit = _zesInit_t(self.__dditable.Global.pfnInit) # call driver to get function pointers _Device = _zes_device_dditable_t() r = ze_result_v(self.__dll.zesGetDeviceProcAddrTable(version, byref(_Device))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Device = _Device # attach function interface to function address self.zesDeviceGetProperties = _zesDeviceGetProperties_t(self.__dditable.Device.pfnGetProperties) self.zesDeviceGetState = _zesDeviceGetState_t(self.__dditable.Device.pfnGetState) self.zesDeviceReset = _zesDeviceReset_t(self.__dditable.Device.pfnReset) self.zesDeviceProcessesGetState = _zesDeviceProcessesGetState_t(self.__dditable.Device.pfnProcessesGetState) self.zesDevicePciGetProperties = _zesDevicePciGetProperties_t(self.__dditable.Device.pfnPciGetProperties) self.zesDevicePciGetState = _zesDevicePciGetState_t(self.__dditable.Device.pfnPciGetState) self.zesDevicePciGetBars = _zesDevicePciGetBars_t(self.__dditable.Device.pfnPciGetBars) self.zesDevicePciGetStats = _zesDevicePciGetStats_t(self.__dditable.Device.pfnPciGetStats) self.zesDeviceEnumDiagnosticTestSuites = _zesDeviceEnumDiagnosticTestSuites_t(self.__dditable.Device.pfnEnumDiagnosticTestSuites) self.zesDeviceEnumEngineGroups = _zesDeviceEnumEngineGroups_t(self.__dditable.Device.pfnEnumEngineGroups) self.zesDeviceEventRegister = _zesDeviceEventRegister_t(self.__dditable.Device.pfnEventRegister) self.zesDeviceEnumFabricPorts = _zesDeviceEnumFabricPorts_t(self.__dditable.Device.pfnEnumFabricPorts) self.zesDeviceEnumFans = _zesDeviceEnumFans_t(self.__dditable.Device.pfnEnumFans) self.zesDeviceEnumFirmwares = _zesDeviceEnumFirmwares_t(self.__dditable.Device.pfnEnumFirmwares) self.zesDeviceEnumFrequencyDomains = _zesDeviceEnumFrequencyDomains_t(self.__dditable.Device.pfnEnumFrequencyDomains) self.zesDeviceEnumLeds = _zesDeviceEnumLeds_t(self.__dditable.Device.pfnEnumLeds) self.zesDeviceEnumMemoryModules = _zesDeviceEnumMemoryModules_t(self.__dditable.Device.pfnEnumMemoryModules) self.zesDeviceEnumPerformanceFactorDomains = _zesDeviceEnumPerformanceFactorDomains_t(self.__dditable.Device.pfnEnumPerformanceFactorDomains) self.zesDeviceEnumPowerDomains = _zesDeviceEnumPowerDomains_t(self.__dditable.Device.pfnEnumPowerDomains) self.zesDeviceGetCardPowerDomain = _zesDeviceGetCardPowerDomain_t(self.__dditable.Device.pfnGetCardPowerDomain) self.zesDeviceEnumPsus = _zesDeviceEnumPsus_t(self.__dditable.Device.pfnEnumPsus) self.zesDeviceEnumRasErrorSets = _zesDeviceEnumRasErrorSets_t(self.__dditable.Device.pfnEnumRasErrorSets) self.zesDeviceEnumSchedulers = _zesDeviceEnumSchedulers_t(self.__dditable.Device.pfnEnumSchedulers) self.zesDeviceEnumStandbyDomains = _zesDeviceEnumStandbyDomains_t(self.__dditable.Device.pfnEnumStandbyDomains) self.zesDeviceEnumTemperatureSensors = _zesDeviceEnumTemperatureSensors_t(self.__dditable.Device.pfnEnumTemperatureSensors) self.zesDeviceEccAvailable = _zesDeviceEccAvailable_t(self.__dditable.Device.pfnEccAvailable) self.zesDeviceEccConfigurable = _zesDeviceEccConfigurable_t(self.__dditable.Device.pfnEccConfigurable) self.zesDeviceGetEccState = _zesDeviceGetEccState_t(self.__dditable.Device.pfnGetEccState) self.zesDeviceSetEccState = _zesDeviceSetEccState_t(self.__dditable.Device.pfnSetEccState) self.zesDeviceGet = _zesDeviceGet_t(self.__dditable.Device.pfnGet) self.zesDeviceSetOverclockWaiver = _zesDeviceSetOverclockWaiver_t(self.__dditable.Device.pfnSetOverclockWaiver) self.zesDeviceGetOverclockDomains = _zesDeviceGetOverclockDomains_t(self.__dditable.Device.pfnGetOverclockDomains) self.zesDeviceGetOverclockControls = _zesDeviceGetOverclockControls_t(self.__dditable.Device.pfnGetOverclockControls) self.zesDeviceResetOverclockSettings = _zesDeviceResetOverclockSettings_t(self.__dditable.Device.pfnResetOverclockSettings) self.zesDeviceReadOverclockState = _zesDeviceReadOverclockState_t(self.__dditable.Device.pfnReadOverclockState) self.zesDeviceEnumOverclockDomains = _zesDeviceEnumOverclockDomains_t(self.__dditable.Device.pfnEnumOverclockDomains) self.zesDeviceResetExt = _zesDeviceResetExt_t(self.__dditable.Device.pfnResetExt) # call driver to get function pointers _DeviceExp = _zes_device_exp_dditable_t() r = ze_result_v(self.__dll.zesGetDeviceExpProcAddrTable(version, byref(_DeviceExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.DeviceExp = _DeviceExp # attach function interface to function address self.zesDeviceGetSubDevicePropertiesExp = _zesDeviceGetSubDevicePropertiesExp_t(self.__dditable.DeviceExp.pfnGetSubDevicePropertiesExp) self.zesDeviceEnumActiveVFExp = _zesDeviceEnumActiveVFExp_t(self.__dditable.DeviceExp.pfnEnumActiveVFExp) self.zesDeviceEnumEnabledVFExp = _zesDeviceEnumEnabledVFExp_t(self.__dditable.DeviceExp.pfnEnumEnabledVFExp) # call driver to get function pointers _Driver = _zes_driver_dditable_t() r = ze_result_v(self.__dll.zesGetDriverProcAddrTable(version, byref(_Driver))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Driver = _Driver # attach function interface to function address self.zesDriverEventListen = _zesDriverEventListen_t(self.__dditable.Driver.pfnEventListen) self.zesDriverEventListenEx = _zesDriverEventListenEx_t(self.__dditable.Driver.pfnEventListenEx) self.zesDriverGet = _zesDriverGet_t(self.__dditable.Driver.pfnGet) self.zesDriverGetExtensionProperties = _zesDriverGetExtensionProperties_t(self.__dditable.Driver.pfnGetExtensionProperties) self.zesDriverGetExtensionFunctionAddress = _zesDriverGetExtensionFunctionAddress_t(self.__dditable.Driver.pfnGetExtensionFunctionAddress) # call driver to get function pointers _DriverExp = _zes_driver_exp_dditable_t() r = ze_result_v(self.__dll.zesGetDriverExpProcAddrTable(version, byref(_DriverExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.DriverExp = _DriverExp # attach function interface to function address self.zesDriverGetDeviceByUuidExp = _zesDriverGetDeviceByUuidExp_t(self.__dditable.DriverExp.pfnGetDeviceByUuidExp) # call driver to get function pointers _Overclock = _zes_overclock_dditable_t() r = ze_result_v(self.__dll.zesGetOverclockProcAddrTable(version, byref(_Overclock))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Overclock = _Overclock # attach function interface to function address self.zesOverclockGetDomainProperties = _zesOverclockGetDomainProperties_t(self.__dditable.Overclock.pfnGetDomainProperties) self.zesOverclockGetDomainVFProperties = _zesOverclockGetDomainVFProperties_t(self.__dditable.Overclock.pfnGetDomainVFProperties) self.zesOverclockGetDomainControlProperties = _zesOverclockGetDomainControlProperties_t(self.__dditable.Overclock.pfnGetDomainControlProperties) self.zesOverclockGetControlCurrentValue = _zesOverclockGetControlCurrentValue_t(self.__dditable.Overclock.pfnGetControlCurrentValue) self.zesOverclockGetControlPendingValue = _zesOverclockGetControlPendingValue_t(self.__dditable.Overclock.pfnGetControlPendingValue) self.zesOverclockSetControlUserValue = _zesOverclockSetControlUserValue_t(self.__dditable.Overclock.pfnSetControlUserValue) self.zesOverclockGetControlState = _zesOverclockGetControlState_t(self.__dditable.Overclock.pfnGetControlState) self.zesOverclockGetVFPointValues = _zesOverclockGetVFPointValues_t(self.__dditable.Overclock.pfnGetVFPointValues) self.zesOverclockSetVFPointValues = _zesOverclockSetVFPointValues_t(self.__dditable.Overclock.pfnSetVFPointValues) # call driver to get function pointers _Scheduler = _zes_scheduler_dditable_t() r = ze_result_v(self.__dll.zesGetSchedulerProcAddrTable(version, byref(_Scheduler))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Scheduler = _Scheduler # attach function interface to function address self.zesSchedulerGetProperties = _zesSchedulerGetProperties_t(self.__dditable.Scheduler.pfnGetProperties) self.zesSchedulerGetCurrentMode = _zesSchedulerGetCurrentMode_t(self.__dditable.Scheduler.pfnGetCurrentMode) self.zesSchedulerGetTimeoutModeProperties = _zesSchedulerGetTimeoutModeProperties_t(self.__dditable.Scheduler.pfnGetTimeoutModeProperties) self.zesSchedulerGetTimesliceModeProperties = _zesSchedulerGetTimesliceModeProperties_t(self.__dditable.Scheduler.pfnGetTimesliceModeProperties) self.zesSchedulerSetTimeoutMode = _zesSchedulerSetTimeoutMode_t(self.__dditable.Scheduler.pfnSetTimeoutMode) self.zesSchedulerSetTimesliceMode = _zesSchedulerSetTimesliceMode_t(self.__dditable.Scheduler.pfnSetTimesliceMode) self.zesSchedulerSetExclusiveMode = _zesSchedulerSetExclusiveMode_t(self.__dditable.Scheduler.pfnSetExclusiveMode) self.zesSchedulerSetComputeUnitDebugMode = _zesSchedulerSetComputeUnitDebugMode_t(self.__dditable.Scheduler.pfnSetComputeUnitDebugMode) # call driver to get function pointers _PerformanceFactor = _zes_performance_factor_dditable_t() r = ze_result_v(self.__dll.zesGetPerformanceFactorProcAddrTable(version, byref(_PerformanceFactor))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.PerformanceFactor = _PerformanceFactor # attach function interface to function address self.zesPerformanceFactorGetProperties = _zesPerformanceFactorGetProperties_t(self.__dditable.PerformanceFactor.pfnGetProperties) self.zesPerformanceFactorGetConfig = _zesPerformanceFactorGetConfig_t(self.__dditable.PerformanceFactor.pfnGetConfig) self.zesPerformanceFactorSetConfig = _zesPerformanceFactorSetConfig_t(self.__dditable.PerformanceFactor.pfnSetConfig) # call driver to get function pointers _Power = _zes_power_dditable_t() r = ze_result_v(self.__dll.zesGetPowerProcAddrTable(version, byref(_Power))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Power = _Power # attach function interface to function address self.zesPowerGetProperties = _zesPowerGetProperties_t(self.__dditable.Power.pfnGetProperties) self.zesPowerGetEnergyCounter = _zesPowerGetEnergyCounter_t(self.__dditable.Power.pfnGetEnergyCounter) self.zesPowerGetLimits = _zesPowerGetLimits_t(self.__dditable.Power.pfnGetLimits) self.zesPowerSetLimits = _zesPowerSetLimits_t(self.__dditable.Power.pfnSetLimits) self.zesPowerGetEnergyThreshold = _zesPowerGetEnergyThreshold_t(self.__dditable.Power.pfnGetEnergyThreshold) self.zesPowerSetEnergyThreshold = _zesPowerSetEnergyThreshold_t(self.__dditable.Power.pfnSetEnergyThreshold) self.zesPowerGetLimitsExt = _zesPowerGetLimitsExt_t(self.__dditable.Power.pfnGetLimitsExt) self.zesPowerSetLimitsExt = _zesPowerSetLimitsExt_t(self.__dditable.Power.pfnSetLimitsExt) # call driver to get function pointers _Frequency = _zes_frequency_dditable_t() r = ze_result_v(self.__dll.zesGetFrequencyProcAddrTable(version, byref(_Frequency))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Frequency = _Frequency # attach function interface to function address self.zesFrequencyGetProperties = _zesFrequencyGetProperties_t(self.__dditable.Frequency.pfnGetProperties) self.zesFrequencyGetAvailableClocks = _zesFrequencyGetAvailableClocks_t(self.__dditable.Frequency.pfnGetAvailableClocks) self.zesFrequencyGetRange = _zesFrequencyGetRange_t(self.__dditable.Frequency.pfnGetRange) self.zesFrequencySetRange = _zesFrequencySetRange_t(self.__dditable.Frequency.pfnSetRange) self.zesFrequencyGetState = _zesFrequencyGetState_t(self.__dditable.Frequency.pfnGetState) self.zesFrequencyGetThrottleTime = _zesFrequencyGetThrottleTime_t(self.__dditable.Frequency.pfnGetThrottleTime) self.zesFrequencyOcGetCapabilities = _zesFrequencyOcGetCapabilities_t(self.__dditable.Frequency.pfnOcGetCapabilities) self.zesFrequencyOcGetFrequencyTarget = _zesFrequencyOcGetFrequencyTarget_t(self.__dditable.Frequency.pfnOcGetFrequencyTarget) self.zesFrequencyOcSetFrequencyTarget = _zesFrequencyOcSetFrequencyTarget_t(self.__dditable.Frequency.pfnOcSetFrequencyTarget) self.zesFrequencyOcGetVoltageTarget = _zesFrequencyOcGetVoltageTarget_t(self.__dditable.Frequency.pfnOcGetVoltageTarget) self.zesFrequencyOcSetVoltageTarget = _zesFrequencyOcSetVoltageTarget_t(self.__dditable.Frequency.pfnOcSetVoltageTarget) self.zesFrequencyOcSetMode = _zesFrequencyOcSetMode_t(self.__dditable.Frequency.pfnOcSetMode) self.zesFrequencyOcGetMode = _zesFrequencyOcGetMode_t(self.__dditable.Frequency.pfnOcGetMode) self.zesFrequencyOcGetIccMax = _zesFrequencyOcGetIccMax_t(self.__dditable.Frequency.pfnOcGetIccMax) self.zesFrequencyOcSetIccMax = _zesFrequencyOcSetIccMax_t(self.__dditable.Frequency.pfnOcSetIccMax) self.zesFrequencyOcGetTjMax = _zesFrequencyOcGetTjMax_t(self.__dditable.Frequency.pfnOcGetTjMax) self.zesFrequencyOcSetTjMax = _zesFrequencyOcSetTjMax_t(self.__dditable.Frequency.pfnOcSetTjMax) # call driver to get function pointers _Engine = _zes_engine_dditable_t() r = ze_result_v(self.__dll.zesGetEngineProcAddrTable(version, byref(_Engine))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Engine = _Engine # attach function interface to function address self.zesEngineGetProperties = _zesEngineGetProperties_t(self.__dditable.Engine.pfnGetProperties) self.zesEngineGetActivity = _zesEngineGetActivity_t(self.__dditable.Engine.pfnGetActivity) self.zesEngineGetActivityExt = _zesEngineGetActivityExt_t(self.__dditable.Engine.pfnGetActivityExt) # call driver to get function pointers _Standby = _zes_standby_dditable_t() r = ze_result_v(self.__dll.zesGetStandbyProcAddrTable(version, byref(_Standby))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Standby = _Standby # attach function interface to function address self.zesStandbyGetProperties = _zesStandbyGetProperties_t(self.__dditable.Standby.pfnGetProperties) self.zesStandbyGetMode = _zesStandbyGetMode_t(self.__dditable.Standby.pfnGetMode) self.zesStandbySetMode = _zesStandbySetMode_t(self.__dditable.Standby.pfnSetMode) # call driver to get function pointers _Firmware = _zes_firmware_dditable_t() r = ze_result_v(self.__dll.zesGetFirmwareProcAddrTable(version, byref(_Firmware))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Firmware = _Firmware # attach function interface to function address self.zesFirmwareGetProperties = _zesFirmwareGetProperties_t(self.__dditable.Firmware.pfnGetProperties) self.zesFirmwareFlash = _zesFirmwareFlash_t(self.__dditable.Firmware.pfnFlash) self.zesFirmwareGetFlashProgress = _zesFirmwareGetFlashProgress_t(self.__dditable.Firmware.pfnGetFlashProgress) self.zesFirmwareGetConsoleLogs = _zesFirmwareGetConsoleLogs_t(self.__dditable.Firmware.pfnGetConsoleLogs) # call driver to get function pointers _FirmwareExp = _zes_firmware_exp_dditable_t() r = ze_result_v(self.__dll.zesGetFirmwareExpProcAddrTable(version, byref(_FirmwareExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.FirmwareExp = _FirmwareExp # attach function interface to function address self.zesFirmwareGetSecurityVersionExp = _zesFirmwareGetSecurityVersionExp_t(self.__dditable.FirmwareExp.pfnGetSecurityVersionExp) self.zesFirmwareSetSecurityVersionExp = _zesFirmwareSetSecurityVersionExp_t(self.__dditable.FirmwareExp.pfnSetSecurityVersionExp) # call driver to get function pointers _Memory = _zes_memory_dditable_t() r = ze_result_v(self.__dll.zesGetMemoryProcAddrTable(version, byref(_Memory))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Memory = _Memory # attach function interface to function address self.zesMemoryGetProperties = _zesMemoryGetProperties_t(self.__dditable.Memory.pfnGetProperties) self.zesMemoryGetState = _zesMemoryGetState_t(self.__dditable.Memory.pfnGetState) self.zesMemoryGetBandwidth = _zesMemoryGetBandwidth_t(self.__dditable.Memory.pfnGetBandwidth) # call driver to get function pointers _FabricPort = _zes_fabric_port_dditable_t() r = ze_result_v(self.__dll.zesGetFabricPortProcAddrTable(version, byref(_FabricPort))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.FabricPort = _FabricPort # attach function interface to function address self.zesFabricPortGetProperties = _zesFabricPortGetProperties_t(self.__dditable.FabricPort.pfnGetProperties) self.zesFabricPortGetLinkType = _zesFabricPortGetLinkType_t(self.__dditable.FabricPort.pfnGetLinkType) self.zesFabricPortGetConfig = _zesFabricPortGetConfig_t(self.__dditable.FabricPort.pfnGetConfig) self.zesFabricPortSetConfig = _zesFabricPortSetConfig_t(self.__dditable.FabricPort.pfnSetConfig) self.zesFabricPortGetState = _zesFabricPortGetState_t(self.__dditable.FabricPort.pfnGetState) self.zesFabricPortGetThroughput = _zesFabricPortGetThroughput_t(self.__dditable.FabricPort.pfnGetThroughput) self.zesFabricPortGetFabricErrorCounters = _zesFabricPortGetFabricErrorCounters_t(self.__dditable.FabricPort.pfnGetFabricErrorCounters) self.zesFabricPortGetMultiPortThroughput = _zesFabricPortGetMultiPortThroughput_t(self.__dditable.FabricPort.pfnGetMultiPortThroughput) # call driver to get function pointers _Temperature = _zes_temperature_dditable_t() r = ze_result_v(self.__dll.zesGetTemperatureProcAddrTable(version, byref(_Temperature))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Temperature = _Temperature # attach function interface to function address self.zesTemperatureGetProperties = _zesTemperatureGetProperties_t(self.__dditable.Temperature.pfnGetProperties) self.zesTemperatureGetConfig = _zesTemperatureGetConfig_t(self.__dditable.Temperature.pfnGetConfig) self.zesTemperatureSetConfig = _zesTemperatureSetConfig_t(self.__dditable.Temperature.pfnSetConfig) self.zesTemperatureGetState = _zesTemperatureGetState_t(self.__dditable.Temperature.pfnGetState) # call driver to get function pointers _Psu = _zes_psu_dditable_t() r = ze_result_v(self.__dll.zesGetPsuProcAddrTable(version, byref(_Psu))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Psu = _Psu # attach function interface to function address self.zesPsuGetProperties = _zesPsuGetProperties_t(self.__dditable.Psu.pfnGetProperties) self.zesPsuGetState = _zesPsuGetState_t(self.__dditable.Psu.pfnGetState) # call driver to get function pointers _Fan = _zes_fan_dditable_t() r = ze_result_v(self.__dll.zesGetFanProcAddrTable(version, byref(_Fan))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Fan = _Fan # attach function interface to function address self.zesFanGetProperties = _zesFanGetProperties_t(self.__dditable.Fan.pfnGetProperties) self.zesFanGetConfig = _zesFanGetConfig_t(self.__dditable.Fan.pfnGetConfig) self.zesFanSetDefaultMode = _zesFanSetDefaultMode_t(self.__dditable.Fan.pfnSetDefaultMode) self.zesFanSetFixedSpeedMode = _zesFanSetFixedSpeedMode_t(self.__dditable.Fan.pfnSetFixedSpeedMode) self.zesFanSetSpeedTableMode = _zesFanSetSpeedTableMode_t(self.__dditable.Fan.pfnSetSpeedTableMode) self.zesFanGetState = _zesFanGetState_t(self.__dditable.Fan.pfnGetState) # call driver to get function pointers _Led = _zes_led_dditable_t() r = ze_result_v(self.__dll.zesGetLedProcAddrTable(version, byref(_Led))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Led = _Led # attach function interface to function address self.zesLedGetProperties = _zesLedGetProperties_t(self.__dditable.Led.pfnGetProperties) self.zesLedGetState = _zesLedGetState_t(self.__dditable.Led.pfnGetState) self.zesLedSetState = _zesLedSetState_t(self.__dditable.Led.pfnSetState) self.zesLedSetColor = _zesLedSetColor_t(self.__dditable.Led.pfnSetColor) # call driver to get function pointers _Ras = _zes_ras_dditable_t() r = ze_result_v(self.__dll.zesGetRasProcAddrTable(version, byref(_Ras))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Ras = _Ras # attach function interface to function address self.zesRasGetProperties = _zesRasGetProperties_t(self.__dditable.Ras.pfnGetProperties) self.zesRasGetConfig = _zesRasGetConfig_t(self.__dditable.Ras.pfnGetConfig) self.zesRasSetConfig = _zesRasSetConfig_t(self.__dditable.Ras.pfnSetConfig) self.zesRasGetState = _zesRasGetState_t(self.__dditable.Ras.pfnGetState) # call driver to get function pointers _RasExp = _zes_ras_exp_dditable_t() r = ze_result_v(self.__dll.zesGetRasExpProcAddrTable(version, byref(_RasExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.RasExp = _RasExp # attach function interface to function address self.zesRasGetStateExp = _zesRasGetStateExp_t(self.__dditable.RasExp.pfnGetStateExp) self.zesRasClearStateExp = _zesRasClearStateExp_t(self.__dditable.RasExp.pfnClearStateExp) # call driver to get function pointers _Diagnostics = _zes_diagnostics_dditable_t() r = ze_result_v(self.__dll.zesGetDiagnosticsProcAddrTable(version, byref(_Diagnostics))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Diagnostics = _Diagnostics # attach function interface to function address self.zesDiagnosticsGetProperties = _zesDiagnosticsGetProperties_t(self.__dditable.Diagnostics.pfnGetProperties) self.zesDiagnosticsGetTests = _zesDiagnosticsGetTests_t(self.__dditable.Diagnostics.pfnGetTests) self.zesDiagnosticsRunTests = _zesDiagnosticsRunTests_t(self.__dditable.Diagnostics.pfnRunTests) # call driver to get function pointers _VFManagementExp = _zes_vf_management_exp_dditable_t() r = ze_result_v(self.__dll.zesGetVFManagementExpProcAddrTable(version, byref(_VFManagementExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.VFManagementExp = _VFManagementExp # attach function interface to function address self.zesVFManagementGetVFPropertiesExp = _zesVFManagementGetVFPropertiesExp_t(self.__dditable.VFManagementExp.pfnGetVFPropertiesExp) self.zesVFManagementGetVFMemoryUtilizationExp = _zesVFManagementGetVFMemoryUtilizationExp_t(self.__dditable.VFManagementExp.pfnGetVFMemoryUtilizationExp) self.zesVFManagementGetVFEngineUtilizationExp = _zesVFManagementGetVFEngineUtilizationExp_t(self.__dditable.VFManagementExp.pfnGetVFEngineUtilizationExp) self.zesVFManagementSetVFTelemetryModeExp = _zesVFManagementSetVFTelemetryModeExp_t(self.__dditable.VFManagementExp.pfnSetVFTelemetryModeExp) self.zesVFManagementSetVFTelemetrySamplingIntervalExp = _zesVFManagementSetVFTelemetrySamplingIntervalExp_t(self.__dditable.VFManagementExp.pfnSetVFTelemetrySamplingIntervalExp) self.zesVFManagementGetVFCapabilitiesExp = _zesVFManagementGetVFCapabilitiesExp_t(self.__dditable.VFManagementExp.pfnGetVFCapabilitiesExp) self.zesVFManagementGetVFMemoryUtilizationExp2 = _zesVFManagementGetVFMemoryUtilizationExp2_t(self.__dditable.VFManagementExp.pfnGetVFMemoryUtilizationExp2) self.zesVFManagementGetVFEngineUtilizationExp2 = _zesVFManagementGetVFEngineUtilizationExp2_t(self.__dditable.VFManagementExp.pfnGetVFEngineUtilizationExp2) self.zesVFManagementGetVFCapabilitiesExp2 = _zesVFManagementGetVFCapabilitiesExp2_t(self.__dditable.VFManagementExp.pfnGetVFCapabilitiesExp2) # success! level-zero-1.20.6/include/zes_api.h000066400000000000000000016054651475521542100171410ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_api.h * @version v1.12-r1.12.15 * */ #ifndef _ZES_API_H #define _ZES_API_H #if defined(__cplusplus) #pragma once #endif // 'core' API headers #include "ze_api.h" #if defined(__cplusplus) extern "C" { #endif // Intel 'oneAPI' Level-Zero Sysman API common types #if !defined(__GNUC__) #pragma region common #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Handle to a driver instance typedef ze_driver_handle_t zes_driver_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of device object typedef ze_device_handle_t zes_device_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device scheduler queue typedef struct _zes_sched_handle_t *zes_sched_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device performance factors typedef struct _zes_perf_handle_t *zes_perf_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device power domain typedef struct _zes_pwr_handle_t *zes_pwr_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device frequency domain typedef struct _zes_freq_handle_t *zes_freq_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device engine group typedef struct _zes_engine_handle_t *zes_engine_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device standby control typedef struct _zes_standby_handle_t *zes_standby_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device firmware typedef struct _zes_firmware_handle_t *zes_firmware_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device memory module typedef struct _zes_mem_handle_t *zes_mem_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman fabric port typedef struct _zes_fabric_port_handle_t *zes_fabric_port_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device temperature sensor typedef struct _zes_temp_handle_t *zes_temp_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device power supply typedef struct _zes_psu_handle_t *zes_psu_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device fan typedef struct _zes_fan_handle_t *zes_fan_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device LED typedef struct _zes_led_handle_t *zes_led_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device RAS error set typedef struct _zes_ras_handle_t *zes_ras_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device diagnostics test suite typedef struct _zes_diag_handle_t *zes_diag_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman device overclock domain typedef struct _zes_overclock_handle_t *zes_overclock_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle for a Sysman virtual function management domain typedef struct _zes_vf_handle_t *zes_vf_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Defines structure types typedef enum _zes_structure_type_t { ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES = 0x1, ///< ::zes_device_properties_t ZES_STRUCTURE_TYPE_PCI_PROPERTIES = 0x2, ///< ::zes_pci_properties_t ZES_STRUCTURE_TYPE_PCI_BAR_PROPERTIES = 0x3, ///< ::zes_pci_bar_properties_t ZES_STRUCTURE_TYPE_DIAG_PROPERTIES = 0x4, ///< ::zes_diag_properties_t ZES_STRUCTURE_TYPE_ENGINE_PROPERTIES = 0x5, ///< ::zes_engine_properties_t ZES_STRUCTURE_TYPE_FABRIC_PORT_PROPERTIES = 0x6, ///< ::zes_fabric_port_properties_t ZES_STRUCTURE_TYPE_FAN_PROPERTIES = 0x7, ///< ::zes_fan_properties_t ZES_STRUCTURE_TYPE_FIRMWARE_PROPERTIES = 0x8, ///< ::zes_firmware_properties_t ZES_STRUCTURE_TYPE_FREQ_PROPERTIES = 0x9, ///< ::zes_freq_properties_t ZES_STRUCTURE_TYPE_LED_PROPERTIES = 0xa, ///< ::zes_led_properties_t ZES_STRUCTURE_TYPE_MEM_PROPERTIES = 0xb, ///< ::zes_mem_properties_t ZES_STRUCTURE_TYPE_PERF_PROPERTIES = 0xc, ///< ::zes_perf_properties_t ZES_STRUCTURE_TYPE_POWER_PROPERTIES = 0xd, ///< ::zes_power_properties_t ZES_STRUCTURE_TYPE_PSU_PROPERTIES = 0xe, ///< ::zes_psu_properties_t ZES_STRUCTURE_TYPE_RAS_PROPERTIES = 0xf, ///< ::zes_ras_properties_t ZES_STRUCTURE_TYPE_SCHED_PROPERTIES = 0x10, ///< ::zes_sched_properties_t ZES_STRUCTURE_TYPE_SCHED_TIMEOUT_PROPERTIES = 0x11, ///< ::zes_sched_timeout_properties_t ZES_STRUCTURE_TYPE_SCHED_TIMESLICE_PROPERTIES = 0x12, ///< ::zes_sched_timeslice_properties_t ZES_STRUCTURE_TYPE_STANDBY_PROPERTIES = 0x13, ///< ::zes_standby_properties_t ZES_STRUCTURE_TYPE_TEMP_PROPERTIES = 0x14, ///< ::zes_temp_properties_t ZES_STRUCTURE_TYPE_DEVICE_STATE = 0x15, ///< ::zes_device_state_t ZES_STRUCTURE_TYPE_PROCESS_STATE = 0x16, ///< ::zes_process_state_t ZES_STRUCTURE_TYPE_PCI_STATE = 0x17, ///< ::zes_pci_state_t ZES_STRUCTURE_TYPE_FABRIC_PORT_CONFIG = 0x18, ///< ::zes_fabric_port_config_t ZES_STRUCTURE_TYPE_FABRIC_PORT_STATE = 0x19, ///< ::zes_fabric_port_state_t ZES_STRUCTURE_TYPE_FAN_CONFIG = 0x1a, ///< ::zes_fan_config_t ZES_STRUCTURE_TYPE_FREQ_STATE = 0x1b, ///< ::zes_freq_state_t ZES_STRUCTURE_TYPE_OC_CAPABILITIES = 0x1c, ///< ::zes_oc_capabilities_t ZES_STRUCTURE_TYPE_LED_STATE = 0x1d, ///< ::zes_led_state_t ZES_STRUCTURE_TYPE_MEM_STATE = 0x1e, ///< ::zes_mem_state_t ZES_STRUCTURE_TYPE_PSU_STATE = 0x1f, ///< ::zes_psu_state_t ZES_STRUCTURE_TYPE_BASE_STATE = 0x20, ///< ::zes_base_state_t ZES_STRUCTURE_TYPE_RAS_CONFIG = 0x21, ///< ::zes_ras_config_t ZES_STRUCTURE_TYPE_RAS_STATE = 0x22, ///< ::zes_ras_state_t ZES_STRUCTURE_TYPE_TEMP_CONFIG = 0x23, ///< ::zes_temp_config_t ZES_STRUCTURE_TYPE_PCI_BAR_PROPERTIES_1_2 = 0x24, ///< ::zes_pci_bar_properties_1_2_t ZES_STRUCTURE_TYPE_DEVICE_ECC_DESC = 0x25, ///< ::zes_device_ecc_desc_t ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES = 0x26, ///< ::zes_device_ecc_properties_t ZES_STRUCTURE_TYPE_POWER_LIMIT_EXT_DESC = 0x27, ///< ::zes_power_limit_ext_desc_t ZES_STRUCTURE_TYPE_POWER_EXT_PROPERTIES = 0x28, ///< ::zes_power_ext_properties_t ZES_STRUCTURE_TYPE_OVERCLOCK_PROPERTIES = 0x29, ///< ::zes_overclock_properties_t ZES_STRUCTURE_TYPE_FABRIC_PORT_ERROR_COUNTERS = 0x2a, ///< ::zes_fabric_port_error_counters_t ZES_STRUCTURE_TYPE_ENGINE_EXT_PROPERTIES = 0x2b, ///< ::zes_engine_ext_properties_t ZES_STRUCTURE_TYPE_RESET_PROPERTIES = 0x2c, ///< ::zes_reset_properties_t ZES_STRUCTURE_TYPE_DEVICE_EXT_PROPERTIES = 0x2d, ///< ::zes_device_ext_properties_t ZES_STRUCTURE_TYPE_DEVICE_UUID = 0x2e, ///< ::zes_uuid_t ZES_STRUCTURE_TYPE_POWER_DOMAIN_EXP_PROPERTIES = 0x00020001, ///< ::zes_power_domain_exp_properties_t ZES_STRUCTURE_TYPE_MEM_BANDWIDTH_COUNTER_BITS_EXP_PROPERTIES = 0x00020002, ///< ::zes_mem_bandwidth_counter_bits_exp_properties_t ZES_STRUCTURE_TYPE_MEMORY_PAGE_OFFLINE_STATE_EXP = 0x00020003, ///< ::zes_mem_page_offline_state_exp_t ZES_STRUCTURE_TYPE_SUBDEVICE_EXP_PROPERTIES = 0x00020004, ///< ::zes_subdevice_exp_properties_t ZES_STRUCTURE_TYPE_VF_EXP_PROPERTIES = 0x00020005, ///< ::zes_vf_exp_properties_t ZES_STRUCTURE_TYPE_VF_UTIL_MEM_EXP = 0x00020006, ///< ::zes_vf_util_mem_exp_t ZES_STRUCTURE_TYPE_VF_UTIL_ENGINE_EXP = 0x00020007, ///< ::zes_vf_util_engine_exp_t ZES_STRUCTURE_TYPE_VF_EXP_CAPABILITIES = 0x00020008, ///< ::zes_vf_exp_capabilities_t ZES_STRUCTURE_TYPE_VF_UTIL_MEM_EXP2 = 0x00020009, ///< ::zes_vf_util_mem_exp2_t ZES_STRUCTURE_TYPE_VF_UTIL_ENGINE_EXP2 = 0x00020010, ///< ::zes_vf_util_engine_exp2_t ZES_STRUCTURE_TYPE_VF_EXP2_CAPABILITIES = 0x00020011, ///< ::zes_vf_exp2_capabilities_t ZES_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff } zes_structure_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Base for all properties types typedef struct _zes_base_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). } zes_base_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Base for all descriptor types typedef struct _zes_base_desc_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). } zes_base_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Base for all state types typedef struct _zes_base_state_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). } zes_base_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Base for all config types typedef struct _zes_base_config_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). } zes_base_config_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Base for all capability types typedef struct _zes_base_capability_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). } zes_base_capability_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_base_properties_t typedef struct _zes_base_properties_t zes_base_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_base_desc_t typedef struct _zes_base_desc_t zes_base_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_base_state_t typedef struct _zes_base_state_t zes_base_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_base_config_t typedef struct _zes_base_config_t zes_base_config_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_base_capability_t typedef struct _zes_base_capability_t zes_base_capability_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_driver_extension_properties_t typedef struct _zes_driver_extension_properties_t zes_driver_extension_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_device_state_t typedef struct _zes_device_state_t zes_device_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_reset_properties_t typedef struct _zes_reset_properties_t zes_reset_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_uuid_t typedef struct _zes_uuid_t zes_uuid_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_device_properties_t typedef struct _zes_device_properties_t zes_device_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_device_ext_properties_t typedef struct _zes_device_ext_properties_t zes_device_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_process_state_t typedef struct _zes_process_state_t zes_process_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_pci_address_t typedef struct _zes_pci_address_t zes_pci_address_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_pci_speed_t typedef struct _zes_pci_speed_t zes_pci_speed_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_pci_properties_t typedef struct _zes_pci_properties_t zes_pci_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_pci_state_t typedef struct _zes_pci_state_t zes_pci_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_pci_bar_properties_t typedef struct _zes_pci_bar_properties_t zes_pci_bar_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_pci_bar_properties_1_2_t typedef struct _zes_pci_bar_properties_1_2_t zes_pci_bar_properties_1_2_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_pci_stats_t typedef struct _zes_pci_stats_t zes_pci_stats_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_overclock_properties_t typedef struct _zes_overclock_properties_t zes_overclock_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_control_property_t typedef struct _zes_control_property_t zes_control_property_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_vf_property_t typedef struct _zes_vf_property_t zes_vf_property_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_diag_test_t typedef struct _zes_diag_test_t zes_diag_test_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_diag_properties_t typedef struct _zes_diag_properties_t zes_diag_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_device_ecc_desc_t typedef struct _zes_device_ecc_desc_t zes_device_ecc_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_device_ecc_properties_t typedef struct _zes_device_ecc_properties_t zes_device_ecc_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_engine_properties_t typedef struct _zes_engine_properties_t zes_engine_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_engine_stats_t typedef struct _zes_engine_stats_t zes_engine_stats_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fabric_port_id_t typedef struct _zes_fabric_port_id_t zes_fabric_port_id_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fabric_port_speed_t typedef struct _zes_fabric_port_speed_t zes_fabric_port_speed_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fabric_port_properties_t typedef struct _zes_fabric_port_properties_t zes_fabric_port_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fabric_link_type_t typedef struct _zes_fabric_link_type_t zes_fabric_link_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fabric_port_config_t typedef struct _zes_fabric_port_config_t zes_fabric_port_config_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fabric_port_state_t typedef struct _zes_fabric_port_state_t zes_fabric_port_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fabric_port_throughput_t typedef struct _zes_fabric_port_throughput_t zes_fabric_port_throughput_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fabric_port_error_counters_t typedef struct _zes_fabric_port_error_counters_t zes_fabric_port_error_counters_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fan_speed_t typedef struct _zes_fan_speed_t zes_fan_speed_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fan_temp_speed_t typedef struct _zes_fan_temp_speed_t zes_fan_temp_speed_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fan_speed_table_t typedef struct _zes_fan_speed_table_t zes_fan_speed_table_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fan_properties_t typedef struct _zes_fan_properties_t zes_fan_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_fan_config_t typedef struct _zes_fan_config_t zes_fan_config_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_firmware_properties_t typedef struct _zes_firmware_properties_t zes_firmware_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_freq_properties_t typedef struct _zes_freq_properties_t zes_freq_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_freq_range_t typedef struct _zes_freq_range_t zes_freq_range_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_freq_state_t typedef struct _zes_freq_state_t zes_freq_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_freq_throttle_time_t typedef struct _zes_freq_throttle_time_t zes_freq_throttle_time_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_oc_capabilities_t typedef struct _zes_oc_capabilities_t zes_oc_capabilities_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_led_properties_t typedef struct _zes_led_properties_t zes_led_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_led_color_t typedef struct _zes_led_color_t zes_led_color_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_led_state_t typedef struct _zes_led_state_t zes_led_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_mem_properties_t typedef struct _zes_mem_properties_t zes_mem_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_mem_state_t typedef struct _zes_mem_state_t zes_mem_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_mem_bandwidth_t typedef struct _zes_mem_bandwidth_t zes_mem_bandwidth_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_mem_ext_bandwidth_t typedef struct _zes_mem_ext_bandwidth_t zes_mem_ext_bandwidth_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_perf_properties_t typedef struct _zes_perf_properties_t zes_perf_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_power_properties_t typedef struct _zes_power_properties_t zes_power_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_power_energy_counter_t typedef struct _zes_power_energy_counter_t zes_power_energy_counter_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_power_sustained_limit_t typedef struct _zes_power_sustained_limit_t zes_power_sustained_limit_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_power_burst_limit_t typedef struct _zes_power_burst_limit_t zes_power_burst_limit_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_power_peak_limit_t typedef struct _zes_power_peak_limit_t zes_power_peak_limit_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_energy_threshold_t typedef struct _zes_energy_threshold_t zes_energy_threshold_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_psu_properties_t typedef struct _zes_psu_properties_t zes_psu_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_psu_state_t typedef struct _zes_psu_state_t zes_psu_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_ras_properties_t typedef struct _zes_ras_properties_t zes_ras_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_ras_state_t typedef struct _zes_ras_state_t zes_ras_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_ras_config_t typedef struct _zes_ras_config_t zes_ras_config_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_sched_properties_t typedef struct _zes_sched_properties_t zes_sched_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_sched_timeout_properties_t typedef struct _zes_sched_timeout_properties_t zes_sched_timeout_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_sched_timeslice_properties_t typedef struct _zes_sched_timeslice_properties_t zes_sched_timeslice_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_standby_properties_t typedef struct _zes_standby_properties_t zes_standby_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_temp_properties_t typedef struct _zes_temp_properties_t zes_temp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_temp_threshold_t typedef struct _zes_temp_threshold_t zes_temp_threshold_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_temp_config_t typedef struct _zes_temp_config_t zes_temp_config_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_power_limit_ext_desc_t typedef struct _zes_power_limit_ext_desc_t zes_power_limit_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_power_ext_properties_t typedef struct _zes_power_ext_properties_t zes_power_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_engine_ext_properties_t typedef struct _zes_engine_ext_properties_t zes_engine_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_ras_state_exp_t typedef struct _zes_ras_state_exp_t zes_ras_state_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_mem_page_offline_state_exp_t typedef struct _zes_mem_page_offline_state_exp_t zes_mem_page_offline_state_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_mem_bandwidth_counter_bits_exp_properties_t typedef struct _zes_mem_bandwidth_counter_bits_exp_properties_t zes_mem_bandwidth_counter_bits_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_power_domain_exp_properties_t typedef struct _zes_power_domain_exp_properties_t zes_power_domain_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_subdevice_exp_properties_t typedef struct _zes_subdevice_exp_properties_t zes_subdevice_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_vf_exp_properties_t typedef struct _zes_vf_exp_properties_t zes_vf_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_vf_util_mem_exp_t typedef struct _zes_vf_util_mem_exp_t zes_vf_util_mem_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_vf_util_engine_exp_t typedef struct _zes_vf_util_engine_exp_t zes_vf_util_engine_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_vf_exp_capabilities_t typedef struct _zes_vf_exp_capabilities_t zes_vf_exp_capabilities_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_vf_exp2_capabilities_t typedef struct _zes_vf_exp2_capabilities_t zes_vf_exp2_capabilities_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_vf_util_mem_exp2_t typedef struct _zes_vf_util_mem_exp2_t zes_vf_util_mem_exp2_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zes_vf_util_engine_exp2_t typedef struct _zes_vf_util_engine_exp2_t zes_vf_util_engine_exp2_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) #if !defined(__GNUC__) #pragma region driver #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported sysman initialization flags typedef uint32_t zes_init_flags_t; typedef enum _zes_init_flag_t { ZES_INIT_FLAG_PLACEHOLDER = ZE_BIT(0), ///< placeholder for future use ZES_INIT_FLAG_FORCE_UINT32 = 0x7fffffff } zes_init_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Initialize 'oneAPI' System Resource Management (sysman) /// /// @details /// - The application must call this function or ::zeInit with the /// ::ZES_ENABLE_SYSMAN environment variable set before calling any other /// sysman function. /// - If this function is not called then all other sysman functions will /// return ::ZE_RESULT_ERROR_UNINITIALIZED. /// - This function will only initialize sysman. To initialize other /// functions, call ::zeInit. /// - There is no requirement to call this function before or after /// ::zeInit. /// - Only one instance of sysman will be initialized per process. /// - 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 sysman simultaneously. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x1 < flags` /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY ZE_APIEXPORT ze_result_t ZE_APICALL zesInit( zes_init_flags_t flags ///< [in] initialization flags. ///< currently unused, must be 0 (default). ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves sysman driver instances /// /// @details /// - A sysman driver represents a collection of physical devices. /// - Multiple calls to this function will return identical sysman driver /// handles, in the same order. /// - The application may pass nullptr for pDrivers when only querying the /// number of sysman drivers. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDriverGet( uint32_t* pCount, ///< [in,out] pointer to the number of sysman driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of sysman drivers available. ///< if count is greater than the number of sysman drivers available, then ///< the loader shall update the value with the correct number of sysman ///< drivers available. zes_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of sysman driver instance handles. ///< if count is less than the number of sysman drivers available, then the ///< loader shall only retrieve that number of sysman drivers. ); /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_MAX_EXTENSION_NAME /// @brief Maximum extension name string size #define ZES_MAX_EXTENSION_NAME 256 #endif // ZES_MAX_EXTENSION_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Extension properties queried using ::zesDriverGetExtensionProperties typedef struct _zes_driver_extension_properties_t { char name[ZES_MAX_EXTENSION_NAME]; ///< [out] extension name uint32_t version; ///< [out] extension version using ::ZE_MAKE_VERSION } zes_driver_extension_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves extension properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDriverGetExtensionProperties( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. zes_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves function pointer for vendor-specific or experimental /// extensions /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == name` /// + `nullptr == ppFunctionAddress` ZE_APIEXPORT ze_result_t ZE_APICALL zesDriverGetExtensionFunctionAddress( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Device management #if !defined(__GNUC__) #pragma region device #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves sysman devices within a sysman driver /// /// @details /// - Multiple calls to this function will return identical sysman device /// handles, in the same order. /// - The number and order of handles returned from this function is NOT /// affected by the ::ZE_AFFINITY_MASK, ::ZE_ENABLE_PCI_ID_DEVICE_ORDER, /// or ::ZE_FLAT_DEVICE_HIERARCHY environment variables. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceGet( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance uint32_t* pCount, ///< [in,out] pointer to the number of sysman devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sysman devices available. ///< if count is greater than the number of sysman devices available, then ///< the driver shall update the value with the correct number of sysman ///< devices available. zes_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of sysman devices. ///< if count is less than the number of sysman devices available, then ///< driver shall only retrieve that number of sysman devices. ); /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_STRING_PROPERTY_SIZE /// @brief Maximum number of characters in string properties. #define ZES_STRING_PROPERTY_SIZE 64 #endif // ZES_STRING_PROPERTY_SIZE /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_MAX_UUID_SIZE /// @brief Maximum device universal unique id (UUID) size in bytes. #define ZES_MAX_UUID_SIZE 16 #endif // ZES_MAX_UUID_SIZE /////////////////////////////////////////////////////////////////////////////// /// @brief Types of accelerator engines typedef uint32_t zes_engine_type_flags_t; typedef enum _zes_engine_type_flag_t { ZES_ENGINE_TYPE_FLAG_OTHER = ZE_BIT(0), ///< Undefined types of accelerators. ZES_ENGINE_TYPE_FLAG_COMPUTE = ZE_BIT(1), ///< Engines that process compute kernels only (no 3D content). ZES_ENGINE_TYPE_FLAG_3D = ZE_BIT(2), ///< Engines that process 3D content only (no compute kernels). ZES_ENGINE_TYPE_FLAG_MEDIA = ZE_BIT(3), ///< Engines that process media workloads. ZES_ENGINE_TYPE_FLAG_DMA = ZE_BIT(4), ///< Engines that copy blocks of data. ZES_ENGINE_TYPE_FLAG_RENDER = ZE_BIT(5), ///< Engines that can process both 3D content and compute kernels. ZES_ENGINE_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff } zes_engine_type_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device repair status typedef enum _zes_repair_status_t { ZES_REPAIR_STATUS_UNSUPPORTED = 0, ///< The device does not support in-field repairs. ZES_REPAIR_STATUS_NOT_PERFORMED = 1, ///< The device has never been repaired. ZES_REPAIR_STATUS_PERFORMED = 2, ///< The device has been repaired. ZES_REPAIR_STATUS_FORCE_UINT32 = 0x7fffffff } zes_repair_status_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device reset reasons typedef uint32_t zes_reset_reason_flags_t; typedef enum _zes_reset_reason_flag_t { ZES_RESET_REASON_FLAG_WEDGED = ZE_BIT(0), ///< The device needs to be reset because one or more parts of the hardware ///< is wedged ZES_RESET_REASON_FLAG_REPAIR = ZE_BIT(1), ///< The device needs to be reset in order to complete in-field repairs ZES_RESET_REASON_FLAG_FORCE_UINT32 = 0x7fffffff } zes_reset_reason_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device reset type typedef enum _zes_reset_type_t { ZES_RESET_TYPE_WARM = 0, ///< Apply warm reset ZES_RESET_TYPE_COLD = 1, ///< Apply cold reset ZES_RESET_TYPE_FLR = 2, ///< Apply FLR reset ZES_RESET_TYPE_FORCE_UINT32 = 0x7fffffff } zes_reset_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device state typedef struct _zes_device_state_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_reset_reason_flags_t reset; ///< [out] Indicates if the device needs to be reset and for what reasons. ///< returns 0 (none) or combination of ::zes_reset_reason_flag_t zes_repair_status_t repaired; ///< [out] Indicates if the device has been repaired } zes_device_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device reset properties typedef struct _zes_reset_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t force; ///< [in] If set to true, all applications that are currently using the ///< device will be forcibly killed. zes_reset_type_t resetType; ///< [in] Type of reset needs to be performed } zes_reset_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device universal unique id (UUID) typedef struct _zes_uuid_t { uint8_t id[ZES_MAX_UUID_SIZE]; ///< [out] opaque data representing a device UUID } zes_uuid_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported device types typedef enum _zes_device_type_t { ZES_DEVICE_TYPE_GPU = 1, ///< Graphics Processing Unit ZES_DEVICE_TYPE_CPU = 2, ///< Central Processing Unit ZES_DEVICE_TYPE_FPGA = 3, ///< Field Programmable Gate Array ZES_DEVICE_TYPE_MCA = 4, ///< Memory Copy Accelerator ZES_DEVICE_TYPE_VPU = 5, ///< Vision Processing Unit ZES_DEVICE_TYPE_FORCE_UINT32 = 0x7fffffff } zes_device_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported device property flags typedef uint32_t zes_device_property_flags_t; typedef enum _zes_device_property_flag_t { ZES_DEVICE_PROPERTY_FLAG_INTEGRATED = ZE_BIT(0), ///< Device is integrated with the Host. ZES_DEVICE_PROPERTY_FLAG_SUBDEVICE = ZE_BIT(1), ///< Device handle used for query represents a sub-device. ZES_DEVICE_PROPERTY_FLAG_ECC = ZE_BIT(2), ///< Device supports error correction memory access. ZES_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING = ZE_BIT(3), ///< Device supports on-demand page-faulting. ZES_DEVICE_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff } zes_device_property_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device properties typedef struct _zes_device_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_device_properties_t core; ///< [out] (Deprecated, use ::zes_uuid_t in the extended structure) Core ///< device properties uint32_t numSubdevices; ///< [out] Number of sub-devices. A value of 0 indicates that this device ///< doesn't have sub-devices. char serialNumber[ZES_STRING_PROPERTY_SIZE]; ///< [out] Manufacturing serial number (NULL terminated string value). This ///< value is intended to reflect the Part ID/SoC ID assigned by ///< manufacturer that is unique for a SoC. Will be set to the string ///< "unknown" if this cannot be determined for the device. char boardNumber[ZES_STRING_PROPERTY_SIZE]; ///< [out] Manufacturing board number (NULL terminated string value). ///< Alternatively "boardSerialNumber", this value is intended to reflect ///< the string printed on board label by manufacturer. Will be set to the ///< string "unknown" if this cannot be determined for the device. char brandName[ZES_STRING_PROPERTY_SIZE]; ///< [out] Brand name of the device (NULL terminated string value). Will be ///< set to the string "unknown" if this cannot be determined for the ///< device. char modelName[ZES_STRING_PROPERTY_SIZE]; ///< [out] Model name of the device (NULL terminated string value). Will be ///< set to the string "unknown" if this cannot be determined for the ///< device. char vendorName[ZES_STRING_PROPERTY_SIZE]; ///< [out] Vendor name of the device (NULL terminated string value). Will ///< be set to the string "unknown" if this cannot be determined for the ///< device. char driverVersion[ZES_STRING_PROPERTY_SIZE]; ///< [out] Installed driver version (NULL terminated string value). Will be ///< set to the string "unknown" if this cannot be determined for the ///< device. } zes_device_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device properties typedef struct _zes_device_ext_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_uuid_t uuid; ///< [out] universal unique identifier. Note: uuid obtained from Sysman API ///< is the same as from core API. Subdevices will have their own uuid. zes_device_type_t type; ///< [out] generic device type zes_device_property_flags_t flags; ///< [out] 0 (none) or a valid combination of ::zes_device_property_flag_t } zes_device_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get properties about the device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceGetProperties( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_properties_t* pProperties ///< [in,out] Structure that will contain information about the device. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get information about the state of the device - if a reset is /// required, reasons for the reset and if the device has been repaired /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_state_t* pState ///< [in,out] Structure that will contain information about the device. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Reset device /// /// @details /// - Performs a PCI bus reset of the device. This will result in all /// current device state being lost. /// - All applications using the device should be stopped before calling /// this function. /// - If the force argument is specified, all applications using the device /// will be forcibly killed. /// - The function will block until the device has restarted or an /// implementation defined timeout occurred waiting for the reset to /// complete. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to perform this operation. /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + Reset cannot be performed because applications are using this device. /// - ::ZE_RESULT_ERROR_UNKNOWN /// + There were problems unloading the device driver, performing a bus reset or reloading the device driver. ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceReset( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device ze_bool_t force ///< [in] If set to true, all applications that are currently using the ///< device will be forcibly killed. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Reset device extension /// /// @details /// - Performs a PCI bus reset of the device. This will result in all /// current device state being lost. /// - Prior to calling this function, user is responsible for closing /// applications using the device unless force argument is specified. /// - If the force argument is specified, all applications using the device /// will be forcibly killed. /// - The function will block until the device has restarted or a /// implementation specific timeout occurred waiting for the reset to /// complete. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to perform this operation. /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + Reset cannot be performed because applications are using this device. /// - ::ZE_RESULT_ERROR_UNKNOWN /// + There were problems unloading the device driver, performing a bus reset or reloading the device driver. ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceResetExt( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device zes_reset_properties_t* pProperties ///< [in] Device reset properties to apply ); /////////////////////////////////////////////////////////////////////////////// /// @brief Contains information about a process that has an open connection with /// this device /// /// @details /// - The application can use the process ID to query the OS for the owner /// and the path to the executable. typedef struct _zes_process_state_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t processId; ///< [out] Host OS process ID. uint64_t memSize; ///< [out] Device memory size in bytes allocated by this process (may not ///< necessarily be resident on the device at the time of reading). uint64_t sharedSize; ///< [out] The size of shared device memory mapped into this process (may ///< not necessarily be resident on the device at the time of reading). zes_engine_type_flags_t engines; ///< [out] Bitfield of accelerator engine types being used by this process. } zes_process_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get information about host processes using the device /// /// @details /// - The number of processes connected to the device is dynamic. This means /// that between a call to determine the value of pCount and the /// subsequent call, the number of processes may have increased or /// decreased. It is recommended that a large array be passed in so as to /// avoid receiving the error ::ZE_RESULT_ERROR_INVALID_SIZE. Also, always /// check the returned value in pCount since it may be less than the /// earlier call to get the required array size. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + The provided value of pCount is not big enough to store information about all the processes currently attached to the device. ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceProcessesGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device uint32_t* pCount, ///< [in,out] pointer to the number of processes. ///< if count is zero, then the driver shall update the value with the ///< total number of processes currently attached to the device. ///< if count is greater than the number of processes currently attached to ///< the device, then the driver shall update the value with the correct ///< number of processes. zes_process_state_t* pProcesses ///< [in,out][optional][range(0, *pCount)] array of process information. ///< if count is less than the number of processes currently attached to ///< the device, then the driver shall only retrieve information about that ///< number of processes. In this case, the return code will ::ZE_RESULT_ERROR_INVALID_SIZE. ); /////////////////////////////////////////////////////////////////////////////// /// @brief PCI address typedef struct _zes_pci_address_t { uint32_t domain; ///< [out] BDF domain uint32_t bus; ///< [out] BDF bus uint32_t device; ///< [out] BDF device uint32_t function; ///< [out] BDF function } zes_pci_address_t; /////////////////////////////////////////////////////////////////////////////// /// @brief PCI speed typedef struct _zes_pci_speed_t { int32_t gen; ///< [out] The link generation. A value of -1 means that this property is ///< unknown. int32_t width; ///< [out] The number of lanes. A value of -1 means that this property is ///< unknown. int64_t maxBandwidth; ///< [out] The maximum bandwidth in bytes/sec (sum of all lanes). A value ///< of -1 means that this property is unknown. } zes_pci_speed_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Static PCI properties typedef struct _zes_pci_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_pci_address_t address; ///< [out] The BDF address zes_pci_speed_t maxSpeed; ///< [out] Fastest port configuration supported by the device (sum of all ///< lanes) ze_bool_t haveBandwidthCounters; ///< [out] Indicates whether the `rxCounter` and `txCounter` members of ///< ::zes_pci_stats_t will have valid values ze_bool_t havePacketCounters; ///< [out] Indicates whether the `packetCounter` member of ///< ::zes_pci_stats_t will have a valid value ze_bool_t haveReplayCounters; ///< [out] Indicates whether the `replayCounter` member of ///< ::zes_pci_stats_t will have a valid value } zes_pci_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief PCI link status typedef enum _zes_pci_link_status_t { ZES_PCI_LINK_STATUS_UNKNOWN = 0, ///< The link status could not be determined ZES_PCI_LINK_STATUS_GOOD = 1, ///< The link is up and operating as expected ZES_PCI_LINK_STATUS_QUALITY_ISSUES = 2, ///< The link is up but has quality and/or bandwidth degradation ZES_PCI_LINK_STATUS_STABILITY_ISSUES = 3, ///< The link has stability issues and preventing workloads making forward ///< progress ZES_PCI_LINK_STATUS_FORCE_UINT32 = 0x7fffffff } zes_pci_link_status_t; /////////////////////////////////////////////////////////////////////////////// /// @brief PCI link quality degradation reasons typedef uint32_t zes_pci_link_qual_issue_flags_t; typedef enum _zes_pci_link_qual_issue_flag_t { ZES_PCI_LINK_QUAL_ISSUE_FLAG_REPLAYS = ZE_BIT(0), ///< A significant number of replays are occurring ZES_PCI_LINK_QUAL_ISSUE_FLAG_SPEED = ZE_BIT(1), ///< There is a degradation in the maximum bandwidth of the link ZES_PCI_LINK_QUAL_ISSUE_FLAG_FORCE_UINT32 = 0x7fffffff } zes_pci_link_qual_issue_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief PCI link stability issues typedef uint32_t zes_pci_link_stab_issue_flags_t; typedef enum _zes_pci_link_stab_issue_flag_t { ZES_PCI_LINK_STAB_ISSUE_FLAG_RETRAINING = ZE_BIT(0), ///< Link retraining has occurred to deal with quality issues ZES_PCI_LINK_STAB_ISSUE_FLAG_FORCE_UINT32 = 0x7fffffff } zes_pci_link_stab_issue_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Dynamic PCI state typedef struct _zes_pci_state_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_pci_link_status_t status; ///< [out] The current status of the port zes_pci_link_qual_issue_flags_t qualityIssues; ///< [out] If status is ::ZES_PCI_LINK_STATUS_QUALITY_ISSUES, ///< then this gives a combination of ::zes_pci_link_qual_issue_flag_t for ///< quality issues that have been detected; ///< otherwise, 0 indicates there are no quality issues with the link at ///< this time." zes_pci_link_stab_issue_flags_t stabilityIssues; ///< [out] If status is ::ZES_PCI_LINK_STATUS_STABILITY_ISSUES, ///< then this gives a combination of ::zes_pci_link_stab_issue_flag_t for ///< reasons for the connection instability; ///< otherwise, 0 indicates there are no connection stability issues at ///< this time." zes_pci_speed_t speed; ///< [out] The current port configure speed } zes_pci_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief PCI bar types typedef enum _zes_pci_bar_type_t { ZES_PCI_BAR_TYPE_MMIO = 0, ///< MMIO registers ZES_PCI_BAR_TYPE_ROM = 1, ///< ROM aperture ZES_PCI_BAR_TYPE_MEM = 2, ///< Device memory ZES_PCI_BAR_TYPE_FORCE_UINT32 = 0x7fffffff } zes_pci_bar_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Properties of a pci bar typedef struct _zes_pci_bar_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_pci_bar_type_t type; ///< [out] The type of bar uint32_t index; ///< [out] The index of the bar uint64_t base; ///< [out] Base address of the bar. uint64_t size; ///< [out] Size of the bar. } zes_pci_bar_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Properties of a pci bar, including the resizable bar. typedef struct _zes_pci_bar_properties_1_2_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_pci_bar_type_t type; ///< [out] The type of bar uint32_t index; ///< [out] The index of the bar uint64_t base; ///< [out] Base address of the bar. uint64_t size; ///< [out] Size of the bar. ze_bool_t resizableBarSupported; ///< [out] Support for Resizable Bar on this device. ze_bool_t resizableBarEnabled; ///< [out] Resizable Bar enabled on this device } zes_pci_bar_properties_1_2_t; /////////////////////////////////////////////////////////////////////////////// /// @brief PCI stats counters /// /// @details /// - Percent replays is calculated by taking two snapshots (s1, s2) and /// using the equation: %replay = 10^6 * (s2.replayCounter - /// s1.replayCounter) / (s2.maxBandwidth * (s2.timestamp - s1.timestamp)) /// - Percent throughput is calculated by taking two snapshots (s1, s2) and /// using the equation: %bw = 10^6 * ((s2.rxCounter - s1.rxCounter) + /// (s2.txCounter - s1.txCounter)) / (s2.maxBandwidth * (s2.timestamp - /// s1.timestamp)) typedef struct _zes_pci_stats_t { uint64_t timestamp; ///< [out] Monotonic timestamp counter in microseconds when the measurement ///< was made. ///< This timestamp should only be used to calculate delta time between ///< snapshots of this structure. ///< Never take the delta of this timestamp with the timestamp from a ///< different structure since they are not guaranteed to have the same base. ///< The absolute value of the timestamp is only valid during within the ///< application and may be different on the next execution. uint64_t replayCounter; ///< [out] Monotonic counter for the number of replay packets (sum of all ///< lanes). Will always be 0 when the `haveReplayCounters` member of ///< ::zes_pci_properties_t is FALSE. uint64_t packetCounter; ///< [out] Monotonic counter for the number of packets (sum of all lanes). ///< Will always be 0 when the `havePacketCounters` member of ///< ::zes_pci_properties_t is FALSE. uint64_t rxCounter; ///< [out] Monotonic counter for the number of bytes received (sum of all ///< lanes). Will always be 0 when the `haveBandwidthCounters` member of ///< ::zes_pci_properties_t is FALSE. uint64_t txCounter; ///< [out] Monotonic counter for the number of bytes transmitted (including ///< replays) (sum of all lanes). Will always be 0 when the ///< `haveBandwidthCounters` member of ::zes_pci_properties_t is FALSE. zes_pci_speed_t speed; ///< [out] The current speed of the link (sum of all lanes) } zes_pci_stats_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get PCI properties - address, max speed /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesDevicePciGetProperties( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_properties_t* pProperties ///< [in,out] Will contain the PCI properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get current PCI state - current speed /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ZE_APIEXPORT ze_result_t ZE_APICALL zesDevicePciGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_state_t* pState ///< [in,out] Will contain the PCI properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get information about each configured bar /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDevicePciGetBars( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of PCI bars. ///< if count is zero, then the driver shall update the value with the ///< total number of PCI bars that are setup. ///< if count is greater than the number of PCI bars that are setup, then ///< the driver shall update the value with the correct number of PCI bars. zes_pci_bar_properties_t* pProperties ///< [in,out][optional][range(0, *pCount)] array of information about setup ///< PCI bars. ///< if count is less than the number of PCI bars that are setup, then the ///< driver shall only retrieve information about that number of PCI bars. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get PCI stats - bandwidth, number of packets, number of replays /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pStats` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to query this telemetry. ZE_APIEXPORT ze_result_t ZE_APICALL zesDevicePciGetStats( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_stats_t* pStats ///< [in,out] Will contain a snapshot of the latest stats. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Overclock controls, VF curve manipulation #if !defined(__GNUC__) #pragma region Overclock #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Overclock domains. typedef enum _zes_overclock_domain_t { ZES_OVERCLOCK_DOMAIN_CARD = 1, ///< Overclocking card level properties such as temperature limits. ZES_OVERCLOCK_DOMAIN_PACKAGE = 2, ///< Overclocking package level properties such as power limits. ZES_OVERCLOCK_DOMAIN_GPU_ALL = 4, ///< Overclocking a GPU that has all accelerator assets on the same PLL/VR. ZES_OVERCLOCK_DOMAIN_GPU_RENDER_COMPUTE = 8, ///< Overclocking a GPU with render and compute assets on the same PLL/VR. ZES_OVERCLOCK_DOMAIN_GPU_RENDER = 16, ///< Overclocking a GPU with render assets on its own PLL/VR. ZES_OVERCLOCK_DOMAIN_GPU_COMPUTE = 32, ///< Overclocking a GPU with compute assets on its own PLL/VR. ZES_OVERCLOCK_DOMAIN_GPU_MEDIA = 64, ///< Overclocking a GPU with media assets on its own PLL/VR. ZES_OVERCLOCK_DOMAIN_VRAM = 128, ///< Overclocking device local memory. ZES_OVERCLOCK_DOMAIN_ADM = 256, ///< Overclocking LLC/L4 cache. ZES_OVERCLOCK_DOMAIN_FORCE_UINT32 = 0x7fffffff } zes_overclock_domain_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Overclock controls. typedef enum _zes_overclock_control_t { ZES_OVERCLOCK_CONTROL_VF = 1, ///< This control permits setting a custom V-F curve. ZES_OVERCLOCK_CONTROL_FREQ_OFFSET = 2, ///< The V-F curve of the overclock domain can be shifted up or down using ///< this control. ZES_OVERCLOCK_CONTROL_VMAX_OFFSET = 4, ///< This control is used to increase the permitted voltage above the ///< shipped voltage maximum. ZES_OVERCLOCK_CONTROL_FREQ = 8, ///< This control permits direct changes to the operating frequency. ZES_OVERCLOCK_CONTROL_VOLT_LIMIT = 16, ///< This control prevents frequencies that would push the voltage above ///< this value, typically used by V-F scanners. ZES_OVERCLOCK_CONTROL_POWER_SUSTAINED_LIMIT = 32, ///< This control changes the sustained power limit (PL1). ZES_OVERCLOCK_CONTROL_POWER_BURST_LIMIT = 64, ///< This control changes the burst power limit (PL2). ZES_OVERCLOCK_CONTROL_POWER_PEAK_LIMIT = 128, ///< his control changes the peak power limit (PL4). ZES_OVERCLOCK_CONTROL_ICCMAX_LIMIT = 256, ///< This control changes the value of IccMax.. ZES_OVERCLOCK_CONTROL_TEMP_LIMIT = 512, ///< This control changes the value of TjMax. ZES_OVERCLOCK_CONTROL_ITD_DISABLE = 1024, ///< This control permits disabling the adaptive voltage feature ITD ZES_OVERCLOCK_CONTROL_ACM_DISABLE = 2048, ///< This control permits disabling the adaptive voltage feature ACM. ZES_OVERCLOCK_CONTROL_FORCE_UINT32 = 0x7fffffff } zes_overclock_control_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Overclock modes. typedef enum _zes_overclock_mode_t { ZES_OVERCLOCK_MODE_MODE_OFF = 0, ///< Overclock mode is off ZES_OVERCLOCK_MODE_MODE_STOCK = 2, ///< Stock (manufacturing settings) are being used. ZES_OVERCLOCK_MODE_MODE_ON = 3, ///< Overclock mode is on. ZES_OVERCLOCK_MODE_MODE_UNAVAILABLE = 4, ///< Overclocking is unavailable at this time since the system is running ///< on battery. ZES_OVERCLOCK_MODE_MODE_DISABLED = 5, ///< Overclock mode is disabled. ZES_OVERCLOCK_MODE_FORCE_UINT32 = 0x7fffffff } zes_overclock_mode_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Overclock control states. typedef enum _zes_control_state_t { ZES_CONTROL_STATE_STATE_UNSET = 0, ///< No overclock control has not been changed by the driver since the last ///< boot/reset. ZES_CONTROL_STATE_STATE_ACTIVE = 2, ///< The overclock control has been set and it is active. ZES_CONTROL_STATE_STATE_DISABLED = 3, ///< The overclock control value has been disabled due to the current power ///< configuration (typically when running on DC). ZES_CONTROL_STATE_FORCE_UINT32 = 0x7fffffff } zes_control_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Overclock pending actions. typedef enum _zes_pending_action_t { ZES_PENDING_ACTION_PENDING_NONE = 0, ///< There no pending actions. . ZES_PENDING_ACTION_PENDING_IMMINENT = 1, ///< The requested change is in progress and should complete soon. ZES_PENDING_ACTION_PENDING_COLD_RESET = 2, ///< The requested change requires a device cold reset (hotplug, system ///< boot). ZES_PENDING_ACTION_PENDING_WARM_RESET = 3, ///< The requested change requires a device warm reset (PCIe FLR). ZES_PENDING_ACTION_FORCE_UINT32 = 0x7fffffff } zes_pending_action_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Overclock V-F curve programing. typedef enum _zes_vf_program_type_t { ZES_VF_PROGRAM_TYPE_VF_ARBITRARY = 0, ///< Can program an arbitrary number of V-F points up to the maximum number ///< and each point can have arbitrary voltage and frequency values within ///< the min/max/step limits ZES_VF_PROGRAM_TYPE_VF_FREQ_FIXED = 1, ///< Can only program the voltage for the V-F points that it reads back - ///< the frequency of those points cannot be changed ZES_VF_PROGRAM_TYPE_VF_VOLT_FIXED = 2, ///< Can only program the frequency for the V-F points that is reads back - ///< the voltage of each point cannot be changed. ZES_VF_PROGRAM_TYPE_FORCE_UINT32 = 0x7fffffff } zes_vf_program_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief VF type typedef enum _zes_vf_type_t { ZES_VF_TYPE_VOLT = 0, ///< VF Voltage point ZES_VF_TYPE_FREQ = 1, ///< VF Frequency point ZES_VF_TYPE_FORCE_UINT32 = 0x7fffffff } zes_vf_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief VF type typedef enum _zes_vf_array_type_t { ZES_VF_ARRAY_TYPE_USER_VF_ARRAY = 0, ///< User V-F array ZES_VF_ARRAY_TYPE_DEFAULT_VF_ARRAY = 1, ///< Default V-F array ZES_VF_ARRAY_TYPE_LIVE_VF_ARRAY = 2, ///< Live V-F array ZES_VF_ARRAY_TYPE_FORCE_UINT32 = 0x7fffffff } zes_vf_array_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Overclock properties /// /// @details /// - Information on the overclock domain type and all the contols that are /// part of the domain. typedef struct _zes_overclock_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_overclock_domain_t domainType; ///< [out] The hardware block that this overclock domain controls (GPU, ///< VRAM, ...) uint32_t AvailableControls; ///< [out] Returns the overclock controls that are supported (a bit for ///< each of enum ::zes_overclock_control_t). If no bits are set, the ///< domain doesn't support overclocking. zes_vf_program_type_t VFProgramType; ///< [out] Type of V-F curve programming that is permitted:. uint32_t NumberOfVFPoints; ///< [out] Number of VF points that can be programmed - max_num_points } zes_overclock_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Overclock Control properties /// /// @details /// - Provides all the control capabilities supported by the device for the /// overclock domain. typedef struct _zes_control_property_t { double MinValue; ///< [out] This provides information about the limits of the control value ///< so that the driver can calculate the set of valid values. double MaxValue; ///< [out] This provides information about the limits of the control value ///< so that the driver can calculate the set of valid values. double StepValue; ///< [out] This provides information about the limits of the control value ///< so that the driver can calculate the set of valid values. double RefValue; ///< [out] The reference value provides the anchor point, UIs can combine ///< this with the user offset request to show the anticipated improvement. double DefaultValue; ///< [out] The shipped out-of-box position of this control. Driver can ///< request this value at any time to return to the out-of-box behavior. } zes_control_property_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Overclock VF properties /// /// @details /// - Provides all the VF capabilities supported by the device for the /// overclock domain. typedef struct _zes_vf_property_t { double MinFreq; ///< [out] Read the minimum frequency that can be be programmed in the ///< custom V-F point.. double MaxFreq; ///< [out] Read the maximum frequency that can be be programmed in the ///< custom V-F point.. double StepFreq; ///< [out] Read the frequency step that can be be programmed in the custom ///< V-F point.. double MinVolt; ///< [out] Read the minimum voltage that can be be programmed in the custom ///< V-F point.. double MaxVolt; ///< [out] Read the maximum voltage that can be be programmed in the custom ///< V-F point.. double StepVolt; ///< [out] Read the voltage step that can be be programmed in the custom ///< V-F point. } zes_vf_property_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Set the overclock waiver.The overclock waiver setting is persistent /// until the next pcode boot /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This product does not support overclocking ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceSetOverclockWaiver( zes_device_handle_t hDevice ///< [in] Sysman handle of the device. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the list of supported overclock domains for this device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOverclockDomains` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceGetOverclockDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pOverclockDomains ///< [in,out] Returns the overclock domains that are supported (a bit for ///< each of enum ::zes_overclock_domain_t). If no bits are set, the device ///< doesn't support overclocking. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the list of supported overclock controls available for one of the /// supported overclock domains on the device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OVERCLOCK_DOMAIN_ADM < domainType` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pAvailableControls` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceGetOverclockControls( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_domain_t domainType, ///< [in] Domain type. uint32_t* pAvailableControls ///< [in,out] Returns the overclock controls that are supported for the ///< specified overclock domain (a bit for each of enum ///< ::zes_overclock_control_t). ); /////////////////////////////////////////////////////////////////////////////// /// @brief Reset all overclock settings to default values (shipped = 1 or /// manufacturing =0) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceResetOverclockSettings( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. ze_bool_t onShippedState ///< [in] True will reset to shipped state; false will reset to ///< manufacturing state ); /////////////////////////////////////////////////////////////////////////////// /// @brief Determine the state of overclocking /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOverclockMode` /// + `nullptr == pWaiverSetting` /// + `nullptr == pOverclockState` /// + `nullptr == pPendingAction` /// + `nullptr == pPendingReset` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceReadOverclockState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_mode_t* pOverclockMode, ///< [out] One of overclock mode. ze_bool_t* pWaiverSetting, ///< [out] Waiver setting: 0 = Waiver not set, 1 = waiver has been set. ze_bool_t* pOverclockState, ///< [out] Current settings 0 =manufacturing state, 1= shipped state).. zes_pending_action_t* pPendingAction, ///< [out] This enum is returned when the driver attempts to set an ///< overclock control or reset overclock settings. ze_bool_t* pPendingReset ///< [out] Pending reset 0 =manufacturing state, 1= shipped state).. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of overclock domains /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumOverclockDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_overclock_handle_t* phDomainHandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get overclock domain control properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pDomainProperties` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetDomainProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_properties_t* pDomainProperties ///< [in,out] The overclock properties for the specified domain. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Read overclock VF min,max and step values /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pVFProperties` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetDomainVFProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_property_t* pVFProperties ///< [in,out] The VF min,max,step for a specified domain. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Read overclock control values - min/max/step/default/ref /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pControlProperties` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetDomainControlProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Handle for the component. zes_control_property_t* pControlProperties ///< [in,out] overclock control values. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Read the current value for a given overclock control /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pValue` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetControlCurrentValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [in,out] Getting overclock control value for the specified control. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Read the the reset pending value for a given overclock control /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pValue` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetControlPendingValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [out] Returns the pending value for a given control. The units and ///< format of the value depend on the control type. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set the value for a given overclock control /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pPendingAction` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockSetControlUserValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. double pValue, ///< [in] The new value of the control. The units and format of the value ///< depend on the control type. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Determine the state of an overclock control /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pControlState` /// + `nullptr == pPendingAction` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetControlState( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. zes_control_state_t* pControlState, ///< [out] Current overclock control state. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Read the frequency or voltage of a V-F point from the default or /// custom V-F curve. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_VF_TYPE_FREQ < VFType` /// + `::ZES_VF_ARRAY_TYPE_LIVE_VF_ARRAY < VFArrayType` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == PointValue` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockGetVFPointValues( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. zes_vf_array_type_t VFArrayType, ///< [in] User,Default or Live VF array to read from uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t* PointValue ///< [out] Returns the frequency in 1kHz units or voltage in millivolt ///< units from the custom V-F curve at the specified zero-based index ); /////////////////////////////////////////////////////////////////////////////// /// @brief Write the frequency or voltage of a V-F point to custom V-F curve. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_VF_TYPE_FREQ < VFType` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ZE_APIEXPORT ze_result_t ZE_APICALL zesOverclockSetVFPointValues( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t PointValue ///< [in] Writes frequency in 1kHz units or voltage in millivolt units to ///< custom V-F curve at the specified zero-based index ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management #if !defined(__GNUC__) #pragma region diagnostics #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Diagnostic results typedef enum _zes_diag_result_t { ZES_DIAG_RESULT_NO_ERRORS = 0, ///< Diagnostic completed without finding errors to repair ZES_DIAG_RESULT_ABORT = 1, ///< Diagnostic had problems running tests ZES_DIAG_RESULT_FAIL_CANT_REPAIR = 2, ///< Diagnostic had problems setting up repairs ZES_DIAG_RESULT_REBOOT_FOR_REPAIR = 3, ///< Diagnostics found errors, setup for repair and reboot is required to ///< complete the process ZES_DIAG_RESULT_FORCE_UINT32 = 0x7fffffff } zes_diag_result_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_DIAG_FIRST_TEST_INDEX /// @brief Diagnostic test index to use for the very first test. #define ZES_DIAG_FIRST_TEST_INDEX 0x0 #endif // ZES_DIAG_FIRST_TEST_INDEX /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_DIAG_LAST_TEST_INDEX /// @brief Diagnostic test index to use for the very last test. #define ZES_DIAG_LAST_TEST_INDEX 0xFFFFFFFF #endif // ZES_DIAG_LAST_TEST_INDEX /////////////////////////////////////////////////////////////////////////////// /// @brief Diagnostic test typedef struct _zes_diag_test_t { uint32_t index; ///< [out] Index of the test char name[ZES_STRING_PROPERTY_SIZE]; ///< [out] Name of the test } zes_diag_test_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Diagnostics test suite properties typedef struct _zes_diag_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device char name[ZES_STRING_PROPERTY_SIZE]; ///< [out] Name of the diagnostics test suite ze_bool_t haveTests; ///< [out] Indicates if this test suite has individual tests which can be ///< run separately (use the function ::zesDiagnosticsGetTests() to get the ///< list of these tests) } zes_diag_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of diagnostics test suites /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumDiagnosticTestSuites( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_diag_handle_t* phDiagnostics ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get properties of a diagnostics test suite /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDiagnostics` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesDiagnosticsGetProperties( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. zes_diag_properties_t* pProperties ///< [in,out] Structure describing the properties of a diagnostics test ///< suite ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get individual tests that can be run separately. Not all test suites /// permit running individual tests, check the `haveTests` member of /// ::zes_diag_properties_t. /// /// @details /// - The list of available tests is returned in order of increasing test /// index (see the `index` member of ::zes_diag_test_t). /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDiagnostics` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDiagnosticsGetTests( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of tests. ///< if count is zero, then the driver shall update the value with the ///< total number of tests that are available. ///< if count is greater than the number of tests that are available, then ///< the driver shall update the value with the correct number of tests. zes_diag_test_t* pTests ///< [in,out][optional][range(0, *pCount)] array of information about ///< individual tests sorted by increasing value of the `index` member of ::zes_diag_test_t. ///< if count is less than the number of tests that are available, then the ///< driver shall only retrieve that number of tests. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Run a diagnostics test suite, either all tests or a subset of tests. /// /// @details /// - WARNING: Running diagnostics may destroy current device state /// information. Gracefully close any running workloads before initiating. /// - To run all tests in a test suite, set start = /// ::ZES_DIAG_FIRST_TEST_INDEX and end = ::ZES_DIAG_LAST_TEST_INDEX. /// - If the test suite permits running individual tests, the `haveTests` /// member of ::zes_diag_properties_t will be true. In this case, the /// function ::zesDiagnosticsGetTests() can be called to get the list of /// tests and corresponding indices that can be supplied to the arguments /// start and end in this function. /// - This function will block until the diagnostics have completed and /// force reset based on result /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDiagnostics` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pResult` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to perform diagnostics. ZE_APIEXPORT ze_result_t ZE_APICALL zesDiagnosticsRunTests( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t startIndex, ///< [in] The index of the first test to run. Set to ///< ::ZES_DIAG_FIRST_TEST_INDEX to start from the beginning. uint32_t endIndex, ///< [in] The index of the last test to run. Set to ///< ::ZES_DIAG_LAST_TEST_INDEX to complete all tests after the start test. zes_diag_result_t* pResult ///< [in,out] The result of the diagnostics ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - ECC management #if !defined(__GNUC__) #pragma region ecc #endif /////////////////////////////////////////////////////////////////////////////// /// @brief ECC State typedef enum _zes_device_ecc_state_t { ZES_DEVICE_ECC_STATE_UNAVAILABLE = 0, ///< None ZES_DEVICE_ECC_STATE_ENABLED = 1, ///< ECC enabled. ZES_DEVICE_ECC_STATE_DISABLED = 2, ///< ECC disabled. ZES_DEVICE_ECC_STATE_FORCE_UINT32 = 0x7fffffff } zes_device_ecc_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief State Change Requirements typedef enum _zes_device_action_t { ZES_DEVICE_ACTION_NONE = 0, ///< No action. ZES_DEVICE_ACTION_WARM_CARD_RESET = 1, ///< Warm reset of the card. ZES_DEVICE_ACTION_COLD_CARD_RESET = 2, ///< Cold reset of the card. ZES_DEVICE_ACTION_COLD_SYSTEM_REBOOT = 3, ///< Cold reboot of the system. ZES_DEVICE_ACTION_FORCE_UINT32 = 0x7fffffff } zes_device_action_t; /////////////////////////////////////////////////////////////////////////////// /// @brief ECC State Descriptor typedef struct _zes_device_ecc_desc_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_device_ecc_state_t state; ///< [out] ECC state } zes_device_ecc_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief ECC State typedef struct _zes_device_ecc_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_device_ecc_state_t currentState; ///< [out] Current ECC state zes_device_ecc_state_t pendingState; ///< [out] Pending ECC state zes_device_action_t pendingAction; ///< [out] Pending action } zes_device_ecc_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Is ECC functionality available - true or false? /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pAvailable` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEccAvailable( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pAvailable ///< [out] ECC functionality is available (true)/unavailable (false). ); /////////////////////////////////////////////////////////////////////////////// /// @brief Is ECC support configurable - true or false? /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfigurable` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEccConfigurable( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pConfigurable ///< [out] ECC can be enabled/disabled (true)/enabled/disabled (false). ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get current ECC state, pending state, and pending action /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceGetEccState( zes_device_handle_t hDevice, ///< [in] Handle for the component. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set new ECC state /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - ::zesDeviceGetState should be called to determine pending action /// required to implement state change. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == newState` /// + `nullptr == pState` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_DEVICE_ECC_STATE_DISABLED < newState->state` /// - ::ZE_RESULT_WARNING_ACTION_REQUIRED /// + User must look at the pendingAction attribute of pState & perform the action required to complete the ECC state change. ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceSetEccState( zes_device_handle_t hDevice, ///< [in] Handle for the component. const zes_device_ecc_desc_t* newState, ///< [in] Pointer to desired ECC state. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Engine groups #if !defined(__GNUC__) #pragma region engine #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Accelerator engine groups typedef enum _zes_engine_group_t { ZES_ENGINE_GROUP_ALL = 0, ///< Access information about all engines combined. ZES_ENGINE_GROUP_COMPUTE_ALL = 1, ///< Access information about all compute engines combined. Compute engines ///< can only process compute kernels (no 3D content). ZES_ENGINE_GROUP_MEDIA_ALL = 2, ///< Access information about all media engines combined. ZES_ENGINE_GROUP_COPY_ALL = 3, ///< Access information about all copy (blitter) engines combined. ZES_ENGINE_GROUP_COMPUTE_SINGLE = 4, ///< Access information about a single compute engine - this is an engine ///< that can process compute kernels. Note that single engines may share ///< the same underlying accelerator resources as other engines so activity ///< of such an engine may not be indicative of the underlying resource ///< utilization - use ::ZES_ENGINE_GROUP_3D_RENDER_COMPUTE_ALL for that. ZES_ENGINE_GROUP_RENDER_SINGLE = 5, ///< Access information about a single render engine - this is an engine ///< that can process both 3D content and compute kernels. Note that single ///< engines may share the same underlying accelerator resources as other ///< engines so activity of such an engine may not be indicative of the ///< underlying resource utilization - use ///< ::ZES_ENGINE_GROUP_3D_RENDER_COMPUTE_ALL for that. ZES_ENGINE_GROUP_MEDIA_DECODE_SINGLE = 6, ///< [DEPRECATED] No longer supported. ZES_ENGINE_GROUP_MEDIA_ENCODE_SINGLE = 7, ///< [DEPRECATED] No longer supported. ZES_ENGINE_GROUP_COPY_SINGLE = 8, ///< Access information about a single media encode engine. Note that ///< single engines may share the same underlying accelerator resources as ///< other engines so activity of such an engine may not be indicative of ///< the underlying resource utilization - use ::ZES_ENGINE_GROUP_COPY_ALL ///< for that. ZES_ENGINE_GROUP_MEDIA_ENHANCEMENT_SINGLE = 9, ///< Access information about a single media enhancement engine. Note that ///< single engines may share the same underlying accelerator resources as ///< other engines so activity of such an engine may not be indicative of ///< the underlying resource utilization - use ::ZES_ENGINE_GROUP_MEDIA_ALL ///< for that. ZES_ENGINE_GROUP_3D_SINGLE = 10, ///< [DEPRECATED] No longer supported. ZES_ENGINE_GROUP_3D_RENDER_COMPUTE_ALL = 11, ///< [DEPRECATED] No longer supported. ZES_ENGINE_GROUP_RENDER_ALL = 12, ///< Access information about all render engines combined. Render engines ///< are those than process both 3D content and compute kernels. ZES_ENGINE_GROUP_3D_ALL = 13, ///< [DEPRECATED] No longer supported. ZES_ENGINE_GROUP_MEDIA_CODEC_SINGLE = 14, ///< Access information about a single media engine. Note that single ///< engines may share the same underlying accelerator resources as other ///< engines so activity of such an engine may not be indicative of the ///< underlying resource utilization - use ::ZES_ENGINE_GROUP_MEDIA_ALL for ///< that. ZES_ENGINE_GROUP_FORCE_UINT32 = 0x7fffffff } zes_engine_group_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Engine group properties typedef struct _zes_engine_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_engine_group_t type; ///< [out] The engine group ze_bool_t onSubdevice; ///< [out] True if this resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device } zes_engine_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Engine activity counters /// /// @details /// - Percent utilization is calculated by taking two snapshots (s1, s2) and /// using the equation: %util = (s2.activeTime - s1.activeTime) / /// (s2.timestamp - s1.timestamp) /// - The `activeTime` time units are implementation-specific since the /// value is only intended to be used for calculating utilization /// percentage. /// - The `timestamp` should only be used to calculate delta between /// snapshots of this structure. /// - The application should never take the delta of `timestamp` with the /// timestamp from a different structure since they are not guaranteed to /// have the same base. /// - When taking the delta, the difference between `timestamp` samples /// could be `0`, if the frequency of sampling the snapshots is higher /// than the frequency of the timestamp update. /// - The absolute value of `timestamp` is only valid during within the /// application and may be different on the next execution. typedef struct _zes_engine_stats_t { uint64_t activeTime; ///< [out] Monotonic counter where the resource is actively running ///< workloads. uint64_t timestamp; ///< [out] Monotonic counter when activeTime counter was sampled. } zes_engine_stats_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of engine groups /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumEngineGroups( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_engine_handle_t* phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get engine group properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEngine` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesEngineGetProperties( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_properties_t* pProperties ///< [in,out] The properties for the specified engine group. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the activity stats for an engine group. /// /// @details /// - This function also returns the engine activity inside a Virtual /// Machine (VM), in the presence of hardware virtualization (SRIOV) /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEngine` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pStats` ZE_APIEXPORT ze_result_t ZE_APICALL zesEngineGetActivity( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_stats_t* pStats ///< [in,out] Will contain a snapshot of the engine group activity ///< counters. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Event management #if !defined(__GNUC__) #pragma region events #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Event types typedef uint32_t zes_event_type_flags_t; typedef enum _zes_event_type_flag_t { ZES_EVENT_TYPE_FLAG_DEVICE_DETACH = ZE_BIT(0), ///< Event is triggered when the device is no longer available (due to a ///< reset or being disabled). ZES_EVENT_TYPE_FLAG_DEVICE_ATTACH = ZE_BIT(1), ///< Event is triggered after the device is available again. ZES_EVENT_TYPE_FLAG_DEVICE_SLEEP_STATE_ENTER = ZE_BIT(2), ///< Event is triggered when the driver is about to put the device into a ///< deep sleep state ZES_EVENT_TYPE_FLAG_DEVICE_SLEEP_STATE_EXIT = ZE_BIT(3), ///< Event is triggered when the driver is waking the device up from a deep ///< sleep state ZES_EVENT_TYPE_FLAG_FREQ_THROTTLED = ZE_BIT(4), ///< Event is triggered when the frequency starts being throttled ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED = ZE_BIT(5), ///< Event is triggered when the energy consumption threshold is reached ///< (use ::zesPowerSetEnergyThreshold() to configure). ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL = ZE_BIT(6), ///< Event is triggered when the critical temperature is reached (use ///< ::zesTemperatureSetConfig() to configure - disabled by default). ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 = ZE_BIT(7), ///< Event is triggered when the temperature crosses threshold 1 (use ///< ::zesTemperatureSetConfig() to configure - disabled by default). ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 = ZE_BIT(8), ///< Event is triggered when the temperature crosses threshold 2 (use ///< ::zesTemperatureSetConfig() to configure - disabled by default). ZES_EVENT_TYPE_FLAG_MEM_HEALTH = ZE_BIT(9), ///< Event is triggered when the health of device memory changes. ZES_EVENT_TYPE_FLAG_FABRIC_PORT_HEALTH = ZE_BIT(10), ///< Event is triggered when the health of fabric ports change. ZES_EVENT_TYPE_FLAG_PCI_LINK_HEALTH = ZE_BIT(11), ///< Event is triggered when the health of the PCI link changes. ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS = ZE_BIT(12), ///< Event is triggered when accelerator RAS correctable errors cross ///< thresholds (use ::zesRasSetConfig() to configure - disabled by ///< default). ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS = ZE_BIT(13), ///< Event is triggered when accelerator RAS uncorrectable errors cross ///< thresholds (use ::zesRasSetConfig() to configure - disabled by ///< default). ZES_EVENT_TYPE_FLAG_DEVICE_RESET_REQUIRED = ZE_BIT(14), ///< Event is triggered when the device needs to be reset (use ///< ::zesDeviceGetState() to determine the reasons for the reset). ZES_EVENT_TYPE_FLAG_SURVIVABILITY_MODE_DETECTED = ZE_BIT(15), ///< Event is triggered when graphics driver encounter an error condition. ZES_EVENT_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff } zes_event_type_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Specify the list of events to listen to for a given device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xffff < events` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEventRegister( zes_device_handle_t hDevice, ///< [in] The device handle. zes_event_type_flags_t events ///< [in] List of events to listen to. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Wait for events to be received from a one or more devices. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phDevices` /// + `nullptr == pNumDeviceEvents` /// + `nullptr == pEvents` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to listen to events. /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + One or more of the supplied device handles belongs to a different driver. ZE_APIEXPORT ze_result_t ZE_APICALL zesDriverEventListen( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT32_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Wait for events to be received from a one or more devices. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phDevices` /// + `nullptr == pNumDeviceEvents` /// + `nullptr == pEvents` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to listen to events. /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + One or more of the supplied device handles belongs to a different driver. ZE_APIEXPORT ze_result_t ZE_APICALL zesDriverEventListenEx( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT64_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management #if !defined(__GNUC__) #pragma region fabric #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_MAX_FABRIC_PORT_MODEL_SIZE /// @brief Maximum Fabric port model string size #define ZES_MAX_FABRIC_PORT_MODEL_SIZE 256 #endif // ZES_MAX_FABRIC_PORT_MODEL_SIZE /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_MAX_FABRIC_LINK_TYPE_SIZE /// @brief Maximum size of the buffer that will return information about link /// types #define ZES_MAX_FABRIC_LINK_TYPE_SIZE 256 #endif // ZES_MAX_FABRIC_LINK_TYPE_SIZE /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric port status typedef enum _zes_fabric_port_status_t { ZES_FABRIC_PORT_STATUS_UNKNOWN = 0, ///< The port status cannot be determined ZES_FABRIC_PORT_STATUS_HEALTHY = 1, ///< The port is up and operating as expected ZES_FABRIC_PORT_STATUS_DEGRADED = 2, ///< The port is up but has quality and/or speed degradation ZES_FABRIC_PORT_STATUS_FAILED = 3, ///< Port connection instabilities are preventing workloads making forward ///< progress ZES_FABRIC_PORT_STATUS_DISABLED = 4, ///< The port is configured down ZES_FABRIC_PORT_STATUS_FORCE_UINT32 = 0x7fffffff } zes_fabric_port_status_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric port quality degradation reasons typedef uint32_t zes_fabric_port_qual_issue_flags_t; typedef enum _zes_fabric_port_qual_issue_flag_t { ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS = ZE_BIT(0), ///< Excessive link errors are occurring ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_SPEED = ZE_BIT(1), ///< There is a degradation in the bitrate and/or width of the link ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_FORCE_UINT32 = 0x7fffffff } zes_fabric_port_qual_issue_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric port failure reasons typedef uint32_t zes_fabric_port_failure_flags_t; typedef enum _zes_fabric_port_failure_flag_t { ZES_FABRIC_PORT_FAILURE_FLAG_FAILED = ZE_BIT(0), ///< A previously operating link has failed. Hardware will automatically ///< retrain this port. This state will persist until either the physical ///< connection is removed or the link trains successfully. ZES_FABRIC_PORT_FAILURE_FLAG_TRAINING_TIMEOUT = ZE_BIT(1), ///< A connection has not been established within an expected time. ///< Hardware will continue to attempt port training. This status will ///< persist until either the physical connection is removed or the link ///< successfully trains. ZES_FABRIC_PORT_FAILURE_FLAG_FLAPPING = ZE_BIT(2), ///< Port has excessively trained and then transitioned down for some ///< period of time. Driver will allow port to continue to train, but will ///< not enable the port for use until the port has been disabled and ///< subsequently re-enabled using ::zesFabricPortSetConfig(). ZES_FABRIC_PORT_FAILURE_FLAG_FORCE_UINT32 = 0x7fffffff } zes_fabric_port_failure_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Unique identifier for a fabric port /// /// @details /// - This not a universal identifier. The identified is garanteed to be /// unique for the current hardware configuration of the system. Changes /// in the hardware may result in a different identifier for a given port. /// - The main purpose of this identifier to build up an instantaneous /// topology map of system connectivity. An application should enumerate /// all fabric ports and match the `remotePortId` member of /// ::zes_fabric_port_state_t to the `portId` member of /// ::zes_fabric_port_properties_t. typedef struct _zes_fabric_port_id_t { uint32_t fabricId; ///< [out] Unique identifier for the fabric end-point uint32_t attachId; ///< [out] Unique identifier for the device attachment point uint8_t portNumber; ///< [out] The logical port number (this is typically marked somewhere on ///< the physical device) } zes_fabric_port_id_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric port speed in one direction typedef struct _zes_fabric_port_speed_t { int64_t bitRate; ///< [out] Bits/sec that the link is operating at. A value of -1 means that ///< this property is unknown. int32_t width; ///< [out] The number of lanes. A value of -1 means that this property is ///< unknown. } zes_fabric_port_speed_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric port properties typedef struct _zes_fabric_port_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). char model[ZES_MAX_FABRIC_PORT_MODEL_SIZE]; ///< [out] Description of port technology. Will be set to the string ///< "unkown" if this cannot be determined for this port. ze_bool_t onSubdevice; ///< [out] True if the port is located on a sub-device; false means that ///< the port is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device zes_fabric_port_id_t portId; ///< [out] The unique port identifier zes_fabric_port_speed_t maxRxSpeed; ///< [out] Maximum speed supported by the receive side of the port (sum of ///< all lanes) zes_fabric_port_speed_t maxTxSpeed; ///< [out] Maximum speed supported by the transmit side of the port (sum of ///< all lanes) } zes_fabric_port_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Provides information about the fabric link attached to a port typedef struct _zes_fabric_link_type_t { char desc[ZES_MAX_FABRIC_LINK_TYPE_SIZE]; ///< [out] Description of link technology. Will be set to the string ///< "unkown" if this cannot be determined for this link. } zes_fabric_link_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric port configuration typedef struct _zes_fabric_port_config_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t enabled; ///< [in,out] Port is configured up/down ze_bool_t beaconing; ///< [in,out] Beaconing is configured on/off } zes_fabric_port_config_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric port state typedef struct _zes_fabric_port_state_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_fabric_port_status_t status; ///< [out] The current status of the port zes_fabric_port_qual_issue_flags_t qualityIssues; ///< [out] If status is ::ZES_FABRIC_PORT_STATUS_DEGRADED, ///< then this gives a combination of ::zes_fabric_port_qual_issue_flag_t ///< for quality issues that have been detected; ///< otherwise, 0 indicates there are no quality issues with the link at ///< this time. zes_fabric_port_failure_flags_t failureReasons; ///< [out] If status is ::ZES_FABRIC_PORT_STATUS_FAILED, ///< then this gives a combination of ::zes_fabric_port_failure_flag_t for ///< reasons for the connection instability; ///< otherwise, 0 indicates there are no connection stability issues at ///< this time. zes_fabric_port_id_t remotePortId; ///< [out] The unique port identifier for the remote connection point if ///< status is ::ZES_FABRIC_PORT_STATUS_HEALTHY, ///< ::ZES_FABRIC_PORT_STATUS_DEGRADED or ::ZES_FABRIC_PORT_STATUS_FAILED zes_fabric_port_speed_t rxSpeed; ///< [out] Current maximum receive speed (sum of all lanes) zes_fabric_port_speed_t txSpeed; ///< [out] Current maximum transmit speed (sum of all lanes) } zes_fabric_port_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric port throughput. typedef struct _zes_fabric_port_throughput_t { uint64_t timestamp; ///< [out] Monotonic timestamp counter in microseconds when the measurement ///< was made. ///< This timestamp should only be used to calculate delta time between ///< snapshots of this structure. ///< Never take the delta of this timestamp with the timestamp from a ///< different structure since they are not guaranteed to have the same base. ///< The absolute value of the timestamp is only valid during within the ///< application and may be different on the next execution. uint64_t rxCounter; ///< [out] Monotonic counter for the number of bytes received (sum of all ///< lanes). This includes all protocol overhead, not only the GPU traffic. uint64_t txCounter; ///< [out] Monotonic counter for the number of bytes transmitted (sum of ///< all lanes). This includes all protocol overhead, not only the GPU ///< traffic. } zes_fabric_port_throughput_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fabric Port Error Counters typedef struct _zes_fabric_port_error_counters_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t linkFailureCount; ///< [out] Link Failure Error Count reported per port uint64_t fwCommErrorCount; ///< [out] Firmware Communication Error Count reported per device uint64_t fwErrorCount; ///< [out] Firmware reported Error Count reported per device uint64_t linkDegradeCount; ///< [out] Link Degrade Error Count reported per port } zes_fabric_port_error_counters_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of Fabric ports in a device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumFabricPorts( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fabric_port_handle_t* phPort ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric port properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesFabricPortGetProperties( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_properties_t* pProperties ///< [in,out] Will contain properties of the Fabric Port. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric port link type /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pLinkType` ZE_APIEXPORT ze_result_t ZE_APICALL zesFabricPortGetLinkType( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_link_type_t* pLinkType ///< [in,out] Will contain details about the link attached to the Fabric ///< port. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric port configuration /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` ZE_APIEXPORT ze_result_t ZE_APICALL zesFabricPortGetConfig( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_config_t* pConfig ///< [in,out] Will contain configuration of the Fabric Port. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set Fabric port configuration /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesFabricPortSetConfig( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. const zes_fabric_port_config_t* pConfig ///< [in] Contains new configuration of the Fabric Port. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric port state - status (health/degraded/failed/disabled), /// reasons for link degradation or instability, current rx/tx speed /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ZE_APIEXPORT ze_result_t ZE_APICALL zesFabricPortGetState( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_state_t* pState ///< [in,out] Will contain the current state of the Fabric Port ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric port throughput /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pThroughput` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to query this telemetry. ZE_APIEXPORT ze_result_t ZE_APICALL zesFabricPortGetThroughput( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_throughput_t* pThroughput ///< [in,out] Will contain the Fabric port throughput counters. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric Port Error Counters /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - The memory backing the arrays for phPorts and ppThroughputs must be /// allocated in system memory by the user who is also responsible for /// releasing them when they are no longer needed. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pErrors` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to query this telemetry. ZE_APIEXPORT ze_result_t ZE_APICALL zesFabricPortGetFabricErrorCounters( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_error_counters_t* pErrors ///< [in,out] Will contain the Fabric port Error counters. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric port throughput from multiple ports in a single call /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phPort` /// + `nullptr == pThroughput` ZE_APIEXPORT ze_result_t ZE_APICALL zesFabricPortGetMultiPortThroughput( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t numPorts, ///< [in] Number of ports enumerated in function ::zesDeviceEnumFabricPorts zes_fabric_port_handle_t* phPort, ///< [in][range(0, numPorts)] array of fabric port handles provided by user ///< to gather throughput values. zes_fabric_port_throughput_t** pThroughput ///< [out][range(0, numPorts)] array of fabric port throughput counters ///< from multiple ports of type ::zes_fabric_port_throughput_t. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management #if !defined(__GNUC__) #pragma region fan #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Fan resource speed mode typedef enum _zes_fan_speed_mode_t { ZES_FAN_SPEED_MODE_DEFAULT = 0, ///< The fan speed is operating using the hardware default settings ZES_FAN_SPEED_MODE_FIXED = 1, ///< The fan speed is currently set to a fixed value ZES_FAN_SPEED_MODE_TABLE = 2, ///< The fan speed is currently controlled dynamically by hardware based on ///< a temp/speed table ZES_FAN_SPEED_MODE_FORCE_UINT32 = 0x7fffffff } zes_fan_speed_mode_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fan speed units typedef enum _zes_fan_speed_units_t { ZES_FAN_SPEED_UNITS_RPM = 0, ///< The fan speed is in units of revolutions per minute (rpm) ZES_FAN_SPEED_UNITS_PERCENT = 1, ///< The fan speed is a percentage of the maximum speed of the fan ZES_FAN_SPEED_UNITS_FORCE_UINT32 = 0x7fffffff } zes_fan_speed_units_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fan speed typedef struct _zes_fan_speed_t { int32_t speed; ///< [in,out] The speed of the fan. On output, a value of -1 indicates that ///< there is no fixed fan speed setting. zes_fan_speed_units_t units; ///< [in,out] The units that the fan speed is expressed in. On output, if ///< fan speed is -1 then units should be ignored. } zes_fan_speed_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fan temperature/speed pair typedef struct _zes_fan_temp_speed_t { uint32_t temperature; ///< [in,out] Temperature in degrees Celsius. zes_fan_speed_t speed; ///< [in,out] The speed of the fan } zes_fan_temp_speed_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_FAN_TEMP_SPEED_PAIR_COUNT /// @brief Maximum number of fan temperature/speed pairs in the fan speed table. #define ZES_FAN_TEMP_SPEED_PAIR_COUNT 32 #endif // ZES_FAN_TEMP_SPEED_PAIR_COUNT /////////////////////////////////////////////////////////////////////////////// /// @brief Fan speed table typedef struct _zes_fan_speed_table_t { int32_t numPoints; ///< [in,out] The number of valid points in the fan speed table. 0 means ///< that there is no fan speed table configured. -1 means that a fan speed ///< table is not supported by the hardware. zes_fan_temp_speed_t table[ZES_FAN_TEMP_SPEED_PAIR_COUNT]; ///< [in,out] Array of temperature/fan speed pairs. The table is ordered ///< based on temperature from lowest to highest. } zes_fan_speed_table_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fan properties typedef struct _zes_fan_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device ze_bool_t canControl; ///< [out] Indicates if software can control the fan speed assuming the ///< user has permissions uint32_t supportedModes; ///< [out] Bitfield of supported fan configuration modes ///< (1<<::zes_fan_speed_mode_t) uint32_t supportedUnits; ///< [out] Bitfield of supported fan speed units ///< (1<<::zes_fan_speed_units_t) int32_t maxRPM; ///< [out] The maximum RPM of the fan. A value of -1 means that this ///< property is unknown. int32_t maxPoints; ///< [out] The maximum number of points in the fan temp/speed table. A ///< value of -1 means that this fan doesn't support providing a temp/speed ///< table. } zes_fan_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Fan configuration typedef struct _zes_fan_config_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_fan_speed_mode_t mode; ///< [in,out] The fan speed mode (fixed, temp-speed table) zes_fan_speed_t speedFixed; ///< [in,out] The current fixed fan speed setting zes_fan_speed_table_t speedTable; ///< [out] A table containing temperature/speed pairs } zes_fan_config_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of fans /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumFans( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fan_handle_t* phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get fan properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFan` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesFanGetProperties( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_properties_t* pProperties ///< [in,out] Will contain the properties of the fan. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get fan configurations and the current fan speed mode (default, fixed, /// temp-speed table) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFan` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` ZE_APIEXPORT ze_result_t ZE_APICALL zesFanGetConfig( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_config_t* pConfig ///< [in,out] Will contain the current configuration of the fan. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Configure the fan to run with hardware factory settings (set mode to /// ::ZES_FAN_SPEED_MODE_DEFAULT) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFan` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesFanSetDefaultMode( zes_fan_handle_t hFan ///< [in] Handle for the component. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Configure the fan to rotate at a fixed speed (set mode to /// ::ZES_FAN_SPEED_MODE_FIXED) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFan` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == speed` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Fixing the fan speed not supported by the hardware or the fan speed units are not supported. See the `supportedModes` and `supportedUnits` members of ::zes_fan_properties_t. ZE_APIEXPORT ze_result_t ZE_APICALL zesFanSetFixedSpeedMode( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_t* speed ///< [in] The fixed fan speed setting ); /////////////////////////////////////////////////////////////////////////////// /// @brief Configure the fan to adjust speed based on a temperature/speed table /// (set mode to ::ZES_FAN_SPEED_MODE_TABLE) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFan` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == speedTable` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + The temperature/speed pairs in the array are not sorted on temperature from lowest to highest. /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Fan speed table not supported by the hardware or the fan speed units are not supported. See the `supportedModes` and `supportedUnits` members of ::zes_fan_properties_t. ZE_APIEXPORT ze_result_t ZE_APICALL zesFanSetSpeedTableMode( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_table_t* speedTable ///< [in] A table containing temperature/speed pairs. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get current state of a fan - current mode and speed /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFan` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_FAN_SPEED_UNITS_PERCENT < units` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSpeed` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + The requested fan speed units are not supported. See the `supportedUnits` member of ::zes_fan_properties_t. ZE_APIEXPORT ze_result_t ZE_APICALL zesFanGetState( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned. int32_t* pSpeed ///< [in,out] Will contain the current speed of the fan in the units ///< requested. A value of -1 indicates that the fan speed cannot be ///< measured. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management #if !defined(__GNUC__) #pragma region firmware #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Firmware properties typedef struct _zes_firmware_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device ze_bool_t canControl; ///< [out] Indicates if software can flash the firmware assuming the user ///< has permissions char name[ZES_STRING_PROPERTY_SIZE]; ///< [out] NULL terminated string value. The string "unknown" will be ///< returned if this property cannot be determined. char version[ZES_STRING_PROPERTY_SIZE]; ///< [out] NULL terminated string value. The string "unknown" will be ///< returned if this property cannot be determined. } zes_firmware_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of firmwares /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumFirmwares( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_firmware_handle_t* phFirmware ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get firmware properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFirmware` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesFirmwareGetProperties( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. zes_firmware_properties_t* pProperties ///< [in,out] Pointer to an array that will hold the properties of the ///< firmware ); /////////////////////////////////////////////////////////////////////////////// /// @brief Flash a new firmware image /// /// @details /// - Any running workload must be gracefully closed before invoking this /// function. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - This is a non-blocking call. Application may call /// ::zesFirmwareGetFlashProgress to get completion status. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFirmware` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pImage` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to perform this operation. ZE_APIEXPORT ze_result_t ZE_APICALL zesFirmwareFlash( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. void* pImage, ///< [in] Image of the new firmware to flash. uint32_t size ///< [in] Size of the flash image. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get Firmware Flash Progress /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFirmware` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCompletionPercent` ZE_APIEXPORT ze_result_t ZE_APICALL zesFirmwareGetFlashProgress( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. uint32_t* pCompletionPercent ///< [in,out] Pointer to the Completion Percentage of Firmware Update ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get Firmware Console Logs /// /// @details /// - The caller may pass nullptr for pFirmwareLog and set pSize to zero /// when querying only for size. /// - The caller must provide memory for Firmware log. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFirmware` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` ZE_APIEXPORT ze_result_t ZE_APICALL zesFirmwareGetConsoleLogs( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. size_t* pSize, ///< [in,out] size of firmware log char* pFirmwareLog ///< [in,out][optional] pointer to null-terminated string of the log. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Frequency domains #if !defined(__GNUC__) #pragma region frequency #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Frequency domains. typedef enum _zes_freq_domain_t { ZES_FREQ_DOMAIN_GPU = 0, ///< GPU Core Domain. ZES_FREQ_DOMAIN_MEMORY = 1, ///< Local Memory Domain. ZES_FREQ_DOMAIN_MEDIA = 2, ///< GPU Media Domain. ZES_FREQ_DOMAIN_FORCE_UINT32 = 0x7fffffff } zes_freq_domain_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Frequency properties /// /// @details /// - Indicates if this frequency domain can be overclocked (if true, /// functions such as ::zesFrequencyOcSetFrequencyTarget() are supported). /// - The min/max hardware frequencies are specified for non-overclock /// configurations. For overclock configurations, use /// ::zesFrequencyOcGetFrequencyTarget() to determine the maximum /// frequency that can be requested. typedef struct _zes_freq_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_freq_domain_t type; ///< [out] The hardware block that this frequency domain controls (GPU, ///< memory, ...) ze_bool_t onSubdevice; ///< [out] True if this resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device ze_bool_t canControl; ///< [out] Indicates if software can control the frequency of this domain ///< assuming the user has permissions ze_bool_t isThrottleEventSupported; ///< [out] Indicates if software can register to receive event ///< ::ZES_EVENT_TYPE_FLAG_FREQ_THROTTLED double min; ///< [out] The minimum hardware clock frequency in units of MHz. double max; ///< [out] The maximum non-overclock hardware clock frequency in units of ///< MHz. } zes_freq_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Frequency range between which the hardware can operate. /// /// @details /// - When setting limits, they will be clamped to the hardware limits. /// - When setting limits, ensure that the max frequency is greater than or /// equal to the min frequency specified. /// - When setting limits to return to factory settings, specify -1 for both /// the min and max limit. typedef struct _zes_freq_range_t { double min; ///< [in,out] The min frequency in MHz below which hardware frequency ///< management will not request frequencies. On input, setting to 0 will ///< permit the frequency to go down to the hardware minimum while setting ///< to -1 will return the min frequency limit to the factory value (can be ///< larger than the hardware min). On output, a negative value indicates ///< that no external minimum frequency limit is in effect. double max; ///< [in,out] The max frequency in MHz above which hardware frequency ///< management will not request frequencies. On input, setting to 0 or a ///< very big number will permit the frequency to go all the way up to the ///< hardware maximum while setting to -1 will return the max frequency to ///< the factory value (which can be less than the hardware max). On ///< output, a negative number indicates that no external maximum frequency ///< limit is in effect. } zes_freq_range_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Frequency throttle reasons typedef uint32_t zes_freq_throttle_reason_flags_t; typedef enum _zes_freq_throttle_reason_flag_t { ZES_FREQ_THROTTLE_REASON_FLAG_AVE_PWR_CAP = ZE_BIT(0), ///< frequency throttled due to average power excursion (PL1) ZES_FREQ_THROTTLE_REASON_FLAG_BURST_PWR_CAP = ZE_BIT(1), ///< frequency throttled due to burst power excursion (PL2) ZES_FREQ_THROTTLE_REASON_FLAG_CURRENT_LIMIT = ZE_BIT(2), ///< frequency throttled due to current excursion (PL4) ZES_FREQ_THROTTLE_REASON_FLAG_THERMAL_LIMIT = ZE_BIT(3), ///< frequency throttled due to thermal excursion (T > TjMax) ZES_FREQ_THROTTLE_REASON_FLAG_PSU_ALERT = ZE_BIT(4), ///< frequency throttled due to power supply assertion ZES_FREQ_THROTTLE_REASON_FLAG_SW_RANGE = ZE_BIT(5), ///< frequency throttled due to software supplied frequency range ZES_FREQ_THROTTLE_REASON_FLAG_HW_RANGE = ZE_BIT(6), ///< frequency throttled due to a sub block that has a lower frequency ///< range when it receives clocks ZES_FREQ_THROTTLE_REASON_FLAG_FORCE_UINT32 = 0x7fffffff } zes_freq_throttle_reason_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Frequency state typedef struct _zes_freq_state_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). double currentVoltage; ///< [out] Current voltage in Volts. A negative value indicates that this ///< property is not known. double request; ///< [out] The current frequency request in MHz. A negative value indicates ///< that this property is not known. double tdp; ///< [out] The maximum frequency in MHz supported under the current TDP ///< conditions. This fluctuates dynamically based on the power and thermal ///< limits of the part. A negative value indicates that this property is ///< not known. double efficient; ///< [out] The efficient minimum frequency in MHz. A negative value ///< indicates that this property is not known. double actual; ///< [out] The resolved frequency in MHz. A negative value indicates that ///< this property is not known. zes_freq_throttle_reason_flags_t throttleReasons; ///< [out] The reasons that the frequency is being limited by the hardware. ///< Returns 0 (frequency not throttled) or a combination of ::zes_freq_throttle_reason_flag_t. } zes_freq_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Frequency throttle time snapshot /// /// @details /// - Percent time throttled is calculated by taking two snapshots (s1, s2) /// and using the equation: %throttled = (s2.throttleTime - /// s1.throttleTime) / (s2.timestamp - s1.timestamp) typedef struct _zes_freq_throttle_time_t { uint64_t throttleTime; ///< [out] The monotonic counter of time in microseconds that the frequency ///< has been limited by the hardware. uint64_t timestamp; ///< [out] Microsecond timestamp when throttleTime was captured. ///< This timestamp should only be used to calculate delta time between ///< snapshots of this structure. ///< Never take the delta of this timestamp with the timestamp from a ///< different structure since they are not guaranteed to have the same base. ///< The absolute value of the timestamp is only valid during within the ///< application and may be different on the next execution. } zes_freq_throttle_time_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Overclocking modes /// /// @details /// - [DEPRECATED] No longer supported. typedef enum _zes_oc_mode_t { ZES_OC_MODE_OFF = 0, ///< Overclocking if off - hardware is running using factory default ///< voltages/frequencies. ZES_OC_MODE_OVERRIDE = 1, ///< Overclock override mode - In this mode, a fixed user-supplied voltage ///< is applied independent of the frequency request. The maximum permitted ///< frequency can also be increased. This mode disables INTERPOLATIVE and ///< FIXED modes. ZES_OC_MODE_INTERPOLATIVE = 2, ///< Overclock interpolative mode - In this mode, the voltage/frequency ///< curve can be extended with a new voltage/frequency point that will be ///< interpolated. The existing voltage/frequency points can also be offset ///< (up or down) by a fixed voltage. This mode disables FIXED and OVERRIDE ///< modes. ZES_OC_MODE_FIXED = 3, ///< Overclocking fixed Mode - In this mode, hardware will disable most ///< frequency throttling and lock the frequency and voltage at the ///< specified overclock values. This mode disables OVERRIDE and ///< INTERPOLATIVE modes. This mode can damage the part, most of the ///< protections are disabled on this mode. ZES_OC_MODE_FORCE_UINT32 = 0x7fffffff } zes_oc_mode_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Overclocking properties /// /// @details /// - Provides all the overclocking capabilities and properties supported by /// the device for the frequency domain. /// - [DEPRECATED] No longer supported. typedef struct _zes_oc_capabilities_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t isOcSupported; ///< [out] Indicates if any overclocking features are supported on this ///< frequency domain. double maxFactoryDefaultFrequency; ///< [out] Factory default non-overclock maximum frequency in Mhz. double maxFactoryDefaultVoltage; ///< [out] Factory default voltage used for the non-overclock maximum ///< frequency in MHz. double maxOcFrequency; ///< [out] Maximum hardware overclocking frequency limit in Mhz. double minOcVoltageOffset; ///< [out] The minimum voltage offset that can be applied to the ///< voltage/frequency curve. Note that this number can be negative. double maxOcVoltageOffset; ///< [out] The maximum voltage offset that can be applied to the ///< voltage/frequency curve. double maxOcVoltage; ///< [out] The maximum overclock voltage that hardware supports. ze_bool_t isTjMaxSupported; ///< [out] Indicates if the maximum temperature limit (TjMax) can be ///< changed for this frequency domain. ze_bool_t isIccMaxSupported; ///< [out] Indicates if the maximum current (IccMax) can be changed for ///< this frequency domain. ze_bool_t isHighVoltModeCapable; ///< [out] Indicates if this frequency domains supports a feature to set ///< very high voltages. ze_bool_t isHighVoltModeEnabled; ///< [out] Indicates if very high voltages are permitted on this frequency ///< domain. ze_bool_t isExtendedModeSupported; ///< [out] Indicates if the extended overclocking features are supported. ///< If this is supported, increments are on 1 Mhz basis. ze_bool_t isFixedModeSupported; ///< [out] Indicates if the fixed mode is supported. In this mode, hardware ///< will disable most frequency throttling and lock the frequency and ///< voltage at the specified overclock values. } zes_oc_capabilities_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of frequency domains /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumFrequencyDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_freq_handle_t* phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get frequency properties - available frequencies /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyGetProperties( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_properties_t* pProperties ///< [in,out] The frequency properties for the specified domain. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get available non-overclocked hardware clock frequencies for the /// frequency domain /// /// @details /// - The list of available frequencies is returned in order of slowest to /// fastest. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyGetAvailableClocks( zes_freq_handle_t hFrequency, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of frequencies. ///< if count is zero, then the driver shall update the value with the ///< total number of frequencies that are available. ///< if count is greater than the number of frequencies that are available, ///< then the driver shall update the value with the correct number of frequencies. double* phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of ///< MHz and sorted from slowest to fastest. ///< if count is less than the number of frequencies that are available, ///< then the driver shall only retrieve that number of frequencies. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get current frequency limits /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pLimits` ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyGetRange( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_range_t* pLimits ///< [in,out] The range between which the hardware can operate for the ///< specified domain. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set frequency range between which the hardware can operate. /// /// @details /// - The application may call this function with the frequency range min /// and max values set to `-1` to request the frequency be (re)set to the /// default values. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pLimits` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencySetRange( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. const zes_freq_range_t* pLimits ///< [in] The limits between which the hardware can operate for the ///< specified domain. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get current frequency state - frequency request, actual frequency, TDP /// limits /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyGetState( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_state_t* pState ///< [in,out] Frequency state for the specified domain. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get frequency throttle time /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pThrottleTime` ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyGetThrottleTime( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_throttle_time_t* pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the ///< specified domain. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the overclocking capabilities. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOcCapabilities` ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyOcGetCapabilities( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_capabilities_t* pOcCapabilities ///< [in,out] Pointer to the capabilities structure. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the current overclocking frequency target, if extended moded is /// supported, will returned in 1 Mhz granularity. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCurrentOcFrequency` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). /// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyOcGetFrequencyTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentOcFrequency ///< [out] Overclocking Frequency in MHz, if extended moded is supported, ///< will returned in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set the current overclocking frequency target, if extended moded is /// supported, can be set in 1 Mhz granularity. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). /// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyOcSetFrequencyTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentOcFrequency ///< [in] Overclocking Frequency in MHz, if extended moded is supported, it ///< could be set in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the current overclocking voltage settings. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCurrentVoltageTarget` /// + `nullptr == pCurrentVoltageOffset` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). /// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyOcGetVoltageTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentVoltageTarget, ///< [out] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double* pCurrentVoltageOffset ///< [out] This voltage offset is applied to all points on the ///< voltage/frequency curve, including the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set the current overclocking voltage settings. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). /// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyOcSetVoltageTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentVoltageTarget, ///< [in] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double CurrentVoltageOffset ///< [in] This voltage offset is applied to all points on the ///< voltage/frequency curve, include the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set the current overclocking mode. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OC_MODE_FIXED < CurrentOcMode` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). /// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyOcSetMode( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t CurrentOcMode ///< [in] Current Overclocking Mode ::zes_oc_mode_t. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the current overclocking mode. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCurrentOcMode` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). /// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyOcGetMode( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t* pCurrentOcMode ///< [out] Current Overclocking Mode ::zes_oc_mode_t. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the maximum current limit setting. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOcIccMax` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + Capability the `isIccMaxSupported` member of ::zes_oc_capabilities_t is false for this frequency domain. ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyOcGetIccMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcIccMax ///< [in,out] Will contain the maximum current limit in Amperes on ///< successful return. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Change the maximum current limit setting. /// /// @details /// - Setting ocIccMax to 0.0 will return the value to the factory default. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The `isIccMaxSupported` member of ::zes_oc_capabilities_t is false for this frequency domain. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + The specified current limit is too low or too high. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyOcSetIccMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocIccMax ///< [in] The new maximum current limit in Amperes. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the maximum temperature limit setting. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOcTjMax` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyOcGetTjMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcTjMax ///< [in,out] Will contain the maximum temperature limit in degrees Celsius ///< on successful return. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Change the maximum temperature limit setting. /// /// @details /// - Setting ocTjMax to 0.0 will return the value to the factory default. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The `isTjMaxSupported` member of ::zes_oc_capabilities_t is false for this frequency domain. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + The specified temperature limit is too high. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesFrequencyOcSetTjMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocTjMax ///< [in] The new maximum temperature limit in degrees Celsius. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management #if !defined(__GNUC__) #pragma region led #endif /////////////////////////////////////////////////////////////////////////////// /// @brief LED properties typedef struct _zes_led_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device ze_bool_t canControl; ///< [out] Indicates if software can control the LED assuming the user has ///< permissions ze_bool_t haveRGB; ///< [out] Indicates if the LED is RGB capable } zes_led_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief LED color typedef struct _zes_led_color_t { double red; ///< [in,out][range(0.0, 1.0)] The LED red value. On output, a value less ///< than 0.0 indicates that the color is not known. double green; ///< [in,out][range(0.0, 1.0)] The LED green value. On output, a value less ///< than 0.0 indicates that the color is not known. double blue; ///< [in,out][range(0.0, 1.0)] The LED blue value. On output, a value less ///< than 0.0 indicates that the color is not known. } zes_led_color_t; /////////////////////////////////////////////////////////////////////////////// /// @brief LED state typedef struct _zes_led_state_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t isOn; ///< [out] Indicates if the LED is on or off zes_led_color_t color; ///< [out] Color of the LED } zes_led_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of LEDs /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumLeds( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_led_handle_t* phLed ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get LED properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hLed` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesLedGetProperties( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_properties_t* pProperties ///< [in,out] Will contain the properties of the LED. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get current state of a LED - on/off, color /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hLed` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ZE_APIEXPORT ze_result_t ZE_APICALL zesLedGetState( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_state_t* pState ///< [in,out] Will contain the current state of the LED. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Turn the LED on/off /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hLed` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesLedSetState( zes_led_handle_t hLed, ///< [in] Handle for the component. ze_bool_t enable ///< [in] Set to TRUE to turn the LED on, FALSE to turn off. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set the color of the LED /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hLed` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pColor` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This LED doesn't not support color changes. See the `haveRGB` member of ::zes_led_properties_t. ZE_APIEXPORT ze_result_t ZE_APICALL zesLedSetColor( zes_led_handle_t hLed, ///< [in] Handle for the component. const zes_led_color_t* pColor ///< [in] New color of the LED. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Memory management #if !defined(__GNUC__) #pragma region memory #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Memory module types typedef enum _zes_mem_type_t { ZES_MEM_TYPE_HBM = 0, ///< HBM memory ZES_MEM_TYPE_DDR = 1, ///< DDR memory ZES_MEM_TYPE_DDR3 = 2, ///< DDR3 memory ZES_MEM_TYPE_DDR4 = 3, ///< DDR4 memory ZES_MEM_TYPE_DDR5 = 4, ///< DDR5 memory ZES_MEM_TYPE_LPDDR = 5, ///< LPDDR memory ZES_MEM_TYPE_LPDDR3 = 6, ///< LPDDR3 memory ZES_MEM_TYPE_LPDDR4 = 7, ///< LPDDR4 memory ZES_MEM_TYPE_LPDDR5 = 8, ///< LPDDR5 memory ZES_MEM_TYPE_SRAM = 9, ///< SRAM memory ZES_MEM_TYPE_L1 = 10, ///< L1 cache ZES_MEM_TYPE_L3 = 11, ///< L3 cache ZES_MEM_TYPE_GRF = 12, ///< Execution unit register file ZES_MEM_TYPE_SLM = 13, ///< Execution unit shared local memory ZES_MEM_TYPE_GDDR4 = 14, ///< GDDR4 memory ZES_MEM_TYPE_GDDR5 = 15, ///< GDDR5 memory ZES_MEM_TYPE_GDDR5X = 16, ///< GDDR5X memory ZES_MEM_TYPE_GDDR6 = 17, ///< GDDR6 memory ZES_MEM_TYPE_GDDR6X = 18, ///< GDDR6X memory ZES_MEM_TYPE_GDDR7 = 19, ///< GDDR7 memory ZES_MEM_TYPE_FORCE_UINT32 = 0x7fffffff } zes_mem_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Memory module location typedef enum _zes_mem_loc_t { ZES_MEM_LOC_SYSTEM = 0, ///< System memory ZES_MEM_LOC_DEVICE = 1, ///< On board local device memory ZES_MEM_LOC_FORCE_UINT32 = 0x7fffffff } zes_mem_loc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Memory health typedef enum _zes_mem_health_t { ZES_MEM_HEALTH_UNKNOWN = 0, ///< The memory health cannot be determined. ZES_MEM_HEALTH_OK = 1, ///< All memory channels are healthy. ZES_MEM_HEALTH_DEGRADED = 2, ///< Excessive correctable errors have been detected on one or more ///< channels. Device should be reset. ZES_MEM_HEALTH_CRITICAL = 3, ///< Operating with reduced memory to cover banks with too many ///< uncorrectable errors. ZES_MEM_HEALTH_REPLACE = 4, ///< Device should be replaced due to excessive uncorrectable errors. ZES_MEM_HEALTH_FORCE_UINT32 = 0x7fffffff } zes_mem_health_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Memory properties typedef struct _zes_mem_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_mem_type_t type; ///< [out] The memory type ze_bool_t onSubdevice; ///< [out] True if this resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device zes_mem_loc_t location; ///< [out] Location of this memory (system, device) uint64_t physicalSize; ///< [out] Physical memory size in bytes. A value of 0 indicates that this ///< property is not known. However, a call to ::zesMemoryGetState() will ///< correctly return the total size of usable memory. int32_t busWidth; ///< [out] Width of the memory bus. A value of -1 means that this property ///< is unknown. int32_t numChannels; ///< [out] The number of memory channels. A value of -1 means that this ///< property is unknown. } zes_mem_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Memory state - health, allocated /// /// @details /// - Percent allocation is given by 100 * (size - free / size. /// - Percent free is given by 100 * free / size. typedef struct _zes_mem_state_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_mem_health_t health; ///< [out] Indicates the health of the memory uint64_t free; ///< [out] The free memory in bytes uint64_t size; ///< [out] The total allocatable memory in bytes (can be less than the ///< `physicalSize` member of ::zes_mem_properties_t) } zes_mem_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Memory bandwidth /// /// @details /// - Percent bandwidth is calculated by taking two snapshots (s1, s2) and /// using the equation: %bw = 10^6 * ((s2.readCounter - s1.readCounter) + /// (s2.writeCounter - s1.writeCounter)) / (s2.maxBandwidth * /// (s2.timestamp - s1.timestamp)) /// - Counter can roll over and rollover needs to be handled by comparing /// the current read against the previous read /// - Counter is a 32 byte transaction count, which means the calculated /// delta (delta = current_value - previous_value or delta = 2^32 - /// previous_value + current_value in case of rollover) needs to be /// multiplied by 32 to get delta between samples in actual byte count typedef struct _zes_mem_bandwidth_t { uint64_t readCounter; ///< [out] Total bytes read from memory uint64_t writeCounter; ///< [out] Total bytes written to memory uint64_t maxBandwidth; ///< [out] Current maximum bandwidth in units of bytes/sec uint64_t timestamp; ///< [out] The timestamp in microseconds when these measurements were sampled. ///< This timestamp should only be used to calculate delta time between ///< snapshots of this structure. ///< Never take the delta of this timestamp with the timestamp from a ///< different structure since they are not guaranteed to have the same base. ///< The absolute value of the timestamp is only valid during within the ///< application and may be different on the next execution. } zes_mem_bandwidth_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Extension properties for Memory bandwidth /// /// @details /// - Number of counter bits /// - [DEPRECATED] No longer supported. typedef struct _zes_mem_ext_bandwidth_t { uint32_t memoryTimestampValidBits; ///< [out] Returns the number of valid bits in the timestamp values } zes_mem_ext_bandwidth_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of memory modules /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumMemoryModules( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_mem_handle_t* phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get memory properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMemory` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesMemoryGetProperties( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_properties_t* pProperties ///< [in,out] Will contain memory properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get memory state - health, allocated /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMemory` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ZE_APIEXPORT ze_result_t ZE_APICALL zesMemoryGetState( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_state_t* pState ///< [in,out] Will contain the current health and allocated memory. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get memory bandwidth /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMemory` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pBandwidth` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to query this telemetry. ZE_APIEXPORT ze_result_t ZE_APICALL zesMemoryGetBandwidth( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_bandwidth_t* pBandwidth ///< [in,out] Will contain the total number of bytes read from and written ///< to memory, as well as the current maximum bandwidth. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Performance factor #if !defined(__GNUC__) #pragma region performance #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Static information about a Performance Factor domain typedef struct _zes_perf_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t onSubdevice; ///< [out] True if this Performance Factor affects accelerators located on ///< a sub-device uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device zes_engine_type_flags_t engines; ///< [out] Bitfield of accelerator engine types that are affected by this ///< Performance Factor. } zes_perf_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handles to accelerator domains whose performance can be optimized /// via a Performance Factor /// /// @details /// - A Performance Factor should be tuned for each workload. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumPerformanceFactorDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_perf_handle_t* phPerf ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get properties about a Performance Factor domain /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPerf` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesPerformanceFactorGetProperties( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. zes_perf_properties_t* pProperties ///< [in,out] Will contain information about the specified Performance ///< Factor domain. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get current Performance Factor for a given domain /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPerf` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pFactor` ZE_APIEXPORT ze_result_t ZE_APICALL zesPerformanceFactorGetConfig( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double* pFactor ///< [in,out] Will contain the actual Performance Factor being used by the ///< hardware (may not be the same as the requested Performance Factor). ); /////////////////////////////////////////////////////////////////////////////// /// @brief Change the performance factor for a domain /// /// @details /// - The Performance Factor is a number between 0 and 100. /// - A Performance Factor is a hint to the hardware. Depending on the /// hardware, the request may not be granted. Follow up this function with /// a call to ::zesPerformanceFactorGetConfig() to determine the actual /// factor being used by the hardware. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPerf` ZE_APIEXPORT ze_result_t ZE_APICALL zesPerformanceFactorSetConfig( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double factor ///< [in] The new Performance Factor. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Scheduler management #if !defined(__GNUC__) #pragma region power #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Power Domain typedef enum _zes_power_domain_t { ZES_POWER_DOMAIN_UNKNOWN = 0, ///< The PUnit power domain level cannot be determined. ZES_POWER_DOMAIN_CARD = 1, ///< The PUnit power domain is a card-level power domain. ZES_POWER_DOMAIN_PACKAGE = 2, ///< The PUnit power domain is a package-level power domain. ZES_POWER_DOMAIN_STACK = 3, ///< The PUnit power domain is a stack-level power domain. ZES_POWER_DOMAIN_MEMORY = 4, ///< The PUnit power domain is a memory-level power domain. ZES_POWER_DOMAIN_GPU = 5, ///< The PUnit power domain is a GPU-level power domain. ZES_POWER_DOMAIN_FORCE_UINT32 = 0x7fffffff } zes_power_domain_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Power Level Type typedef enum _zes_power_level_t { ZES_POWER_LEVEL_UNKNOWN = 0, ///< The PUnit power monitoring duration cannot be determined. ZES_POWER_LEVEL_SUSTAINED = 1, ///< The PUnit determines effective power draw by computing a moving ///< average of the actual power draw over a time interval (longer than ///< BURST). ZES_POWER_LEVEL_BURST = 2, ///< The PUnit determines effective power draw by computing a moving ///< average of the actual power draw over a time interval (longer than ///< PEAK). ZES_POWER_LEVEL_PEAK = 3, ///< The PUnit determines effective power draw by computing a moving ///< average of the actual power draw over a very short time interval. ZES_POWER_LEVEL_INSTANTANEOUS = 4, ///< The PUnit predicts effective power draw using the current device ///< configuration (frequency, voltage, etc...) & throttles proactively to ///< stay within the specified limit. ZES_POWER_LEVEL_FORCE_UINT32 = 0x7fffffff } zes_power_level_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Power Source Type typedef enum _zes_power_source_t { ZES_POWER_SOURCE_ANY = 0, ///< Limit active no matter whether the power source is mains powered or ///< battery powered. ZES_POWER_SOURCE_MAINS = 1, ///< Limit active only when the device is mains powered. ZES_POWER_SOURCE_BATTERY = 2, ///< Limit active only when the device is battery powered. ZES_POWER_SOURCE_FORCE_UINT32 = 0x7fffffff } zes_power_source_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Limit Unit typedef enum _zes_limit_unit_t { ZES_LIMIT_UNIT_UNKNOWN = 0, ///< The PUnit power monitoring unit cannot be determined. ZES_LIMIT_UNIT_CURRENT = 1, ///< The limit is specified in milliamperes of current drawn. ZES_LIMIT_UNIT_POWER = 2, ///< The limit is specified in milliwatts of power generated. ZES_LIMIT_UNIT_FORCE_UINT32 = 0x7fffffff } zes_limit_unit_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Properties related to device power settings typedef struct _zes_power_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t onSubdevice; ///< [out] True if this resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device ze_bool_t canControl; ///< [out] Software can change the power limits of this domain assuming the ///< user has permissions. ze_bool_t isEnergyThresholdSupported; ///< [out] Indicates if this power domain supports the energy threshold ///< event (::ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED). int32_t defaultLimit; ///< [out] (Deprecated) The factory default TDP power limit of the part in ///< milliwatts. A value of -1 means that this is not known. int32_t minLimit; ///< [out] (Deprecated) The minimum power limit in milliwatts that can be ///< requested. A value of -1 means that this is not known. int32_t maxLimit; ///< [out] (Deprecated) The maximum power limit in milliwatts that can be ///< requested. A value of -1 means that this is not known. } zes_power_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Energy counter snapshot /// /// @details /// - Average power is calculated by taking two snapshots (s1, s2) and using /// the equation: PowerWatts = (s2.energy - s1.energy) / (s2.timestamp - /// s1.timestamp) typedef struct _zes_power_energy_counter_t { uint64_t energy; ///< [out] The monotonic energy counter in microjoules. uint64_t timestamp; ///< [out] Microsecond timestamp when energy was captured. ///< This timestamp should only be used to calculate delta time between ///< snapshots of this structure. ///< Never take the delta of this timestamp with the timestamp from a ///< different structure since they are not guaranteed to have the same base. ///< The absolute value of the timestamp is only valid during within the ///< application and may be different on the next execution. } zes_power_energy_counter_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Sustained power limits /// /// @details /// - The power controller (Punit) will throttle the operating frequency if /// the power averaged over a window (typically seconds) exceeds this /// limit. /// - [DEPRECATED] No longer supported. typedef struct _zes_power_sustained_limit_t { ze_bool_t enabled; ///< [in,out] indicates if the limit is enabled (true) or ignored (false) int32_t power; ///< [in,out] power limit in milliwatts int32_t interval; ///< [in,out] power averaging window (Tau) in milliseconds } zes_power_sustained_limit_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Burst power limit /// /// @details /// - The power controller (Punit) will throttle the operating frequency of /// the device if the power averaged over a few milliseconds exceeds a /// limit known as PL2. Typically PL2 > PL1 so that it permits the /// frequency to burst higher for short periods than would be otherwise /// permitted by PL1. /// - [DEPRECATED] No longer supported. typedef struct _zes_power_burst_limit_t { ze_bool_t enabled; ///< [in,out] indicates if the limit is enabled (true) or ignored (false) int32_t power; ///< [in,out] power limit in milliwatts } zes_power_burst_limit_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Peak power limit /// /// @details /// - The power controller (Punit) will reactively/proactively throttle the /// operating frequency of the device when the instantaneous/100usec power /// exceeds this limit. The limit is known as PL4 or Psys. It expresses /// the maximum power that can be drawn from the power supply. /// - If this power limit is removed or set too high, the power supply will /// generate an interrupt when it detects an overcurrent condition and the /// power controller will throttle the device frequencies down to min. It /// is thus better to tune the PL4 value in order to avoid such /// excursions. /// - [DEPRECATED] No longer supported. typedef struct _zes_power_peak_limit_t { int32_t powerAC; ///< [in,out] power limit in milliwatts for the AC power source. int32_t powerDC; ///< [in,out] power limit in milliwatts for the DC power source. On input, ///< this is ignored if the product does not have a battery. On output, ///< this will be -1 if the product does not have a battery. } zes_power_peak_limit_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Energy threshold /// /// @details /// - . typedef struct _zes_energy_threshold_t { ze_bool_t enable; ///< [in,out] Indicates if the energy threshold is enabled. double threshold; ///< [in,out] The energy threshold in Joules. Will be 0.0 if no threshold ///< has been set. uint32_t processId; ///< [in,out] The host process ID that set the energy threshold. Will be ///< 0xFFFFFFFF if no threshold has been set. } zes_energy_threshold_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of power domains /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumPowerDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_pwr_handle_t* phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of the PCIe card-level power /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phPower` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + The device does not provide access to card level power controls or telemetry. An invalid power domain handle will be returned in phPower. ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceGetCardPowerDomain( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pwr_handle_t* phPower ///< [in,out] power domain handle for the entire PCIe card. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get properties related to a power domain /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesPowerGetProperties( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_properties_t* pProperties ///< [in,out] Structure that will contain property data. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get energy counter /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pEnergy` ZE_APIEXPORT ze_result_t ZE_APICALL zesPowerGetEnergyCounter( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_energy_counter_t* pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and ///< timestamp when the last counter value was measured. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get power limits /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] Use ::zesPowerGetLimitsExt. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` ZE_APIEXPORT ze_result_t ZE_APICALL zesPowerGetLimits( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_sustained_limit_t* pSustained, ///< [in,out][optional] The sustained power limit. If this is null, the ///< current sustained power limits will not be returned. zes_power_burst_limit_t* pBurst, ///< [in,out][optional] The burst power limit. If this is null, the current ///< peak power limits will not be returned. zes_power_peak_limit_t* pPeak ///< [in,out][optional] The peak power limit. If this is null, the peak ///< power limits will not be returned. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set power limits /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] Use ::zesPowerSetLimitsExt. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + The device is in use, meaning that the GPU is under Over clocking, applying power limits under overclocking is not supported. ZE_APIEXPORT ze_result_t ZE_APICALL zesPowerSetLimits( zes_pwr_handle_t hPower, ///< [in] Handle for the component. const zes_power_sustained_limit_t* pSustained, ///< [in][optional] The sustained power limit. If this is null, no changes ///< will be made to the sustained power limits. const zes_power_burst_limit_t* pBurst, ///< [in][optional] The burst power limit. If this is null, no changes will ///< be made to the burst power limits. const zes_power_peak_limit_t* pPeak ///< [in][optional] The peak power limit. If this is null, no changes will ///< be made to the peak power limits. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get energy threshold /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pThreshold` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Energy threshold not supported on this power domain (check the `isEnergyThresholdSupported` member of ::zes_power_properties_t). /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to request this feature. ZE_APIEXPORT ze_result_t ZE_APICALL zesPowerGetEnergyThreshold( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_energy_threshold_t* pThreshold ///< [in,out] Returns information about the energy threshold setting - ///< enabled/energy threshold/process ID. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set energy threshold /// /// @details /// - An event ::ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED will be /// generated when the delta energy consumed starting from this call /// exceeds the specified threshold. Use the function /// ::zesDeviceEventRegister() to start receiving the event. /// - Only one running process can control the energy threshold at a given /// time. If another process attempts to change the energy threshold, the /// error ::ZE_RESULT_ERROR_NOT_AVAILABLE will be returned. The function /// ::zesPowerGetEnergyThreshold() to determine the process ID currently /// controlling this setting. /// - Calling this function will remove any pending energy thresholds and /// start counting from the time of this call. /// - Once the energy threshold has been reached and the event generated, /// the threshold is automatically removed. It is up to the application to /// request a new threshold. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Energy threshold not supported on this power domain (check the `isEnergyThresholdSupported` member of ::zes_power_properties_t). /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to request this feature. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Another running process has set the energy threshold. ZE_APIEXPORT ze_result_t ZE_APICALL zesPowerSetEnergyThreshold( zes_pwr_handle_t hPower, ///< [in] Handle for the component. double threshold ///< [in] The energy threshold to be set in joules. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management #if !defined(__GNUC__) #pragma region psu #endif /////////////////////////////////////////////////////////////////////////////// /// @brief PSU voltage status typedef enum _zes_psu_voltage_status_t { ZES_PSU_VOLTAGE_STATUS_UNKNOWN = 0, ///< The status of the power supply voltage controllers cannot be ///< determined ZES_PSU_VOLTAGE_STATUS_NORMAL = 1, ///< No unusual voltages have been detected ZES_PSU_VOLTAGE_STATUS_OVER = 2, ///< Over-voltage has occurred ZES_PSU_VOLTAGE_STATUS_UNDER = 3, ///< Under-voltage has occurred ZES_PSU_VOLTAGE_STATUS_FORCE_UINT32 = 0x7fffffff } zes_psu_voltage_status_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Static properties of the power supply typedef struct _zes_psu_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device ze_bool_t haveFan; ///< [out] True if the power supply has a fan int32_t ampLimit; ///< [out] The maximum electrical current in milliamperes that can be ///< drawn. A value of -1 indicates that this property cannot be ///< determined. } zes_psu_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Dynamic state of the power supply typedef struct _zes_psu_state_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_psu_voltage_status_t voltStatus; ///< [out] The current PSU voltage status ze_bool_t fanFailed; ///< [out] Indicates if the fan has failed int32_t temperature; ///< [out] Read the current heatsink temperature in degrees Celsius. A ///< value of -1 indicates that this property cannot be determined. int32_t current; ///< [out] The amps being drawn in milliamperes. A value of -1 indicates ///< that this property cannot be determined. } zes_psu_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of power supplies /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumPsus( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_psu_handle_t* phPsu ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get power supply properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPsu` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesPsuGetProperties( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_properties_t* pProperties ///< [in,out] Will contain the properties of the power supply. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get current power supply state /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPsu` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ZE_APIEXPORT ze_result_t ZE_APICALL zesPsuGetState( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_state_t* pState ///< [in,out] Will contain the current state of the power supply. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management #if !defined(__GNUC__) #pragma region ras #endif /////////////////////////////////////////////////////////////////////////////// /// @brief RAS error type typedef enum _zes_ras_error_type_t { ZES_RAS_ERROR_TYPE_CORRECTABLE = 0, ///< Errors were corrected by hardware ZES_RAS_ERROR_TYPE_UNCORRECTABLE = 1, ///< Error were not corrected ZES_RAS_ERROR_TYPE_FORCE_UINT32 = 0x7fffffff } zes_ras_error_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief RAS error categories typedef enum _zes_ras_error_cat_t { ZES_RAS_ERROR_CAT_RESET = 0, ///< The number of accelerator engine resets attempted by the driver ZES_RAS_ERROR_CAT_PROGRAMMING_ERRORS = 1, ///< The number of hardware exceptions generated by the way workloads have ///< programmed the hardware ZES_RAS_ERROR_CAT_DRIVER_ERRORS = 2, ///< The number of low level driver communication errors have occurred ZES_RAS_ERROR_CAT_COMPUTE_ERRORS = 3, ///< The number of errors that have occurred in the compute accelerator ///< hardware ZES_RAS_ERROR_CAT_NON_COMPUTE_ERRORS = 4, ///< The number of errors that have occurred in the fixed-function ///< accelerator hardware ZES_RAS_ERROR_CAT_CACHE_ERRORS = 5, ///< The number of errors that have occurred in caches (L1/L3/register ///< file/shared local memory/sampler) ZES_RAS_ERROR_CAT_DISPLAY_ERRORS = 6, ///< The number of errors that have occurred in the display ZES_RAS_ERROR_CAT_FORCE_UINT32 = 0x7fffffff } zes_ras_error_cat_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_MAX_RAS_ERROR_CATEGORY_COUNT /// @brief The maximum number of categories #define ZES_MAX_RAS_ERROR_CATEGORY_COUNT 7 #endif // ZES_MAX_RAS_ERROR_CATEGORY_COUNT /////////////////////////////////////////////////////////////////////////////// /// @brief RAS properties typedef struct _zes_ras_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_ras_error_type_t type; ///< [out] The type of RAS error ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device } zes_ras_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief RAS error details typedef struct _zes_ras_state_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t category[ZES_MAX_RAS_ERROR_CATEGORY_COUNT]; ///< [in][out] Breakdown of error by category } zes_ras_state_t; /////////////////////////////////////////////////////////////////////////////// /// @brief RAS error configuration - thresholds used for triggering RAS events /// (::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS, /// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS) /// /// @details /// - The driver maintains a total counter which is updated every time a /// hardware block covered by the corresponding RAS error set notifies /// that an error has occurred. When this total count goes above the /// totalThreshold specified below, a RAS event is triggered. /// - The driver also maintains a counter for each category of RAS error /// (see ::zes_ras_state_t for a breakdown). Each time a hardware block of /// that category notifies that an error has occurred, that corresponding /// category counter is updated. When it goes above the threshold /// specified in detailedThresholds, a RAS event is triggered. typedef struct _zes_ras_config_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t totalThreshold; ///< [in,out] If the total RAS errors exceeds this threshold, the event ///< will be triggered. A value of 0ULL disables triggering the event based ///< on the total counter. zes_ras_state_t detailedThresholds; ///< [in,out] If the RAS errors for each category exceed the threshold for ///< that category, the event will be triggered. A value of 0ULL will ///< disable an event being triggered for that category. } zes_ras_config_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of all RAS error sets on a device /// /// @details /// - A RAS error set is a collection of RAS error counters of a given type /// (correctable/uncorrectable) from hardware blocks contained within a /// sub-device or within the device. /// - A device without sub-devices will typically return two handles, one /// for correctable errors sets and one for uncorrectable error sets. /// - A device with sub-devices will return RAS error sets for each /// sub-device and possibly RAS error sets for hardware blocks outside the /// sub-devices. /// - If the function completes successfully but pCount is set to 0, RAS /// features are not available/enabled on this device. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumRasErrorSets( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_ras_handle_t* phRas ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get RAS properties of a given RAS error set - this enables discovery /// of the type of RAS error set (correctable/uncorrectable) and if /// located on a sub-device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesRasGetProperties( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_properties_t* pProperties ///< [in,out] Structure describing RAS properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get RAS error thresholds that control when RAS events are generated /// /// @details /// - The driver maintains counters for all RAS error sets and error /// categories. Events are generated when errors occur. The configuration /// enables setting thresholds to limit when events are sent. /// - When a particular RAS correctable error counter exceeds the configured /// threshold, the event ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS will /// be triggered. /// - When a particular RAS uncorrectable error counter exceeds the /// configured threshold, the event /// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS will be triggered. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` ZE_APIEXPORT ze_result_t ZE_APICALL zesRasGetConfig( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_config_t* pConfig ///< [in,out] Will be populed with the current RAS configuration - ///< thresholds used to trigger events ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set RAS error thresholds that control when RAS events are generated /// /// @details /// - The driver maintains counters for all RAS error sets and error /// categories. Events are generated when errors occur. The configuration /// enables setting thresholds to limit when events are sent. /// - When a particular RAS correctable error counter exceeds the specified /// threshold, the event ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS will /// be generated. /// - When a particular RAS uncorrectable error counter exceeds the /// specified threshold, the event /// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS will be generated. /// - Call ::zesRasGetState() and set the clear flag to true to restart /// event generation once counters have exceeded thresholds. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Another running process is controlling these settings. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + Don't have permissions to set thresholds. ZE_APIEXPORT ze_result_t ZE_APICALL zesRasSetConfig( zes_ras_handle_t hRas, ///< [in] Handle for the component. const zes_ras_config_t* pConfig ///< [in] Change the RAS configuration - thresholds used to trigger events ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the current value of RAS error counters for a particular error set /// /// @details /// - Clearing errors will affect other threads/applications - the counter /// values will start from zero. /// - Clearing errors requires write permissions. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + Don't have permissions to clear error counters. ZE_APIEXPORT ze_result_t ZE_APICALL zesRasGetState( zes_ras_handle_t hRas, ///< [in] Handle for the component. ze_bool_t clear, ///< [in] Set to 1 to clear the counters of this type zes_ras_state_t* pState ///< [in,out] Breakdown of where errors have occurred ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Scheduler management #if !defined(__GNUC__) #pragma region scheduler #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Scheduler mode typedef enum _zes_sched_mode_t { ZES_SCHED_MODE_TIMEOUT = 0, ///< Multiple applications or contexts are submitting work to the hardware. ///< When higher priority work arrives, the scheduler attempts to pause the ///< current executing work within some timeout interval, then submits the ///< other work. ZES_SCHED_MODE_TIMESLICE = 1, ///< The scheduler attempts to fairly timeslice hardware execution time ///< between multiple contexts submitting work to the hardware ///< concurrently. ZES_SCHED_MODE_EXCLUSIVE = 2, ///< Any application or context can run indefinitely on the hardware ///< without being preempted or terminated. All pending work for other ///< contexts must wait until the running context completes with no further ///< submitted work. ZES_SCHED_MODE_COMPUTE_UNIT_DEBUG = 3, ///< [DEPRECATED] No longer supported. ZES_SCHED_MODE_FORCE_UINT32 = 0x7fffffff } zes_sched_mode_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Properties related to scheduler component typedef struct _zes_sched_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t onSubdevice; ///< [out] True if this resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device ze_bool_t canControl; ///< [out] Software can change the scheduler component configuration ///< assuming the user has permissions. zes_engine_type_flags_t engines; ///< [out] Bitfield of accelerator engine types that are managed by this ///< scheduler component. Note that there can be more than one scheduler ///< component for the same type of accelerator engine. uint32_t supportedModes; ///< [out] Bitfield of scheduler modes that can be configured for this ///< scheduler component (bitfield of 1<<::zes_sched_mode_t). } zes_sched_properties_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_SCHED_WATCHDOG_DISABLE /// @brief Disable forward progress guard timeout. #define ZES_SCHED_WATCHDOG_DISABLE (~(0ULL)) #endif // ZES_SCHED_WATCHDOG_DISABLE /////////////////////////////////////////////////////////////////////////////// /// @brief Configuration for timeout scheduler mode (::ZES_SCHED_MODE_TIMEOUT) typedef struct _zes_sched_timeout_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t watchdogTimeout; ///< [in,out] The maximum time in microseconds that the scheduler will wait ///< for a batch of work submitted to a hardware engine to complete or to ///< be preempted so as to run another context. ///< If this time is exceeded, the hardware engine is reset and the context terminated. ///< If set to ::ZES_SCHED_WATCHDOG_DISABLE, a running workload can run as ///< long as it wants without being terminated, but preemption attempts to ///< run other contexts are permitted but not enforced. } zes_sched_timeout_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Configuration for timeslice scheduler mode /// (::ZES_SCHED_MODE_TIMESLICE) typedef struct _zes_sched_timeslice_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t interval; ///< [in,out] The average interval in microseconds that a submission for a ///< context will run on a hardware engine before being preempted out to ///< run a pending submission for another context. uint64_t yieldTimeout; ///< [in,out] The maximum time in microseconds that the scheduler will wait ///< to preempt a workload running on an engine before deciding to reset ///< the hardware engine and terminating the associated context. } zes_sched_timeslice_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Returns handles to scheduler components. /// /// @details /// - Each scheduler component manages the distribution of work across one /// or more accelerator engines. /// - If an application wishes to change the scheduler behavior for all /// accelerator engines of a specific type (e.g. compute), it should /// select all the handles where the `engines` member /// ::zes_sched_properties_t contains that type. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumSchedulers( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_sched_handle_t* phScheduler ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get properties related to a scheduler component /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerGetProperties( zes_sched_handle_t hScheduler, ///< [in] Handle for the component. zes_sched_properties_t* pProperties ///< [in,out] Structure that will contain property data. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get current scheduling mode in effect on a scheduler component. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pMode` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerGetCurrentMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_mode_t* pMode ///< [in,out] Will contain the current scheduler mode. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get scheduler config for mode ::ZES_SCHED_MODE_TIMEOUT /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerGetTimeoutModeProperties( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeout_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get scheduler config for mode ::ZES_SCHED_MODE_TIMESLICE /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerGetTimesliceModeProperties( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeslice_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Change scheduler mode to ::ZES_SCHED_MODE_TIMEOUT or update scheduler /// mode parameters if already running in this mode. /// /// @details /// - This mode is optimized for multiple applications or contexts /// submitting work to the hardware. When higher priority work arrives, /// the scheduler attempts to pause the current executing work within some /// timeout interval, then submits the other work. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` /// + `nullptr == pNeedReload` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make this modification. ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerSetTimeoutMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeout_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Change scheduler mode to ::ZES_SCHED_MODE_TIMESLICE or update /// scheduler mode parameters if already running in this mode. /// /// @details /// - This mode is optimized to provide fair sharing of hardware execution /// time between multiple contexts submitting work to the hardware /// concurrently. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` /// + `nullptr == pNeedReload` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make this modification. ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerSetTimesliceMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeslice_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Change scheduler mode to ::ZES_SCHED_MODE_EXCLUSIVE /// /// @details /// - This mode is optimized for single application/context use-cases. It /// permits a context to run indefinitely on the hardware without being /// preempted or terminated. All pending work for other contexts must wait /// until the running context completes with no further submitted work. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pNeedReload` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make this modification. ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerSetExclusiveMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Change scheduler mode to ::ZES_SCHED_MODE_COMPUTE_UNIT_DEBUG /// /// @details /// - This is a special mode that must ben enabled when debugging an /// application that uses this device e.g. using the Level0 Debug API. /// - It ensures that only one command queue can execute work on the /// hardware at a given time. Work is permitted to run as long as needed /// without enforcing any scheduler fairness policies. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pNeedReload` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make this modification. ZE_APIEXPORT ze_result_t ZE_APICALL zesSchedulerSetComputeUnitDebugMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Standby domains #if !defined(__GNUC__) #pragma region standby #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Standby hardware components typedef enum _zes_standby_type_t { ZES_STANDBY_TYPE_GLOBAL = 0, ///< Control the overall standby policy of the device/sub-device ZES_STANDBY_TYPE_FORCE_UINT32 = 0x7fffffff } zes_standby_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Standby hardware component properties typedef struct _zes_standby_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_standby_type_t type; ///< [out] Which standby hardware component this controls ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device } zes_standby_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Standby promotion modes typedef enum _zes_standby_promo_mode_t { ZES_STANDBY_PROMO_MODE_DEFAULT = 0, ///< Best compromise between performance and energy savings. ZES_STANDBY_PROMO_MODE_NEVER = 1, ///< The device/component will never shutdown. This can improve performance ///< but uses more energy. ZES_STANDBY_PROMO_MODE_FORCE_UINT32 = 0x7fffffff } zes_standby_promo_mode_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of standby controls /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumStandbyDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_standby_handle_t* phStandby ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get standby hardware component properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hStandby` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesStandbyGetProperties( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_properties_t* pProperties ///< [in,out] Will contain the standby hardware properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the current standby promotion mode /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hStandby` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pMode` ZE_APIEXPORT ze_result_t ZE_APICALL zesStandbyGetMode( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t* pMode ///< [in,out] Will contain the current standby mode. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set standby promotion mode /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hStandby` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_STANDBY_PROMO_MODE_NEVER < mode` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ZE_APIEXPORT ze_result_t ZE_APICALL zesStandbySetMode( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t mode ///< [in] New standby mode. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for System Resource Management (Sysman) - Firmware management #if !defined(__GNUC__) #pragma region temperature #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Temperature sensors typedef enum _zes_temp_sensors_t { ZES_TEMP_SENSORS_GLOBAL = 0, ///< The maximum temperature across all device sensors ZES_TEMP_SENSORS_GPU = 1, ///< The maximum temperature across all sensors in the GPU ZES_TEMP_SENSORS_MEMORY = 2, ///< The maximum temperature across all sensors in the local memory ZES_TEMP_SENSORS_GLOBAL_MIN = 3, ///< The minimum temperature across all device sensors ZES_TEMP_SENSORS_GPU_MIN = 4, ///< The minimum temperature across all sensors in the GPU ZES_TEMP_SENSORS_MEMORY_MIN = 5, ///< The minimum temperature across all sensors in the local device memory ZES_TEMP_SENSORS_GPU_BOARD = 6, ///< The maximum temperature across all sensors in the GPU Board ZES_TEMP_SENSORS_GPU_BOARD_MIN = 7, ///< The minimum temperature across all sensors in the GPU Board ZES_TEMP_SENSORS_VOLTAGE_REGULATOR = 8, ///< The maximum temperature across all sensors in the Voltage Regulator ZES_TEMP_SENSORS_FORCE_UINT32 = 0x7fffffff } zes_temp_sensors_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Temperature sensor properties typedef struct _zes_temp_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_temp_sensors_t type; ///< [out] Which part of the device the temperature sensor measures ze_bool_t onSubdevice; ///< [out] True if the resource is located on a sub-device; false means ///< that the resource is on the device of the calling Sysman handle uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device double maxTemperature; ///< [out] Will contain the maximum temperature for the specific device in ///< degrees Celsius. ze_bool_t isCriticalTempSupported; ///< [out] Indicates if the critical temperature event ///< ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL is supported ze_bool_t isThreshold1Supported; ///< [out] Indicates if the temperature threshold 1 event ///< ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 is supported ze_bool_t isThreshold2Supported; ///< [out] Indicates if the temperature threshold 2 event ///< ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 is supported } zes_temp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Temperature sensor threshold typedef struct _zes_temp_threshold_t { ze_bool_t enableLowToHigh; ///< [in,out] Trigger an event when the temperature crosses from below the ///< threshold to above. ze_bool_t enableHighToLow; ///< [in,out] Trigger an event when the temperature crosses from above the ///< threshold to below. double threshold; ///< [in,out] The threshold in degrees Celsius. } zes_temp_threshold_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Temperature configuration - which events should be triggered and the /// trigger conditions. typedef struct _zes_temp_config_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). ze_bool_t enableCritical; ///< [in,out] Indicates if event ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL should ///< be triggered by the driver. zes_temp_threshold_t threshold1; ///< [in,out] Configuration controlling if and when event ///< ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 should be triggered by the ///< driver. zes_temp_threshold_t threshold2; ///< [in,out] Configuration controlling if and when event ///< ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 should be triggered by the ///< driver. } zes_temp_config_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of temperature sensors /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumTemperatureSensors( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_temp_handle_t* phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get temperature sensor properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTemperature` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesTemperatureGetProperties( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_properties_t* pProperties ///< [in,out] Will contain the temperature sensor properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get temperature configuration for this sensor - which events are /// triggered and the trigger conditions /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTemperature` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Temperature thresholds are not supported on this temperature sensor. Generally this is only supported for temperature sensor ::ZES_TEMP_SENSORS_GLOBAL. /// + One or both of the thresholds is not supported. Check the `isThreshold1Supported` and `isThreshold2Supported` members of ::zes_temp_properties_t. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to request this feature. ZE_APIEXPORT ze_result_t ZE_APICALL zesTemperatureGetConfig( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_config_t* pConfig ///< [in,out] Returns current configuration. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set temperature configuration for this sensor - indicates which events /// are triggered and the trigger conditions /// /// @details /// - Events ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL will be triggered when /// temperature reaches the critical range. Use the function /// ::zesDeviceEventRegister() to start receiving this event. /// - Events ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 and /// ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 will be generated when /// temperature cross the thresholds set using this function. Use the /// function ::zesDeviceEventRegister() to start receiving these events. /// - Only one running process can set the temperature configuration at a /// time. If another process attempts to change the configuration, the /// error ::ZE_RESULT_ERROR_NOT_AVAILABLE will be returned. The function /// ::zesTemperatureGetConfig() will return the process ID currently /// controlling these settings. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTemperature` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Temperature thresholds are not supported on this temperature sensor. Generally they are only supported for temperature sensor ::ZES_TEMP_SENSORS_GLOBAL. /// + Enabling the critical temperature event is not supported. Check the `isCriticalTempSupported` member of ::zes_temp_properties_t. /// + One or both of the thresholds is not supported. Check the `isThreshold1Supported` and `isThreshold2Supported` members of ::zes_temp_properties_t. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to request this feature. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Another running process is controlling these settings. /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + One or both the thresholds is above TjMax (see ::zesFrequencyOcGetTjMax()). Temperature thresholds must be below this value. ZE_APIEXPORT ze_result_t ZE_APICALL zesTemperatureSetConfig( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. const zes_temp_config_t* pConfig ///< [in] New configuration. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the temperature from a specified sensor /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTemperature` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pTemperature` ZE_APIEXPORT ze_result_t ZE_APICALL zesTemperatureGetState( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. double* pTemperature ///< [in,out] Will contain the temperature read from the specified sensor ///< in degrees Celsius. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Sysman Extension APIs for Power Limits #if !defined(__GNUC__) #pragma region powerLimits #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_POWER_LIMITS_EXT_NAME /// @brief Power Limits Extension Name #define ZES_POWER_LIMITS_EXT_NAME "ZES_extension_power_limits" #endif // ZES_POWER_LIMITS_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Power Limits Extension Version(s) typedef enum _zes_power_limits_ext_version_t { ZES_POWER_LIMITS_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_POWER_LIMITS_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZES_POWER_LIMITS_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } zes_power_limits_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device power/current limit descriptor. typedef struct _zes_power_limit_ext_desc_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_power_level_t level; ///< [in,out] duration type over which the power draw is measured, i.e. ///< sustained, burst, peak, or critical. zes_power_source_t source; ///< [out] source of power used by the system, i.e. AC or DC. zes_limit_unit_t limitUnit; ///< [out] unit used for specifying limit, i.e. current units (milliamps) ///< or power units (milliwatts). ze_bool_t enabledStateLocked; ///< [out] indicates if the power limit state (enabled/ignored) can be set ///< (false) or is locked (true). ze_bool_t enabled; ///< [in,out] indicates if the limit is enabled (true) or ignored (false). ///< If enabledStateIsLocked is True, this value is ignored. ze_bool_t intervalValueLocked; ///< [out] indicates if the interval can be modified (false) or is fixed ///< (true). int32_t interval; ///< [in,out] power averaging window in milliseconds. If ///< intervalValueLocked is true, this value is ignored. ze_bool_t limitValueLocked; ///< [out] indicates if the limit can be set (false) or if the limit is ///< fixed (true). int32_t limit; ///< [in,out] limit value. If limitValueLocked is true, this value is ///< ignored. The value should be provided in the unit specified by ///< limitUnit. } zes_power_limit_ext_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Extension properties related to device power settings /// /// @details /// - This structure may be returned from ::zesPowerGetProperties via the /// `pNext` member of ::zes_power_properties_t. /// - This structure may also be returned from ::zesPowerGetProperties via /// the `pNext` member of ::zes_power_ext_properties_t /// - Used for determining the power domain level, i.e. card-level v/s /// package-level v/s stack-level & the factory default power limits. typedef struct _zes_power_ext_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_power_domain_t domain; ///< [out] domain that the power limit belongs to. zes_power_limit_ext_desc_t* defaultLimit; ///< [out] the factory default limit of the part. } zes_power_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get power limits /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - This function returns all the power limits associated with the /// supplied power domain. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesPowerGetLimitsExt( zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. uint32_t* pCount, ///< [in,out] Pointer to the number of power limit descriptors. If count is ///< zero, then the driver shall update the value with the total number of ///< components of this type that are available. If count is greater than ///< the number of components of this type that are available, then the ///< driver shall update the value with the correct number of components. zes_power_limit_ext_desc_t* pSustained ///< [in,out][optional][range(0, *pCount)] Array of query results for power ///< limit descriptors. If count is less than the number of components of ///< this type that are available, then the driver shall only retrieve that ///< number of components. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set power limits /// /// @details /// - The application can only modify unlocked members of the limit /// descriptors returned by ::zesPowerGetLimitsExt. /// - Not all the limits returned by ::zesPowerGetLimitsExt need to be /// supplied to this function. /// - Limits do not have to be supplied in the same order as returned by /// ::zesPowerGetLimitsExt. /// - The same limit can be supplied multiple times. Limits are applied in /// the order in which they are supplied. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + The device is in use, meaning that the GPU is under Over clocking, applying power limits under overclocking is not supported. ZE_APIEXPORT ze_result_t ZE_APICALL zesPowerSetLimitsExt( zes_pwr_handle_t hPower, ///< [in] Handle for the component. uint32_t* pCount, ///< [in] Pointer to the number of power limit descriptors. zes_power_limit_ext_desc_t* pSustained ///< [in][optional][range(0, *pCount)] Array of power limit descriptors. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Sysman Extension APIs for Engine Activity #if !defined(__GNUC__) #pragma region engineActivity #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_ENGINE_ACTIVITY_EXT_NAME /// @brief Engine Activity Extension Name #define ZES_ENGINE_ACTIVITY_EXT_NAME "ZES_extension_engine_activity" #endif // ZES_ENGINE_ACTIVITY_EXT_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Engine Activity Extension Version(s) typedef enum _zes_engine_activity_ext_version_t { ZES_ENGINE_ACTIVITY_EXT_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_ENGINE_ACTIVITY_EXT_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZES_ENGINE_ACTIVITY_EXT_VERSION_FORCE_UINT32 = 0x7fffffff } zes_engine_activity_ext_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Extension properties related to Engine Groups /// /// @details /// - This structure may be passed to ::zesEngineGetProperties by having the /// pNext member of ::zes_engine_properties_t point at this struct. /// - Used for SRIOV per Virtual Function device utilization by /// ::zes_engine_group_t typedef struct _zes_engine_ext_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t countOfVirtualFunctionInstance; ///< [out] Number of Virtual Function(VF) instances associated with engine ///< to monitor the utilization of hardware across all Virtual Function ///< from a Physical Function (PF) instance. ///< These VF-by-VF views should provide engine group and individual engine ///< level granularity. ///< This count represents the number of VF instances that are actively ///< using the resource represented by the engine handle. } zes_engine_ext_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get activity stats for Physical Function (PF) and each Virtual /// Function (VF) associated with engine group. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEngine` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE - "Engine activity extension is not supported in the environment." ZE_APIEXPORT ze_result_t ZE_APICALL zesEngineGetActivityExt( zes_engine_handle_t hEngine, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_engine_stats_t* pStats ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector with engine stat for ///< PF at index 0 of the vector followed by user provided pCount-1 number ///< of VF engine stats. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Sysman Extension APIs for RAS Get State and Clear State #if !defined(__GNUC__) #pragma region rasState #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_RAS_GET_STATE_EXP_NAME /// @brief RAS Get State Extension Name #define ZES_RAS_GET_STATE_EXP_NAME "ZES_extension_ras_state" #endif // ZES_RAS_GET_STATE_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief RAS Get State Extension Version(s) typedef enum _zes_ras_state_exp_version_t { ZES_RAS_STATE_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_RAS_STATE_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZES_RAS_STATE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zes_ras_state_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief RAS error categories typedef enum _zes_ras_error_category_exp_t { ZES_RAS_ERROR_CATEGORY_EXP_RESET = 0, ///< The number of accelerator engine resets attempted by the driver ZES_RAS_ERROR_CATEGORY_EXP_PROGRAMMING_ERRORS = 1, ///< The number of hardware exceptions generated by the way workloads have ///< programmed the hardware ZES_RAS_ERROR_CATEGORY_EXP_DRIVER_ERRORS = 2, ///< The number of low level driver communication errors have occurred ZES_RAS_ERROR_CATEGORY_EXP_COMPUTE_ERRORS = 3, ///< The number of errors that have occurred in the compute accelerator ///< hardware ZES_RAS_ERROR_CATEGORY_EXP_NON_COMPUTE_ERRORS = 4, ///< The number of errors that have occurred in the fixed-function ///< accelerator hardware ZES_RAS_ERROR_CATEGORY_EXP_CACHE_ERRORS = 5, ///< The number of errors that have occurred in caches (L1/L3/register ///< file/shared local memory/sampler) ZES_RAS_ERROR_CATEGORY_EXP_DISPLAY_ERRORS = 6, ///< The number of errors that have occurred in the display ZES_RAS_ERROR_CATEGORY_EXP_MEMORY_ERRORS = 7, ///< The number of errors that have occurred in Memory ZES_RAS_ERROR_CATEGORY_EXP_SCALE_ERRORS = 8, ///< The number of errors that have occurred in Scale Fabric ZES_RAS_ERROR_CATEGORY_EXP_L3FABRIC_ERRORS = 9, ///< The number of errors that have occurred in L3 Fabric ZES_RAS_ERROR_CATEGORY_EXP_FORCE_UINT32 = 0x7fffffff } zes_ras_error_category_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Extension structure for providing RAS error counters for different /// error sets typedef struct _zes_ras_state_exp_t { zes_ras_error_category_exp_t category; ///< [out] category for which error counter is provided. uint64_t errorCounter; ///< [out] Current value of RAS counter for specific error category. } zes_ras_state_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Ras Get State /// /// @details /// - This function retrieves error counters for different RAS error /// categories. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesRasGetStateExp( zes_ras_handle_t hRas, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of RAS state structures that can be retrieved. ///< if count is zero, then the driver shall update the value with the ///< total number of error categories for which state can be retrieved. ///< if count is greater than the number of RAS states available, then the ///< driver shall update the value with the correct number of RAS states available. zes_ras_state_exp_t* pState ///< [in,out][optional][range(0, *pCount)] array of query results for RAS ///< error states for different categories. ///< if count is less than the number of RAS states available, then driver ///< shall only retrieve that number of RAS states. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Ras Clear State /// /// @details /// - This function clears error counters for a RAS error category. /// - Clearing errors will affect other threads/applications - the counter /// values will start from zero. /// - Clearing errors requires write permissions. /// - The application should not call this function from simultaneous /// threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_RAS_ERROR_CATEGORY_EXP_L3FABRIC_ERRORS < category` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + Don't have permissions to clear error counters. ZE_APIEXPORT ze_result_t ZE_APICALL zesRasClearStateExp( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_error_category_exp_t category ///< [in] category for which error counter is to be cleared. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Sysman Extension APIs for Memory State #if !defined(__GNUC__) #pragma region memPageOfflineState #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_MEM_PAGE_OFFLINE_STATE_EXP_NAME /// @brief Memory State Extension Name #define ZES_MEM_PAGE_OFFLINE_STATE_EXP_NAME "ZES_extension_mem_state" #endif // ZES_MEM_PAGE_OFFLINE_STATE_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Memory State Extension Version(s) typedef enum _zes_mem_page_offline_state_exp_version_t { ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZES_MEM_PAGE_OFFLINE_STATE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zes_mem_page_offline_state_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Extension properties for Memory State /// /// @details /// - This structure may be returned from ::zesMemoryGetState via the /// `pNext` member of ::zes_mem_state_t /// - These additional parameters get Memory Page Offline Metrics typedef struct _zes_mem_page_offline_state_exp_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t memoryPageOffline; ///< [out] Returns the number of Memory Pages Offline uint32_t maxMemoryPageOffline; ///< [out] Returns the Allowed Memory Pages Offline } zes_mem_page_offline_state_exp_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Sysman Extension APIs for Memory Bandwidth Counter Valid Bits #if !defined(__GNUC__) #pragma region memoryBwCounterValidBits #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_MEMORY_BANDWIDTH_COUNTER_BITS_EXP_PROPERTIES_NAME /// @brief Memory Bandwidth Counter Valid Bits Extension Name #define ZES_MEMORY_BANDWIDTH_COUNTER_BITS_EXP_PROPERTIES_NAME "ZES_extension_mem_bandwidth_counter_bits_properties" #endif // ZES_MEMORY_BANDWIDTH_COUNTER_BITS_EXP_PROPERTIES_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Memory Bandwidth Counter Valid Bits Extension Version(s) typedef enum _zes_mem_bandwidth_counter_bits_exp_version_t { ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZES_MEM_BANDWIDTH_COUNTER_BITS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zes_mem_bandwidth_counter_bits_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Extension properties for reporting valid bit count for memory /// bandwidth counter value /// /// @details /// - Number of valid read and write counter bits of memory bandwidth /// - This structure may be returned from ::zesMemoryGetProperties via the /// `pNext` member of ::zes_mem_properties_t. /// - Used for denoting number of valid bits in the counter value returned /// in ::zes_mem_bandwidth_t. typedef struct _zes_mem_bandwidth_counter_bits_exp_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t validBitsCount; ///< [out] Returns the number of valid bits in the counter values } zes_mem_bandwidth_counter_bits_exp_properties_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Sysman Extension APIs for Power Domain Properties #if !defined(__GNUC__) #pragma region powerDomainProperties #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_POWER_DOMAIN_PROPERTIES_EXP_NAME /// @brief Power Domain Properties Name #define ZES_POWER_DOMAIN_PROPERTIES_EXP_NAME "ZES_extension_power_domain_properties" #endif // ZES_POWER_DOMAIN_PROPERTIES_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Power Domain Properties Extension Version(s) typedef enum _zes_power_domain_properties_exp_version_t { ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZES_POWER_DOMAIN_PROPERTIES_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zes_power_domain_properties_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Extension structure for providing power domain information associated /// with a power handle /// /// @details /// - This structure may be returned from ::zesPowerGetProperties via the /// `pNext` member of ::zes_power_properties_t. /// - Used for associating a power handle with a power domain. typedef struct _zes_power_domain_exp_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_power_domain_t powerDomain; ///< [out] Power domain associated with the power handle. } zes_power_domain_exp_properties_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Sysman Extension APIs for firmware security version #if !defined(__GNUC__) #pragma region firmwareSecurityVersion #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_FIRMWARE_SECURITY_VERSION_EXP_NAME /// @brief Firmware security version #define ZES_FIRMWARE_SECURITY_VERSION_EXP_NAME "ZES_experimental_firmware_security_version" #endif // ZES_FIRMWARE_SECURITY_VERSION_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Firmware security version Extension Version(s) typedef enum _zes_firmware_security_exp_version_t { ZES_FIRMWARE_SECURITY_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_FIRMWARE_SECURITY_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZES_FIRMWARE_SECURITY_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zes_firmware_security_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get the firmware security version number of the currently running /// firmware /// /// @details /// - The application should create a character array of size /// ::ZES_STRING_PROPERTY_SIZE and reference it for the `pVersion` /// parameter. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFirmware` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pVersion` ZE_APIEXPORT ze_result_t ZE_APICALL zesFirmwareGetSecurityVersionExp( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. char* pVersion ///< [in,out] NULL terminated string value. The string "unknown" will be ///< returned if this property cannot be determined. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set the firmware security version number /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFirmware` ZE_APIEXPORT ze_result_t ZE_APICALL zesFirmwareSetSecurityVersionExp( zes_firmware_handle_t hFirmware ///< [in] Handle for the component. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Sysman Extension APIs for Sysman Device Mapping #if !defined(__GNUC__) #pragma region sysmanDeviceMapping #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_SYSMAN_DEVICE_MAPPING_EXP_NAME /// @brief Sysman Device Mapping Extension Name #define ZES_SYSMAN_DEVICE_MAPPING_EXP_NAME "ZES_experimental_sysman_device_mapping" #endif // ZES_SYSMAN_DEVICE_MAPPING_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Sysman Device Mapping Extension Version(s) typedef enum _zes_sysman_device_mapping_exp_version_t { ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ),///< latest known version ZES_SYSMAN_DEVICE_MAPPING_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zes_sysman_device_mapping_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Sub Device Properties typedef struct _zes_subdevice_exp_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t subdeviceId; ///< [out] this gives the ID of the sub device zes_uuid_t uuid; ///< [out] universal unique identifier of the sub device. } zes_subdevice_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves sub device properties for the given sysman device handle /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceGetSubDevicePropertiesExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of sub devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub devices currently attached to the device. ///< if count is greater than the number of sub devices currently attached ///< to the device, then the driver shall update the value with the correct ///< number of sub devices. zes_subdevice_exp_properties_t* pSubdeviceProps ///< [in,out][optional][range(0, *pCount)] array of sub device property structures. ///< if count is less than the number of sysman sub devices available, then ///< the driver shall only retrieve that number of sub device property structures. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves sysman device and subdevice index for the given UUID and /// sysman driver /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phDevice` /// + `nullptr == onSubdevice` /// + `nullptr == subdeviceId` ZE_APIEXPORT ze_result_t ZE_APICALL zesDriverGetDeviceByUuidExp( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance zes_uuid_t uuid, ///< [in] universal unique identifier. zes_device_handle_t* phDevice, ///< [out] Sysman handle of the device. ze_bool_t* onSubdevice, ///< [out] True if the UUID belongs to the sub-device; false means that ///< UUID belongs to the root device. uint32_t* subdeviceId ///< [out] If onSubdevice is true, this gives the ID of the sub-device ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Sysman Extension APIs for Virtual Function Management Properties #if !defined(__GNUC__) #pragma region virtualFunctionManagement #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZES_VIRTUAL_FUNCTION_MANAGEMENT_EXP_NAME /// @brief Virtual Function Management Extension Name #define ZES_VIRTUAL_FUNCTION_MANAGEMENT_EXP_NAME "ZES_experimental_virtual_function_management" #endif // ZES_VIRTUAL_FUNCTION_MANAGEMENT_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Virtual Function Management Extension Version(s) typedef enum _zes_vf_management_exp_version_t { ZES_VF_MANAGEMENT_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 (deprecated) ZES_VF_MANAGEMENT_EXP_VERSION_1_1 = ZE_MAKE_VERSION( 1, 1 ), ///< version 1.1 (deprecated) ZES_VF_MANAGEMENT_EXP_VERSION_1_2 = ZE_MAKE_VERSION( 1, 2 ), ///< version 1.2 ZES_VF_MANAGEMENT_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 2 ), ///< latest known version ZES_VF_MANAGEMENT_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zes_vf_management_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Virtual function memory types (deprecated) typedef uint32_t zes_vf_info_mem_type_exp_flags_t; typedef enum _zes_vf_info_mem_type_exp_flag_t { ZES_VF_INFO_MEM_TYPE_EXP_FLAG_MEM_TYPE_SYSTEM = ZE_BIT(0), ///< System memory ZES_VF_INFO_MEM_TYPE_EXP_FLAG_MEM_TYPE_DEVICE = ZE_BIT(1), ///< Device local memory ZES_VF_INFO_MEM_TYPE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } zes_vf_info_mem_type_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Virtual function utilization flag bit fields (deprecated) typedef uint32_t zes_vf_info_util_exp_flags_t; typedef enum _zes_vf_info_util_exp_flag_t { ZES_VF_INFO_UTIL_EXP_FLAG_INFO_NONE = ZE_BIT(0), ///< No info associated with virtual function ZES_VF_INFO_UTIL_EXP_FLAG_INFO_MEM_CPU = ZE_BIT(1), ///< System memory utilization associated with virtual function ZES_VF_INFO_UTIL_EXP_FLAG_INFO_MEM_GPU = ZE_BIT(2), ///< Device memory utilization associated with virtual function ZES_VF_INFO_UTIL_EXP_FLAG_INFO_ENGINE = ZE_BIT(3), ///< Engine utilization associated with virtual function ZES_VF_INFO_UTIL_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } zes_vf_info_util_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Virtual function management properties (deprecated) typedef struct _zes_vf_exp_properties_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_pci_address_t address; ///< [out] Virtual function BDF address zes_uuid_t uuid; ///< [out] universal unique identifier of the device zes_vf_info_util_exp_flags_t flags; ///< [out] utilization flags available. May be 0 or a valid combination of ///< ::zes_vf_info_util_exp_flag_t. } zes_vf_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Provides memory utilization values for a virtual function (deprecated) typedef struct _zes_vf_util_mem_exp_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_vf_info_mem_type_exp_flags_t memTypeFlags; ///< [out] Memory type flags. uint64_t free; ///< [out] Free memory size in bytes. uint64_t size; ///< [out] Total allocatable memory in bytes. uint64_t timestamp; ///< [out] Wall clock time from VF when value was sampled. } zes_vf_util_mem_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Provides engine utilization values for a virtual function (deprecated) typedef struct _zes_vf_util_engine_exp_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_engine_group_t type; ///< [out] The engine group. uint64_t activeCounterValue; ///< [out] Represents active counter. uint64_t samplingCounterValue; ///< [out] Represents counter value when activeCounterValue was sampled. uint64_t timestamp; ///< [out] Wall clock time when the activeCounterValue was sampled. } zes_vf_util_engine_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Virtual function management capabilities (deprecated) typedef struct _zes_vf_exp_capabilities_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_pci_address_t address; ///< [out] Virtual function BDF address uint32_t vfDeviceMemSize; ///< [out] Virtual function memory size in kilo bytes uint32_t vfID; ///< [out] Virtual Function ID } zes_vf_exp_capabilities_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Virtual function management capabilities typedef struct _zes_vf_exp2_capabilities_t { zes_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_pci_address_t address; ///< [out] Virtual function BDF address uint64_t vfDeviceMemSize; ///< [out] Virtual function memory size in bytes uint32_t vfID; ///< [out] Virtual Function ID } zes_vf_exp2_capabilities_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Provides memory utilization values for a virtual function typedef struct _zes_vf_util_mem_exp2_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_mem_loc_t vfMemLocation; ///< [out] Location of this memory (system, device) uint64_t vfMemUtilized; ///< [out] Utilized memory size in bytes. } zes_vf_util_mem_exp2_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Provides engine utilization values for a virtual function /// /// @details /// - Percent utilization is calculated by taking two snapshots (s1, s2) and /// using the equation: %util = (s2.activeCounterValue - /// s1.activeCounterValue) / (s2.samplingCounterValue - /// s1.samplingCounterValue) typedef struct _zes_vf_util_engine_exp2_t { zes_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zes_engine_group_t vfEngineType; ///< [out] The engine group. uint64_t activeCounterValue; ///< [out] Represents active counter. uint64_t samplingCounterValue; ///< [out] Represents counter value when activeCounterValue was sampled. ///< Refer to the formulae above for calculating the utilization percent } zes_vf_util_engine_exp2_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of virtual function modules /// /// @details /// - [DEPRECATED] No longer supported. Use ::zesDeviceEnumEnabledVFExp. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumActiveVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get virtual function management properties /// /// @details /// - [DEPRECATED] No longer supported. Use /// ::zesVFManagementGetVFCapabilitiesExp. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zesVFManagementGetVFPropertiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get memory activity stats for each available memory types associated /// with Virtual Function (VF) /// /// @details /// - [DEPRECATED] No longer supported. Use /// ::zesVFManagementGetVFMemoryUtilizationExp2. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesVFManagementGetVFMemoryUtilizationExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get engine activity stats for each available engine group associated /// with Virtual Function (VF) /// /// @details /// - [DEPRECATED] No longer supported. Use /// ::zesVFManagementGetVFEngineUtilizationExp2. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesVFManagementGetVFEngineUtilizationExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Configure utilization telemetry enabled or disabled associated with /// Virtual Function (VF) /// /// @details /// - [DEPRECATED] No longer supported. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xf < flags` ZE_APIEXPORT ze_result_t ZE_APICALL zesVFManagementSetVFTelemetryModeExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. ze_bool_t enable ///< [in] Enable utilization telemetry. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Set sampling interval to monitor for a particular utilization /// telemetry associated with Virtual Function (VF) /// /// @details /// - [DEPRECATED] No longer supported. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xf < flag` ZE_APIEXPORT ze_result_t ZE_APICALL zesVFManagementSetVFTelemetrySamplingIntervalExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. uint64_t samplingInterval ///< [in] Sampling interval value. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of virtual function modules /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesDeviceEnumEnabledVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get virtual function management capabilities /// /// @details /// - [DEPRECATED] No longer supported. Use /// ::zesVFManagementGetVFCapabilitiesExp2. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCapability` ZE_APIEXPORT ze_result_t ZE_APICALL zesVFManagementGetVFCapabilitiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get memory activity stats for each available memory types associated /// with Virtual Function (VF) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - If VF is disable/pause/not active, utilization will give zero value. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesVFManagementGetVFMemoryUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get engine activity stats for each available engine group associated /// with Virtual Function (VF) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - If VF is disable/pause/not active, utilization will give zero value. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zesVFManagementGetVFEngineUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get virtual function management capabilities /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCapability` ZE_APIEXPORT ze_result_t ZE_APICALL zesVFManagementGetVFCapabilitiesExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp2_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ); #if !defined(__GNUC__) #pragma endregion #endif #if defined(__cplusplus) } // extern "C" #endif #endif // _ZES_API_Hlevel-zero-1.20.6/include/zes_ddi.h000066400000000000000000002435141475521542100171200ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_ddi.h * @version v1.12-r1.12.15 * */ #ifndef _ZES_DDI_H #define _ZES_DDI_H #if defined(__cplusplus) #pragma once #endif #include "zes_api.h" #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesInit typedef ze_result_t (ZE_APICALL *zes_pfnInit_t)( zes_init_flags_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Global functions pointers typedef struct _zes_global_dditable_t { zes_pfnInit_t pfnInit; } zes_global_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Global table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetGlobalProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_global_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetGlobalProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetGlobalProcAddrTable_t)( ze_api_version_t, zes_global_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnDeviceGetProperties_t)( zes_device_handle_t, zes_device_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceGetState typedef ze_result_t (ZE_APICALL *zes_pfnDeviceGetState_t)( zes_device_handle_t, zes_device_state_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceReset typedef ze_result_t (ZE_APICALL *zes_pfnDeviceReset_t)( zes_device_handle_t, ze_bool_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceProcessesGetState typedef ze_result_t (ZE_APICALL *zes_pfnDeviceProcessesGetState_t)( zes_device_handle_t, uint32_t*, zes_process_state_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDevicePciGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnDevicePciGetProperties_t)( zes_device_handle_t, zes_pci_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDevicePciGetState typedef ze_result_t (ZE_APICALL *zes_pfnDevicePciGetState_t)( zes_device_handle_t, zes_pci_state_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDevicePciGetBars typedef ze_result_t (ZE_APICALL *zes_pfnDevicePciGetBars_t)( zes_device_handle_t, uint32_t*, zes_pci_bar_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDevicePciGetStats typedef ze_result_t (ZE_APICALL *zes_pfnDevicePciGetStats_t)( zes_device_handle_t, zes_pci_stats_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumDiagnosticTestSuites typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumDiagnosticTestSuites_t)( zes_device_handle_t, uint32_t*, zes_diag_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumEngineGroups typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumEngineGroups_t)( zes_device_handle_t, uint32_t*, zes_engine_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEventRegister typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEventRegister_t)( zes_device_handle_t, zes_event_type_flags_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumFabricPorts typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumFabricPorts_t)( zes_device_handle_t, uint32_t*, zes_fabric_port_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumFans typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumFans_t)( zes_device_handle_t, uint32_t*, zes_fan_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumFirmwares typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumFirmwares_t)( zes_device_handle_t, uint32_t*, zes_firmware_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumFrequencyDomains typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumFrequencyDomains_t)( zes_device_handle_t, uint32_t*, zes_freq_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumLeds typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumLeds_t)( zes_device_handle_t, uint32_t*, zes_led_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumMemoryModules typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumMemoryModules_t)( zes_device_handle_t, uint32_t*, zes_mem_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumPerformanceFactorDomains typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumPerformanceFactorDomains_t)( zes_device_handle_t, uint32_t*, zes_perf_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumPowerDomains typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumPowerDomains_t)( zes_device_handle_t, uint32_t*, zes_pwr_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceGetCardPowerDomain typedef ze_result_t (ZE_APICALL *zes_pfnDeviceGetCardPowerDomain_t)( zes_device_handle_t, zes_pwr_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumPsus typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumPsus_t)( zes_device_handle_t, uint32_t*, zes_psu_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumRasErrorSets typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumRasErrorSets_t)( zes_device_handle_t, uint32_t*, zes_ras_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumSchedulers typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumSchedulers_t)( zes_device_handle_t, uint32_t*, zes_sched_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumStandbyDomains typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumStandbyDomains_t)( zes_device_handle_t, uint32_t*, zes_standby_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumTemperatureSensors typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumTemperatureSensors_t)( zes_device_handle_t, uint32_t*, zes_temp_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEccAvailable typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEccAvailable_t)( zes_device_handle_t, ze_bool_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEccConfigurable typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEccConfigurable_t)( zes_device_handle_t, ze_bool_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceGetEccState typedef ze_result_t (ZE_APICALL *zes_pfnDeviceGetEccState_t)( zes_device_handle_t, zes_device_ecc_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceSetEccState typedef ze_result_t (ZE_APICALL *zes_pfnDeviceSetEccState_t)( zes_device_handle_t, const zes_device_ecc_desc_t*, zes_device_ecc_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceGet typedef ze_result_t (ZE_APICALL *zes_pfnDeviceGet_t)( zes_driver_handle_t, uint32_t*, zes_device_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceSetOverclockWaiver typedef ze_result_t (ZE_APICALL *zes_pfnDeviceSetOverclockWaiver_t)( zes_device_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceGetOverclockDomains typedef ze_result_t (ZE_APICALL *zes_pfnDeviceGetOverclockDomains_t)( zes_device_handle_t, uint32_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceGetOverclockControls typedef ze_result_t (ZE_APICALL *zes_pfnDeviceGetOverclockControls_t)( zes_device_handle_t, zes_overclock_domain_t, uint32_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceResetOverclockSettings typedef ze_result_t (ZE_APICALL *zes_pfnDeviceResetOverclockSettings_t)( zes_device_handle_t, ze_bool_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceReadOverclockState typedef ze_result_t (ZE_APICALL *zes_pfnDeviceReadOverclockState_t)( zes_device_handle_t, zes_overclock_mode_t*, ze_bool_t*, ze_bool_t*, zes_pending_action_t*, ze_bool_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumOverclockDomains typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumOverclockDomains_t)( zes_device_handle_t, uint32_t*, zes_overclock_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceResetExt typedef ze_result_t (ZE_APICALL *zes_pfnDeviceResetExt_t)( zes_device_handle_t, zes_reset_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Device functions pointers typedef struct _zes_device_dditable_t { zes_pfnDeviceGetProperties_t pfnGetProperties; zes_pfnDeviceGetState_t pfnGetState; zes_pfnDeviceReset_t pfnReset; zes_pfnDeviceProcessesGetState_t pfnProcessesGetState; zes_pfnDevicePciGetProperties_t pfnPciGetProperties; zes_pfnDevicePciGetState_t pfnPciGetState; zes_pfnDevicePciGetBars_t pfnPciGetBars; zes_pfnDevicePciGetStats_t pfnPciGetStats; zes_pfnDeviceEnumDiagnosticTestSuites_t pfnEnumDiagnosticTestSuites; zes_pfnDeviceEnumEngineGroups_t pfnEnumEngineGroups; zes_pfnDeviceEventRegister_t pfnEventRegister; zes_pfnDeviceEnumFabricPorts_t pfnEnumFabricPorts; zes_pfnDeviceEnumFans_t pfnEnumFans; zes_pfnDeviceEnumFirmwares_t pfnEnumFirmwares; zes_pfnDeviceEnumFrequencyDomains_t pfnEnumFrequencyDomains; zes_pfnDeviceEnumLeds_t pfnEnumLeds; zes_pfnDeviceEnumMemoryModules_t pfnEnumMemoryModules; zes_pfnDeviceEnumPerformanceFactorDomains_t pfnEnumPerformanceFactorDomains; zes_pfnDeviceEnumPowerDomains_t pfnEnumPowerDomains; zes_pfnDeviceGetCardPowerDomain_t pfnGetCardPowerDomain; zes_pfnDeviceEnumPsus_t pfnEnumPsus; zes_pfnDeviceEnumRasErrorSets_t pfnEnumRasErrorSets; zes_pfnDeviceEnumSchedulers_t pfnEnumSchedulers; zes_pfnDeviceEnumStandbyDomains_t pfnEnumStandbyDomains; zes_pfnDeviceEnumTemperatureSensors_t pfnEnumTemperatureSensors; zes_pfnDeviceEccAvailable_t pfnEccAvailable; zes_pfnDeviceEccConfigurable_t pfnEccConfigurable; zes_pfnDeviceGetEccState_t pfnGetEccState; zes_pfnDeviceSetEccState_t pfnSetEccState; zes_pfnDeviceGet_t pfnGet; zes_pfnDeviceSetOverclockWaiver_t pfnSetOverclockWaiver; zes_pfnDeviceGetOverclockDomains_t pfnGetOverclockDomains; zes_pfnDeviceGetOverclockControls_t pfnGetOverclockControls; zes_pfnDeviceResetOverclockSettings_t pfnResetOverclockSettings; zes_pfnDeviceReadOverclockState_t pfnReadOverclockState; zes_pfnDeviceEnumOverclockDomains_t pfnEnumOverclockDomains; zes_pfnDeviceResetExt_t pfnResetExt; } zes_device_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetDeviceProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetDeviceProcAddrTable_t)( ze_api_version_t, zes_device_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceGetSubDevicePropertiesExp typedef ze_result_t (ZE_APICALL *zes_pfnDeviceGetSubDevicePropertiesExp_t)( zes_device_handle_t, uint32_t*, zes_subdevice_exp_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumActiveVFExp typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumActiveVFExp_t)( zes_device_handle_t, uint32_t*, zes_vf_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDeviceEnumEnabledVFExp typedef ze_result_t (ZE_APICALL *zes_pfnDeviceEnumEnabledVFExp_t)( zes_device_handle_t, uint32_t*, zes_vf_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of DeviceExp functions pointers typedef struct _zes_device_exp_dditable_t { zes_pfnDeviceGetSubDevicePropertiesExp_t pfnGetSubDevicePropertiesExp; zes_pfnDeviceEnumActiveVFExp_t pfnEnumActiveVFExp; zes_pfnDeviceEnumEnabledVFExp_t pfnEnumEnabledVFExp; } zes_device_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetDeviceExpProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetDeviceExpProcAddrTable_t)( ze_api_version_t, zes_device_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDriverEventListen typedef ze_result_t (ZE_APICALL *zes_pfnDriverEventListen_t)( ze_driver_handle_t, uint32_t, uint32_t, zes_device_handle_t*, uint32_t*, zes_event_type_flags_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDriverEventListenEx typedef ze_result_t (ZE_APICALL *zes_pfnDriverEventListenEx_t)( ze_driver_handle_t, uint64_t, uint32_t, zes_device_handle_t*, uint32_t*, zes_event_type_flags_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDriverGet typedef ze_result_t (ZE_APICALL *zes_pfnDriverGet_t)( uint32_t*, zes_driver_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDriverGetExtensionProperties typedef ze_result_t (ZE_APICALL *zes_pfnDriverGetExtensionProperties_t)( zes_driver_handle_t, uint32_t*, zes_driver_extension_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDriverGetExtensionFunctionAddress typedef ze_result_t (ZE_APICALL *zes_pfnDriverGetExtensionFunctionAddress_t)( zes_driver_handle_t, const char*, void** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Driver functions pointers typedef struct _zes_driver_dditable_t { zes_pfnDriverEventListen_t pfnEventListen; zes_pfnDriverEventListenEx_t pfnEventListenEx; zes_pfnDriverGet_t pfnGet; zes_pfnDriverGetExtensionProperties_t pfnGetExtensionProperties; zes_pfnDriverGetExtensionFunctionAddress_t pfnGetExtensionFunctionAddress; } zes_driver_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Driver table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDriverProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_driver_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetDriverProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetDriverProcAddrTable_t)( ze_api_version_t, zes_driver_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDriverGetDeviceByUuidExp typedef ze_result_t (ZE_APICALL *zes_pfnDriverGetDeviceByUuidExp_t)( zes_driver_handle_t, zes_uuid_t, zes_device_handle_t*, ze_bool_t*, uint32_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of DriverExp functions pointers typedef struct _zes_driver_exp_dditable_t { zes_pfnDriverGetDeviceByUuidExp_t pfnGetDeviceByUuidExp; } zes_driver_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DriverExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDriverExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_driver_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetDriverExpProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetDriverExpProcAddrTable_t)( ze_api_version_t, zes_driver_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesOverclockGetDomainProperties typedef ze_result_t (ZE_APICALL *zes_pfnOverclockGetDomainProperties_t)( zes_overclock_handle_t, zes_overclock_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesOverclockGetDomainVFProperties typedef ze_result_t (ZE_APICALL *zes_pfnOverclockGetDomainVFProperties_t)( zes_overclock_handle_t, zes_vf_property_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesOverclockGetDomainControlProperties typedef ze_result_t (ZE_APICALL *zes_pfnOverclockGetDomainControlProperties_t)( zes_overclock_handle_t, zes_overclock_control_t, zes_control_property_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesOverclockGetControlCurrentValue typedef ze_result_t (ZE_APICALL *zes_pfnOverclockGetControlCurrentValue_t)( zes_overclock_handle_t, zes_overclock_control_t, double* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesOverclockGetControlPendingValue typedef ze_result_t (ZE_APICALL *zes_pfnOverclockGetControlPendingValue_t)( zes_overclock_handle_t, zes_overclock_control_t, double* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesOverclockSetControlUserValue typedef ze_result_t (ZE_APICALL *zes_pfnOverclockSetControlUserValue_t)( zes_overclock_handle_t, zes_overclock_control_t, double, zes_pending_action_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesOverclockGetControlState typedef ze_result_t (ZE_APICALL *zes_pfnOverclockGetControlState_t)( zes_overclock_handle_t, zes_overclock_control_t, zes_control_state_t*, zes_pending_action_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesOverclockGetVFPointValues typedef ze_result_t (ZE_APICALL *zes_pfnOverclockGetVFPointValues_t)( zes_overclock_handle_t, zes_vf_type_t, zes_vf_array_type_t, uint32_t, uint32_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesOverclockSetVFPointValues typedef ze_result_t (ZE_APICALL *zes_pfnOverclockSetVFPointValues_t)( zes_overclock_handle_t, zes_vf_type_t, uint32_t, uint32_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Overclock functions pointers typedef struct _zes_overclock_dditable_t { zes_pfnOverclockGetDomainProperties_t pfnGetDomainProperties; zes_pfnOverclockGetDomainVFProperties_t pfnGetDomainVFProperties; zes_pfnOverclockGetDomainControlProperties_t pfnGetDomainControlProperties; zes_pfnOverclockGetControlCurrentValue_t pfnGetControlCurrentValue; zes_pfnOverclockGetControlPendingValue_t pfnGetControlPendingValue; zes_pfnOverclockSetControlUserValue_t pfnSetControlUserValue; zes_pfnOverclockGetControlState_t pfnGetControlState; zes_pfnOverclockGetVFPointValues_t pfnGetVFPointValues; zes_pfnOverclockSetVFPointValues_t pfnSetVFPointValues; } zes_overclock_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Overclock table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetOverclockProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_overclock_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetOverclockProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetOverclockProcAddrTable_t)( ze_api_version_t, zes_overclock_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesSchedulerGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnSchedulerGetProperties_t)( zes_sched_handle_t, zes_sched_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesSchedulerGetCurrentMode typedef ze_result_t (ZE_APICALL *zes_pfnSchedulerGetCurrentMode_t)( zes_sched_handle_t, zes_sched_mode_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesSchedulerGetTimeoutModeProperties typedef ze_result_t (ZE_APICALL *zes_pfnSchedulerGetTimeoutModeProperties_t)( zes_sched_handle_t, ze_bool_t, zes_sched_timeout_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesSchedulerGetTimesliceModeProperties typedef ze_result_t (ZE_APICALL *zes_pfnSchedulerGetTimesliceModeProperties_t)( zes_sched_handle_t, ze_bool_t, zes_sched_timeslice_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesSchedulerSetTimeoutMode typedef ze_result_t (ZE_APICALL *zes_pfnSchedulerSetTimeoutMode_t)( zes_sched_handle_t, zes_sched_timeout_properties_t*, ze_bool_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesSchedulerSetTimesliceMode typedef ze_result_t (ZE_APICALL *zes_pfnSchedulerSetTimesliceMode_t)( zes_sched_handle_t, zes_sched_timeslice_properties_t*, ze_bool_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesSchedulerSetExclusiveMode typedef ze_result_t (ZE_APICALL *zes_pfnSchedulerSetExclusiveMode_t)( zes_sched_handle_t, ze_bool_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesSchedulerSetComputeUnitDebugMode typedef ze_result_t (ZE_APICALL *zes_pfnSchedulerSetComputeUnitDebugMode_t)( zes_sched_handle_t, ze_bool_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Scheduler functions pointers typedef struct _zes_scheduler_dditable_t { zes_pfnSchedulerGetProperties_t pfnGetProperties; zes_pfnSchedulerGetCurrentMode_t pfnGetCurrentMode; zes_pfnSchedulerGetTimeoutModeProperties_t pfnGetTimeoutModeProperties; zes_pfnSchedulerGetTimesliceModeProperties_t pfnGetTimesliceModeProperties; zes_pfnSchedulerSetTimeoutMode_t pfnSetTimeoutMode; zes_pfnSchedulerSetTimesliceMode_t pfnSetTimesliceMode; zes_pfnSchedulerSetExclusiveMode_t pfnSetExclusiveMode; zes_pfnSchedulerSetComputeUnitDebugMode_t pfnSetComputeUnitDebugMode; } zes_scheduler_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Scheduler table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetSchedulerProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_scheduler_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetSchedulerProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetSchedulerProcAddrTable_t)( ze_api_version_t, zes_scheduler_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPerformanceFactorGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnPerformanceFactorGetProperties_t)( zes_perf_handle_t, zes_perf_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPerformanceFactorGetConfig typedef ze_result_t (ZE_APICALL *zes_pfnPerformanceFactorGetConfig_t)( zes_perf_handle_t, double* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPerformanceFactorSetConfig typedef ze_result_t (ZE_APICALL *zes_pfnPerformanceFactorSetConfig_t)( zes_perf_handle_t, double ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of PerformanceFactor functions pointers typedef struct _zes_performance_factor_dditable_t { zes_pfnPerformanceFactorGetProperties_t pfnGetProperties; zes_pfnPerformanceFactorGetConfig_t pfnGetConfig; zes_pfnPerformanceFactorSetConfig_t pfnSetConfig; } zes_performance_factor_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's PerformanceFactor table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetPerformanceFactorProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_performance_factor_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetPerformanceFactorProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetPerformanceFactorProcAddrTable_t)( ze_api_version_t, zes_performance_factor_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPowerGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnPowerGetProperties_t)( zes_pwr_handle_t, zes_power_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPowerGetEnergyCounter typedef ze_result_t (ZE_APICALL *zes_pfnPowerGetEnergyCounter_t)( zes_pwr_handle_t, zes_power_energy_counter_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPowerGetLimits typedef ze_result_t (ZE_APICALL *zes_pfnPowerGetLimits_t)( zes_pwr_handle_t, zes_power_sustained_limit_t*, zes_power_burst_limit_t*, zes_power_peak_limit_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPowerSetLimits typedef ze_result_t (ZE_APICALL *zes_pfnPowerSetLimits_t)( zes_pwr_handle_t, const zes_power_sustained_limit_t*, const zes_power_burst_limit_t*, const zes_power_peak_limit_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPowerGetEnergyThreshold typedef ze_result_t (ZE_APICALL *zes_pfnPowerGetEnergyThreshold_t)( zes_pwr_handle_t, zes_energy_threshold_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPowerSetEnergyThreshold typedef ze_result_t (ZE_APICALL *zes_pfnPowerSetEnergyThreshold_t)( zes_pwr_handle_t, double ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPowerGetLimitsExt typedef ze_result_t (ZE_APICALL *zes_pfnPowerGetLimitsExt_t)( zes_pwr_handle_t, uint32_t*, zes_power_limit_ext_desc_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPowerSetLimitsExt typedef ze_result_t (ZE_APICALL *zes_pfnPowerSetLimitsExt_t)( zes_pwr_handle_t, uint32_t*, zes_power_limit_ext_desc_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Power functions pointers typedef struct _zes_power_dditable_t { zes_pfnPowerGetProperties_t pfnGetProperties; zes_pfnPowerGetEnergyCounter_t pfnGetEnergyCounter; zes_pfnPowerGetLimits_t pfnGetLimits; zes_pfnPowerSetLimits_t pfnSetLimits; zes_pfnPowerGetEnergyThreshold_t pfnGetEnergyThreshold; zes_pfnPowerSetEnergyThreshold_t pfnSetEnergyThreshold; zes_pfnPowerGetLimitsExt_t pfnGetLimitsExt; zes_pfnPowerSetLimitsExt_t pfnSetLimitsExt; } zes_power_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Power table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetPowerProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_power_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetPowerProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetPowerProcAddrTable_t)( ze_api_version_t, zes_power_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyGetProperties_t)( zes_freq_handle_t, zes_freq_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyGetAvailableClocks typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyGetAvailableClocks_t)( zes_freq_handle_t, uint32_t*, double* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyGetRange typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyGetRange_t)( zes_freq_handle_t, zes_freq_range_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencySetRange typedef ze_result_t (ZE_APICALL *zes_pfnFrequencySetRange_t)( zes_freq_handle_t, const zes_freq_range_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyGetState typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyGetState_t)( zes_freq_handle_t, zes_freq_state_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyGetThrottleTime typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyGetThrottleTime_t)( zes_freq_handle_t, zes_freq_throttle_time_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyOcGetCapabilities typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyOcGetCapabilities_t)( zes_freq_handle_t, zes_oc_capabilities_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyOcGetFrequencyTarget typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyOcGetFrequencyTarget_t)( zes_freq_handle_t, double* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyOcSetFrequencyTarget typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyOcSetFrequencyTarget_t)( zes_freq_handle_t, double ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyOcGetVoltageTarget typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyOcGetVoltageTarget_t)( zes_freq_handle_t, double*, double* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyOcSetVoltageTarget typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyOcSetVoltageTarget_t)( zes_freq_handle_t, double, double ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyOcSetMode typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyOcSetMode_t)( zes_freq_handle_t, zes_oc_mode_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyOcGetMode typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyOcGetMode_t)( zes_freq_handle_t, zes_oc_mode_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyOcGetIccMax typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyOcGetIccMax_t)( zes_freq_handle_t, double* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyOcSetIccMax typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyOcSetIccMax_t)( zes_freq_handle_t, double ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyOcGetTjMax typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyOcGetTjMax_t)( zes_freq_handle_t, double* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFrequencyOcSetTjMax typedef ze_result_t (ZE_APICALL *zes_pfnFrequencyOcSetTjMax_t)( zes_freq_handle_t, double ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Frequency functions pointers typedef struct _zes_frequency_dditable_t { zes_pfnFrequencyGetProperties_t pfnGetProperties; zes_pfnFrequencyGetAvailableClocks_t pfnGetAvailableClocks; zes_pfnFrequencyGetRange_t pfnGetRange; zes_pfnFrequencySetRange_t pfnSetRange; zes_pfnFrequencyGetState_t pfnGetState; zes_pfnFrequencyGetThrottleTime_t pfnGetThrottleTime; zes_pfnFrequencyOcGetCapabilities_t pfnOcGetCapabilities; zes_pfnFrequencyOcGetFrequencyTarget_t pfnOcGetFrequencyTarget; zes_pfnFrequencyOcSetFrequencyTarget_t pfnOcSetFrequencyTarget; zes_pfnFrequencyOcGetVoltageTarget_t pfnOcGetVoltageTarget; zes_pfnFrequencyOcSetVoltageTarget_t pfnOcSetVoltageTarget; zes_pfnFrequencyOcSetMode_t pfnOcSetMode; zes_pfnFrequencyOcGetMode_t pfnOcGetMode; zes_pfnFrequencyOcGetIccMax_t pfnOcGetIccMax; zes_pfnFrequencyOcSetIccMax_t pfnOcSetIccMax; zes_pfnFrequencyOcGetTjMax_t pfnOcGetTjMax; zes_pfnFrequencyOcSetTjMax_t pfnOcSetTjMax; } zes_frequency_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Frequency table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFrequencyProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_frequency_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetFrequencyProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetFrequencyProcAddrTable_t)( ze_api_version_t, zes_frequency_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesEngineGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnEngineGetProperties_t)( zes_engine_handle_t, zes_engine_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesEngineGetActivity typedef ze_result_t (ZE_APICALL *zes_pfnEngineGetActivity_t)( zes_engine_handle_t, zes_engine_stats_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesEngineGetActivityExt typedef ze_result_t (ZE_APICALL *zes_pfnEngineGetActivityExt_t)( zes_engine_handle_t, uint32_t*, zes_engine_stats_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Engine functions pointers typedef struct _zes_engine_dditable_t { zes_pfnEngineGetProperties_t pfnGetProperties; zes_pfnEngineGetActivity_t pfnGetActivity; zes_pfnEngineGetActivityExt_t pfnGetActivityExt; } zes_engine_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Engine table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetEngineProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_engine_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetEngineProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetEngineProcAddrTable_t)( ze_api_version_t, zes_engine_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesStandbyGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnStandbyGetProperties_t)( zes_standby_handle_t, zes_standby_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesStandbyGetMode typedef ze_result_t (ZE_APICALL *zes_pfnStandbyGetMode_t)( zes_standby_handle_t, zes_standby_promo_mode_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesStandbySetMode typedef ze_result_t (ZE_APICALL *zes_pfnStandbySetMode_t)( zes_standby_handle_t, zes_standby_promo_mode_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Standby functions pointers typedef struct _zes_standby_dditable_t { zes_pfnStandbyGetProperties_t pfnGetProperties; zes_pfnStandbyGetMode_t pfnGetMode; zes_pfnStandbySetMode_t pfnSetMode; } zes_standby_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Standby table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetStandbyProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_standby_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetStandbyProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetStandbyProcAddrTable_t)( ze_api_version_t, zes_standby_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFirmwareGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnFirmwareGetProperties_t)( zes_firmware_handle_t, zes_firmware_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFirmwareFlash typedef ze_result_t (ZE_APICALL *zes_pfnFirmwareFlash_t)( zes_firmware_handle_t, void*, uint32_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFirmwareGetFlashProgress typedef ze_result_t (ZE_APICALL *zes_pfnFirmwareGetFlashProgress_t)( zes_firmware_handle_t, uint32_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFirmwareGetConsoleLogs typedef ze_result_t (ZE_APICALL *zes_pfnFirmwareGetConsoleLogs_t)( zes_firmware_handle_t, size_t*, char* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Firmware functions pointers typedef struct _zes_firmware_dditable_t { zes_pfnFirmwareGetProperties_t pfnGetProperties; zes_pfnFirmwareFlash_t pfnFlash; zes_pfnFirmwareGetFlashProgress_t pfnGetFlashProgress; zes_pfnFirmwareGetConsoleLogs_t pfnGetConsoleLogs; } zes_firmware_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Firmware table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFirmwareProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_firmware_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetFirmwareProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetFirmwareProcAddrTable_t)( ze_api_version_t, zes_firmware_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFirmwareGetSecurityVersionExp typedef ze_result_t (ZE_APICALL *zes_pfnFirmwareGetSecurityVersionExp_t)( zes_firmware_handle_t, char* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFirmwareSetSecurityVersionExp typedef ze_result_t (ZE_APICALL *zes_pfnFirmwareSetSecurityVersionExp_t)( zes_firmware_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of FirmwareExp functions pointers typedef struct _zes_firmware_exp_dditable_t { zes_pfnFirmwareGetSecurityVersionExp_t pfnGetSecurityVersionExp; zes_pfnFirmwareSetSecurityVersionExp_t pfnSetSecurityVersionExp; } zes_firmware_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FirmwareExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFirmwareExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_firmware_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetFirmwareExpProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetFirmwareExpProcAddrTable_t)( ze_api_version_t, zes_firmware_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesMemoryGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnMemoryGetProperties_t)( zes_mem_handle_t, zes_mem_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesMemoryGetState typedef ze_result_t (ZE_APICALL *zes_pfnMemoryGetState_t)( zes_mem_handle_t, zes_mem_state_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesMemoryGetBandwidth typedef ze_result_t (ZE_APICALL *zes_pfnMemoryGetBandwidth_t)( zes_mem_handle_t, zes_mem_bandwidth_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Memory functions pointers typedef struct _zes_memory_dditable_t { zes_pfnMemoryGetProperties_t pfnGetProperties; zes_pfnMemoryGetState_t pfnGetState; zes_pfnMemoryGetBandwidth_t pfnGetBandwidth; } zes_memory_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Memory table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetMemoryProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_memory_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetMemoryProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetMemoryProcAddrTable_t)( ze_api_version_t, zes_memory_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFabricPortGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnFabricPortGetProperties_t)( zes_fabric_port_handle_t, zes_fabric_port_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFabricPortGetLinkType typedef ze_result_t (ZE_APICALL *zes_pfnFabricPortGetLinkType_t)( zes_fabric_port_handle_t, zes_fabric_link_type_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFabricPortGetConfig typedef ze_result_t (ZE_APICALL *zes_pfnFabricPortGetConfig_t)( zes_fabric_port_handle_t, zes_fabric_port_config_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFabricPortSetConfig typedef ze_result_t (ZE_APICALL *zes_pfnFabricPortSetConfig_t)( zes_fabric_port_handle_t, const zes_fabric_port_config_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFabricPortGetState typedef ze_result_t (ZE_APICALL *zes_pfnFabricPortGetState_t)( zes_fabric_port_handle_t, zes_fabric_port_state_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFabricPortGetThroughput typedef ze_result_t (ZE_APICALL *zes_pfnFabricPortGetThroughput_t)( zes_fabric_port_handle_t, zes_fabric_port_throughput_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFabricPortGetFabricErrorCounters typedef ze_result_t (ZE_APICALL *zes_pfnFabricPortGetFabricErrorCounters_t)( zes_fabric_port_handle_t, zes_fabric_port_error_counters_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFabricPortGetMultiPortThroughput typedef ze_result_t (ZE_APICALL *zes_pfnFabricPortGetMultiPortThroughput_t)( zes_device_handle_t, uint32_t, zes_fabric_port_handle_t*, zes_fabric_port_throughput_t** ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of FabricPort functions pointers typedef struct _zes_fabric_port_dditable_t { zes_pfnFabricPortGetProperties_t pfnGetProperties; zes_pfnFabricPortGetLinkType_t pfnGetLinkType; zes_pfnFabricPortGetConfig_t pfnGetConfig; zes_pfnFabricPortSetConfig_t pfnSetConfig; zes_pfnFabricPortGetState_t pfnGetState; zes_pfnFabricPortGetThroughput_t pfnGetThroughput; zes_pfnFabricPortGetFabricErrorCounters_t pfnGetFabricErrorCounters; zes_pfnFabricPortGetMultiPortThroughput_t pfnGetMultiPortThroughput; } zes_fabric_port_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricPort table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFabricPortProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_fabric_port_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetFabricPortProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetFabricPortProcAddrTable_t)( ze_api_version_t, zes_fabric_port_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesTemperatureGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnTemperatureGetProperties_t)( zes_temp_handle_t, zes_temp_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesTemperatureGetConfig typedef ze_result_t (ZE_APICALL *zes_pfnTemperatureGetConfig_t)( zes_temp_handle_t, zes_temp_config_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesTemperatureSetConfig typedef ze_result_t (ZE_APICALL *zes_pfnTemperatureSetConfig_t)( zes_temp_handle_t, const zes_temp_config_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesTemperatureGetState typedef ze_result_t (ZE_APICALL *zes_pfnTemperatureGetState_t)( zes_temp_handle_t, double* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Temperature functions pointers typedef struct _zes_temperature_dditable_t { zes_pfnTemperatureGetProperties_t pfnGetProperties; zes_pfnTemperatureGetConfig_t pfnGetConfig; zes_pfnTemperatureSetConfig_t pfnSetConfig; zes_pfnTemperatureGetState_t pfnGetState; } zes_temperature_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Temperature table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetTemperatureProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_temperature_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetTemperatureProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetTemperatureProcAddrTable_t)( ze_api_version_t, zes_temperature_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPsuGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnPsuGetProperties_t)( zes_psu_handle_t, zes_psu_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesPsuGetState typedef ze_result_t (ZE_APICALL *zes_pfnPsuGetState_t)( zes_psu_handle_t, zes_psu_state_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Psu functions pointers typedef struct _zes_psu_dditable_t { zes_pfnPsuGetProperties_t pfnGetProperties; zes_pfnPsuGetState_t pfnGetState; } zes_psu_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Psu table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetPsuProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_psu_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetPsuProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetPsuProcAddrTable_t)( ze_api_version_t, zes_psu_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFanGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnFanGetProperties_t)( zes_fan_handle_t, zes_fan_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFanGetConfig typedef ze_result_t (ZE_APICALL *zes_pfnFanGetConfig_t)( zes_fan_handle_t, zes_fan_config_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFanSetDefaultMode typedef ze_result_t (ZE_APICALL *zes_pfnFanSetDefaultMode_t)( zes_fan_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFanSetFixedSpeedMode typedef ze_result_t (ZE_APICALL *zes_pfnFanSetFixedSpeedMode_t)( zes_fan_handle_t, const zes_fan_speed_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFanSetSpeedTableMode typedef ze_result_t (ZE_APICALL *zes_pfnFanSetSpeedTableMode_t)( zes_fan_handle_t, const zes_fan_speed_table_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesFanGetState typedef ze_result_t (ZE_APICALL *zes_pfnFanGetState_t)( zes_fan_handle_t, zes_fan_speed_units_t, int32_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Fan functions pointers typedef struct _zes_fan_dditable_t { zes_pfnFanGetProperties_t pfnGetProperties; zes_pfnFanGetConfig_t pfnGetConfig; zes_pfnFanSetDefaultMode_t pfnSetDefaultMode; zes_pfnFanSetFixedSpeedMode_t pfnSetFixedSpeedMode; zes_pfnFanSetSpeedTableMode_t pfnSetSpeedTableMode; zes_pfnFanGetState_t pfnGetState; } zes_fan_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Fan table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFanProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_fan_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetFanProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetFanProcAddrTable_t)( ze_api_version_t, zes_fan_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesLedGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnLedGetProperties_t)( zes_led_handle_t, zes_led_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesLedGetState typedef ze_result_t (ZE_APICALL *zes_pfnLedGetState_t)( zes_led_handle_t, zes_led_state_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesLedSetState typedef ze_result_t (ZE_APICALL *zes_pfnLedSetState_t)( zes_led_handle_t, ze_bool_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesLedSetColor typedef ze_result_t (ZE_APICALL *zes_pfnLedSetColor_t)( zes_led_handle_t, const zes_led_color_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Led functions pointers typedef struct _zes_led_dditable_t { zes_pfnLedGetProperties_t pfnGetProperties; zes_pfnLedGetState_t pfnGetState; zes_pfnLedSetState_t pfnSetState; zes_pfnLedSetColor_t pfnSetColor; } zes_led_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Led table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetLedProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_led_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetLedProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetLedProcAddrTable_t)( ze_api_version_t, zes_led_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesRasGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnRasGetProperties_t)( zes_ras_handle_t, zes_ras_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesRasGetConfig typedef ze_result_t (ZE_APICALL *zes_pfnRasGetConfig_t)( zes_ras_handle_t, zes_ras_config_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesRasSetConfig typedef ze_result_t (ZE_APICALL *zes_pfnRasSetConfig_t)( zes_ras_handle_t, const zes_ras_config_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesRasGetState typedef ze_result_t (ZE_APICALL *zes_pfnRasGetState_t)( zes_ras_handle_t, ze_bool_t, zes_ras_state_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Ras functions pointers typedef struct _zes_ras_dditable_t { zes_pfnRasGetProperties_t pfnGetProperties; zes_pfnRasGetConfig_t pfnGetConfig; zes_pfnRasSetConfig_t pfnSetConfig; zes_pfnRasGetState_t pfnGetState; } zes_ras_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Ras table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetRasProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_ras_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetRasProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetRasProcAddrTable_t)( ze_api_version_t, zes_ras_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesRasGetStateExp typedef ze_result_t (ZE_APICALL *zes_pfnRasGetStateExp_t)( zes_ras_handle_t, uint32_t*, zes_ras_state_exp_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesRasClearStateExp typedef ze_result_t (ZE_APICALL *zes_pfnRasClearStateExp_t)( zes_ras_handle_t, zes_ras_error_category_exp_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of RasExp functions pointers typedef struct _zes_ras_exp_dditable_t { zes_pfnRasGetStateExp_t pfnGetStateExp; zes_pfnRasClearStateExp_t pfnClearStateExp; } zes_ras_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RasExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetRasExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_ras_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetRasExpProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetRasExpProcAddrTable_t)( ze_api_version_t, zes_ras_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDiagnosticsGetProperties typedef ze_result_t (ZE_APICALL *zes_pfnDiagnosticsGetProperties_t)( zes_diag_handle_t, zes_diag_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDiagnosticsGetTests typedef ze_result_t (ZE_APICALL *zes_pfnDiagnosticsGetTests_t)( zes_diag_handle_t, uint32_t*, zes_diag_test_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesDiagnosticsRunTests typedef ze_result_t (ZE_APICALL *zes_pfnDiagnosticsRunTests_t)( zes_diag_handle_t, uint32_t, uint32_t, zes_diag_result_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Diagnostics functions pointers typedef struct _zes_diagnostics_dditable_t { zes_pfnDiagnosticsGetProperties_t pfnGetProperties; zes_pfnDiagnosticsGetTests_t pfnGetTests; zes_pfnDiagnosticsRunTests_t pfnRunTests; } zes_diagnostics_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Diagnostics table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDiagnosticsProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_diagnostics_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetDiagnosticsProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetDiagnosticsProcAddrTable_t)( ze_api_version_t, zes_diagnostics_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesVFManagementGetVFPropertiesExp typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFPropertiesExp_t)( zes_vf_handle_t, zes_vf_exp_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesVFManagementGetVFMemoryUtilizationExp typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFMemoryUtilizationExp_t)( zes_vf_handle_t, uint32_t*, zes_vf_util_mem_exp_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesVFManagementGetVFEngineUtilizationExp typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFEngineUtilizationExp_t)( zes_vf_handle_t, uint32_t*, zes_vf_util_engine_exp_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesVFManagementSetVFTelemetryModeExp typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementSetVFTelemetryModeExp_t)( zes_vf_handle_t, zes_vf_info_util_exp_flags_t, ze_bool_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesVFManagementSetVFTelemetrySamplingIntervalExp typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementSetVFTelemetrySamplingIntervalExp_t)( zes_vf_handle_t, zes_vf_info_util_exp_flags_t, uint64_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesVFManagementGetVFCapabilitiesExp typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFCapabilitiesExp_t)( zes_vf_handle_t, zes_vf_exp_capabilities_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesVFManagementGetVFMemoryUtilizationExp2 typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFMemoryUtilizationExp2_t)( zes_vf_handle_t, uint32_t*, zes_vf_util_mem_exp2_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesVFManagementGetVFEngineUtilizationExp2 typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFEngineUtilizationExp2_t)( zes_vf_handle_t, uint32_t*, zes_vf_util_engine_exp2_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesVFManagementGetVFCapabilitiesExp2 typedef ze_result_t (ZE_APICALL *zes_pfnVFManagementGetVFCapabilitiesExp2_t)( zes_vf_handle_t, zes_vf_exp2_capabilities_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of VFManagementExp functions pointers typedef struct _zes_vf_management_exp_dditable_t { zes_pfnVFManagementGetVFPropertiesExp_t pfnGetVFPropertiesExp; zes_pfnVFManagementGetVFMemoryUtilizationExp_t pfnGetVFMemoryUtilizationExp; zes_pfnVFManagementGetVFEngineUtilizationExp_t pfnGetVFEngineUtilizationExp; zes_pfnVFManagementSetVFTelemetryModeExp_t pfnSetVFTelemetryModeExp; zes_pfnVFManagementSetVFTelemetrySamplingIntervalExp_t pfnSetVFTelemetrySamplingIntervalExp; zes_pfnVFManagementGetVFCapabilitiesExp_t pfnGetVFCapabilitiesExp; zes_pfnVFManagementGetVFMemoryUtilizationExp2_t pfnGetVFMemoryUtilizationExp2; zes_pfnVFManagementGetVFEngineUtilizationExp2_t pfnGetVFEngineUtilizationExp2; zes_pfnVFManagementGetVFCapabilitiesExp2_t pfnGetVFCapabilitiesExp2; } zes_vf_management_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's VFManagementExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetVFManagementExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_vf_management_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zesGetVFManagementExpProcAddrTable typedef ze_result_t (ZE_APICALL *zes_pfnGetVFManagementExpProcAddrTable_t)( ze_api_version_t, zes_vf_management_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Container for all DDI tables typedef struct _zes_dditable_t { zes_global_dditable_t Global; zes_device_dditable_t Device; zes_device_exp_dditable_t DeviceExp; zes_driver_dditable_t Driver; zes_driver_exp_dditable_t DriverExp; zes_overclock_dditable_t Overclock; zes_scheduler_dditable_t Scheduler; zes_performance_factor_dditable_t PerformanceFactor; zes_power_dditable_t Power; zes_frequency_dditable_t Frequency; zes_engine_dditable_t Engine; zes_standby_dditable_t Standby; zes_firmware_dditable_t Firmware; zes_firmware_exp_dditable_t FirmwareExp; zes_memory_dditable_t Memory; zes_fabric_port_dditable_t FabricPort; zes_temperature_dditable_t Temperature; zes_psu_dditable_t Psu; zes_fan_dditable_t Fan; zes_led_dditable_t Led; zes_ras_dditable_t Ras; zes_ras_exp_dditable_t RasExp; zes_diagnostics_dditable_t Diagnostics; zes_vf_management_exp_dditable_t VFManagementExp; } zes_dditable_t; /// @brief Container for all DDI tables with version and tables set by the Driver typedef struct _zes_dditable_driver_t { ze_api_version_t version; uint8_t isValidFlag; zes_global_dditable_t * Global; zes_device_dditable_t * Device; zes_device_exp_dditable_t * DeviceExp; zes_driver_dditable_t * Driver; zes_driver_exp_dditable_t * DriverExp; zes_overclock_dditable_t * Overclock; zes_scheduler_dditable_t * Scheduler; zes_performance_factor_dditable_t * PerformanceFactor; zes_power_dditable_t * Power; zes_frequency_dditable_t * Frequency; zes_engine_dditable_t * Engine; zes_standby_dditable_t * Standby; zes_firmware_dditable_t * Firmware; zes_firmware_exp_dditable_t * FirmwareExp; zes_memory_dditable_t * Memory; zes_fabric_port_dditable_t * FabricPort; zes_temperature_dditable_t * Temperature; zes_psu_dditable_t * Psu; zes_fan_dditable_t * Fan; zes_led_dditable_t * Led; zes_ras_dditable_t * Ras; zes_ras_exp_dditable_t * RasExp; zes_diagnostics_dditable_t * Diagnostics; zes_vf_management_exp_dditable_t * VFManagementExp; } zes_dditable_driver_t; #if defined(__cplusplus) } // extern "C" #endif #endif // _ZES_DDI_Hlevel-zero-1.20.6/include/zet.py000066400000000000000000003405051475521542100165000ustar00rootroot00000000000000""" Copyright (C) 2019-2021 Intel Corporation SPDX-License-Identifier: MIT @file zet.py @version v1.12-r1.12.15 """ import platform from ctypes import * from enum import * ############################################################################### __version__ = "1.0" ############################################################################### ## @brief Handle to a driver instance class zet_driver_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of device object class zet_device_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of context object class zet_context_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of command list object class zet_command_list_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of module object class zet_module_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of function object class zet_kernel_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of metric group's object class zet_metric_group_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of metric's object class zet_metric_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of metric streamer's object class zet_metric_streamer_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of metric query pool's object class zet_metric_query_pool_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of metric query's object class zet_metric_query_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of tracer object class zet_tracer_exp_handle_t(c_void_p): pass ############################################################################### ## @brief Debug session handle class zet_debug_session_handle_t(c_void_p): pass ############################################################################### ## @brief Defines structure types class zet_structure_type_v(IntEnum): METRIC_GROUP_PROPERTIES = 0x1 ## ::zet_metric_group_properties_t METRIC_PROPERTIES = 0x2 ## ::zet_metric_properties_t METRIC_STREAMER_DESC = 0x3 ## ::zet_metric_streamer_desc_t METRIC_QUERY_POOL_DESC = 0x4 ## ::zet_metric_query_pool_desc_t PROFILE_PROPERTIES = 0x5 ## ::zet_profile_properties_t DEVICE_DEBUG_PROPERTIES = 0x6 ## ::zet_device_debug_properties_t DEBUG_MEMORY_SPACE_DESC = 0x7 ## ::zet_debug_memory_space_desc_t DEBUG_REGSET_PROPERTIES = 0x8 ## ::zet_debug_regset_properties_t GLOBAL_METRICS_TIMESTAMPS_EXP_PROPERTIES = 0x9 ## ::zet_metric_global_timestamps_resolution_exp_t. Deprecated, use ## ::ZET_STRUCTURE_TYPE_METRIC_GLOBAL_TIMESTAMPS_RESOLUTION_EXP. METRIC_GLOBAL_TIMESTAMPS_RESOLUTION_EXP = 0x9 ## ::zet_metric_global_timestamps_resolution_exp_t TRACER_EXP_DESC = 0x00010001 ## ::zet_tracer_exp_desc_t METRICS_CALCULATE_EXP_DESC = 0x00010002 ## ::zet_metric_calculate_exp_desc_t. Deprecated, use ## ::ZET_STRUCTURE_TYPE_METRIC_CALCULATE_EXP_DESC. METRIC_CALCULATE_EXP_DESC = 0x00010002 ## ::zet_metric_calculate_exp_desc_t METRIC_PROGRAMMABLE_EXP_PROPERTIES = 0x00010003 ## ::zet_metric_programmable_exp_properties_t METRIC_PROGRAMMABLE_PARAM_INFO_EXP = 0x00010004 ## ::zet_metric_programmable_param_info_exp_t METRIC_PROGRAMMABLE_PARAM_VALUE_INFO_EXP = 0x00010005 ## ::zet_metric_programmable_param_value_info_exp_t METRIC_GROUP_TYPE_EXP = 0x00010006 ## ::zet_metric_group_type_exp_t EXPORT_DMA_EXP_PROPERTIES = 0x00010007 ## ::zet_export_dma_buf_exp_properties_t METRIC_TRACER_EXP_DESC = 0x00010008 ## ::zet_metric_tracer_exp_desc_t class zet_structure_type_t(c_int): def __str__(self): return str(zet_structure_type_v(self.value)) ############################################################################### ## @brief Base for all properties types class zet_base_properties_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p) ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ] ############################################################################### ## @brief Base for all descriptor types class zet_base_desc_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p) ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ] ############################################################################### ## @brief Supported value types class zet_value_type_v(IntEnum): UINT32 = 0 ## 32-bit unsigned-integer UINT64 = 1 ## 64-bit unsigned-integer FLOAT32 = 2 ## 32-bit floating-point FLOAT64 = 3 ## 64-bit floating-point BOOL8 = 4 ## 8-bit boolean STRING = 5 ## C string UINT8 = 6 ## 8-bit unsigned-integer UINT16 = 7 ## 16-bit unsigned-integer class zet_value_type_t(c_int): def __str__(self): return str(zet_value_type_v(self.value)) ############################################################################### ## @brief Union of values class zet_value_t(Structure): _fields_ = [ ("ui32", c_ulong), ## [out] 32-bit unsigned-integer ("ui64", c_ulonglong), ## [out] 64-bit unsigned-integer ("fp32", c_float), ## [out] 32-bit floating-point ("fp64", c_double), ## [out] 64-bit floating-point ("b8", ze_bool_t) ## [out] 8-bit boolean ] ############################################################################### ## @brief Typed value class zet_typed_value_t(Structure): _fields_ = [ ("type", zet_value_type_t), ## [out] type of value ("value", zet_value_t) ## [out] value ] ############################################################################### ## @brief Enables driver instrumentation and dependencies for device metrics ############################################################################### ## @brief Enables driver instrumentation and dependencies for program ## instrumentation ############################################################################### ## @brief Enables driver instrumentation and dependencies for program debugging ############################################################################### ## @brief Supported module debug info formats. class zet_module_debug_info_format_v(IntEnum): ELF_DWARF = 0 ## Format is ELF/DWARF class zet_module_debug_info_format_t(c_int): def __str__(self): return str(zet_module_debug_info_format_v(self.value)) ############################################################################### ## @brief Supported device debug property flags class zet_device_debug_property_flags_v(IntEnum): ATTACH = ZE_BIT(0) ## the device supports attaching for debug class zet_device_debug_property_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device debug properties queried using ::zetDeviceGetDebugProperties. class zet_device_debug_properties_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", zet_device_debug_property_flags_t) ## [out] returns 0 (none) or a valid combination of ## ::zet_device_debug_property_flag_t ] ############################################################################### ## @brief Debug configuration provided to ::zetDebugAttach class zet_debug_config_t(Structure): _fields_ = [ ("pid", c_ulong) ## [in] the host process identifier ] ############################################################################### ## @brief Supported debug event flags. class zet_debug_event_flags_v(IntEnum): NEED_ACK = ZE_BIT(0) ## The event needs to be acknowledged by calling ## ::zetDebugAcknowledgeEvent. class zet_debug_event_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Supported debug event types. class zet_debug_event_type_v(IntEnum): INVALID = 0 ## The event is invalid DETACHED = 1 ## The tool was detached PROCESS_ENTRY = 2 ## The debuggee process created command queues on the device PROCESS_EXIT = 3 ## The debuggee process destroyed all command queues on the device MODULE_LOAD = 4 ## An in-memory module was loaded onto the device MODULE_UNLOAD = 5 ## An in-memory module is about to get unloaded from the device THREAD_STOPPED = 6 ## The thread stopped due to a device exception THREAD_UNAVAILABLE = 7 ## The thread is not available to be stopped PAGE_FAULT = 8 ## A page request could not be completed on the device class zet_debug_event_type_t(c_int): def __str__(self): return str(zet_debug_event_type_v(self.value)) ############################################################################### ## @brief Supported debug detach reasons. class zet_debug_detach_reason_v(IntEnum): INVALID = 0 ## The detach reason is not valid HOST_EXIT = 1 ## The host process exited class zet_debug_detach_reason_t(c_int): def __str__(self): return str(zet_debug_detach_reason_v(self.value)) ############################################################################### ## @brief Event information for ::ZET_DEBUG_EVENT_TYPE_DETACHED class zet_debug_event_info_detached_t(Structure): _fields_ = [ ("reason", zet_debug_detach_reason_t) ## [out] the detach reason ] ############################################################################### ## @brief Event information for ::ZET_DEBUG_EVENT_TYPE_MODULE_LOAD and ## ::ZET_DEBUG_EVENT_TYPE_MODULE_UNLOAD class zet_debug_event_info_module_t(Structure): _fields_ = [ ("format", zet_module_debug_info_format_t), ## [out] the module format ("moduleBegin", c_ulonglong), ## [out] the begin address of the in-memory module (inclusive) ("moduleEnd", c_ulonglong), ## [out] the end address of the in-memory module (exclusive) ("load", c_ulonglong) ## [out] the load address of the module on the device ] ############################################################################### ## @brief Event information for ::ZET_DEBUG_EVENT_TYPE_THREAD_STOPPED and ## ::ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE class zet_debug_event_info_thread_stopped_t(Structure): _fields_ = [ ("thread", ze_device_thread_t) ## [out] the stopped/unavailable thread ] ############################################################################### ## @brief Page fault reasons. class zet_debug_page_fault_reason_v(IntEnum): INVALID = 0 ## The page fault reason is not valid MAPPING_ERROR = 1 ## The address is not mapped PERMISSION_ERROR = 2 ## Invalid access permissions class zet_debug_page_fault_reason_t(c_int): def __str__(self): return str(zet_debug_page_fault_reason_v(self.value)) ############################################################################### ## @brief Event information for ::ZET_DEBUG_EVENT_TYPE_PAGE_FAULT class zet_debug_event_info_page_fault_t(Structure): _fields_ = [ ("address", c_ulonglong), ## [out] the faulting address ("mask", c_ulonglong), ## [out] the alignment mask ("reason", zet_debug_page_fault_reason_t) ## [out] the page fault reason ] ############################################################################### ## @brief Event type-specific information class zet_debug_event_info_t(Structure): _fields_ = [ ("detached", zet_debug_event_info_detached_t), ## [out] type == ::ZET_DEBUG_EVENT_TYPE_DETACHED ("module", zet_debug_event_info_module_t), ## [out] type == ::ZET_DEBUG_EVENT_TYPE_MODULE_LOAD or ## ::ZET_DEBUG_EVENT_TYPE_MODULE_UNLOAD ("thread", zet_debug_event_info_thread_stopped_t), ## [out] type == ::ZET_DEBUG_EVENT_TYPE_THREAD_STOPPED or ## ::ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE ("page_fault", zet_debug_event_info_page_fault_t) ## [out] type == ::ZET_DEBUG_EVENT_TYPE_PAGE_FAULT ] ############################################################################### ## @brief A debug event on the device. class zet_debug_event_t(Structure): _fields_ = [ ("type", zet_debug_event_type_t), ## [out] the event type ("flags", zet_debug_event_flags_t), ## [out] returns 0 (none) or a combination of ::zet_debug_event_flag_t ("info", zet_debug_event_info_t) ## [out] event type specific information ] ############################################################################### ## @brief Supported device memory space types. class zet_debug_memory_space_type_v(IntEnum): DEFAULT = 0 ## default memory space (attribute may be omitted) SLM = 1 ## shared local memory space (GPU-only) ELF = 2 ## ELF file memory space class zet_debug_memory_space_type_t(c_int): def __str__(self): return str(zet_debug_memory_space_type_v(self.value)) ############################################################################### ## @brief Device memory space descriptor class zet_debug_memory_space_desc_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zet_debug_memory_space_type_t), ## [in] type of memory space ("address", c_ulonglong) ## [in] the virtual address within the memory space ] ############################################################################### ## @brief Supported general register set flags. class zet_debug_regset_flags_v(IntEnum): READABLE = ZE_BIT(0) ## register set is readable WRITEABLE = ZE_BIT(1) ## register set is writeable class zet_debug_regset_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Device register set properties queried using ## ::zetDebugGetRegisterSetProperties. class zet_debug_regset_properties_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", c_ulong), ## [out] device-specific register set type ("version", c_ulong), ## [out] device-specific version of this register set ("generalFlags", zet_debug_regset_flags_t), ## [out] general register set flags ("deviceFlags", c_ulong), ## [out] device-specific register set flags ("count", c_ulong), ## [out] number of registers in the set ("bitSize", c_ulong), ## [out] the size of a register in bits ("byteSize", c_ulong) ## [out] the size required for reading or writing a register in bytes ] ############################################################################### ## @brief Maximum metric group name string size ZET_MAX_METRIC_GROUP_NAME = 256 ############################################################################### ## @brief Maximum metric group description string size ZET_MAX_METRIC_GROUP_DESCRIPTION = 256 ############################################################################### ## @brief Metric group sampling type class zet_metric_group_sampling_type_flags_v(IntEnum): EVENT_BASED = ZE_BIT(0) ## Event based sampling TIME_BASED = ZE_BIT(1) ## Time based sampling EXP_TRACER_BASED = ZE_BIT(2) ## Experimental Tracer based sampling class zet_metric_group_sampling_type_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Metric group properties queried using ::zetMetricGroupGetProperties class zet_metric_group_properties_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("name", c_char * ZET_MAX_METRIC_GROUP_NAME), ## [out] metric group name ("description", c_char * ZET_MAX_METRIC_GROUP_DESCRIPTION), ## [out] metric group description ("samplingType", zet_metric_group_sampling_type_flags_t), ## [out] metric group sampling type. ## returns a combination of ::zet_metric_group_sampling_type_flag_t. ("domain", c_ulong), ## [out] metric group domain number. Cannot use multiple, simultaneous ## metric groups from the same domain. ("metricCount", c_ulong) ## [out] metric count belonging to this group ] ############################################################################### ## @brief Metric types class zet_metric_type_v(IntEnum): DURATION = 0 ## Metric type: duration EVENT = 1 ## Metric type: event EVENT_WITH_RANGE = 2 ## Metric type: event with range THROUGHPUT = 3 ## Metric type: throughput TIMESTAMP = 4 ## Metric type: timestamp FLAG = 5 ## Metric type: flag RATIO = 6 ## Metric type: ratio RAW = 7 ## Metric type: raw EVENT_EXP_TIMESTAMP = 0x7ffffff9 ## Metric type: event with only timestamp and value has no meaning EVENT_EXP_START = 0x7ffffffa ## Metric type: the first event of a start/end event pair EVENT_EXP_END = 0x7ffffffb ## Metric type: the second event of a start/end event pair EVENT_EXP_MONOTONIC_WRAPS_VALUE = 0x7ffffffc ## Metric type: value of the event is a monotonically increasing value ## that can wrap around EXP_EXPORT_DMA_BUF = 0x7ffffffd ## Metric which exports linux dma_buf, which could be imported/mapped to ## the host process IP_EXP = 0x7ffffffe ## Metric type: instruction pointer. Deprecated, use ## ::ZET_METRIC_TYPE_IP. IP = 0x7ffffffe ## Metric type: instruction pointer class zet_metric_type_t(c_int): def __str__(self): return str(zet_metric_type_v(self.value)) ############################################################################### ## @brief Metric group calculation type class zet_metric_group_calculation_type_v(IntEnum): METRIC_VALUES = 0 ## Calculated metric values from raw data. MAX_METRIC_VALUES = 1 ## Maximum metric values. class zet_metric_group_calculation_type_t(c_int): def __str__(self): return str(zet_metric_group_calculation_type_v(self.value)) ############################################################################### ## @brief Maximum metric name string size ZET_MAX_METRIC_NAME = 256 ############################################################################### ## @brief Maximum metric description string size ZET_MAX_METRIC_DESCRIPTION = 256 ############################################################################### ## @brief Maximum metric component string size ZET_MAX_METRIC_COMPONENT = 256 ############################################################################### ## @brief Maximum metric result units string size ZET_MAX_METRIC_RESULT_UNITS = 256 ############################################################################### ## @brief Metric properties queried using ::zetMetricGetProperties class zet_metric_properties_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("name", c_char * ZET_MAX_METRIC_NAME), ## [out] metric name ("description", c_char * ZET_MAX_METRIC_DESCRIPTION), ## [out] metric description ("component", c_char * ZET_MAX_METRIC_COMPONENT), ## [out] metric component ("tierNumber", c_ulong), ## [out] number of tier ("metricType", zet_metric_type_t), ## [out] metric type ("resultType", zet_value_type_t), ## [out] metric result type ("resultUnits", c_char * ZET_MAX_METRIC_RESULT_UNITS) ## [out] metric result units ] ############################################################################### ## @brief Metric streamer descriptor class zet_metric_streamer_desc_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("notifyEveryNReports", c_ulong), ## [in,out] number of collected reports after which notification event ## will be signaled. If the requested value is not supported exactly, ## then the driver may use a value that is the closest supported ## approximation and shall update this member during ::zetMetricStreamerOpen. ("samplingPeriod", c_ulong) ## [in,out] streamer sampling period in nanoseconds. If the requested ## value is not supported exactly, then the driver may use a value that ## is the closest supported approximation and shall update this member ## during ::zetMetricStreamerOpen. ] ############################################################################### ## @brief Metric query pool types class zet_metric_query_pool_type_v(IntEnum): PERFORMANCE = 0 ## Performance metric query pool. EXECUTION = 1 ## Skips workload execution between begin/end calls. class zet_metric_query_pool_type_t(c_int): def __str__(self): return str(zet_metric_query_pool_type_v(self.value)) ############################################################################### ## @brief Metric query pool description class zet_metric_query_pool_desc_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zet_metric_query_pool_type_t), ## [in] Query pool type. ("count", c_ulong) ## [in] Internal slots count within query pool object. ] ############################################################################### ## @brief Supportted profile features class zet_profile_flags_v(IntEnum): REGISTER_REALLOCATION = ZE_BIT(0) ## request the compiler attempt to minimize register usage as much as ## possible to allow for instrumentation FREE_REGISTER_INFO = ZE_BIT(1) ## request the compiler generate free register info class zet_profile_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Profiling meta-data for instrumentation class zet_profile_properties_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("flags", zet_profile_flags_t), ## [out] indicates which flags were enabled during compilation. ## returns 0 (none) or a combination of ::zet_profile_flag_t ("numTokens", c_ulong) ## [out] number of tokens immediately following this structure ] ############################################################################### ## @brief Supported profile token types class zet_profile_token_type_v(IntEnum): FREE_REGISTER = 0 ## GRF info class zet_profile_token_type_t(c_int): def __str__(self): return str(zet_profile_token_type_v(self.value)) ############################################################################### ## @brief Profile free register token detailing unused registers in the current ## function class zet_profile_free_register_token_t(Structure): _fields_ = [ ("type", zet_profile_token_type_t), ## [out] type of token ("size", c_ulong), ## [out] total size of the token, in bytes ("count", c_ulong) ## [out] number of register sequences immediately following this ## structure ] ############################################################################### ## @brief Profile register sequence detailing consecutive bytes, all of which ## are unused class zet_profile_register_sequence_t(Structure): _fields_ = [ ("start", c_ulong), ## [out] starting byte in the register table, representing the start of ## unused bytes in the current function ("count", c_ulong) ## [out] number of consecutive bytes in the sequence, starting from start ] ############################################################################### ## @brief API Tracing Experimental Extension Name ZET_API_TRACING_EXP_NAME = "ZET_experimental_api_tracing" ############################################################################### ## @brief API Tracing Experimental Extension Version(s) class zet_api_tracing_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class zet_api_tracing_exp_version_t(c_int): def __str__(self): return str(zet_api_tracing_exp_version_v(self.value)) ############################################################################### ## @brief Alias the existing callbacks definition for 'core' callbacks class zet_core_callbacks_t(ze_callbacks_t): pass ############################################################################### ## @brief Tracer descriptor class zet_tracer_exp_desc_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("pUserData", c_void_p) ## [in] pointer passed to every tracer's callbacks ] ############################################################################### ## @brief Concurrent Metric Groups Experimental Extension Name ZET_CONCURRENT_METRIC_GROUPS_EXP_NAME = "ZET_experimental_concurrent_metric_groups" ############################################################################### ## @brief Concurrent Metric Groups Experimental Extension Version(s) class zet_concurrent_metric_groups_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class zet_concurrent_metric_groups_exp_version_t(c_int): def __str__(self): return str(zet_concurrent_metric_groups_exp_version_v(self.value)) ############################################################################### ## @brief Metric Tracer Experimental Extension Name ZET_METRICS_TRACER_EXP_NAME = "ZET_experimental_metric_tracer" ############################################################################### ## @brief Metric Tracer Experimental Extension Version(s) class zet_metric_tracer_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class zet_metric_tracer_exp_version_t(c_int): def __str__(self): return str(zet_metric_tracer_exp_version_v(self.value)) ############################################################################### ## @brief Handle of metric tracer's object class zet_metric_tracer_exp_handle_t(c_void_p): pass ############################################################################### ## @brief Handle of metric decoder's object class zet_metric_decoder_exp_handle_t(c_void_p): pass ############################################################################### ## @brief Metric tracer descriptor class zet_metric_tracer_exp_desc_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("notifyEveryNBytes", c_ulong) ## [in,out] number of collected bytes after which notification event will ## be signaled. If the requested value is not supported exactly, then the ## driver may use a value that is the closest supported approximation and ## shall update this member during ::zetMetricTracerCreateExp. ] ############################################################################### ## @brief Decoded metric entry class zet_metric_entry_exp_t(Structure): _fields_ = [ ("value", zet_value_t), ## [out] value of the decodable metric entry or event. Number is ## meaningful based on the metric type. ("timeStamp", c_ulonglong), ## [out] timestamp at which the event happened. ("metricIndex", c_ulong), ## [out] index to the decodable metric handle in the input array ## (phMetric) in ::zetMetricTracerDecodeExp(). ("onSubdevice", ze_bool_t), ## [out] True if the event occurred on a sub-device; false means the ## device on which the metric tracer was opened does not have ## sub-devices. ("subdeviceId", c_ulong) ## [out] If onSubdevice is true, this gives the ID of the sub-device. ] ############################################################################### ## @brief Metric group type class zet_metric_group_type_exp_flags_v(IntEnum): EXPORT_DMA_BUF = ZE_BIT(0) ## Metric group and metrics exports memory using linux dma-buf, which ## could be imported/mapped to the host process. Properties of the ## dma_buf could be queried using ::zet_export_dma_buf_exp_properties_t. USER_CREATED = ZE_BIT(1) ## Metric group created using ::zetDeviceCreateMetricGroupsFromMetricsExp OTHER = ZE_BIT(2) ## Metric group which has a collection of metrics class zet_metric_group_type_exp_flags_t(c_int): def __str__(self): return hex(self.value) ############################################################################### ## @brief Query the metric group type using `pNext` of ## ::zet_metric_group_properties_t class zet_metric_group_type_exp_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zet_metric_group_type_exp_flags_t) ## [out] metric group type. ## returns a combination of ::zet_metric_group_type_exp_flags_t. ] ############################################################################### ## @brief Exported dma_buf properties queried using `pNext` of ## ::zet_metric_group_properties_t or ::zet_metric_properties_t class zet_export_dma_buf_exp_properties_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("fd", c_int), ## [out] the file descriptor handle that could be used to import the ## memory by the host process. ("size", c_size_t) ## [out] size in bytes of the dma_buf ] ############################################################################### ## @brief Calculating Multiple Metrics Experimental Extension Name ZET_MULTI_METRICS_EXP_NAME = "ZET_experimental_calculate_multiple_metrics" ############################################################################### ## @brief Calculating Multiple Metrics Experimental Extension Version(s) class ze_calculate_multiple_metrics_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_calculate_multiple_metrics_exp_version_t(c_int): def __str__(self): return str(ze_calculate_multiple_metrics_exp_version_v(self.value)) ############################################################################### ## @brief Global Metric Timestamps Experimental Extension Name ZET_GLOBAL_METRICS_TIMESTAMPS_EXP_NAME = "ZET_experimental_global_metric_timestamps" ############################################################################### ## @brief Global Metric Timestamps Experimental Extension Version(s) class ze_metric_global_timestamps_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class ze_metric_global_timestamps_exp_version_t(c_int): def __str__(self): return str(ze_metric_global_timestamps_exp_version_v(self.value)) ############################################################################### ## @brief Metric timestamps resolution ## ## @details ## - This structure may be returned from ::zetMetricGroupGetProperties via ## the `pNext` member of ::zet_metric_group_properties_t. ## - Used for mapping metric timestamps to other timers. class zet_metric_global_timestamps_resolution_exp_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("timerResolution", c_ulonglong), ## [out] Returns the resolution of metrics timer (used for timestamps) in ## cycles/sec. ("timestampValidBits", c_ulonglong) ## [out] Returns the number of valid bits in the timestamp value. ] ############################################################################### ## @brief Exporting Metrics Data Experimental Extension Name ZET_EXPORT_METRICS_DATA_EXP_NAME = "ZET_experimental_metric_export_data" ############################################################################### ## @brief Exporting Metrics Data Experimental Extension Version(s) class zet_export_metric_data_exp_version_v(IntEnum): _1_0 = ZE_MAKE_VERSION( 1, 0 ) ## version 1.0 CURRENT = ZE_MAKE_VERSION( 1, 0 ) ## latest known version class zet_export_metric_data_exp_version_t(c_int): def __str__(self): return str(zet_export_metric_data_exp_version_v(self.value)) ############################################################################### ## @brief Maximum count of characters in export data element name ZET_MAX_METRIC_EXPORT_DATA_ELEMENT_NAME_EXP = 256 ############################################################################### ## @brief Maximum export data element description string size ZET_MAX_METRIC_EXPORT_DATA_ELEMENT_DESCRIPTION_EXP = 256 ############################################################################### ## @brief Metrics calculation descriptor class zet_metric_calculate_exp_desc_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("rawReportSkipCount", c_ulong) ## [in] number of reports to skip during calculation ] ############################################################################### ## @brief Programmable Metrics Experimental Extension Name ZET_PROGRAMMABLE_METRICS_EXP_NAME = "ZET_experimental_programmable_metrics" ############################################################################### ## @brief Programmable Metrics Experimental Extension Version(s) class zet_metric_programmable_exp_version_v(IntEnum): _1_1 = ZE_MAKE_VERSION( 1, 1 ) ## version 1.1 CURRENT = ZE_MAKE_VERSION( 1, 1 ) ## latest known version class zet_metric_programmable_exp_version_t(c_int): def __str__(self): return str(zet_metric_programmable_exp_version_v(self.value)) ############################################################################### ## @brief Maximum count of characters in export data element name ZET_MAX_PROGRAMMABLE_METRICS_ELEMENT_NAME_EXP = 256 ############################################################################### ## @brief Maximum export data element description string size ZET_MAX_PROGRAMMABLE_METRICS_ELEMENT_DESCRIPTION_EXP = 256 ############################################################################### ## @brief Maximum count of characters in metric group name prefix ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP = 64 ############################################################################### ## @brief Maximum metric programmable name string size ZET_MAX_METRIC_PROGRAMMABLE_NAME_EXP = 128 ############################################################################### ## @brief Maximum metric programmable description string size ZET_MAX_METRIC_PROGRAMMABLE_DESCRIPTION_EXP = 128 ############################################################################### ## @brief Maximum metric programmable component string size ZET_MAX_METRIC_PROGRAMMABLE_COMPONENT_EXP = 128 ############################################################################### ## @brief Maximum metric programmable parameter string size ZET_MAX_METRIC_PROGRAMMABLE_PARAMETER_NAME_EXP = 128 ############################################################################### ## @brief Maximum value for programmable value description ZET_MAX_METRIC_PROGRAMMABLE_VALUE_DESCRIPTION_EXP = 128 ############################################################################### ## @brief Maximum value metric group name prefix ZE_MAX_METRIC_GROUP_NAME_PREFIX = 64 ############################################################################### ## @brief Handle of metric programmable's object class zet_metric_programmable_exp_handle_t(c_void_p): pass ############################################################################### ## @brief Metric Programmable properties queried using ## ::zetMetricProgrammableGetPropertiesExp class zet_metric_programmable_exp_properties_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("name", c_char * ZET_MAX_METRIC_PROGRAMMABLE_NAME_EXP), ## [out] metric programmable name ("description", c_char * ZET_MAX_METRIC_PROGRAMMABLE_DESCRIPTION_EXP), ## [out] metric programmable description ("component", c_char * ZET_MAX_METRIC_PROGRAMMABLE_COMPONENT_EXP), ## [out] metric programmable component ("tierNumber", c_ulong), ## [out] tier number ("domain", c_ulong), ## [out] metric domain number. ("parameterCount", c_ulong), ## [out] number of parameters in the programmable ("samplingType", zet_metric_group_sampling_type_flags_t), ## [out] metric sampling type. ## returns a combination of ::zet_metric_group_sampling_type_flag_t. ("sourceId", c_ulong) ## [out] unique metric source identifier(within platform)to identify the ## HW block where the metric is collected. ] ############################################################################### ## @brief Metric Programmable Parameter types class zet_metric_programmable_param_type_exp_v(IntEnum): DISAGGREGATION = 0 ## Metric is disaggregated. LATENCY = 1 ## Metric for latency measurement. NORMALIZATION_UTILIZATION = 2 ## Produces normalization in percent using raw_metric * 100 / cycles / HW ## instance_count. NORMALIZATION_AVERAGE = 3 ## Produces normalization using raw_metric / HW instance_count. NORMALIZATION_RATE = 4 ## Produces normalization average using raw_metric / timestamp. NORMALIZATION_BYTES = 5 ## Produces normalization average using raw_metric * n bytes. GENERIC = 6 ## Generic Parameter type. Please refer the parameter's description. class zet_metric_programmable_param_type_exp_t(c_int): def __str__(self): return str(zet_metric_programmable_param_type_exp_v(self.value)) ############################################################################### ## @brief Supported value info types class zet_value_info_type_exp_v(IntEnum): UINT32 = 0 ## 32-bit unsigned-integer UINT64 = 1 ## 64-bit unsigned-integer FLOAT32 = 2 ## 32-bit floating-point FLOAT64 = 3 ## 64-bit floating-point BOOL8 = 4 ## 8-bit boolean UINT8 = 5 ## 8-bit unsigned-integer UINT16 = 6 ## 16-bit unsigned-integer UINT64_RANGE = 7 ## 64-bit unsigned-integer range (minimum and maximum) FLOAT64_RANGE = 8 ## 64-bit floating point range (minimum and maximum) class zet_value_info_type_exp_t(c_int): def __str__(self): return str(zet_value_info_type_exp_v(self.value)) ############################################################################### ## @brief Value info of type uint64_t range class zet_value_uint64_range_exp_t(Structure): _fields_ = [ ("ui64Min", c_ulonglong), ## [out] minimum value of the range ("ui64Max", c_ulonglong) ## [out] maximum value of the range ] ############################################################################### ## @brief Value info of type float64 range class zet_value_fp64_range_exp_t(Structure): _fields_ = [ ("fp64Min", c_double), ## [out] minimum value of the range ("fp64Max", c_double) ## [out] maximum value of the range ] ############################################################################### ## @brief Union of value information class zet_value_info_exp_t(Structure): _fields_ = [ ("ui32", c_ulong), ## [out] 32-bit unsigned-integer ("ui64", c_ulonglong), ## [out] 64-bit unsigned-integer ("fp32", c_float), ## [out] 32-bit floating-point ("fp64", c_double), ## [out] 64-bit floating-point ("b8", ze_bool_t), ## [out] 8-bit boolean ("ui8", c_ubyte), ## [out] 8-bit unsigned integer ("ui16", c_ushort), ## [out] 16-bit unsigned integer ("ui64Range", zet_value_uint64_range_exp_t), ## [out] minimum and maximum value of the range ("fp64Range", zet_value_fp64_range_exp_t) ## [out] minimum and maximum value of the range ] ############################################################################### ## @brief Metric Programmable parameter information class zet_metric_programmable_param_info_exp_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("type", zet_metric_programmable_param_type_exp_t), ## [out] programmable parameter type ("name", c_char * ZET_MAX_METRIC_PROGRAMMABLE_PARAMETER_NAME_EXP), ## [out] metric programmable parameter name ("valueInfoType", zet_value_info_type_exp_t), ## [out] value info type ("defaultValue", zet_value_t), ## [out] default value for the parameter ("valueInfoCount", c_ulong) ## [out] count of ::zet_metric_programmable_param_value_info_exp_t ] ############################################################################### ## @brief Metric Programmable parameter value information class zet_metric_programmable_param_value_info_exp_t(Structure): _fields_ = [ ("stype", zet_structure_type_t), ## [in] type of this structure ("pNext", c_void_p), ## [in,out][optional] must be null or a pointer to an extension-specific ## structure (i.e. contains stype and pNext). ("valueInfo", zet_value_info_exp_t), ## [out] information about the parameter value ("description", c_char * ZET_MAX_METRIC_PROGRAMMABLE_VALUE_DESCRIPTION_EXP) ## [out] description about the value ] ############################################################################### ## @brief Metric Programmable parameter value class zet_metric_programmable_param_value_exp_t(Structure): _fields_ = [ ("value", zet_value_t) ## [in] parameter value ] ############################################################################### __use_win_types = "Windows" == platform.uname()[0] ############################################################################### ## @brief Function-pointer for zetMetricProgrammableGetExp if __use_win_types: _zetMetricProgrammableGetExp_t = WINFUNCTYPE( ze_result_t, zet_device_handle_t, POINTER(c_ulong), POINTER(zet_metric_programmable_exp_handle_t) ) else: _zetMetricProgrammableGetExp_t = CFUNCTYPE( ze_result_t, zet_device_handle_t, POINTER(c_ulong), POINTER(zet_metric_programmable_exp_handle_t) ) ############################################################################### ## @brief Function-pointer for zetMetricProgrammableGetPropertiesExp if __use_win_types: _zetMetricProgrammableGetPropertiesExp_t = WINFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, POINTER(zet_metric_programmable_exp_properties_t) ) else: _zetMetricProgrammableGetPropertiesExp_t = CFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, POINTER(zet_metric_programmable_exp_properties_t) ) ############################################################################### ## @brief Function-pointer for zetMetricProgrammableGetParamInfoExp if __use_win_types: _zetMetricProgrammableGetParamInfoExp_t = WINFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, POINTER(c_ulong), POINTER(zet_metric_programmable_param_info_exp_t) ) else: _zetMetricProgrammableGetParamInfoExp_t = CFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, POINTER(c_ulong), POINTER(zet_metric_programmable_param_info_exp_t) ) ############################################################################### ## @brief Function-pointer for zetMetricProgrammableGetParamValueInfoExp if __use_win_types: _zetMetricProgrammableGetParamValueInfoExp_t = WINFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, c_ulong, POINTER(c_ulong), POINTER(zet_metric_programmable_param_value_info_exp_t) ) else: _zetMetricProgrammableGetParamValueInfoExp_t = CFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, c_ulong, POINTER(c_ulong), POINTER(zet_metric_programmable_param_value_info_exp_t) ) ############################################################################### ## @brief Table of MetricProgrammableExp functions pointers class _zet_metric_programmable_exp_dditable_t(Structure): _fields_ = [ ("pfnGetExp", c_void_p), ## _zetMetricProgrammableGetExp_t ("pfnGetPropertiesExp", c_void_p), ## _zetMetricProgrammableGetPropertiesExp_t ("pfnGetParamInfoExp", c_void_p), ## _zetMetricProgrammableGetParamInfoExp_t ("pfnGetParamValueInfoExp", c_void_p) ## _zetMetricProgrammableGetParamValueInfoExp_t ] ############################################################################### ## @brief Function-pointer for zetMetricTracerCreateExp if __use_win_types: _zetMetricTracerCreateExp_t = WINFUNCTYPE( ze_result_t, zet_context_handle_t, zet_device_handle_t, c_ulong, POINTER(zet_metric_group_handle_t), POINTER(zet_metric_tracer_exp_desc_t), ze_event_handle_t, POINTER(zet_metric_tracer_exp_handle_t) ) else: _zetMetricTracerCreateExp_t = CFUNCTYPE( ze_result_t, zet_context_handle_t, zet_device_handle_t, c_ulong, POINTER(zet_metric_group_handle_t), POINTER(zet_metric_tracer_exp_desc_t), ze_event_handle_t, POINTER(zet_metric_tracer_exp_handle_t) ) ############################################################################### ## @brief Function-pointer for zetMetricTracerDestroyExp if __use_win_types: _zetMetricTracerDestroyExp_t = WINFUNCTYPE( ze_result_t, zet_metric_tracer_exp_handle_t ) else: _zetMetricTracerDestroyExp_t = CFUNCTYPE( ze_result_t, zet_metric_tracer_exp_handle_t ) ############################################################################### ## @brief Function-pointer for zetMetricTracerEnableExp if __use_win_types: _zetMetricTracerEnableExp_t = WINFUNCTYPE( ze_result_t, zet_metric_tracer_exp_handle_t, ze_bool_t ) else: _zetMetricTracerEnableExp_t = CFUNCTYPE( ze_result_t, zet_metric_tracer_exp_handle_t, ze_bool_t ) ############################################################################### ## @brief Function-pointer for zetMetricTracerDisableExp if __use_win_types: _zetMetricTracerDisableExp_t = WINFUNCTYPE( ze_result_t, zet_metric_tracer_exp_handle_t, ze_bool_t ) else: _zetMetricTracerDisableExp_t = CFUNCTYPE( ze_result_t, zet_metric_tracer_exp_handle_t, ze_bool_t ) ############################################################################### ## @brief Function-pointer for zetMetricTracerReadDataExp if __use_win_types: _zetMetricTracerReadDataExp_t = WINFUNCTYPE( ze_result_t, zet_metric_tracer_exp_handle_t, POINTER(c_size_t), POINTER(c_ubyte) ) else: _zetMetricTracerReadDataExp_t = CFUNCTYPE( ze_result_t, zet_metric_tracer_exp_handle_t, POINTER(c_size_t), POINTER(c_ubyte) ) ############################################################################### ## @brief Function-pointer for zetMetricTracerDecodeExp if __use_win_types: _zetMetricTracerDecodeExp_t = WINFUNCTYPE( ze_result_t, zet_metric_decoder_exp_handle_t, POINTER(c_size_t), POINTER(c_ubyte), c_ulong, POINTER(zet_metric_handle_t), POINTER(c_ulong), POINTER(c_ulong), POINTER(c_ulong), POINTER(zet_metric_entry_exp_t) ) else: _zetMetricTracerDecodeExp_t = CFUNCTYPE( ze_result_t, zet_metric_decoder_exp_handle_t, POINTER(c_size_t), POINTER(c_ubyte), c_ulong, POINTER(zet_metric_handle_t), POINTER(c_ulong), POINTER(c_ulong), POINTER(c_ulong), POINTER(zet_metric_entry_exp_t) ) ############################################################################### ## @brief Table of MetricTracerExp functions pointers class _zet_metric_tracer_exp_dditable_t(Structure): _fields_ = [ ("pfnCreateExp", c_void_p), ## _zetMetricTracerCreateExp_t ("pfnDestroyExp", c_void_p), ## _zetMetricTracerDestroyExp_t ("pfnEnableExp", c_void_p), ## _zetMetricTracerEnableExp_t ("pfnDisableExp", c_void_p), ## _zetMetricTracerDisableExp_t ("pfnReadDataExp", c_void_p), ## _zetMetricTracerReadDataExp_t ("pfnDecodeExp", c_void_p) ## _zetMetricTracerDecodeExp_t ] ############################################################################### ## @brief Function-pointer for zetMetricDecoderCreateExp if __use_win_types: _zetMetricDecoderCreateExp_t = WINFUNCTYPE( ze_result_t, zet_metric_tracer_exp_handle_t, POINTER(zet_metric_decoder_exp_handle_t) ) else: _zetMetricDecoderCreateExp_t = CFUNCTYPE( ze_result_t, zet_metric_tracer_exp_handle_t, POINTER(zet_metric_decoder_exp_handle_t) ) ############################################################################### ## @brief Function-pointer for zetMetricDecoderDestroyExp if __use_win_types: _zetMetricDecoderDestroyExp_t = WINFUNCTYPE( ze_result_t, zet_metric_decoder_exp_handle_t ) else: _zetMetricDecoderDestroyExp_t = CFUNCTYPE( ze_result_t, zet_metric_decoder_exp_handle_t ) ############################################################################### ## @brief Function-pointer for zetMetricDecoderGetDecodableMetricsExp if __use_win_types: _zetMetricDecoderGetDecodableMetricsExp_t = WINFUNCTYPE( ze_result_t, zet_metric_decoder_exp_handle_t, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) else: _zetMetricDecoderGetDecodableMetricsExp_t = CFUNCTYPE( ze_result_t, zet_metric_decoder_exp_handle_t, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) ############################################################################### ## @brief Table of MetricDecoderExp functions pointers class _zet_metric_decoder_exp_dditable_t(Structure): _fields_ = [ ("pfnCreateExp", c_void_p), ## _zetMetricDecoderCreateExp_t ("pfnDestroyExp", c_void_p), ## _zetMetricDecoderDestroyExp_t ("pfnGetDecodableMetricsExp", c_void_p) ## _zetMetricDecoderGetDecodableMetricsExp_t ] ############################################################################### ## @brief Function-pointer for zetDeviceGetDebugProperties if __use_win_types: _zetDeviceGetDebugProperties_t = WINFUNCTYPE( ze_result_t, zet_device_handle_t, POINTER(zet_device_debug_properties_t) ) else: _zetDeviceGetDebugProperties_t = CFUNCTYPE( ze_result_t, zet_device_handle_t, POINTER(zet_device_debug_properties_t) ) ############################################################################### ## @brief Table of Device functions pointers class _zet_device_dditable_t(Structure): _fields_ = [ ("pfnGetDebugProperties", c_void_p) ## _zetDeviceGetDebugProperties_t ] ############################################################################### ## @brief Function-pointer for zetDeviceGetConcurrentMetricGroupsExp if __use_win_types: _zetDeviceGetConcurrentMetricGroupsExp_t = WINFUNCTYPE( ze_result_t, zet_device_handle_t, c_ulong, *, *, * ) else: _zetDeviceGetConcurrentMetricGroupsExp_t = CFUNCTYPE( ze_result_t, zet_device_handle_t, c_ulong, *, *, * ) ############################################################################### ## @brief Function-pointer for zetDeviceCreateMetricGroupsFromMetricsExp if __use_win_types: _zetDeviceCreateMetricGroupsFromMetricsExp_t = WINFUNCTYPE( ze_result_t, zet_device_handle_t, c_ulong, *, *, *, *, POINTER(zet_metric_group_handle_t) ) else: _zetDeviceCreateMetricGroupsFromMetricsExp_t = CFUNCTYPE( ze_result_t, zet_device_handle_t, c_ulong, *, *, *, *, POINTER(zet_metric_group_handle_t) ) ############################################################################### ## @brief Table of DeviceExp functions pointers class _zet_device_exp_dditable_t(Structure): _fields_ = [ ("pfnGetConcurrentMetricGroupsExp", c_void_p), ## _zetDeviceGetConcurrentMetricGroupsExp_t ("pfnCreateMetricGroupsFromMetricsExp", c_void_p) ## _zetDeviceCreateMetricGroupsFromMetricsExp_t ] ############################################################################### ## @brief Function-pointer for zetContextActivateMetricGroups if __use_win_types: _zetContextActivateMetricGroups_t = WINFUNCTYPE( ze_result_t, zet_context_handle_t, zet_device_handle_t, c_ulong, POINTER(zet_metric_group_handle_t) ) else: _zetContextActivateMetricGroups_t = CFUNCTYPE( ze_result_t, zet_context_handle_t, zet_device_handle_t, c_ulong, POINTER(zet_metric_group_handle_t) ) ############################################################################### ## @brief Table of Context functions pointers class _zet_context_dditable_t(Structure): _fields_ = [ ("pfnActivateMetricGroups", c_void_p) ## _zetContextActivateMetricGroups_t ] ############################################################################### ## @brief Function-pointer for zetCommandListAppendMetricStreamerMarker if __use_win_types: _zetCommandListAppendMetricStreamerMarker_t = WINFUNCTYPE( ze_result_t, zet_command_list_handle_t, zet_metric_streamer_handle_t, c_ulong ) else: _zetCommandListAppendMetricStreamerMarker_t = CFUNCTYPE( ze_result_t, zet_command_list_handle_t, zet_metric_streamer_handle_t, c_ulong ) ############################################################################### ## @brief Function-pointer for zetCommandListAppendMetricQueryBegin if __use_win_types: _zetCommandListAppendMetricQueryBegin_t = WINFUNCTYPE( ze_result_t, zet_command_list_handle_t, zet_metric_query_handle_t ) else: _zetCommandListAppendMetricQueryBegin_t = CFUNCTYPE( ze_result_t, zet_command_list_handle_t, zet_metric_query_handle_t ) ############################################################################### ## @brief Function-pointer for zetCommandListAppendMetricQueryEnd if __use_win_types: _zetCommandListAppendMetricQueryEnd_t = WINFUNCTYPE( ze_result_t, zet_command_list_handle_t, zet_metric_query_handle_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) else: _zetCommandListAppendMetricQueryEnd_t = CFUNCTYPE( ze_result_t, zet_command_list_handle_t, zet_metric_query_handle_t, ze_event_handle_t, c_ulong, POINTER(ze_event_handle_t) ) ############################################################################### ## @brief Function-pointer for zetCommandListAppendMetricMemoryBarrier if __use_win_types: _zetCommandListAppendMetricMemoryBarrier_t = WINFUNCTYPE( ze_result_t, zet_command_list_handle_t ) else: _zetCommandListAppendMetricMemoryBarrier_t = CFUNCTYPE( ze_result_t, zet_command_list_handle_t ) ############################################################################### ## @brief Table of CommandList functions pointers class _zet_command_list_dditable_t(Structure): _fields_ = [ ("pfnAppendMetricStreamerMarker", c_void_p), ## _zetCommandListAppendMetricStreamerMarker_t ("pfnAppendMetricQueryBegin", c_void_p), ## _zetCommandListAppendMetricQueryBegin_t ("pfnAppendMetricQueryEnd", c_void_p), ## _zetCommandListAppendMetricQueryEnd_t ("pfnAppendMetricMemoryBarrier", c_void_p) ## _zetCommandListAppendMetricMemoryBarrier_t ] ############################################################################### ## @brief Function-pointer for zetModuleGetDebugInfo if __use_win_types: _zetModuleGetDebugInfo_t = WINFUNCTYPE( ze_result_t, zet_module_handle_t, zet_module_debug_info_format_t, POINTER(c_size_t), POINTER(c_ubyte) ) else: _zetModuleGetDebugInfo_t = CFUNCTYPE( ze_result_t, zet_module_handle_t, zet_module_debug_info_format_t, POINTER(c_size_t), POINTER(c_ubyte) ) ############################################################################### ## @brief Table of Module functions pointers class _zet_module_dditable_t(Structure): _fields_ = [ ("pfnGetDebugInfo", c_void_p) ## _zetModuleGetDebugInfo_t ] ############################################################################### ## @brief Function-pointer for zetKernelGetProfileInfo if __use_win_types: _zetKernelGetProfileInfo_t = WINFUNCTYPE( ze_result_t, zet_kernel_handle_t, POINTER(zet_profile_properties_t) ) else: _zetKernelGetProfileInfo_t = CFUNCTYPE( ze_result_t, zet_kernel_handle_t, POINTER(zet_profile_properties_t) ) ############################################################################### ## @brief Table of Kernel functions pointers class _zet_kernel_dditable_t(Structure): _fields_ = [ ("pfnGetProfileInfo", c_void_p) ## _zetKernelGetProfileInfo_t ] ############################################################################### ## @brief Function-pointer for zetMetricGet if __use_win_types: _zetMetricGet_t = WINFUNCTYPE( ze_result_t, zet_metric_group_handle_t, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) else: _zetMetricGet_t = CFUNCTYPE( ze_result_t, zet_metric_group_handle_t, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) ############################################################################### ## @brief Function-pointer for zetMetricGetProperties if __use_win_types: _zetMetricGetProperties_t = WINFUNCTYPE( ze_result_t, zet_metric_handle_t, POINTER(zet_metric_properties_t) ) else: _zetMetricGetProperties_t = CFUNCTYPE( ze_result_t, zet_metric_handle_t, POINTER(zet_metric_properties_t) ) ############################################################################### ## @brief Table of Metric functions pointers class _zet_metric_dditable_t(Structure): _fields_ = [ ("pfnGet", c_void_p), ## _zetMetricGet_t ("pfnGetProperties", c_void_p) ## _zetMetricGetProperties_t ] ############################################################################### ## @brief Function-pointer for zetMetricCreateFromProgrammableExp if __use_win_types: _zetMetricCreateFromProgrammableExp_t = WINFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, POINTER(zet_metric_programmable_param_value_exp_t), c_ulong, c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) else: _zetMetricCreateFromProgrammableExp_t = CFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, POINTER(zet_metric_programmable_param_value_exp_t), c_ulong, c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) ############################################################################### ## @brief Function-pointer for zetMetricDestroyExp if __use_win_types: _zetMetricDestroyExp_t = WINFUNCTYPE( ze_result_t, zet_metric_handle_t ) else: _zetMetricDestroyExp_t = CFUNCTYPE( ze_result_t, zet_metric_handle_t ) ############################################################################### ## @brief Function-pointer for zetMetricCreateFromProgrammableExp2 if __use_win_types: _zetMetricCreateFromProgrammableExp2_t = WINFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, c_ulong, POINTER(zet_metric_programmable_param_value_exp_t), c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) else: _zetMetricCreateFromProgrammableExp2_t = CFUNCTYPE( ze_result_t, zet_metric_programmable_exp_handle_t, c_ulong, POINTER(zet_metric_programmable_param_value_exp_t), c_char_p, c_char_p, POINTER(c_ulong), POINTER(zet_metric_handle_t) ) ############################################################################### ## @brief Table of MetricExp functions pointers class _zet_metric_exp_dditable_t(Structure): _fields_ = [ ("pfnCreateFromProgrammableExp", c_void_p), ## _zetMetricCreateFromProgrammableExp_t ("pfnDestroyExp", c_void_p), ## _zetMetricDestroyExp_t ("pfnCreateFromProgrammableExp2", c_void_p) ## _zetMetricCreateFromProgrammableExp2_t ] ############################################################################### ## @brief Function-pointer for zetMetricGroupGet if __use_win_types: _zetMetricGroupGet_t = WINFUNCTYPE( ze_result_t, zet_device_handle_t, POINTER(c_ulong), POINTER(zet_metric_group_handle_t) ) else: _zetMetricGroupGet_t = CFUNCTYPE( ze_result_t, zet_device_handle_t, POINTER(c_ulong), POINTER(zet_metric_group_handle_t) ) ############################################################################### ## @brief Function-pointer for zetMetricGroupGetProperties if __use_win_types: _zetMetricGroupGetProperties_t = WINFUNCTYPE( ze_result_t, zet_metric_group_handle_t, POINTER(zet_metric_group_properties_t) ) else: _zetMetricGroupGetProperties_t = CFUNCTYPE( ze_result_t, zet_metric_group_handle_t, POINTER(zet_metric_group_properties_t) ) ############################################################################### ## @brief Function-pointer for zetMetricGroupCalculateMetricValues if __use_win_types: _zetMetricGroupCalculateMetricValues_t = WINFUNCTYPE( ze_result_t, zet_metric_group_handle_t, zet_metric_group_calculation_type_t, c_size_t, POINTER(c_ubyte), POINTER(c_ulong), POINTER(zet_typed_value_t) ) else: _zetMetricGroupCalculateMetricValues_t = CFUNCTYPE( ze_result_t, zet_metric_group_handle_t, zet_metric_group_calculation_type_t, c_size_t, POINTER(c_ubyte), POINTER(c_ulong), POINTER(zet_typed_value_t) ) ############################################################################### ## @brief Table of MetricGroup functions pointers class _zet_metric_group_dditable_t(Structure): _fields_ = [ ("pfnGet", c_void_p), ## _zetMetricGroupGet_t ("pfnGetProperties", c_void_p), ## _zetMetricGroupGetProperties_t ("pfnCalculateMetricValues", c_void_p) ## _zetMetricGroupCalculateMetricValues_t ] ############################################################################### ## @brief Function-pointer for zetMetricGroupCalculateMultipleMetricValuesExp if __use_win_types: _zetMetricGroupCalculateMultipleMetricValuesExp_t = WINFUNCTYPE( ze_result_t, zet_metric_group_handle_t, zet_metric_group_calculation_type_t, c_size_t, POINTER(c_ubyte), POINTER(c_ulong), POINTER(c_ulong), POINTER(c_ulong), POINTER(zet_typed_value_t) ) else: _zetMetricGroupCalculateMultipleMetricValuesExp_t = CFUNCTYPE( ze_result_t, zet_metric_group_handle_t, zet_metric_group_calculation_type_t, c_size_t, POINTER(c_ubyte), POINTER(c_ulong), POINTER(c_ulong), POINTER(c_ulong), POINTER(zet_typed_value_t) ) ############################################################################### ## @brief Function-pointer for zetMetricGroupGetGlobalTimestampsExp if __use_win_types: _zetMetricGroupGetGlobalTimestampsExp_t = WINFUNCTYPE( ze_result_t, zet_metric_group_handle_t, ze_bool_t, POINTER(c_ulonglong), POINTER(c_ulonglong) ) else: _zetMetricGroupGetGlobalTimestampsExp_t = CFUNCTYPE( ze_result_t, zet_metric_group_handle_t, ze_bool_t, POINTER(c_ulonglong), POINTER(c_ulonglong) ) ############################################################################### ## @brief Function-pointer for zetMetricGroupGetExportDataExp if __use_win_types: _zetMetricGroupGetExportDataExp_t = WINFUNCTYPE( ze_result_t, zet_metric_group_handle_t, POINTER(c_ubyte), c_size_t, POINTER(c_size_t), * ) else: _zetMetricGroupGetExportDataExp_t = CFUNCTYPE( ze_result_t, zet_metric_group_handle_t, POINTER(c_ubyte), c_size_t, POINTER(c_size_t), * ) ############################################################################### ## @brief Function-pointer for zetMetricGroupCalculateMetricExportDataExp if __use_win_types: _zetMetricGroupCalculateMetricExportDataExp_t = WINFUNCTYPE( ze_result_t, ze_driver_handle_t, zet_metric_group_calculation_type_t, c_size_t, POINTER(c_ubyte), POINTER(zet_metric_calculate_exp_desc_t), POINTER(c_ulong), POINTER(c_ulong), POINTER(c_ulong), POINTER(zet_typed_value_t) ) else: _zetMetricGroupCalculateMetricExportDataExp_t = CFUNCTYPE( ze_result_t, ze_driver_handle_t, zet_metric_group_calculation_type_t, c_size_t, POINTER(c_ubyte), POINTER(zet_metric_calculate_exp_desc_t), POINTER(c_ulong), POINTER(c_ulong), POINTER(c_ulong), POINTER(zet_typed_value_t) ) ############################################################################### ## @brief Function-pointer for zetMetricGroupCreateExp if __use_win_types: _zetMetricGroupCreateExp_t = WINFUNCTYPE( ze_result_t, zet_device_handle_t, c_char_p, c_char_p, zet_metric_group_sampling_type_flags_t, POINTER(zet_metric_group_handle_t) ) else: _zetMetricGroupCreateExp_t = CFUNCTYPE( ze_result_t, zet_device_handle_t, c_char_p, c_char_p, zet_metric_group_sampling_type_flags_t, POINTER(zet_metric_group_handle_t) ) ############################################################################### ## @brief Function-pointer for zetMetricGroupAddMetricExp if __use_win_types: _zetMetricGroupAddMetricExp_t = WINFUNCTYPE( ze_result_t, zet_metric_group_handle_t, zet_metric_handle_t, *, c_char_p ) else: _zetMetricGroupAddMetricExp_t = CFUNCTYPE( ze_result_t, zet_metric_group_handle_t, zet_metric_handle_t, *, c_char_p ) ############################################################################### ## @brief Function-pointer for zetMetricGroupRemoveMetricExp if __use_win_types: _zetMetricGroupRemoveMetricExp_t = WINFUNCTYPE( ze_result_t, zet_metric_group_handle_t, zet_metric_handle_t ) else: _zetMetricGroupRemoveMetricExp_t = CFUNCTYPE( ze_result_t, zet_metric_group_handle_t, zet_metric_handle_t ) ############################################################################### ## @brief Function-pointer for zetMetricGroupCloseExp if __use_win_types: _zetMetricGroupCloseExp_t = WINFUNCTYPE( ze_result_t, zet_metric_group_handle_t ) else: _zetMetricGroupCloseExp_t = CFUNCTYPE( ze_result_t, zet_metric_group_handle_t ) ############################################################################### ## @brief Function-pointer for zetMetricGroupDestroyExp if __use_win_types: _zetMetricGroupDestroyExp_t = WINFUNCTYPE( ze_result_t, zet_metric_group_handle_t ) else: _zetMetricGroupDestroyExp_t = CFUNCTYPE( ze_result_t, zet_metric_group_handle_t ) ############################################################################### ## @brief Table of MetricGroupExp functions pointers class _zet_metric_group_exp_dditable_t(Structure): _fields_ = [ ("pfnCalculateMultipleMetricValuesExp", c_void_p), ## _zetMetricGroupCalculateMultipleMetricValuesExp_t ("pfnGetGlobalTimestampsExp", c_void_p), ## _zetMetricGroupGetGlobalTimestampsExp_t ("pfnGetExportDataExp", c_void_p), ## _zetMetricGroupGetExportDataExp_t ("pfnCalculateMetricExportDataExp", c_void_p), ## _zetMetricGroupCalculateMetricExportDataExp_t ("pfnCreateExp", c_void_p), ## _zetMetricGroupCreateExp_t ("pfnAddMetricExp", c_void_p), ## _zetMetricGroupAddMetricExp_t ("pfnRemoveMetricExp", c_void_p), ## _zetMetricGroupRemoveMetricExp_t ("pfnCloseExp", c_void_p), ## _zetMetricGroupCloseExp_t ("pfnDestroyExp", c_void_p) ## _zetMetricGroupDestroyExp_t ] ############################################################################### ## @brief Function-pointer for zetMetricStreamerOpen if __use_win_types: _zetMetricStreamerOpen_t = WINFUNCTYPE( ze_result_t, zet_context_handle_t, zet_device_handle_t, zet_metric_group_handle_t, POINTER(zet_metric_streamer_desc_t), ze_event_handle_t, POINTER(zet_metric_streamer_handle_t) ) else: _zetMetricStreamerOpen_t = CFUNCTYPE( ze_result_t, zet_context_handle_t, zet_device_handle_t, zet_metric_group_handle_t, POINTER(zet_metric_streamer_desc_t), ze_event_handle_t, POINTER(zet_metric_streamer_handle_t) ) ############################################################################### ## @brief Function-pointer for zetMetricStreamerClose if __use_win_types: _zetMetricStreamerClose_t = WINFUNCTYPE( ze_result_t, zet_metric_streamer_handle_t ) else: _zetMetricStreamerClose_t = CFUNCTYPE( ze_result_t, zet_metric_streamer_handle_t ) ############################################################################### ## @brief Function-pointer for zetMetricStreamerReadData if __use_win_types: _zetMetricStreamerReadData_t = WINFUNCTYPE( ze_result_t, zet_metric_streamer_handle_t, c_ulong, POINTER(c_size_t), POINTER(c_ubyte) ) else: _zetMetricStreamerReadData_t = CFUNCTYPE( ze_result_t, zet_metric_streamer_handle_t, c_ulong, POINTER(c_size_t), POINTER(c_ubyte) ) ############################################################################### ## @brief Table of MetricStreamer functions pointers class _zet_metric_streamer_dditable_t(Structure): _fields_ = [ ("pfnOpen", c_void_p), ## _zetMetricStreamerOpen_t ("pfnClose", c_void_p), ## _zetMetricStreamerClose_t ("pfnReadData", c_void_p) ## _zetMetricStreamerReadData_t ] ############################################################################### ## @brief Function-pointer for zetMetricQueryPoolCreate if __use_win_types: _zetMetricQueryPoolCreate_t = WINFUNCTYPE( ze_result_t, zet_context_handle_t, zet_device_handle_t, zet_metric_group_handle_t, POINTER(zet_metric_query_pool_desc_t), POINTER(zet_metric_query_pool_handle_t) ) else: _zetMetricQueryPoolCreate_t = CFUNCTYPE( ze_result_t, zet_context_handle_t, zet_device_handle_t, zet_metric_group_handle_t, POINTER(zet_metric_query_pool_desc_t), POINTER(zet_metric_query_pool_handle_t) ) ############################################################################### ## @brief Function-pointer for zetMetricQueryPoolDestroy if __use_win_types: _zetMetricQueryPoolDestroy_t = WINFUNCTYPE( ze_result_t, zet_metric_query_pool_handle_t ) else: _zetMetricQueryPoolDestroy_t = CFUNCTYPE( ze_result_t, zet_metric_query_pool_handle_t ) ############################################################################### ## @brief Table of MetricQueryPool functions pointers class _zet_metric_query_pool_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zetMetricQueryPoolCreate_t ("pfnDestroy", c_void_p) ## _zetMetricQueryPoolDestroy_t ] ############################################################################### ## @brief Function-pointer for zetMetricQueryCreate if __use_win_types: _zetMetricQueryCreate_t = WINFUNCTYPE( ze_result_t, zet_metric_query_pool_handle_t, c_ulong, POINTER(zet_metric_query_handle_t) ) else: _zetMetricQueryCreate_t = CFUNCTYPE( ze_result_t, zet_metric_query_pool_handle_t, c_ulong, POINTER(zet_metric_query_handle_t) ) ############################################################################### ## @brief Function-pointer for zetMetricQueryDestroy if __use_win_types: _zetMetricQueryDestroy_t = WINFUNCTYPE( ze_result_t, zet_metric_query_handle_t ) else: _zetMetricQueryDestroy_t = CFUNCTYPE( ze_result_t, zet_metric_query_handle_t ) ############################################################################### ## @brief Function-pointer for zetMetricQueryReset if __use_win_types: _zetMetricQueryReset_t = WINFUNCTYPE( ze_result_t, zet_metric_query_handle_t ) else: _zetMetricQueryReset_t = CFUNCTYPE( ze_result_t, zet_metric_query_handle_t ) ############################################################################### ## @brief Function-pointer for zetMetricQueryGetData if __use_win_types: _zetMetricQueryGetData_t = WINFUNCTYPE( ze_result_t, zet_metric_query_handle_t, POINTER(c_size_t), POINTER(c_ubyte) ) else: _zetMetricQueryGetData_t = CFUNCTYPE( ze_result_t, zet_metric_query_handle_t, POINTER(c_size_t), POINTER(c_ubyte) ) ############################################################################### ## @brief Table of MetricQuery functions pointers class _zet_metric_query_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zetMetricQueryCreate_t ("pfnDestroy", c_void_p), ## _zetMetricQueryDestroy_t ("pfnReset", c_void_p), ## _zetMetricQueryReset_t ("pfnGetData", c_void_p) ## _zetMetricQueryGetData_t ] ############################################################################### ## @brief Function-pointer for zetTracerExpCreate if __use_win_types: _zetTracerExpCreate_t = WINFUNCTYPE( ze_result_t, zet_context_handle_t, POINTER(zet_tracer_exp_desc_t), POINTER(zet_tracer_exp_handle_t) ) else: _zetTracerExpCreate_t = CFUNCTYPE( ze_result_t, zet_context_handle_t, POINTER(zet_tracer_exp_desc_t), POINTER(zet_tracer_exp_handle_t) ) ############################################################################### ## @brief Function-pointer for zetTracerExpDestroy if __use_win_types: _zetTracerExpDestroy_t = WINFUNCTYPE( ze_result_t, zet_tracer_exp_handle_t ) else: _zetTracerExpDestroy_t = CFUNCTYPE( ze_result_t, zet_tracer_exp_handle_t ) ############################################################################### ## @brief Function-pointer for zetTracerExpSetPrologues if __use_win_types: _zetTracerExpSetPrologues_t = WINFUNCTYPE( ze_result_t, zet_tracer_exp_handle_t, POINTER(zet_core_callbacks_t) ) else: _zetTracerExpSetPrologues_t = CFUNCTYPE( ze_result_t, zet_tracer_exp_handle_t, POINTER(zet_core_callbacks_t) ) ############################################################################### ## @brief Function-pointer for zetTracerExpSetEpilogues if __use_win_types: _zetTracerExpSetEpilogues_t = WINFUNCTYPE( ze_result_t, zet_tracer_exp_handle_t, POINTER(zet_core_callbacks_t) ) else: _zetTracerExpSetEpilogues_t = CFUNCTYPE( ze_result_t, zet_tracer_exp_handle_t, POINTER(zet_core_callbacks_t) ) ############################################################################### ## @brief Function-pointer for zetTracerExpSetEnabled if __use_win_types: _zetTracerExpSetEnabled_t = WINFUNCTYPE( ze_result_t, zet_tracer_exp_handle_t, ze_bool_t ) else: _zetTracerExpSetEnabled_t = CFUNCTYPE( ze_result_t, zet_tracer_exp_handle_t, ze_bool_t ) ############################################################################### ## @brief Table of TracerExp functions pointers class _zet_tracer_exp_dditable_t(Structure): _fields_ = [ ("pfnCreate", c_void_p), ## _zetTracerExpCreate_t ("pfnDestroy", c_void_p), ## _zetTracerExpDestroy_t ("pfnSetPrologues", c_void_p), ## _zetTracerExpSetPrologues_t ("pfnSetEpilogues", c_void_p), ## _zetTracerExpSetEpilogues_t ("pfnSetEnabled", c_void_p) ## _zetTracerExpSetEnabled_t ] ############################################################################### ## @brief Function-pointer for zetDebugAttach if __use_win_types: _zetDebugAttach_t = WINFUNCTYPE( ze_result_t, zet_device_handle_t, POINTER(zet_debug_config_t), POINTER(zet_debug_session_handle_t) ) else: _zetDebugAttach_t = CFUNCTYPE( ze_result_t, zet_device_handle_t, POINTER(zet_debug_config_t), POINTER(zet_debug_session_handle_t) ) ############################################################################### ## @brief Function-pointer for zetDebugDetach if __use_win_types: _zetDebugDetach_t = WINFUNCTYPE( ze_result_t, zet_debug_session_handle_t ) else: _zetDebugDetach_t = CFUNCTYPE( ze_result_t, zet_debug_session_handle_t ) ############################################################################### ## @brief Function-pointer for zetDebugReadEvent if __use_win_types: _zetDebugReadEvent_t = WINFUNCTYPE( ze_result_t, zet_debug_session_handle_t, c_ulonglong, POINTER(zet_debug_event_t) ) else: _zetDebugReadEvent_t = CFUNCTYPE( ze_result_t, zet_debug_session_handle_t, c_ulonglong, POINTER(zet_debug_event_t) ) ############################################################################### ## @brief Function-pointer for zetDebugAcknowledgeEvent if __use_win_types: _zetDebugAcknowledgeEvent_t = WINFUNCTYPE( ze_result_t, zet_debug_session_handle_t, POINTER(zet_debug_event_t) ) else: _zetDebugAcknowledgeEvent_t = CFUNCTYPE( ze_result_t, zet_debug_session_handle_t, POINTER(zet_debug_event_t) ) ############################################################################### ## @brief Function-pointer for zetDebugInterrupt if __use_win_types: _zetDebugInterrupt_t = WINFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t ) else: _zetDebugInterrupt_t = CFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t ) ############################################################################### ## @brief Function-pointer for zetDebugResume if __use_win_types: _zetDebugResume_t = WINFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t ) else: _zetDebugResume_t = CFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t ) ############################################################################### ## @brief Function-pointer for zetDebugReadMemory if __use_win_types: _zetDebugReadMemory_t = WINFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t, POINTER(zet_debug_memory_space_desc_t), c_size_t, c_void_p ) else: _zetDebugReadMemory_t = CFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t, POINTER(zet_debug_memory_space_desc_t), c_size_t, c_void_p ) ############################################################################### ## @brief Function-pointer for zetDebugWriteMemory if __use_win_types: _zetDebugWriteMemory_t = WINFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t, POINTER(zet_debug_memory_space_desc_t), c_size_t, c_void_p ) else: _zetDebugWriteMemory_t = CFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t, POINTER(zet_debug_memory_space_desc_t), c_size_t, c_void_p ) ############################################################################### ## @brief Function-pointer for zetDebugGetRegisterSetProperties if __use_win_types: _zetDebugGetRegisterSetProperties_t = WINFUNCTYPE( ze_result_t, zet_device_handle_t, POINTER(c_ulong), POINTER(zet_debug_regset_properties_t) ) else: _zetDebugGetRegisterSetProperties_t = CFUNCTYPE( ze_result_t, zet_device_handle_t, POINTER(c_ulong), POINTER(zet_debug_regset_properties_t) ) ############################################################################### ## @brief Function-pointer for zetDebugReadRegisters if __use_win_types: _zetDebugReadRegisters_t = WINFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t, c_ulong, c_ulong, c_ulong, c_void_p ) else: _zetDebugReadRegisters_t = CFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t, c_ulong, c_ulong, c_ulong, c_void_p ) ############################################################################### ## @brief Function-pointer for zetDebugWriteRegisters if __use_win_types: _zetDebugWriteRegisters_t = WINFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t, c_ulong, c_ulong, c_ulong, c_void_p ) else: _zetDebugWriteRegisters_t = CFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t, c_ulong, c_ulong, c_ulong, c_void_p ) ############################################################################### ## @brief Function-pointer for zetDebugGetThreadRegisterSetProperties if __use_win_types: _zetDebugGetThreadRegisterSetProperties_t = WINFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t, POINTER(c_ulong), POINTER(zet_debug_regset_properties_t) ) else: _zetDebugGetThreadRegisterSetProperties_t = CFUNCTYPE( ze_result_t, zet_debug_session_handle_t, ze_device_thread_t, POINTER(c_ulong), POINTER(zet_debug_regset_properties_t) ) ############################################################################### ## @brief Table of Debug functions pointers class _zet_debug_dditable_t(Structure): _fields_ = [ ("pfnAttach", c_void_p), ## _zetDebugAttach_t ("pfnDetach", c_void_p), ## _zetDebugDetach_t ("pfnReadEvent", c_void_p), ## _zetDebugReadEvent_t ("pfnAcknowledgeEvent", c_void_p), ## _zetDebugAcknowledgeEvent_t ("pfnInterrupt", c_void_p), ## _zetDebugInterrupt_t ("pfnResume", c_void_p), ## _zetDebugResume_t ("pfnReadMemory", c_void_p), ## _zetDebugReadMemory_t ("pfnWriteMemory", c_void_p), ## _zetDebugWriteMemory_t ("pfnGetRegisterSetProperties", c_void_p), ## _zetDebugGetRegisterSetProperties_t ("pfnReadRegisters", c_void_p), ## _zetDebugReadRegisters_t ("pfnWriteRegisters", c_void_p), ## _zetDebugWriteRegisters_t ("pfnGetThreadRegisterSetProperties", c_void_p) ## _zetDebugGetThreadRegisterSetProperties_t ] ############################################################################### class _zet_dditable_t(Structure): _fields_ = [ ("MetricProgrammableExp", _zet_metric_programmable_exp_dditable_t), ("MetricTracerExp", _zet_metric_tracer_exp_dditable_t), ("MetricDecoderExp", _zet_metric_decoder_exp_dditable_t), ("Device", _zet_device_dditable_t), ("DeviceExp", _zet_device_exp_dditable_t), ("Context", _zet_context_dditable_t), ("CommandList", _zet_command_list_dditable_t), ("Module", _zet_module_dditable_t), ("Kernel", _zet_kernel_dditable_t), ("Metric", _zet_metric_dditable_t), ("MetricExp", _zet_metric_exp_dditable_t), ("MetricGroup", _zet_metric_group_dditable_t), ("MetricGroupExp", _zet_metric_group_exp_dditable_t), ("MetricStreamer", _zet_metric_streamer_dditable_t), ("MetricQueryPool", _zet_metric_query_pool_dditable_t), ("MetricQuery", _zet_metric_query_dditable_t), ("TracerExp", _zet_tracer_exp_dditable_t), ("Debug", _zet_debug_dditable_t) ] ############################################################################### ## @brief zet device-driver interfaces class ZET_DDI: def __init__(self, version : ze_api_version_t): # load the ze_loader library if "Windows" == platform.uname()[0]: self.__dll = WinDLL("ze_loader.dll") else: self.__dll = CDLL("ze_loader.so") # fill the ddi tables self.__dditable = _zet_dditable_t() # call driver to get function pointers _MetricProgrammableExp = _zet_metric_programmable_exp_dditable_t() r = ze_result_v(self.__dll.zetGetMetricProgrammableExpProcAddrTable(version, byref(_MetricProgrammableExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.MetricProgrammableExp = _MetricProgrammableExp # attach function interface to function address self.zetMetricProgrammableGetExp = _zetMetricProgrammableGetExp_t(self.__dditable.MetricProgrammableExp.pfnGetExp) self.zetMetricProgrammableGetPropertiesExp = _zetMetricProgrammableGetPropertiesExp_t(self.__dditable.MetricProgrammableExp.pfnGetPropertiesExp) self.zetMetricProgrammableGetParamInfoExp = _zetMetricProgrammableGetParamInfoExp_t(self.__dditable.MetricProgrammableExp.pfnGetParamInfoExp) self.zetMetricProgrammableGetParamValueInfoExp = _zetMetricProgrammableGetParamValueInfoExp_t(self.__dditable.MetricProgrammableExp.pfnGetParamValueInfoExp) # call driver to get function pointers _MetricTracerExp = _zet_metric_tracer_exp_dditable_t() r = ze_result_v(self.__dll.zetGetMetricTracerExpProcAddrTable(version, byref(_MetricTracerExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.MetricTracerExp = _MetricTracerExp # attach function interface to function address self.zetMetricTracerCreateExp = _zetMetricTracerCreateExp_t(self.__dditable.MetricTracerExp.pfnCreateExp) self.zetMetricTracerDestroyExp = _zetMetricTracerDestroyExp_t(self.__dditable.MetricTracerExp.pfnDestroyExp) self.zetMetricTracerEnableExp = _zetMetricTracerEnableExp_t(self.__dditable.MetricTracerExp.pfnEnableExp) self.zetMetricTracerDisableExp = _zetMetricTracerDisableExp_t(self.__dditable.MetricTracerExp.pfnDisableExp) self.zetMetricTracerReadDataExp = _zetMetricTracerReadDataExp_t(self.__dditable.MetricTracerExp.pfnReadDataExp) self.zetMetricTracerDecodeExp = _zetMetricTracerDecodeExp_t(self.__dditable.MetricTracerExp.pfnDecodeExp) # call driver to get function pointers _MetricDecoderExp = _zet_metric_decoder_exp_dditable_t() r = ze_result_v(self.__dll.zetGetMetricDecoderExpProcAddrTable(version, byref(_MetricDecoderExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.MetricDecoderExp = _MetricDecoderExp # attach function interface to function address self.zetMetricDecoderCreateExp = _zetMetricDecoderCreateExp_t(self.__dditable.MetricDecoderExp.pfnCreateExp) self.zetMetricDecoderDestroyExp = _zetMetricDecoderDestroyExp_t(self.__dditable.MetricDecoderExp.pfnDestroyExp) self.zetMetricDecoderGetDecodableMetricsExp = _zetMetricDecoderGetDecodableMetricsExp_t(self.__dditable.MetricDecoderExp.pfnGetDecodableMetricsExp) # call driver to get function pointers _Device = _zet_device_dditable_t() r = ze_result_v(self.__dll.zetGetDeviceProcAddrTable(version, byref(_Device))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Device = _Device # attach function interface to function address self.zetDeviceGetDebugProperties = _zetDeviceGetDebugProperties_t(self.__dditable.Device.pfnGetDebugProperties) # call driver to get function pointers _DeviceExp = _zet_device_exp_dditable_t() r = ze_result_v(self.__dll.zetGetDeviceExpProcAddrTable(version, byref(_DeviceExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.DeviceExp = _DeviceExp # attach function interface to function address self.zetDeviceGetConcurrentMetricGroupsExp = _zetDeviceGetConcurrentMetricGroupsExp_t(self.__dditable.DeviceExp.pfnGetConcurrentMetricGroupsExp) self.zetDeviceCreateMetricGroupsFromMetricsExp = _zetDeviceCreateMetricGroupsFromMetricsExp_t(self.__dditable.DeviceExp.pfnCreateMetricGroupsFromMetricsExp) # call driver to get function pointers _Context = _zet_context_dditable_t() r = ze_result_v(self.__dll.zetGetContextProcAddrTable(version, byref(_Context))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Context = _Context # attach function interface to function address self.zetContextActivateMetricGroups = _zetContextActivateMetricGroups_t(self.__dditable.Context.pfnActivateMetricGroups) # call driver to get function pointers _CommandList = _zet_command_list_dditable_t() r = ze_result_v(self.__dll.zetGetCommandListProcAddrTable(version, byref(_CommandList))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.CommandList = _CommandList # attach function interface to function address self.zetCommandListAppendMetricStreamerMarker = _zetCommandListAppendMetricStreamerMarker_t(self.__dditable.CommandList.pfnAppendMetricStreamerMarker) self.zetCommandListAppendMetricQueryBegin = _zetCommandListAppendMetricQueryBegin_t(self.__dditable.CommandList.pfnAppendMetricQueryBegin) self.zetCommandListAppendMetricQueryEnd = _zetCommandListAppendMetricQueryEnd_t(self.__dditable.CommandList.pfnAppendMetricQueryEnd) self.zetCommandListAppendMetricMemoryBarrier = _zetCommandListAppendMetricMemoryBarrier_t(self.__dditable.CommandList.pfnAppendMetricMemoryBarrier) # call driver to get function pointers _Module = _zet_module_dditable_t() r = ze_result_v(self.__dll.zetGetModuleProcAddrTable(version, byref(_Module))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Module = _Module # attach function interface to function address self.zetModuleGetDebugInfo = _zetModuleGetDebugInfo_t(self.__dditable.Module.pfnGetDebugInfo) # call driver to get function pointers _Kernel = _zet_kernel_dditable_t() r = ze_result_v(self.__dll.zetGetKernelProcAddrTable(version, byref(_Kernel))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Kernel = _Kernel # attach function interface to function address self.zetKernelGetProfileInfo = _zetKernelGetProfileInfo_t(self.__dditable.Kernel.pfnGetProfileInfo) # call driver to get function pointers _Metric = _zet_metric_dditable_t() r = ze_result_v(self.__dll.zetGetMetricProcAddrTable(version, byref(_Metric))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Metric = _Metric # attach function interface to function address self.zetMetricGet = _zetMetricGet_t(self.__dditable.Metric.pfnGet) self.zetMetricGetProperties = _zetMetricGetProperties_t(self.__dditable.Metric.pfnGetProperties) # call driver to get function pointers _MetricExp = _zet_metric_exp_dditable_t() r = ze_result_v(self.__dll.zetGetMetricExpProcAddrTable(version, byref(_MetricExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.MetricExp = _MetricExp # attach function interface to function address self.zetMetricCreateFromProgrammableExp = _zetMetricCreateFromProgrammableExp_t(self.__dditable.MetricExp.pfnCreateFromProgrammableExp) self.zetMetricDestroyExp = _zetMetricDestroyExp_t(self.__dditable.MetricExp.pfnDestroyExp) self.zetMetricCreateFromProgrammableExp2 = _zetMetricCreateFromProgrammableExp2_t(self.__dditable.MetricExp.pfnCreateFromProgrammableExp2) # call driver to get function pointers _MetricGroup = _zet_metric_group_dditable_t() r = ze_result_v(self.__dll.zetGetMetricGroupProcAddrTable(version, byref(_MetricGroup))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.MetricGroup = _MetricGroup # attach function interface to function address self.zetMetricGroupGet = _zetMetricGroupGet_t(self.__dditable.MetricGroup.pfnGet) self.zetMetricGroupGetProperties = _zetMetricGroupGetProperties_t(self.__dditable.MetricGroup.pfnGetProperties) self.zetMetricGroupCalculateMetricValues = _zetMetricGroupCalculateMetricValues_t(self.__dditable.MetricGroup.pfnCalculateMetricValues) # call driver to get function pointers _MetricGroupExp = _zet_metric_group_exp_dditable_t() r = ze_result_v(self.__dll.zetGetMetricGroupExpProcAddrTable(version, byref(_MetricGroupExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.MetricGroupExp = _MetricGroupExp # attach function interface to function address self.zetMetricGroupCalculateMultipleMetricValuesExp = _zetMetricGroupCalculateMultipleMetricValuesExp_t(self.__dditable.MetricGroupExp.pfnCalculateMultipleMetricValuesExp) self.zetMetricGroupGetGlobalTimestampsExp = _zetMetricGroupGetGlobalTimestampsExp_t(self.__dditable.MetricGroupExp.pfnGetGlobalTimestampsExp) self.zetMetricGroupGetExportDataExp = _zetMetricGroupGetExportDataExp_t(self.__dditable.MetricGroupExp.pfnGetExportDataExp) self.zetMetricGroupCalculateMetricExportDataExp = _zetMetricGroupCalculateMetricExportDataExp_t(self.__dditable.MetricGroupExp.pfnCalculateMetricExportDataExp) self.zetMetricGroupCreateExp = _zetMetricGroupCreateExp_t(self.__dditable.MetricGroupExp.pfnCreateExp) self.zetMetricGroupAddMetricExp = _zetMetricGroupAddMetricExp_t(self.__dditable.MetricGroupExp.pfnAddMetricExp) self.zetMetricGroupRemoveMetricExp = _zetMetricGroupRemoveMetricExp_t(self.__dditable.MetricGroupExp.pfnRemoveMetricExp) self.zetMetricGroupCloseExp = _zetMetricGroupCloseExp_t(self.__dditable.MetricGroupExp.pfnCloseExp) self.zetMetricGroupDestroyExp = _zetMetricGroupDestroyExp_t(self.__dditable.MetricGroupExp.pfnDestroyExp) # call driver to get function pointers _MetricStreamer = _zet_metric_streamer_dditable_t() r = ze_result_v(self.__dll.zetGetMetricStreamerProcAddrTable(version, byref(_MetricStreamer))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.MetricStreamer = _MetricStreamer # attach function interface to function address self.zetMetricStreamerOpen = _zetMetricStreamerOpen_t(self.__dditable.MetricStreamer.pfnOpen) self.zetMetricStreamerClose = _zetMetricStreamerClose_t(self.__dditable.MetricStreamer.pfnClose) self.zetMetricStreamerReadData = _zetMetricStreamerReadData_t(self.__dditable.MetricStreamer.pfnReadData) # call driver to get function pointers _MetricQueryPool = _zet_metric_query_pool_dditable_t() r = ze_result_v(self.__dll.zetGetMetricQueryPoolProcAddrTable(version, byref(_MetricQueryPool))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.MetricQueryPool = _MetricQueryPool # attach function interface to function address self.zetMetricQueryPoolCreate = _zetMetricQueryPoolCreate_t(self.__dditable.MetricQueryPool.pfnCreate) self.zetMetricQueryPoolDestroy = _zetMetricQueryPoolDestroy_t(self.__dditable.MetricQueryPool.pfnDestroy) # call driver to get function pointers _MetricQuery = _zet_metric_query_dditable_t() r = ze_result_v(self.__dll.zetGetMetricQueryProcAddrTable(version, byref(_MetricQuery))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.MetricQuery = _MetricQuery # attach function interface to function address self.zetMetricQueryCreate = _zetMetricQueryCreate_t(self.__dditable.MetricQuery.pfnCreate) self.zetMetricQueryDestroy = _zetMetricQueryDestroy_t(self.__dditable.MetricQuery.pfnDestroy) self.zetMetricQueryReset = _zetMetricQueryReset_t(self.__dditable.MetricQuery.pfnReset) self.zetMetricQueryGetData = _zetMetricQueryGetData_t(self.__dditable.MetricQuery.pfnGetData) # call driver to get function pointers _TracerExp = _zet_tracer_exp_dditable_t() r = ze_result_v(self.__dll.zetGetTracerExpProcAddrTable(version, byref(_TracerExp))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.TracerExp = _TracerExp # attach function interface to function address self.zetTracerExpCreate = _zetTracerExpCreate_t(self.__dditable.TracerExp.pfnCreate) self.zetTracerExpDestroy = _zetTracerExpDestroy_t(self.__dditable.TracerExp.pfnDestroy) self.zetTracerExpSetPrologues = _zetTracerExpSetPrologues_t(self.__dditable.TracerExp.pfnSetPrologues) self.zetTracerExpSetEpilogues = _zetTracerExpSetEpilogues_t(self.__dditable.TracerExp.pfnSetEpilogues) self.zetTracerExpSetEnabled = _zetTracerExpSetEnabled_t(self.__dditable.TracerExp.pfnSetEnabled) # call driver to get function pointers _Debug = _zet_debug_dditable_t() r = ze_result_v(self.__dll.zetGetDebugProcAddrTable(version, byref(_Debug))) if r != ze_result_v.SUCCESS: raise Exception(r) self.__dditable.Debug = _Debug # attach function interface to function address self.zetDebugAttach = _zetDebugAttach_t(self.__dditable.Debug.pfnAttach) self.zetDebugDetach = _zetDebugDetach_t(self.__dditable.Debug.pfnDetach) self.zetDebugReadEvent = _zetDebugReadEvent_t(self.__dditable.Debug.pfnReadEvent) self.zetDebugAcknowledgeEvent = _zetDebugAcknowledgeEvent_t(self.__dditable.Debug.pfnAcknowledgeEvent) self.zetDebugInterrupt = _zetDebugInterrupt_t(self.__dditable.Debug.pfnInterrupt) self.zetDebugResume = _zetDebugResume_t(self.__dditable.Debug.pfnResume) self.zetDebugReadMemory = _zetDebugReadMemory_t(self.__dditable.Debug.pfnReadMemory) self.zetDebugWriteMemory = _zetDebugWriteMemory_t(self.__dditable.Debug.pfnWriteMemory) self.zetDebugGetRegisterSetProperties = _zetDebugGetRegisterSetProperties_t(self.__dditable.Debug.pfnGetRegisterSetProperties) self.zetDebugReadRegisters = _zetDebugReadRegisters_t(self.__dditable.Debug.pfnReadRegisters) self.zetDebugWriteRegisters = _zetDebugWriteRegisters_t(self.__dditable.Debug.pfnWriteRegisters) self.zetDebugGetThreadRegisterSetProperties = _zetDebugGetThreadRegisterSetProperties_t(self.__dditable.Debug.pfnGetThreadRegisterSetProperties) # success! level-zero-1.20.6/include/zet_api.h000066400000000000000000005657121475521542100171410ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_api.h * @version v1.12-r1.12.15 * */ #ifndef _ZET_API_H #define _ZET_API_H #if defined(__cplusplus) #pragma once #endif // 'core' API headers #include "ze_api.h" #if defined(__cplusplus) extern "C" { #endif // Intel 'oneAPI' Level-Zero Tool API common types #if !defined(__GNUC__) #pragma region common #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Handle to a driver instance typedef ze_driver_handle_t zet_driver_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of device object typedef ze_device_handle_t zet_device_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of context object typedef ze_context_handle_t zet_context_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of command list object typedef ze_command_list_handle_t zet_command_list_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of module object typedef ze_module_handle_t zet_module_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of function object typedef ze_kernel_handle_t zet_kernel_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of metric group's object typedef struct _zet_metric_group_handle_t *zet_metric_group_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of metric's object typedef struct _zet_metric_handle_t *zet_metric_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of metric streamer's object typedef struct _zet_metric_streamer_handle_t *zet_metric_streamer_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of metric query pool's object typedef struct _zet_metric_query_pool_handle_t *zet_metric_query_pool_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of metric query's object typedef struct _zet_metric_query_handle_t *zet_metric_query_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of tracer object typedef struct _zet_tracer_exp_handle_t *zet_tracer_exp_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Debug session handle typedef struct _zet_debug_session_handle_t *zet_debug_session_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Defines structure types typedef enum _zet_structure_type_t { ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES = 0x1, ///< ::zet_metric_group_properties_t ZET_STRUCTURE_TYPE_METRIC_PROPERTIES = 0x2, ///< ::zet_metric_properties_t ZET_STRUCTURE_TYPE_METRIC_STREAMER_DESC = 0x3, ///< ::zet_metric_streamer_desc_t ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC = 0x4, ///< ::zet_metric_query_pool_desc_t ZET_STRUCTURE_TYPE_PROFILE_PROPERTIES = 0x5, ///< ::zet_profile_properties_t ZET_STRUCTURE_TYPE_DEVICE_DEBUG_PROPERTIES = 0x6, ///< ::zet_device_debug_properties_t ZET_STRUCTURE_TYPE_DEBUG_MEMORY_SPACE_DESC = 0x7, ///< ::zet_debug_memory_space_desc_t ZET_STRUCTURE_TYPE_DEBUG_REGSET_PROPERTIES = 0x8, ///< ::zet_debug_regset_properties_t ZET_STRUCTURE_TYPE_GLOBAL_METRICS_TIMESTAMPS_EXP_PROPERTIES = 0x9, ///< ::zet_metric_global_timestamps_resolution_exp_t. Deprecated, use ///< ::ZET_STRUCTURE_TYPE_METRIC_GLOBAL_TIMESTAMPS_RESOLUTION_EXP. ZET_STRUCTURE_TYPE_METRIC_GLOBAL_TIMESTAMPS_RESOLUTION_EXP = 0x9, ///< ::zet_metric_global_timestamps_resolution_exp_t ZET_STRUCTURE_TYPE_TRACER_EXP_DESC = 0x00010001, ///< ::zet_tracer_exp_desc_t ZET_STRUCTURE_TYPE_METRICS_CALCULATE_EXP_DESC = 0x00010002, ///< ::zet_metric_calculate_exp_desc_t. Deprecated, use ///< ::ZET_STRUCTURE_TYPE_METRIC_CALCULATE_EXP_DESC. ZET_STRUCTURE_TYPE_METRIC_CALCULATE_EXP_DESC = 0x00010002, ///< ::zet_metric_calculate_exp_desc_t ZET_STRUCTURE_TYPE_METRIC_PROGRAMMABLE_EXP_PROPERTIES = 0x00010003, ///< ::zet_metric_programmable_exp_properties_t ZET_STRUCTURE_TYPE_METRIC_PROGRAMMABLE_PARAM_INFO_EXP = 0x00010004, ///< ::zet_metric_programmable_param_info_exp_t ZET_STRUCTURE_TYPE_METRIC_PROGRAMMABLE_PARAM_VALUE_INFO_EXP = 0x00010005, ///< ::zet_metric_programmable_param_value_info_exp_t ZET_STRUCTURE_TYPE_METRIC_GROUP_TYPE_EXP = 0x00010006, ///< ::zet_metric_group_type_exp_t ZET_STRUCTURE_TYPE_EXPORT_DMA_EXP_PROPERTIES = 0x00010007, ///< ::zet_export_dma_buf_exp_properties_t ZET_STRUCTURE_TYPE_METRIC_TRACER_EXP_DESC = 0x00010008, ///< ::zet_metric_tracer_exp_desc_t ZET_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff } zet_structure_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Base for all properties types typedef struct _zet_base_properties_t { zet_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). } zet_base_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Base for all descriptor types typedef struct _zet_base_desc_t { zet_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). } zet_base_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported value types typedef enum _zet_value_type_t { ZET_VALUE_TYPE_UINT32 = 0, ///< 32-bit unsigned-integer ZET_VALUE_TYPE_UINT64 = 1, ///< 64-bit unsigned-integer ZET_VALUE_TYPE_FLOAT32 = 2, ///< 32-bit floating-point ZET_VALUE_TYPE_FLOAT64 = 3, ///< 64-bit floating-point ZET_VALUE_TYPE_BOOL8 = 4, ///< 8-bit boolean ZET_VALUE_TYPE_STRING = 5, ///< C string ZET_VALUE_TYPE_UINT8 = 6, ///< 8-bit unsigned-integer ZET_VALUE_TYPE_UINT16 = 7, ///< 16-bit unsigned-integer ZET_VALUE_TYPE_FORCE_UINT32 = 0x7fffffff } zet_value_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Union of values typedef union _zet_value_t { uint32_t ui32; ///< [out] 32-bit unsigned-integer uint64_t ui64; ///< [out] 64-bit unsigned-integer float fp32; ///< [out] 32-bit floating-point double fp64; ///< [out] 64-bit floating-point ze_bool_t b8; ///< [out] 8-bit boolean } zet_value_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Typed value typedef struct _zet_typed_value_t { zet_value_type_t type; ///< [out] type of value zet_value_t value; ///< [out] value } zet_typed_value_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Enables driver instrumentation and dependencies for device metrics /////////////////////////////////////////////////////////////////////////////// /// @brief Enables driver instrumentation and dependencies for program /// instrumentation /////////////////////////////////////////////////////////////////////////////// /// @brief Enables driver instrumentation and dependencies for program debugging /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_base_properties_t typedef struct _zet_base_properties_t zet_base_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_base_desc_t typedef struct _zet_base_desc_t zet_base_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_typed_value_t typedef struct _zet_typed_value_t zet_typed_value_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_device_debug_properties_t typedef struct _zet_device_debug_properties_t zet_device_debug_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_debug_config_t typedef struct _zet_debug_config_t zet_debug_config_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_debug_event_info_detached_t typedef struct _zet_debug_event_info_detached_t zet_debug_event_info_detached_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_debug_event_info_module_t typedef struct _zet_debug_event_info_module_t zet_debug_event_info_module_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_debug_event_info_thread_stopped_t typedef struct _zet_debug_event_info_thread_stopped_t zet_debug_event_info_thread_stopped_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_debug_event_info_page_fault_t typedef struct _zet_debug_event_info_page_fault_t zet_debug_event_info_page_fault_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_debug_event_t typedef struct _zet_debug_event_t zet_debug_event_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_debug_memory_space_desc_t typedef struct _zet_debug_memory_space_desc_t zet_debug_memory_space_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_debug_regset_properties_t typedef struct _zet_debug_regset_properties_t zet_debug_regset_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_group_properties_t typedef struct _zet_metric_group_properties_t zet_metric_group_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_properties_t typedef struct _zet_metric_properties_t zet_metric_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_streamer_desc_t typedef struct _zet_metric_streamer_desc_t zet_metric_streamer_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_query_pool_desc_t typedef struct _zet_metric_query_pool_desc_t zet_metric_query_pool_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_profile_properties_t typedef struct _zet_profile_properties_t zet_profile_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_profile_free_register_token_t typedef struct _zet_profile_free_register_token_t zet_profile_free_register_token_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_profile_register_sequence_t typedef struct _zet_profile_register_sequence_t zet_profile_register_sequence_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_tracer_exp_desc_t typedef struct _zet_tracer_exp_desc_t zet_tracer_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_tracer_exp_desc_t typedef struct _zet_metric_tracer_exp_desc_t zet_metric_tracer_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_entry_exp_t typedef struct _zet_metric_entry_exp_t zet_metric_entry_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_group_type_exp_t typedef struct _zet_metric_group_type_exp_t zet_metric_group_type_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_export_dma_buf_exp_properties_t typedef struct _zet_export_dma_buf_exp_properties_t zet_export_dma_buf_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_global_timestamps_resolution_exp_t typedef struct _zet_metric_global_timestamps_resolution_exp_t zet_metric_global_timestamps_resolution_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_calculate_exp_desc_t typedef struct _zet_metric_calculate_exp_desc_t zet_metric_calculate_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_programmable_exp_properties_t typedef struct _zet_metric_programmable_exp_properties_t zet_metric_programmable_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_value_uint64_range_exp_t typedef struct _zet_value_uint64_range_exp_t zet_value_uint64_range_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_value_fp64_range_exp_t typedef struct _zet_value_fp64_range_exp_t zet_value_fp64_range_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_programmable_param_info_exp_t typedef struct _zet_metric_programmable_param_info_exp_t zet_metric_programmable_param_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_programmable_param_value_info_exp_t typedef struct _zet_metric_programmable_param_value_info_exp_t zet_metric_programmable_param_value_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Forward-declare zet_metric_programmable_param_value_exp_t typedef struct _zet_metric_programmable_param_value_exp_t zet_metric_programmable_param_value_exp_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for Device #if !defined(__GNUC__) #pragma region device #endif #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for Context #if !defined(__GNUC__) #pragma region context #endif #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for Command List #if !defined(__GNUC__) #pragma region cmdlist #endif #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for Module #if !defined(__GNUC__) #pragma region module #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported module debug info formats. typedef enum _zet_module_debug_info_format_t { ZET_MODULE_DEBUG_INFO_FORMAT_ELF_DWARF = 0, ///< Format is ELF/DWARF ZET_MODULE_DEBUG_INFO_FORMAT_FORCE_UINT32 = 0x7fffffff } zet_module_debug_info_format_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve debug info from module. /// /// @details /// - The caller can pass nullptr for pDebugInfo when querying only for /// size. /// - The implementation will copy the native binary into a buffer supplied /// by the caller. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_MODULE_DEBUG_INFO_FORMAT_ELF_DWARF < format` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` ZE_APIEXPORT ze_result_t ZE_APICALL zetModuleGetDebugInfo( zet_module_handle_t hModule, ///< [in] handle of the module zet_module_debug_info_format_t format, ///< [in] debug info format requested size_t* pSize, ///< [in,out] size of debug info in bytes uint8_t* pDebugInfo ///< [in,out][optional] byte pointer to debug info ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for Program Debug #if !defined(__GNUC__) #pragma region debug #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported device debug property flags typedef uint32_t zet_device_debug_property_flags_t; typedef enum _zet_device_debug_property_flag_t { ZET_DEVICE_DEBUG_PROPERTY_FLAG_ATTACH = ZE_BIT(0), ///< the device supports attaching for debug ZET_DEVICE_DEBUG_PROPERTY_FLAG_FORCE_UINT32 = 0x7fffffff } zet_device_debug_property_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device debug properties queried using ::zetDeviceGetDebugProperties. typedef struct _zet_device_debug_properties_t { zet_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zet_device_debug_property_flags_t flags; ///< [out] returns 0 (none) or a valid combination of ///< ::zet_device_debug_property_flag_t } zet_device_debug_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves debug properties of the device. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pDebugProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zetDeviceGetDebugProperties( zet_device_handle_t hDevice, ///< [in] device handle zet_device_debug_properties_t* pDebugProperties ///< [in,out] query result for debug properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Debug configuration provided to ::zetDebugAttach typedef struct _zet_debug_config_t { uint32_t pid; ///< [in] the host process identifier } zet_debug_config_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Attach to a device. /// /// @details /// - The device must be enabled for debug; see /// ::zesSchedulerSetComputeUnitDebugMode. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == config` /// + `nullptr == phDebug` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + attaching to this device is not supported /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + caller does not have sufficient permissions /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + a debugger is already attached ZE_APIEXPORT ze_result_t ZE_APICALL zetDebugAttach( zet_device_handle_t hDevice, ///< [in] device handle const zet_debug_config_t* config, ///< [in] the debug configuration zet_debug_session_handle_t* phDebug ///< [out] debug session handle ); /////////////////////////////////////////////////////////////////////////////// /// @brief Close a debug session. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` ZE_APIEXPORT ze_result_t ZE_APICALL zetDebugDetach( zet_debug_session_handle_t hDebug ///< [in][release] debug session handle ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported debug event flags. typedef uint32_t zet_debug_event_flags_t; typedef enum _zet_debug_event_flag_t { ZET_DEBUG_EVENT_FLAG_NEED_ACK = ZE_BIT(0), ///< The event needs to be acknowledged by calling ///< ::zetDebugAcknowledgeEvent. ZET_DEBUG_EVENT_FLAG_FORCE_UINT32 = 0x7fffffff } zet_debug_event_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported debug event types. typedef enum _zet_debug_event_type_t { ZET_DEBUG_EVENT_TYPE_INVALID = 0, ///< The event is invalid ZET_DEBUG_EVENT_TYPE_DETACHED = 1, ///< The tool was detached ZET_DEBUG_EVENT_TYPE_PROCESS_ENTRY = 2, ///< The debuggee process created command queues on the device ZET_DEBUG_EVENT_TYPE_PROCESS_EXIT = 3, ///< The debuggee process destroyed all command queues on the device ZET_DEBUG_EVENT_TYPE_MODULE_LOAD = 4, ///< An in-memory module was loaded onto the device ZET_DEBUG_EVENT_TYPE_MODULE_UNLOAD = 5, ///< An in-memory module is about to get unloaded from the device ZET_DEBUG_EVENT_TYPE_THREAD_STOPPED = 6, ///< The thread stopped due to a device exception ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE = 7, ///< The thread is not available to be stopped ZET_DEBUG_EVENT_TYPE_PAGE_FAULT = 8, ///< A page request could not be completed on the device ZET_DEBUG_EVENT_TYPE_FORCE_UINT32 = 0x7fffffff } zet_debug_event_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported debug detach reasons. typedef enum _zet_debug_detach_reason_t { ZET_DEBUG_DETACH_REASON_INVALID = 0, ///< The detach reason is not valid ZET_DEBUG_DETACH_REASON_HOST_EXIT = 1, ///< The host process exited ZET_DEBUG_DETACH_REASON_FORCE_UINT32 = 0x7fffffff } zet_debug_detach_reason_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Event information for ::ZET_DEBUG_EVENT_TYPE_DETACHED typedef struct _zet_debug_event_info_detached_t { zet_debug_detach_reason_t reason; ///< [out] the detach reason } zet_debug_event_info_detached_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Event information for ::ZET_DEBUG_EVENT_TYPE_MODULE_LOAD and /// ::ZET_DEBUG_EVENT_TYPE_MODULE_UNLOAD typedef struct _zet_debug_event_info_module_t { zet_module_debug_info_format_t format; ///< [out] the module format uint64_t moduleBegin; ///< [out] the begin address of the in-memory module (inclusive) uint64_t moduleEnd; ///< [out] the end address of the in-memory module (exclusive) uint64_t load; ///< [out] the load address of the module on the device } zet_debug_event_info_module_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Event information for ::ZET_DEBUG_EVENT_TYPE_THREAD_STOPPED and /// ::ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE typedef struct _zet_debug_event_info_thread_stopped_t { ze_device_thread_t thread; ///< [out] the stopped/unavailable thread } zet_debug_event_info_thread_stopped_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Page fault reasons. typedef enum _zet_debug_page_fault_reason_t { ZET_DEBUG_PAGE_FAULT_REASON_INVALID = 0, ///< The page fault reason is not valid ZET_DEBUG_PAGE_FAULT_REASON_MAPPING_ERROR = 1, ///< The address is not mapped ZET_DEBUG_PAGE_FAULT_REASON_PERMISSION_ERROR = 2, ///< Invalid access permissions ZET_DEBUG_PAGE_FAULT_REASON_FORCE_UINT32 = 0x7fffffff } zet_debug_page_fault_reason_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Event information for ::ZET_DEBUG_EVENT_TYPE_PAGE_FAULT typedef struct _zet_debug_event_info_page_fault_t { uint64_t address; ///< [out] the faulting address uint64_t mask; ///< [out] the alignment mask zet_debug_page_fault_reason_t reason; ///< [out] the page fault reason } zet_debug_event_info_page_fault_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Event type-specific information typedef union _zet_debug_event_info_t { zet_debug_event_info_detached_t detached; ///< [out] type == ::ZET_DEBUG_EVENT_TYPE_DETACHED zet_debug_event_info_module_t module; ///< [out] type == ::ZET_DEBUG_EVENT_TYPE_MODULE_LOAD or ///< ::ZET_DEBUG_EVENT_TYPE_MODULE_UNLOAD zet_debug_event_info_thread_stopped_t thread; ///< [out] type == ::ZET_DEBUG_EVENT_TYPE_THREAD_STOPPED or ///< ::ZET_DEBUG_EVENT_TYPE_THREAD_UNAVAILABLE zet_debug_event_info_page_fault_t page_fault; ///< [out] type == ::ZET_DEBUG_EVENT_TYPE_PAGE_FAULT } zet_debug_event_info_t; /////////////////////////////////////////////////////////////////////////////// /// @brief A debug event on the device. typedef struct _zet_debug_event_t { zet_debug_event_type_t type; ///< [out] the event type zet_debug_event_flags_t flags; ///< [out] returns 0 (none) or a combination of ::zet_debug_event_flag_t zet_debug_event_info_t info; ///< [out] event type specific information } zet_debug_event_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Read the topmost debug event. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == event` /// - ::ZE_RESULT_NOT_READY /// + the timeout expired ZE_APIEXPORT ze_result_t ZE_APICALL zetDebugReadEvent( zet_debug_session_handle_t hDebug, ///< [in] debug session handle uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the event; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. zet_debug_event_t* event ///< [in,out] a pointer to a ::zet_debug_event_t. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Acknowledge a debug event. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == event` ZE_APIEXPORT ze_result_t ZE_APICALL zetDebugAcknowledgeEvent( zet_debug_session_handle_t hDebug, ///< [in] debug session handle const zet_debug_event_t* event ///< [in] a pointer to a ::zet_debug_event_t. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Interrupt device threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is already stopped or unavailable ZE_APIEXPORT ze_result_t ZE_APICALL zetDebugInterrupt( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to interrupt ); /////////////////////////////////////////////////////////////////////////////// /// @brief Resume device threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is already running or unavailable ZE_APIEXPORT ze_result_t ZE_APICALL zetDebugResume( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to resume ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported device memory space types. typedef enum _zet_debug_memory_space_type_t { ZET_DEBUG_MEMORY_SPACE_TYPE_DEFAULT = 0, ///< default memory space (attribute may be omitted) ZET_DEBUG_MEMORY_SPACE_TYPE_SLM = 1, ///< shared local memory space (GPU-only) ZET_DEBUG_MEMORY_SPACE_TYPE_ELF = 2, ///< ELF file memory space ZET_DEBUG_MEMORY_SPACE_TYPE_FORCE_UINT32 = 0x7fffffff } zet_debug_memory_space_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device memory space descriptor typedef struct _zet_debug_memory_space_desc_t { zet_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zet_debug_memory_space_type_t type; ///< [in] type of memory space uint64_t address; ///< [in] the virtual address within the memory space } zet_debug_memory_space_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Read memory. /// /// @details /// - The thread identifier 'all' can be used for accessing the default /// memory space, e.g. for setting breakpoints. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == buffer` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_DEBUG_MEMORY_SPACE_TYPE_ELF < desc->type` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is running or unavailable /// + the memory cannot be accessed from the supplied thread ZE_APIEXPORT ze_result_t ZE_APICALL zetDebugReadMemory( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to read void* buffer ///< [in,out] a buffer to hold a copy of the memory ); /////////////////////////////////////////////////////////////////////////////// /// @brief Write memory. /// /// @details /// - The thread identifier 'all' can be used for accessing the default /// memory space, e.g. for setting breakpoints. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == buffer` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_DEBUG_MEMORY_SPACE_TYPE_ELF < desc->type` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is running or unavailable /// + the memory cannot be accessed from the supplied thread ZE_APIEXPORT ze_result_t ZE_APICALL zetDebugWriteMemory( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to write const void* buffer ///< [in] a buffer holding the pattern to write ); /////////////////////////////////////////////////////////////////////////////// /// @brief Supported general register set flags. typedef uint32_t zet_debug_regset_flags_t; typedef enum _zet_debug_regset_flag_t { ZET_DEBUG_REGSET_FLAG_READABLE = ZE_BIT(0), ///< register set is readable ZET_DEBUG_REGSET_FLAG_WRITEABLE = ZE_BIT(1), ///< register set is writeable ZET_DEBUG_REGSET_FLAG_FORCE_UINT32 = 0x7fffffff } zet_debug_regset_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Device register set properties queried using /// ::zetDebugGetRegisterSetProperties. typedef struct _zet_debug_regset_properties_t { zet_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t type; ///< [out] device-specific register set type uint32_t version; ///< [out] device-specific version of this register set zet_debug_regset_flags_t generalFlags; ///< [out] general register set flags uint32_t deviceFlags; ///< [out] device-specific register set flags uint32_t count; ///< [out] number of registers in the set uint32_t bitSize; ///< [out] the size of a register in bits uint32_t byteSize; ///< [out] the size required for reading or writing a register in bytes } zet_debug_regset_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves debug register set properties. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zetDebugGetRegisterSetProperties( zet_device_handle_t hDevice, ///< [in] device handle uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves debug register set properties for a given thread. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is running or unavailable /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + the thread argument specifies more than one or a non-existant thread ZE_APIEXPORT ze_result_t ZE_APICALL zetDebugGetThreadRegisterSetProperties( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier specifying a single stopped thread uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Read register state. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is running or unavailable ZE_APIEXPORT ze_result_t ZE_APICALL zetDebugReadRegisters( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or ///< equal to the `count` member of ::zet_debug_register_group_properties_t ///< for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ); /////////////////////////////////////////////////////////////////////////////// /// @brief Write register state. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is running or unavailable ZE_APIEXPORT ze_result_t ZE_APICALL zetDebugWriteRegisters( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than ///< or equal to the `count` member of ///< ::zet_debug_register_group_properties_t for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for Metric #if !defined(__GNUC__) #pragma region metric #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves metric group for a device. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGroupGet( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric groups. ///< if count is zero, then the driver shall update the value with the ///< total number of metric groups available. ///< if count is greater than the number of metric groups available, then ///< the driver shall update the value with the correct number of metric ///< groups available. zet_metric_group_handle_t* phMetricGroups ///< [in,out][optional][range(0, *pCount)] array of handle of metric groups. ///< if count is less than the number of metric groups available, then ///< driver shall only retrieve that number of metric groups. ); /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_GROUP_NAME /// @brief Maximum metric group name string size #define ZET_MAX_METRIC_GROUP_NAME 256 #endif // ZET_MAX_METRIC_GROUP_NAME /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_GROUP_DESCRIPTION /// @brief Maximum metric group description string size #define ZET_MAX_METRIC_GROUP_DESCRIPTION 256 #endif // ZET_MAX_METRIC_GROUP_DESCRIPTION /////////////////////////////////////////////////////////////////////////////// /// @brief Metric group sampling type typedef uint32_t zet_metric_group_sampling_type_flags_t; typedef enum _zet_metric_group_sampling_type_flag_t { ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED = ZE_BIT(0), ///< Event based sampling ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED = ZE_BIT(1), ///< Time based sampling ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EXP_TRACER_BASED = ZE_BIT(2), ///< Experimental Tracer based sampling ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_FORCE_UINT32 = 0x7fffffff } zet_metric_group_sampling_type_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Metric group properties queried using ::zetMetricGroupGetProperties typedef struct _zet_metric_group_properties_t { zet_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). char name[ZET_MAX_METRIC_GROUP_NAME]; ///< [out] metric group name char description[ZET_MAX_METRIC_GROUP_DESCRIPTION]; ///< [out] metric group description zet_metric_group_sampling_type_flags_t samplingType; ///< [out] metric group sampling type. ///< returns a combination of ::zet_metric_group_sampling_type_flag_t. uint32_t domain; ///< [out] metric group domain number. Cannot use multiple, simultaneous ///< metric groups from the same domain. uint32_t metricCount; ///< [out] metric count belonging to this group } zet_metric_group_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves attributes of a metric group. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGroupGetProperties( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_properties_t* pProperties ///< [in,out] metric group properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Metric types typedef enum _zet_metric_type_t { ZET_METRIC_TYPE_DURATION = 0, ///< Metric type: duration ZET_METRIC_TYPE_EVENT = 1, ///< Metric type: event ZET_METRIC_TYPE_EVENT_WITH_RANGE = 2, ///< Metric type: event with range ZET_METRIC_TYPE_THROUGHPUT = 3, ///< Metric type: throughput ZET_METRIC_TYPE_TIMESTAMP = 4, ///< Metric type: timestamp ZET_METRIC_TYPE_FLAG = 5, ///< Metric type: flag ZET_METRIC_TYPE_RATIO = 6, ///< Metric type: ratio ZET_METRIC_TYPE_RAW = 7, ///< Metric type: raw ZET_METRIC_TYPE_EVENT_EXP_TIMESTAMP = 0x7ffffff9, ///< Metric type: event with only timestamp and value has no meaning ZET_METRIC_TYPE_EVENT_EXP_START = 0x7ffffffa, ///< Metric type: the first event of a start/end event pair ZET_METRIC_TYPE_EVENT_EXP_END = 0x7ffffffb, ///< Metric type: the second event of a start/end event pair ZET_METRIC_TYPE_EVENT_EXP_MONOTONIC_WRAPS_VALUE = 0x7ffffffc, ///< Metric type: value of the event is a monotonically increasing value ///< that can wrap around ZET_METRIC_TYPE_EXP_EXPORT_DMA_BUF = 0x7ffffffd, ///< Metric which exports linux dma_buf, which could be imported/mapped to ///< the host process ZET_METRIC_TYPE_IP_EXP = 0x7ffffffe, ///< Metric type: instruction pointer. Deprecated, use ///< ::ZET_METRIC_TYPE_IP. ZET_METRIC_TYPE_IP = 0x7ffffffe, ///< Metric type: instruction pointer ZET_METRIC_TYPE_FORCE_UINT32 = 0x7fffffff } zet_metric_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Metric group calculation type typedef enum _zet_metric_group_calculation_type_t { ZET_METRIC_GROUP_CALCULATION_TYPE_METRIC_VALUES = 0, ///< Calculated metric values from raw data. ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES = 1, ///< Maximum metric values. ZET_METRIC_GROUP_CALCULATION_TYPE_FORCE_UINT32 = 0x7fffffff } zet_metric_group_calculation_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Calculates metric values from raw data. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawData` /// + `nullptr == pMetricValueCount` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGroupCalculateMetricValues( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pMetricValueCount, ///< [in,out] pointer to number of metric values calculated. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pMetricValueCount)] buffer of calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves metric from a metric group. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGet( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group uint32_t* pCount, ///< [in,out] pointer to the number of metrics. ///< if count is zero, then the driver shall update the value with the ///< total number of metrics available. ///< if count is greater than the number of metrics available, then the ///< driver shall update the value with the correct number of metrics available. zet_metric_handle_t* phMetrics ///< [in,out][optional][range(0, *pCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metrics. ); /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_NAME /// @brief Maximum metric name string size #define ZET_MAX_METRIC_NAME 256 #endif // ZET_MAX_METRIC_NAME /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_DESCRIPTION /// @brief Maximum metric description string size #define ZET_MAX_METRIC_DESCRIPTION 256 #endif // ZET_MAX_METRIC_DESCRIPTION /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_COMPONENT /// @brief Maximum metric component string size #define ZET_MAX_METRIC_COMPONENT 256 #endif // ZET_MAX_METRIC_COMPONENT /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_RESULT_UNITS /// @brief Maximum metric result units string size #define ZET_MAX_METRIC_RESULT_UNITS 256 #endif // ZET_MAX_METRIC_RESULT_UNITS /////////////////////////////////////////////////////////////////////////////// /// @brief Metric properties queried using ::zetMetricGetProperties typedef struct _zet_metric_properties_t { zet_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). char name[ZET_MAX_METRIC_NAME]; ///< [out] metric name char description[ZET_MAX_METRIC_DESCRIPTION]; ///< [out] metric description char component[ZET_MAX_METRIC_COMPONENT]; ///< [out] metric component uint32_t tierNumber; ///< [out] number of tier zet_metric_type_t metricType; ///< [out] metric type zet_value_type_t resultType; ///< [out] metric result type char resultUnits[ZET_MAX_METRIC_RESULT_UNITS]; ///< [out] metric result units } zet_metric_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves attributes of a metric. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetric` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGetProperties( zet_metric_handle_t hMetric, ///< [in] handle of the metric zet_metric_properties_t* pProperties ///< [in,out] metric properties ); /////////////////////////////////////////////////////////////////////////////// /// @brief Activates metric groups. /// /// @details /// - Immediately reconfigures the device to activate only those metric /// groups provided. /// - Any metric groups previously activated but not provided will be /// deactivated. /// - Deactivating metric groups that are still in-use will result in /// undefined behavior. /// - All metric groups must have different domains, see /// ::zet_metric_group_properties_t. /// - The application must **not** call this function from simultaneous /// threads with the same device handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phMetricGroups) && (0 < count)` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + Multiple metric groups share the same domain ZE_APIEXPORT ze_result_t ZE_APICALL zetContextActivateMetricGroups( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t count, ///< [in] metric group count to activate; must be 0 if `nullptr == ///< phMetricGroups` zet_metric_group_handle_t* phMetricGroups ///< [in][optional][range(0, count)] handles of the metric groups to activate. ///< nullptr deactivates all previously used metric groups. ///< all metrics groups must come from a different domains. ///< metric query and metric stream must use activated metric groups. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Metric streamer descriptor typedef struct _zet_metric_streamer_desc_t { zet_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t notifyEveryNReports; ///< [in,out] number of collected reports after which notification event ///< will be signaled. If the requested value is not supported exactly, ///< then the driver may use a value that is the closest supported ///< approximation and shall update this member during ::zetMetricStreamerOpen. uint32_t samplingPeriod; ///< [in,out] streamer sampling period in nanoseconds. If the requested ///< value is not supported exactly, then the driver may use a value that ///< is the closest supported approximation and shall update this member ///< during ::zetMetricStreamerOpen. } zet_metric_streamer_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Opens metric streamer for a device. /// /// @details /// - The notification event must have been created from an event pool that /// was created using ::ZE_EVENT_POOL_FLAG_HOST_VISIBLE flag. /// - The duration of the signal event created from an event pool that was /// created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined. /// However, for consistency and orthogonality the event will report /// correctly as signaled when used by other event API functionality. /// - The application must **not** call this function from simultaneous /// threads with the same device handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phMetricStreamer` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricStreamerOpen( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_streamer_desc_t* desc, ///< [in,out] metric streamer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification zet_metric_streamer_handle_t* phMetricStreamer ///< [out] handle of metric streamer ); /////////////////////////////////////////////////////////////////////////////// /// @brief Append metric streamer marker into a command list. /// /// @details /// - The application must ensure the metric streamer is accessible by the /// device on which the command list was created. /// - The application must ensure the command list and metric streamer were /// created on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - Allow to associate metric stream time based metrics with executed /// workload. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hMetricStreamer` ZE_APIEXPORT ze_result_t ZE_APICALL zetCommandListAppendMetricStreamerMarker( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t value ///< [in] streamer marker value ); /////////////////////////////////////////////////////////////////////////////// /// @brief Closes metric streamer. /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same metric streamer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricStreamer` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricStreamerClose( zet_metric_streamer_handle_t hMetricStreamer ///< [in][release] handle of the metric streamer ); /////////////////////////////////////////////////////////////////////////////// /// @brief Reads data from metric streamer. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricStreamer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawDataSize` /// - ::ZE_RESULT_WARNING_DROPPED_DATA /// + Metric streamer data may have been dropped. Reduce sampling period. ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricStreamerReadData( zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ); /////////////////////////////////////////////////////////////////////////////// /// @brief Metric query pool types typedef enum _zet_metric_query_pool_type_t { ZET_METRIC_QUERY_POOL_TYPE_PERFORMANCE = 0, ///< Performance metric query pool. ZET_METRIC_QUERY_POOL_TYPE_EXECUTION = 1, ///< Skips workload execution between begin/end calls. ZET_METRIC_QUERY_POOL_TYPE_FORCE_UINT32 = 0x7fffffff } zet_metric_query_pool_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Metric query pool description typedef struct _zet_metric_query_pool_desc_t { zet_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zet_metric_query_pool_type_t type; ///< [in] Query pool type. uint32_t count; ///< [in] Internal slots count within query pool object. } zet_metric_query_pool_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a pool of metric queries on the context. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phMetricQueryPool` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_METRIC_QUERY_POOL_TYPE_EXECUTION < desc->type` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricQueryPoolCreate( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] metric group associated with the query object. const zet_metric_query_pool_desc_t* desc, ///< [in] metric query pool descriptor zet_metric_query_pool_handle_t* phMetricQueryPool ///< [out] handle of metric query pool ); /////////////////////////////////////////////////////////////////////////////// /// @brief Deletes a query pool object. /// /// @details /// - The application must destroy all query handles created from the pool /// before destroying the pool itself. /// - The application must ensure the device is not currently referencing /// the any query within the pool before it is deleted. /// - The application must **not** call this function from simultaneous /// threads with the same query pool handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricQueryPool` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricQueryPoolDestroy( zet_metric_query_pool_handle_t hMetricQueryPool ///< [in][release] handle of the metric query pool ); /////////////////////////////////////////////////////////////////////////////// /// @brief Creates metric query from the pool. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricQueryPool` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phMetricQuery` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricQueryCreate( zet_metric_query_pool_handle_t hMetricQueryPool, ///< [in] handle of the metric query pool uint32_t index, ///< [in] index of the query within the pool zet_metric_query_handle_t* phMetricQuery ///< [out] handle of metric query ); /////////////////////////////////////////////////////////////////////////////// /// @brief Deletes a metric query object. /// /// @details /// - The application must ensure the device is not currently referencing /// the query before it is deleted. /// - The application must **not** call this function from simultaneous /// threads with the same query handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricQuery` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricQueryDestroy( zet_metric_query_handle_t hMetricQuery ///< [in][release] handle of metric query ); /////////////////////////////////////////////////////////////////////////////// /// @brief Resets a metric query object back to initial state. /// /// @details /// - The application must ensure the device is not currently referencing /// the query before it is reset /// - The application must **not** call this function from simultaneous /// threads with the same query handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricQuery` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricQueryReset( zet_metric_query_handle_t hMetricQuery ///< [in] handle of metric query ); /////////////////////////////////////////////////////////////////////////////// /// @brief Appends metric query begin into a command list. /// /// @details /// - The application must ensure the metric query is accessible by the /// device on which the command list was created. /// - The application must ensure the command list and metric query were /// created on the same context. /// - This command blocks all following commands from beginning until the /// execution of the query completes. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hMetricQuery` ZE_APIEXPORT ze_result_t ZE_APICALL zetCommandListAppendMetricQueryBegin( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery ///< [in] handle of the metric query ); /////////////////////////////////////////////////////////////////////////////// /// @brief Appends metric query end into a command list. /// /// @details /// - The application must ensure the metric query and events are accessible /// by the device on which the command list was created. /// - The application must ensure the command list, events and metric query /// were created on the same context. /// - The duration of the signal event created from an event pool that was /// created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined. /// However, for consistency and orthogonality the event will report /// correctly as signaled when used by other event API functionality. /// - If numWaitEvents is zero, then all previous commands are completed /// prior to the execution of the query. /// - If numWaitEvents is non-zero, then all phWaitEvents must be signaled /// prior to the execution of the query. /// - This command blocks all following commands from beginning until the /// execution of the query completes. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hMetricQuery` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ZE_APIEXPORT ze_result_t ZE_APICALL zetCommandListAppendMetricQueryEnd( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in] must be zero ze_event_handle_t* phWaitEvents ///< [in][mbz] must be nullptr ); /////////////////////////////////////////////////////////////////////////////// /// @brief Appends metric query commands to flush all caches. /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` ZE_APIEXPORT ze_result_t ZE_APICALL zetCommandListAppendMetricMemoryBarrier( zet_command_list_handle_t hCommandList ///< [in] handle of the command list ); /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves raw data for a given metric query. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricQuery` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawDataSize` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricQueryGetData( zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing query ///< reports in raw format ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool APIs for Program Instrumentation (PIN) #if !defined(__GNUC__) #pragma region pin #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supportted profile features typedef uint32_t zet_profile_flags_t; typedef enum _zet_profile_flag_t { ZET_PROFILE_FLAG_REGISTER_REALLOCATION = ZE_BIT(0), ///< request the compiler attempt to minimize register usage as much as ///< possible to allow for instrumentation ZET_PROFILE_FLAG_FREE_REGISTER_INFO = ZE_BIT(1), ///< request the compiler generate free register info ZET_PROFILE_FLAG_FORCE_UINT32 = 0x7fffffff } zet_profile_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Profiling meta-data for instrumentation typedef struct _zet_profile_properties_t { zet_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zet_profile_flags_t flags; ///< [out] indicates which flags were enabled during compilation. ///< returns 0 (none) or a combination of ::zet_profile_flag_t uint32_t numTokens; ///< [out] number of tokens immediately following this structure } zet_profile_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported profile token types typedef enum _zet_profile_token_type_t { ZET_PROFILE_TOKEN_TYPE_FREE_REGISTER = 0, ///< GRF info ZET_PROFILE_TOKEN_TYPE_FORCE_UINT32 = 0x7fffffff } zet_profile_token_type_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Profile free register token detailing unused registers in the current /// function typedef struct _zet_profile_free_register_token_t { zet_profile_token_type_t type; ///< [out] type of token uint32_t size; ///< [out] total size of the token, in bytes uint32_t count; ///< [out] number of register sequences immediately following this ///< structure } zet_profile_free_register_token_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Profile register sequence detailing consecutive bytes, all of which /// are unused typedef struct _zet_profile_register_sequence_t { uint32_t start; ///< [out] starting byte in the register table, representing the start of ///< unused bytes in the current function uint32_t count; ///< [out] number of consecutive bytes in the sequence, starting from start } zet_profile_register_sequence_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve profiling information generated for the kernel. /// /// @details /// - Module must be created using the following build option: /// + "-zet-profile-flags " - enable generation of profile /// information /// + "" must be a combination of ::zet_profile_flag_t, in hex /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProfileProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zetKernelGetProfileInfo( zet_kernel_handle_t hKernel, ///< [in] handle to kernel zet_profile_properties_t* pProfileProperties ///< [out] pointer to profile properties ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool Experimental Extension APIs for API Tracing #if !defined(__GNUC__) #pragma region tracing #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_API_TRACING_EXP_NAME /// @brief API Tracing Experimental Extension Name #define ZET_API_TRACING_EXP_NAME "ZET_experimental_api_tracing" #endif // ZET_API_TRACING_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief API Tracing Experimental Extension Version(s) typedef enum _zet_api_tracing_exp_version_t { ZET_API_TRACING_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZET_API_TRACING_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZET_API_TRACING_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zet_api_tracing_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Alias the existing callbacks definition for 'core' callbacks typedef ze_callbacks_t zet_core_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Tracer descriptor typedef struct _zet_tracer_exp_desc_t { zet_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). void* pUserData; ///< [in] pointer passed to every tracer's callbacks } zet_tracer_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a tracer on the context. /// /// @details /// - The application must only use the tracer for the context which was /// provided during creation. /// - The tracer is created in the disabled state. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == desc->pUserData` /// + `nullptr == phTracer` ZE_APIEXPORT ze_result_t ZE_APICALL zetTracerExpCreate( zet_context_handle_t hContext, ///< [in] handle of the context object const zet_tracer_exp_desc_t* desc, ///< [in] pointer to tracer descriptor zet_tracer_exp_handle_t* phTracer ///< [out] pointer to handle of tracer object created ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a tracer. /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// - The implementation of this function must be thread-safe. /// - The implementation of this function will stall and wait on any /// outstanding threads executing callbacks before freeing any Host /// allocations associated with this tracer. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ZE_APIEXPORT ze_result_t ZE_APICALL zetTracerExpDestroy( zet_tracer_exp_handle_t hTracer ///< [in][release] handle of tracer object to destroy ); /////////////////////////////////////////////////////////////////////////////// /// @brief Sets the collection of callbacks to be executed **before** driver /// execution. /// /// @details /// - The application only needs to set the function pointers it is /// interested in receiving; all others should be 'nullptr' /// - The application must ensure that no other threads are executing /// functions for which the tracing functions are changing. /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCoreCbs` ZE_APIEXPORT ze_result_t ZE_APICALL zetTracerExpSetPrologues( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Sets the collection of callbacks to be executed **after** driver /// execution. /// /// @details /// - The application only needs to set the function pointers it is /// interested in receiving; all others should be 'nullptr' /// - The application must ensure that no other threads are executing /// functions for which the tracing functions are changing. /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCoreCbs` ZE_APIEXPORT ze_result_t ZE_APICALL zetTracerExpSetEpilogues( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Enables (or disables) the tracer /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` ZE_APIEXPORT ze_result_t ZE_APICALL zetTracerExpSetEnabled( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer ze_bool_t enable ///< [in] enable the tracer if true; disable if false ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool Experimental Extension to get Concurrent Metric Groups #if !defined(__GNUC__) #pragma region concurrentMetricGroup #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_CONCURRENT_METRIC_GROUPS_EXP_NAME /// @brief Concurrent Metric Groups Experimental Extension Name #define ZET_CONCURRENT_METRIC_GROUPS_EXP_NAME "ZET_experimental_concurrent_metric_groups" #endif // ZET_CONCURRENT_METRIC_GROUPS_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Concurrent Metric Groups Experimental Extension Version(s) typedef enum _zet_concurrent_metric_groups_exp_version_t { ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZET_CONCURRENT_METRIC_GROUPS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zet_concurrent_metric_groups_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Get sets of metric groups which could be collected concurrently. /// /// @details /// - Re-arrange the input metric groups to provide sets of concurrent /// metric groups. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// + `nullptr == phMetricGroups` ZE_APIEXPORT ze_result_t ZE_APICALL zetDeviceGetConcurrentMetricGroupsExp( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t * phMetricGroups, ///< [in,out] metrics groups to be re-arranged to be sets of concurrent ///< groups uint32_t * pMetricGroupsCountPerConcurrentGroup, ///< [in,out][optional][*pConcurrentGroupCount] count of metric groups per ///< concurrent group. uint32_t * pConcurrentGroupCount ///< [out] number of concurrent groups. ///< The value of this parameter could be used to determine the number of ///< replays necessary. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool Experimental Extension for Metrics Tracer #if !defined(__GNUC__) #pragma region metricTracer #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_METRICS_TRACER_EXP_NAME /// @brief Metric Tracer Experimental Extension Name #define ZET_METRICS_TRACER_EXP_NAME "ZET_experimental_metric_tracer" #endif // ZET_METRICS_TRACER_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Metric Tracer Experimental Extension Version(s) typedef enum _zet_metric_tracer_exp_version_t { ZET_METRIC_TRACER_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZET_METRIC_TRACER_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZET_METRIC_TRACER_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zet_metric_tracer_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of metric tracer's object typedef struct _zet_metric_tracer_exp_handle_t *zet_metric_tracer_exp_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of metric decoder's object typedef struct _zet_metric_decoder_exp_handle_t *zet_metric_decoder_exp_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Metric tracer descriptor typedef struct _zet_metric_tracer_exp_desc_t { zet_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t notifyEveryNBytes; ///< [in,out] number of collected bytes after which notification event will ///< be signaled. If the requested value is not supported exactly, then the ///< driver may use a value that is the closest supported approximation and ///< shall update this member during ::zetMetricTracerCreateExp. } zet_metric_tracer_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Decoded metric entry typedef struct _zet_metric_entry_exp_t { zet_value_t value; ///< [out] value of the decodable metric entry or event. Number is ///< meaningful based on the metric type. uint64_t timeStamp; ///< [out] timestamp at which the event happened. uint32_t metricIndex; ///< [out] index to the decodable metric handle in the input array ///< (phMetric) in ::zetMetricTracerDecodeExp(). ze_bool_t onSubdevice; ///< [out] True if the event occurred on a sub-device; false means the ///< device on which the metric tracer was opened does not have ///< sub-devices. uint32_t subdeviceId; ///< [out] If onSubdevice is true, this gives the ID of the sub-device. } zet_metric_entry_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Create a metric tracer for a device. /// /// @details /// - The notification event must have been created from an event pool that /// was created using ::ZE_EVENT_POOL_FLAG_HOST_VISIBLE flag. /// - The duration of the signal event created from an event pool that was /// created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined. /// However, for consistency and orthogonality the event will report /// correctly as signaled when used by other event API functionality. /// - The application must **not** call this function from simultaneous /// threads with the same device handle. /// - The metric tracer is created in disabled state /// - Metric groups must support sampling type /// ZET_METRIC_SAMPLING_TYPE_EXP_FLAG_TRACER_BASED /// - All metric groups must be first activated /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phMetricGroups` /// + `nullptr == desc` /// + `nullptr == phMetricTracer` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricTracerCreateExp( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t* phMetricGroups, ///< [in][range(0, metricGroupCount )] handles of the metric groups to ///< trace zet_metric_tracer_exp_desc_t* desc, ///< [in,out] metric tracer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification. Note: ///< If buffer is not drained when the event it flagged, there is a risk of ///< HW event buffer being overrun zet_metric_tracer_exp_handle_t* phMetricTracer ///< [out] handle of the metric tracer ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroy a metric tracer. /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same metric tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricTracer` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricTracerDestroyExp( zet_metric_tracer_exp_handle_t hMetricTracer ///< [in] handle of the metric tracer ); /////////////////////////////////////////////////////////////////////////////// /// @brief Start events collection /// /// @details /// - Driver implementations must make this API call have as minimal /// overhead as possible, to allow applications start/stop event /// collection at any point during execution /// - The application must **not** call this function from simultaneous /// threads with the same metric tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricTracer` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricTracerEnableExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_NOT_READY will be returned ///< when the tracer is inactive. ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Stop events collection /// /// @details /// - Driver implementations must make this API call have as minimal /// overhead as possible, to allow applications start/stop event /// collection at any point during execution /// - The application must **not** call this function from simultaneous /// threads with the same metric tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricTracer` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricTracerDisableExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active or when it is inactive but still has data. ///< ::ZE_RESULT_NOT_READY will be returned when the tracer is inactive and ///< has no more data to be retrieved. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Read data from the metric tracer /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same metric tracer handle. /// - Data can be retrieved after tracer is disabled. When buffers are /// drained ::ZE_RESULT_NOT_READY will be returned /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricTracer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawDataSize` /// - ::ZE_RESULT_WARNING_DROPPED_DATA /// + Metric tracer data may have been dropped. /// - ::ZE_RESULT_NOT_READY /// + Metric tracer is disabled and no data is available to read. ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricTracerReadDataExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all data available. ///< if size is non-zero, then driver will only retrieve that amount of ///< data. ///< if size is larger than size needed for all data, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ); /////////////////////////////////////////////////////////////////////////////// /// @brief Create a metric decoder for a given metric tracer. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricTracer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phMetricDecoder` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricDecoderCreateExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer zet_metric_decoder_exp_handle_t* phMetricDecoder ///< [out] handle of the metric decoder object ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroy a metric decoder. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == phMetricDecoder` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricDecoderDestroyExp( zet_metric_decoder_exp_handle_t phMetricDecoder ///< [in] handle of the metric decoder object ); /////////////////////////////////////////////////////////////////////////////// /// @brief Return the list of the decodable metrics from the decoder. /// /// @details /// - The decodable metrics handles returned by this API are defined by the /// metric groups in the tracer on which the decoder was created. /// - The decodable metrics handles returned by this API are only valid to /// decode metrics raw data with ::zetMetricTracerDecodeExp(). Decodable /// metric handles are not valid to compare with metrics handles included /// in metric groups. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricDecoder` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` /// + `nullptr == phMetrics` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricDecoderGetDecodableMetricsExp( zet_metric_decoder_exp_handle_t hMetricDecoder, ///< [in] handle of the metric decoder object uint32_t* pCount, ///< [in,out] pointer to number of decodable metric in the hMetricDecoder ///< handle. If count is zero, then the driver shall ///< update the value with the total number of decodable metrics available ///< in the decoder. if count is greater than zero ///< but less than the total number of decodable metrics available in the ///< decoder, then only that number will be returned. ///< if count is greater than the number of decodable metrics available in ///< the decoder, then the driver shall update the ///< value with the actual number of decodable metrics available. zet_metric_handle_t* phMetrics ///< [in,out] [range(0, *pCount)] array of handles of decodable metrics in ///< the hMetricDecoder handle provided. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Decode raw events collected from a tracer. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == phMetricDecoder` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawDataSize` /// + `nullptr == phMetrics` /// + `nullptr == pSetCount` /// + `nullptr == pMetricEntriesCount` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricTracerDecodeExp( zet_metric_decoder_exp_handle_t phMetricDecoder, ///< [in] handle of the metric decoder object size_t* pRawDataSize, ///< [in,out] size in bytes of raw data buffer. If pMetricEntriesCount is ///< greater than zero but less than total number of ///< decodable metrics available in the raw data buffer, then driver shall ///< update this value with actual number of raw ///< data bytes processed. uint8_t* pRawData, ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format uint32_t metricsCount, ///< [in] number of decodable metrics in the tracer for which the ///< hMetricDecoder handle was provided. See ///< ::zetMetricDecoderGetDecodableMetricsExp(). If metricCount is greater ///< than zero but less than the number decodable ///< metrics available in the raw data buffer, then driver shall only ///< decode those. zet_metric_handle_t* phMetrics, ///< [in] [range(0, metricsCount)] array of handles of decodable metrics in ///< the decoder for which the hMetricDecoder handle was ///< provided. Metrics handles are expected to be for decodable metrics, ///< see ::zetMetricDecoderGetDecodableMetricsExp() uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. If count is zero, then the ///< driver shall update the value with the total ///< number of metric sets to be decoded. If count is greater than the ///< number available in the raw data buffer, then the ///< driver shall update the value with the actual number of metric sets to ///< be decoded. There is a 1:1 relation between ///< the number of sets and sub-devices returned in the decoded entries. uint32_t* pMetricEntriesCountPerSet, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric entries ///< counts per metric set, one value per set. uint32_t* pMetricEntriesCount, ///< [in,out] pointer to the total number of metric entries decoded, for ///< all metric sets. If count is zero, then the ///< driver shall update the value with the total number of metric entries ///< to be decoded. If count is greater than zero ///< but less than the total number of metric entries available in the raw ///< data, then user provided number will be decoded. ///< If count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with ///< the actual number of decodable metric entries decoded. If set to null, ///< then driver will only update the value of ///< pSetCount. zet_metric_entry_exp_t* pMetricEntries ///< [in,out][optional][range(0, *pMetricEntriesCount)] buffer containing ///< decoded metric entries ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool Experimental Extension for Metrics/Metric Groups which export Memory #if !defined(__GNUC__) #pragma region metricExportMemory #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Metric group type typedef uint32_t zet_metric_group_type_exp_flags_t; typedef enum _zet_metric_group_type_exp_flag_t { ZET_METRIC_GROUP_TYPE_EXP_FLAG_EXPORT_DMA_BUF = ZE_BIT(0), ///< Metric group and metrics exports memory using linux dma-buf, which ///< could be imported/mapped to the host process. Properties of the ///< dma_buf could be queried using ::zet_export_dma_buf_exp_properties_t. ZET_METRIC_GROUP_TYPE_EXP_FLAG_USER_CREATED = ZE_BIT(1), ///< Metric group created using ::zetDeviceCreateMetricGroupsFromMetricsExp ZET_METRIC_GROUP_TYPE_EXP_FLAG_OTHER = ZE_BIT(2), ///< Metric group which has a collection of metrics ZET_METRIC_GROUP_TYPE_EXP_FLAG_FORCE_UINT32 = 0x7fffffff } zet_metric_group_type_exp_flag_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Query the metric group type using `pNext` of /// ::zet_metric_group_properties_t typedef struct _zet_metric_group_type_exp_t { zet_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zet_metric_group_type_exp_flags_t type; ///< [out] metric group type. ///< returns a combination of ::zet_metric_group_type_exp_flags_t. } zet_metric_group_type_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported dma_buf properties queried using `pNext` of /// ::zet_metric_group_properties_t or ::zet_metric_properties_t typedef struct _zet_export_dma_buf_exp_properties_t { zet_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). int fd; ///< [out] the file descriptor handle that could be used to import the ///< memory by the host process. size_t size; ///< [out] size in bytes of the dma_buf } zet_export_dma_buf_exp_properties_t; #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool Experimental Extension for Calculating Multiple Metrics #if !defined(__GNUC__) #pragma region multiMetricValues #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MULTI_METRICS_EXP_NAME /// @brief Calculating Multiple Metrics Experimental Extension Name #define ZET_MULTI_METRICS_EXP_NAME "ZET_experimental_calculate_multiple_metrics" #endif // ZET_MULTI_METRICS_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Calculating Multiple Metrics Experimental Extension Version(s) typedef enum _ze_calculate_multiple_metrics_exp_version_t { ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ),///< version 1.0 ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ),///< latest known version ZE_CALCULATE_MULTIPLE_METRICS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_calculate_multiple_metrics_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Calculate one or more sets of metric values from raw data. /// /// @details /// - This function is similar to ::zetMetricGroupCalculateMetricValues /// except it may calculate more than one set of metric values from a /// single data buffer. There may be one set of metric values for each /// sub-device, for example. /// - Each set of metric values may consist of a different number of metric /// values, returned as the metric value count. /// - All metric values are calculated into a single buffer; use the metric /// counts to determine which metric values belong to which set. /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawData` /// + `nullptr == pSetCount` /// + `nullptr == pTotalMetricValueCount` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGroupCalculateMultipleMetricValuesExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool Experimental Extension for Global Metric Timestamps #if !defined(__GNUC__) #pragma region GlobalTimestamps #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_GLOBAL_METRICS_TIMESTAMPS_EXP_NAME /// @brief Global Metric Timestamps Experimental Extension Name #define ZET_GLOBAL_METRICS_TIMESTAMPS_EXP_NAME "ZET_experimental_global_metric_timestamps" #endif // ZET_GLOBAL_METRICS_TIMESTAMPS_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Global Metric Timestamps Experimental Extension Version(s) typedef enum _ze_metric_global_timestamps_exp_version_t { ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZE_METRIC_GLOBAL_TIMESTAMPS_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } ze_metric_global_timestamps_exp_version_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Metric timestamps resolution /// /// @details /// - This structure may be returned from ::zetMetricGroupGetProperties via /// the `pNext` member of ::zet_metric_group_properties_t. /// - Used for mapping metric timestamps to other timers. typedef struct _zet_metric_global_timestamps_resolution_exp_t { zet_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint64_t timerResolution; ///< [out] Returns the resolution of metrics timer (used for timestamps) in ///< cycles/sec. uint64_t timestampValidBits; ///< [out] Returns the number of valid bits in the timestamp value. } zet_metric_global_timestamps_resolution_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Returns metric timestamps synchronized with global device timestamps, /// optionally synchronized with host /// /// @details /// - The application may call this function from simultaneous threads. /// - By default, the global and metrics timestamps are synchronized to the /// device. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == globalTimestamp` /// + `nullptr == metricTimestamp` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGroupGetGlobalTimestampsExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group ze_bool_t synchronizedWithHost, ///< [in] Returns the timestamps synchronized to the host or the device. uint64_t* globalTimestamp, ///< [out] Device timestamp. uint64_t* metricTimestamp ///< [out] Metric timestamp. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool Experimental Extension for Exporting Metrics Data #if !defined(__GNUC__) #pragma region metricExportData #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_EXPORT_METRICS_DATA_EXP_NAME /// @brief Exporting Metrics Data Experimental Extension Name #define ZET_EXPORT_METRICS_DATA_EXP_NAME "ZET_experimental_metric_export_data" #endif // ZET_EXPORT_METRICS_DATA_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Exporting Metrics Data Experimental Extension Version(s) typedef enum _zet_export_metric_data_exp_version_t { ZET_EXPORT_METRIC_DATA_EXP_VERSION_1_0 = ZE_MAKE_VERSION( 1, 0 ), ///< version 1.0 ZET_EXPORT_METRIC_DATA_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 0 ), ///< latest known version ZET_EXPORT_METRIC_DATA_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zet_export_metric_data_exp_version_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_EXPORT_DATA_ELEMENT_NAME_EXP /// @brief Maximum count of characters in export data element name #define ZET_MAX_METRIC_EXPORT_DATA_ELEMENT_NAME_EXP 256 #endif // ZET_MAX_METRIC_EXPORT_DATA_ELEMENT_NAME_EXP /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_EXPORT_DATA_ELEMENT_DESCRIPTION_EXP /// @brief Maximum export data element description string size #define ZET_MAX_METRIC_EXPORT_DATA_ELEMENT_DESCRIPTION_EXP 256 #endif // ZET_MAX_METRIC_EXPORT_DATA_ELEMENT_DESCRIPTION_EXP /////////////////////////////////////////////////////////////////////////////// /// @brief Metrics calculation descriptor typedef struct _zet_metric_calculate_exp_desc_t { zet_structure_type_t stype; ///< [in] type of this structure const void* pNext; ///< [in][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). uint32_t rawReportSkipCount; ///< [in] number of reports to skip during calculation } zet_metric_calculate_exp_desc_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Export Metrics Data for system independent calculation. /// /// @details /// - This function exports raw data and necessary information to perform /// metrics calculation of collected data in a different system than where /// data was collected, which may or may not have accelerators. /// - Implementations can choose to describe the data arrangement of the /// exported data, using any mechanism which allows users to read and /// process them. /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawData` /// + `nullptr == pExportDataSize` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGroupGetExportDataExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group const uint8_t* pRawData, ///< [in] buffer of raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer size_t* pExportDataSize, ///< [in,out] size in bytes of export data buffer ///< if size is zero, then the driver shall update the value with the ///< number of bytes necessary to store the exported data. ///< if size is greater than required, then the driver shall update the ///< value with the actual number of bytes necessary to store the exported data. uint8_t * pExportData ///< [in,out][optional][range(0, *pExportDataSize)] buffer of exported data. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Calculate one or more sets of metric values from exported raw data. /// /// @details /// - Calculate metrics values using exported data returned by /// ::zetMetricGroupGetExportDataExp. /// - This function is similar to /// ::zetMetricGroupCalculateMultipleMetricValuesExp except it would /// calculate from exported metric data. /// - This function could be used to calculate metrics on a system different /// from where the metric raw data was collected. /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pExportData` /// + `nullptr == pCalculateDescriptor` /// + `nullptr == pSetCount` /// + `nullptr == pTotalMetricValueCount` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGroupCalculateMetricExportDataExp( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t exportDataSize, ///< [in] size in bytes of exported data buffer const uint8_t* pExportData, ///< [in][range(0, exportDataSize)] buffer of exported data to calculate zet_metric_calculate_exp_desc_t* pCalculateDescriptor, ///< [in] descriptor specifying calculation specific parameters uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ); #if !defined(__GNUC__) #pragma endregion #endif // Intel 'oneAPI' Level-Zero Tool Experimental Extension for Programmable Metrics #if !defined(__GNUC__) #pragma region metricProgrammable #endif /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_PROGRAMMABLE_METRICS_EXP_NAME /// @brief Programmable Metrics Experimental Extension Name #define ZET_PROGRAMMABLE_METRICS_EXP_NAME "ZET_experimental_programmable_metrics" #endif // ZET_PROGRAMMABLE_METRICS_EXP_NAME /////////////////////////////////////////////////////////////////////////////// /// @brief Programmable Metrics Experimental Extension Version(s) typedef enum _zet_metric_programmable_exp_version_t { ZET_METRIC_PROGRAMMABLE_EXP_VERSION_1_1 = ZE_MAKE_VERSION( 1, 1 ), ///< version 1.1 ZET_METRIC_PROGRAMMABLE_EXP_VERSION_CURRENT = ZE_MAKE_VERSION( 1, 1 ), ///< latest known version ZET_METRIC_PROGRAMMABLE_EXP_VERSION_FORCE_UINT32 = 0x7fffffff } zet_metric_programmable_exp_version_t; /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_PROGRAMMABLE_METRICS_ELEMENT_NAME_EXP /// @brief Maximum count of characters in export data element name #define ZET_MAX_PROGRAMMABLE_METRICS_ELEMENT_NAME_EXP 256 #endif // ZET_MAX_PROGRAMMABLE_METRICS_ELEMENT_NAME_EXP /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_PROGRAMMABLE_METRICS_ELEMENT_DESCRIPTION_EXP /// @brief Maximum export data element description string size #define ZET_MAX_PROGRAMMABLE_METRICS_ELEMENT_DESCRIPTION_EXP 256 #endif // ZET_MAX_PROGRAMMABLE_METRICS_ELEMENT_DESCRIPTION_EXP /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP /// @brief Maximum count of characters in metric group name prefix #define ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP 64 #endif // ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_PROGRAMMABLE_NAME_EXP /// @brief Maximum metric programmable name string size #define ZET_MAX_METRIC_PROGRAMMABLE_NAME_EXP 128 #endif // ZET_MAX_METRIC_PROGRAMMABLE_NAME_EXP /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_PROGRAMMABLE_DESCRIPTION_EXP /// @brief Maximum metric programmable description string size #define ZET_MAX_METRIC_PROGRAMMABLE_DESCRIPTION_EXP 128 #endif // ZET_MAX_METRIC_PROGRAMMABLE_DESCRIPTION_EXP /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_PROGRAMMABLE_COMPONENT_EXP /// @brief Maximum metric programmable component string size #define ZET_MAX_METRIC_PROGRAMMABLE_COMPONENT_EXP 128 #endif // ZET_MAX_METRIC_PROGRAMMABLE_COMPONENT_EXP /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_PROGRAMMABLE_PARAMETER_NAME_EXP /// @brief Maximum metric programmable parameter string size #define ZET_MAX_METRIC_PROGRAMMABLE_PARAMETER_NAME_EXP 128 #endif // ZET_MAX_METRIC_PROGRAMMABLE_PARAMETER_NAME_EXP /////////////////////////////////////////////////////////////////////////////// #ifndef ZET_MAX_METRIC_PROGRAMMABLE_VALUE_DESCRIPTION_EXP /// @brief Maximum value for programmable value description #define ZET_MAX_METRIC_PROGRAMMABLE_VALUE_DESCRIPTION_EXP 128 #endif // ZET_MAX_METRIC_PROGRAMMABLE_VALUE_DESCRIPTION_EXP /////////////////////////////////////////////////////////////////////////////// #ifndef ZE_MAX_METRIC_GROUP_NAME_PREFIX /// @brief Maximum value metric group name prefix #define ZE_MAX_METRIC_GROUP_NAME_PREFIX 64 #endif // ZE_MAX_METRIC_GROUP_NAME_PREFIX /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of metric programmable's object typedef struct _zet_metric_programmable_exp_handle_t *zet_metric_programmable_exp_handle_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Metric Programmable properties queried using /// ::zetMetricProgrammableGetPropertiesExp typedef struct _zet_metric_programmable_exp_properties_t { zet_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). char name[ZET_MAX_METRIC_PROGRAMMABLE_NAME_EXP]; ///< [out] metric programmable name char description[ZET_MAX_METRIC_PROGRAMMABLE_DESCRIPTION_EXP]; ///< [out] metric programmable description char component[ZET_MAX_METRIC_PROGRAMMABLE_COMPONENT_EXP]; ///< [out] metric programmable component uint32_t tierNumber; ///< [out] tier number uint32_t domain; ///< [out] metric domain number. uint32_t parameterCount; ///< [out] number of parameters in the programmable zet_metric_group_sampling_type_flags_t samplingType; ///< [out] metric sampling type. ///< returns a combination of ::zet_metric_group_sampling_type_flag_t. uint32_t sourceId; ///< [out] unique metric source identifier(within platform)to identify the ///< HW block where the metric is collected. } zet_metric_programmable_exp_properties_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Metric Programmable Parameter types typedef enum _zet_metric_programmable_param_type_exp_t { ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_DISAGGREGATION = 0, ///< Metric is disaggregated. ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_LATENCY = 1, ///< Metric for latency measurement. ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_UTILIZATION = 2, ///< Produces normalization in percent using raw_metric * 100 / cycles / HW ///< instance_count. ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_AVERAGE = 3, ///< Produces normalization using raw_metric / HW instance_count. ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_RATE = 4, ///< Produces normalization average using raw_metric / timestamp. ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_NORMALIZATION_BYTES = 5, ///< Produces normalization average using raw_metric * n bytes. ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_GENERIC = 6, ///< Generic Parameter type. Please refer the parameter's description. ZET_METRIC_PROGRAMMABLE_PARAM_TYPE_EXP_FORCE_UINT32 = 0x7fffffff } zet_metric_programmable_param_type_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Supported value info types typedef enum _zet_value_info_type_exp_t { ZET_VALUE_INFO_TYPE_EXP_UINT32 = 0, ///< 32-bit unsigned-integer ZET_VALUE_INFO_TYPE_EXP_UINT64 = 1, ///< 64-bit unsigned-integer ZET_VALUE_INFO_TYPE_EXP_FLOAT32 = 2, ///< 32-bit floating-point ZET_VALUE_INFO_TYPE_EXP_FLOAT64 = 3, ///< 64-bit floating-point ZET_VALUE_INFO_TYPE_EXP_BOOL8 = 4, ///< 8-bit boolean ZET_VALUE_INFO_TYPE_EXP_UINT8 = 5, ///< 8-bit unsigned-integer ZET_VALUE_INFO_TYPE_EXP_UINT16 = 6, ///< 16-bit unsigned-integer ZET_VALUE_INFO_TYPE_EXP_UINT64_RANGE = 7, ///< 64-bit unsigned-integer range (minimum and maximum) ZET_VALUE_INFO_TYPE_EXP_FLOAT64_RANGE = 8, ///< 64-bit floating point range (minimum and maximum) ZET_VALUE_INFO_TYPE_EXP_FORCE_UINT32 = 0x7fffffff } zet_value_info_type_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Value info of type uint64_t range typedef struct _zet_value_uint64_range_exp_t { uint64_t ui64Min; ///< [out] minimum value of the range uint64_t ui64Max; ///< [out] maximum value of the range } zet_value_uint64_range_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Value info of type float64 range typedef struct _zet_value_fp64_range_exp_t { double fp64Min; ///< [out] minimum value of the range double fp64Max; ///< [out] maximum value of the range } zet_value_fp64_range_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Union of value information typedef union _zet_value_info_exp_t { uint32_t ui32; ///< [out] 32-bit unsigned-integer uint64_t ui64; ///< [out] 64-bit unsigned-integer float fp32; ///< [out] 32-bit floating-point double fp64; ///< [out] 64-bit floating-point ze_bool_t b8; ///< [out] 8-bit boolean uint8_t ui8; ///< [out] 8-bit unsigned integer uint16_t ui16; ///< [out] 16-bit unsigned integer zet_value_uint64_range_exp_t ui64Range; ///< [out] minimum and maximum value of the range zet_value_fp64_range_exp_t fp64Range; ///< [out] minimum and maximum value of the range } zet_value_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Metric Programmable parameter information typedef struct _zet_metric_programmable_param_info_exp_t { zet_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zet_metric_programmable_param_type_exp_t type; ///< [out] programmable parameter type char name[ZET_MAX_METRIC_PROGRAMMABLE_PARAMETER_NAME_EXP]; ///< [out] metric programmable parameter name zet_value_info_type_exp_t valueInfoType; ///< [out] value info type zet_value_t defaultValue; ///< [out] default value for the parameter uint32_t valueInfoCount; ///< [out] count of ::zet_metric_programmable_param_value_info_exp_t } zet_metric_programmable_param_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Metric Programmable parameter value information typedef struct _zet_metric_programmable_param_value_info_exp_t { zet_structure_type_t stype; ///< [in] type of this structure void* pNext; ///< [in,out][optional] must be null or a pointer to an extension-specific ///< structure (i.e. contains stype and pNext). zet_value_info_exp_t valueInfo; ///< [out] information about the parameter value char description[ZET_MAX_METRIC_PROGRAMMABLE_VALUE_DESCRIPTION_EXP]; ///< [out] description about the value } zet_metric_programmable_param_value_info_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Metric Programmable parameter value typedef struct _zet_metric_programmable_param_value_exp_t { zet_value_t value; ///< [in] parameter value } zet_metric_programmable_param_value_exp_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Query and get the available metric programmable handles. /// /// @details /// - Query the available programmable handles using *pCount = 0. /// - Returns all programmable metric handles available in the device. /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricProgrammableGetExp( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric programmable handles. ///< if count is zero, then the driver shall update the value with the ///< total number of metric programmable handles available. ///< if count is greater than the number of metric programmable handles ///< available, then the driver shall update the value with the correct ///< number of metric programmable handles available. zet_metric_programmable_exp_handle_t* phMetricProgrammables ///< [in,out][optional][range(0, *pCount)] array of handle of metric programmables. ///< if count is less than the number of metric programmables available, ///< then driver shall only retrieve that number of metric programmables. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the properties of the metric programmable. /// /// @details /// - Returns the properties of the metric programmable. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricProgrammable` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricProgrammableGetPropertiesExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_exp_properties_t* pProperties ///< [in,out] properties of the metric programmable ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the information about the parameters of the metric programmable. /// /// @details /// - Returns information about the parameters of the metric programmable /// handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricProgrammable` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pParameterCount` /// + `nullptr == pParameterInfo` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricProgrammableGetParamInfoExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t* pParameterCount, ///< [in,out] count of the parameters to retrieve parameter info. ///< if value pParameterCount is greater than count of parameters ///< available, then pParameterCount will be updated with count of ///< parameters available. ///< The count of parameters available can be queried using ::zetMetricProgrammableGetPropertiesExp. zet_metric_programmable_param_info_exp_t* pParameterInfo ///< [in,out][range(1, *pParameterCount)] array of parameter info. ///< if parameterCount is less than the number of parameters available, ///< then driver shall only retrieve that number of parameter info. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Get the information about the parameter value of the metric /// programmable. /// /// @details /// - Returns the value-information about the parameter at the specific /// ordinal of the metric programmable handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricProgrammable` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pValueInfoCount` /// + `nullptr == pValueInfo` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricProgrammableGetParamValueInfoExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterOrdinal, ///< [in] ordinal of the parameter in the metric programmable uint32_t* pValueInfoCount, ///< [in,out] count of parameter value information to retrieve. ///< if value at pValueInfoCount is greater than count of value info ///< available, then pValueInfoCount will be updated with count of value ///< info available. ///< The count of parameter value info available can be queried using ::zetMetricProgrammableGetParamInfoExp. zet_metric_programmable_param_value_info_exp_t* pValueInfo ///< [in,out][range(1, *pValueInfoCount)] array of parameter value info. ///< if pValueInfoCount is less than the number of value info available, ///< then driver shall only retrieve that number of value info. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Create metric handles by applying parameter values on the metric /// programmable handle. /// /// @details /// - Multiple parameter values could be used to prepare a metric. /// - If parameterCount = 0, the default value of the metric programmable /// would be used for all parameters. /// - The implementation can post-fix a C string to the metric name and /// description, based on the parameter values chosen. /// - ::zetMetricProgrammableGetParamInfoExp() returns a list of parameters /// in a defined order. /// - Therefore, the list of values passed in to the API should respect the /// same order such that the desired parameter is set with expected value /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricProgrammable` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pParameterValues` /// + `nullptr == pName` /// + `nullptr == pDescription` /// + `nullptr == pMetricHandleCount` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp2( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues, ///< [in] list of parameter values to be set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Create metric handles by applying parameter values on the metric /// programmable handle. /// /// @details /// - This API is deprecated. Please use /// ::zetMetricCreateFromProgrammableExp2() /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricProgrammable` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pParameterValues` /// + `nullptr == pName` /// + `nullptr == pDescription` /// + `nullptr == pMetricHandleCount` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_param_value_exp_t* pParameterValues, ///< [in] list of parameter values to be set. uint32_t parameterCount, ///< [in] Count of parameters to set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Create multiple metric group handles from metric handles. /// /// @details /// - Creates multiple metric groups from metrics which were created using /// ::zetMetricCreateFromProgrammableExp2(). /// - Metrics whose Hardware resources do not overlap are added to same /// metric group. /// - The metric groups created using this API are managed by the /// application and cannot be retrieved using ::zetMetricGroupGet(). /// - The created metric groups are ready for activation and collection. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// + `nullptr == phMetrics` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + metricGroupCount is lesser than the number of metric group handles that could be created. ZE_APIEXPORT ze_result_t ZE_APICALL zetDeviceCreateMetricGroupsFromMetricsExp( zet_device_handle_t hDevice, ///< [in] handle of the device. uint32_t metricCount, ///< [in] number of metric handles. zet_metric_handle_t * phMetrics, ///< [in] metric handles to be added to the metric groups. const char * pMetricGroupNamePrefix, ///< [in] prefix to the name created for the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP. const char * pDescription, ///< [in] pointer to description of the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. uint32_t * pMetricGroupCount, ///< [in,out] pointer to the number of metric group handles to be created. ///< if pMetricGroupCount is zero, then the driver shall update the value ///< with the maximum possible number of metric group handles that could be created. ///< if pMetricGroupCount is greater than the number of metric group ///< handles that could be created, then the driver shall update the value ///< with the correct number of metric group handles generated. ///< if pMetricGroupCount is lesser than the number of metric group handles ///< that could be created, then ::ZE_RESULT_ERROR_INVALID_ARGUMENT is returned. zet_metric_group_handle_t* phMetricGroup ///< [in,out][optional][range(0, *pMetricGroupCount)] array of handle of ///< metric group handles. ///< Created Metric group handles. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Create metric group handle. /// /// @details /// - This API is deprecated. Please use /// ::zetDeviceCreateMetricGroupsFromMetricsExp /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pName` /// + `nullptr == pDescription` /// + `nullptr == phMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < samplingType` ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGroupCreateExp( zet_device_handle_t hDevice, ///< [in] handle of the device const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. const char* pDescription, ///< [in] pointer to metric group description. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. zet_metric_group_sampling_type_flags_t samplingType, ///< [in] Sampling type for the metric group. zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle ); /////////////////////////////////////////////////////////////////////////////// /// @brief Add a metric handle to the metric group handle created using /// ::zetDeviceCreateMetricGroupsFromMetricsExp. /// /// @details /// - Reasons for failing to add the metric could be queried using /// pErrorString /// - Multiple additions of same metric would add the metric only once to /// the hMetricGroup /// - Metric handles from multiple domains may be used in a single metric /// group. /// - Metric handles from different sourceIds (refer /// ::zet_metric_programmable_exp_properties_t) are not allowed in a /// single metric group. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// + `nullptr == hMetric` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + If a Metric handle from a pre-defined metric group is requested to be added. /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + If the metric group is currently activated. ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGroupAddMetricExp( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric, ///< [in] Metric to be added to the group. size_t * pErrorStringSize, ///< [in,out][optional] Size of the error string to query, if an error was ///< reported during adding the metric handle. ///< if *pErrorStringSize is zero, then the driver shall update the value ///< with the size of the error string in bytes. char* pErrorString ///< [in,out][optional][range(0, *pErrorStringSize)] Error string. ///< if *pErrorStringSize is less than the length of the error string ///< available, then driver shall only retrieve that length of error string. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Remove a metric from the metric group handle created using /// ::zetDeviceCreateMetricGroupsFromMetricsExp. /// /// @details /// - Remove an already added metric handle from the metric group. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// + `nullptr == hMetric` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + If trying to remove a metric not previously added to the metric group /// + If the input metric group is a pre-defined metric group /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + If the metric group is currently activated ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGroupRemoveMetricExp( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric ///< [in] Metric handle to be removed from the metric group. ); /////////////////////////////////////////////////////////////////////////////// /// @brief Closes a created metric group using /// ::zetDeviceCreateMetricGroupsFromMetricsExp, so that it can be /// activated. /// /// @details /// - Finalizes the ::zetMetricGroupAddMetricExp and /// ::zetMetricGroupRemoveMetricExp operations on the metric group. /// - This is a necessary step before activation of the created metric /// group. /// - Add / Remove of metrics is possible after ::zetMetricGroupCloseExp. /// However, a call to ::zetMetricGroupCloseExp is necessary after /// modifying the metric group. /// - Implementations could choose to add new metrics to the group during /// ::zetMetricGroupCloseExp, which are related and might add value to the /// metrics already added by the application /// - Applications can query the list of metrics in the metric group using /// ::zetMetricGet /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + If the input metric group is a pre-defined metric group /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + If the metric group is currently activated ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGroupCloseExp( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroy a metric group created using /// ::zetDeviceCreateMetricGroupsFromMetricsExp. /// /// @details /// - Metric handles created using ::zetMetricCreateFromProgrammableExp2 and /// are part of the metricGroup are not destroyed. /// - It is necessary to call ::zetMetricDestroyExp for each of the metric /// handles (created from ::zetMetricCreateFromProgrammableExp2) to /// destroy them. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + If trying to destroy a pre-defined metric group /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + If trying to destroy an activated metric group ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricGroupDestroyExp( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group to destroy ); /////////////////////////////////////////////////////////////////////////////// /// @brief Destroy a metric created using ::zetMetricCreateFromProgrammableExp2. /// /// @details /// - If a metric is added to a metric group, the metric has to be removed /// using ::zetMetricGroupRemoveMetricExp before it can be destroyed. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetric` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + If trying to destroy a metric from pre-defined metric group /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + If trying to destroy a metric currently added to a metric group ZE_APIEXPORT ze_result_t ZE_APICALL zetMetricDestroyExp( zet_metric_handle_t hMetric ///< [in] Handle of the metric to destroy ); #if !defined(__GNUC__) #pragma endregion #endif #if defined(__cplusplus) } // extern "C" #endif #endif // _ZET_API_Hlevel-zero-1.20.6/include/zet_ddi.h000066400000000000000000001401611475521542100171130ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_ddi.h * @version v1.12-r1.12.15 * */ #ifndef _ZET_DDI_H #define _ZET_DDI_H #if defined(__cplusplus) #pragma once #endif #include "zet_api.h" #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricProgrammableGetExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricProgrammableGetExp_t)( zet_device_handle_t, uint32_t*, zet_metric_programmable_exp_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricProgrammableGetPropertiesExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricProgrammableGetPropertiesExp_t)( zet_metric_programmable_exp_handle_t, zet_metric_programmable_exp_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricProgrammableGetParamInfoExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricProgrammableGetParamInfoExp_t)( zet_metric_programmable_exp_handle_t, uint32_t*, zet_metric_programmable_param_info_exp_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricProgrammableGetParamValueInfoExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricProgrammableGetParamValueInfoExp_t)( zet_metric_programmable_exp_handle_t, uint32_t, uint32_t*, zet_metric_programmable_param_value_info_exp_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of MetricProgrammableExp functions pointers typedef struct _zet_metric_programmable_exp_dditable_t { zet_pfnMetricProgrammableGetExp_t pfnGetExp; zet_pfnMetricProgrammableGetPropertiesExp_t pfnGetPropertiesExp; zet_pfnMetricProgrammableGetParamInfoExp_t pfnGetParamInfoExp; zet_pfnMetricProgrammableGetParamValueInfoExp_t pfnGetParamValueInfoExp; } zet_metric_programmable_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricProgrammableExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricProgrammableExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_programmable_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetMetricProgrammableExpProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricProgrammableExpProcAddrTable_t)( ze_api_version_t, zet_metric_programmable_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricTracerCreateExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricTracerCreateExp_t)( zet_context_handle_t, zet_device_handle_t, uint32_t, zet_metric_group_handle_t*, zet_metric_tracer_exp_desc_t*, ze_event_handle_t, zet_metric_tracer_exp_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricTracerDestroyExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricTracerDestroyExp_t)( zet_metric_tracer_exp_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricTracerEnableExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricTracerEnableExp_t)( zet_metric_tracer_exp_handle_t, ze_bool_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricTracerDisableExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricTracerDisableExp_t)( zet_metric_tracer_exp_handle_t, ze_bool_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricTracerReadDataExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricTracerReadDataExp_t)( zet_metric_tracer_exp_handle_t, size_t*, uint8_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricTracerDecodeExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricTracerDecodeExp_t)( zet_metric_decoder_exp_handle_t, size_t*, uint8_t*, uint32_t, zet_metric_handle_t*, uint32_t*, uint32_t*, uint32_t*, zet_metric_entry_exp_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of MetricTracerExp functions pointers typedef struct _zet_metric_tracer_exp_dditable_t { zet_pfnMetricTracerCreateExp_t pfnCreateExp; zet_pfnMetricTracerDestroyExp_t pfnDestroyExp; zet_pfnMetricTracerEnableExp_t pfnEnableExp; zet_pfnMetricTracerDisableExp_t pfnDisableExp; zet_pfnMetricTracerReadDataExp_t pfnReadDataExp; zet_pfnMetricTracerDecodeExp_t pfnDecodeExp; } zet_metric_tracer_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricTracerExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricTracerExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_tracer_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetMetricTracerExpProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricTracerExpProcAddrTable_t)( ze_api_version_t, zet_metric_tracer_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricDecoderCreateExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricDecoderCreateExp_t)( zet_metric_tracer_exp_handle_t, zet_metric_decoder_exp_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricDecoderDestroyExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricDecoderDestroyExp_t)( zet_metric_decoder_exp_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricDecoderGetDecodableMetricsExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricDecoderGetDecodableMetricsExp_t)( zet_metric_decoder_exp_handle_t, uint32_t*, zet_metric_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of MetricDecoderExp functions pointers typedef struct _zet_metric_decoder_exp_dditable_t { zet_pfnMetricDecoderCreateExp_t pfnCreateExp; zet_pfnMetricDecoderDestroyExp_t pfnDestroyExp; zet_pfnMetricDecoderGetDecodableMetricsExp_t pfnGetDecodableMetricsExp; } zet_metric_decoder_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricDecoderExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricDecoderExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_decoder_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetMetricDecoderExpProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricDecoderExpProcAddrTable_t)( ze_api_version_t, zet_metric_decoder_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDeviceGetDebugProperties typedef ze_result_t (ZE_APICALL *zet_pfnDeviceGetDebugProperties_t)( zet_device_handle_t, zet_device_debug_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Device functions pointers typedef struct _zet_device_dditable_t { zet_pfnDeviceGetDebugProperties_t pfnGetDebugProperties; } zet_device_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetDeviceProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetDeviceProcAddrTable_t)( ze_api_version_t, zet_device_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDeviceGetConcurrentMetricGroupsExp typedef ze_result_t (ZE_APICALL *zet_pfnDeviceGetConcurrentMetricGroupsExp_t)( zet_device_handle_t, uint32_t, zet_metric_group_handle_t *, uint32_t *, uint32_t * ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDeviceCreateMetricGroupsFromMetricsExp typedef ze_result_t (ZE_APICALL *zet_pfnDeviceCreateMetricGroupsFromMetricsExp_t)( zet_device_handle_t, uint32_t, zet_metric_handle_t *, const char *, const char *, uint32_t *, zet_metric_group_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of DeviceExp functions pointers typedef struct _zet_device_exp_dditable_t { zet_pfnDeviceGetConcurrentMetricGroupsExp_t pfnGetConcurrentMetricGroupsExp; zet_pfnDeviceCreateMetricGroupsFromMetricsExp_t pfnCreateMetricGroupsFromMetricsExp; } zet_device_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetDeviceExpProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetDeviceExpProcAddrTable_t)( ze_api_version_t, zet_device_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetContextActivateMetricGroups typedef ze_result_t (ZE_APICALL *zet_pfnContextActivateMetricGroups_t)( zet_context_handle_t, zet_device_handle_t, uint32_t, zet_metric_group_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Context functions pointers typedef struct _zet_context_dditable_t { zet_pfnContextActivateMetricGroups_t pfnActivateMetricGroups; } zet_context_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Context table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetContextProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_context_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetContextProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetContextProcAddrTable_t)( ze_api_version_t, zet_context_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetCommandListAppendMetricStreamerMarker typedef ze_result_t (ZE_APICALL *zet_pfnCommandListAppendMetricStreamerMarker_t)( zet_command_list_handle_t, zet_metric_streamer_handle_t, uint32_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetCommandListAppendMetricQueryBegin typedef ze_result_t (ZE_APICALL *zet_pfnCommandListAppendMetricQueryBegin_t)( zet_command_list_handle_t, zet_metric_query_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetCommandListAppendMetricQueryEnd typedef ze_result_t (ZE_APICALL *zet_pfnCommandListAppendMetricQueryEnd_t)( zet_command_list_handle_t, zet_metric_query_handle_t, ze_event_handle_t, uint32_t, ze_event_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetCommandListAppendMetricMemoryBarrier typedef ze_result_t (ZE_APICALL *zet_pfnCommandListAppendMetricMemoryBarrier_t)( zet_command_list_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of CommandList functions pointers typedef struct _zet_command_list_dditable_t { zet_pfnCommandListAppendMetricStreamerMarker_t pfnAppendMetricStreamerMarker; zet_pfnCommandListAppendMetricQueryBegin_t pfnAppendMetricQueryBegin; zet_pfnCommandListAppendMetricQueryEnd_t pfnAppendMetricQueryEnd; zet_pfnCommandListAppendMetricMemoryBarrier_t pfnAppendMetricMemoryBarrier; } zet_command_list_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandList table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetCommandListProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_command_list_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetCommandListProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetCommandListProcAddrTable_t)( ze_api_version_t, zet_command_list_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetModuleGetDebugInfo typedef ze_result_t (ZE_APICALL *zet_pfnModuleGetDebugInfo_t)( zet_module_handle_t, zet_module_debug_info_format_t, size_t*, uint8_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Module functions pointers typedef struct _zet_module_dditable_t { zet_pfnModuleGetDebugInfo_t pfnGetDebugInfo; } zet_module_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Module table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetModuleProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_module_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetModuleProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetModuleProcAddrTable_t)( ze_api_version_t, zet_module_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetKernelGetProfileInfo typedef ze_result_t (ZE_APICALL *zet_pfnKernelGetProfileInfo_t)( zet_kernel_handle_t, zet_profile_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Kernel functions pointers typedef struct _zet_kernel_dditable_t { zet_pfnKernelGetProfileInfo_t pfnGetProfileInfo; } zet_kernel_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Kernel table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetKernelProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_kernel_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetKernelProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetKernelProcAddrTable_t)( ze_api_version_t, zet_kernel_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGet typedef ze_result_t (ZE_APICALL *zet_pfnMetricGet_t)( zet_metric_group_handle_t, uint32_t*, zet_metric_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGetProperties typedef ze_result_t (ZE_APICALL *zet_pfnMetricGetProperties_t)( zet_metric_handle_t, zet_metric_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Metric functions pointers typedef struct _zet_metric_dditable_t { zet_pfnMetricGet_t pfnGet; zet_pfnMetricGetProperties_t pfnGetProperties; } zet_metric_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Metric table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetMetricProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricProcAddrTable_t)( ze_api_version_t, zet_metric_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricCreateFromProgrammableExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricCreateFromProgrammableExp_t)( zet_metric_programmable_exp_handle_t, zet_metric_programmable_param_value_exp_t*, uint32_t, const char*, const char*, uint32_t*, zet_metric_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricDestroyExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricDestroyExp_t)( zet_metric_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricCreateFromProgrammableExp2 typedef ze_result_t (ZE_APICALL *zet_pfnMetricCreateFromProgrammableExp2_t)( zet_metric_programmable_exp_handle_t, uint32_t, zet_metric_programmable_param_value_exp_t*, const char*, const char*, uint32_t*, zet_metric_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of MetricExp functions pointers typedef struct _zet_metric_exp_dditable_t { zet_pfnMetricCreateFromProgrammableExp_t pfnCreateFromProgrammableExp; zet_pfnMetricDestroyExp_t pfnDestroyExp; zet_pfnMetricCreateFromProgrammableExp2_t pfnCreateFromProgrammableExp2; } zet_metric_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetMetricExpProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricExpProcAddrTable_t)( ze_api_version_t, zet_metric_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupGet typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupGet_t)( zet_device_handle_t, uint32_t*, zet_metric_group_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupGetProperties typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupGetProperties_t)( zet_metric_group_handle_t, zet_metric_group_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupCalculateMetricValues typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupCalculateMetricValues_t)( zet_metric_group_handle_t, zet_metric_group_calculation_type_t, size_t, const uint8_t*, uint32_t*, zet_typed_value_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of MetricGroup functions pointers typedef struct _zet_metric_group_dditable_t { zet_pfnMetricGroupGet_t pfnGet; zet_pfnMetricGroupGetProperties_t pfnGetProperties; zet_pfnMetricGroupCalculateMetricValues_t pfnCalculateMetricValues; } zet_metric_group_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricGroup table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricGroupProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_group_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetMetricGroupProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricGroupProcAddrTable_t)( ze_api_version_t, zet_metric_group_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupCalculateMultipleMetricValuesExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupCalculateMultipleMetricValuesExp_t)( zet_metric_group_handle_t, zet_metric_group_calculation_type_t, size_t, const uint8_t*, uint32_t*, uint32_t*, uint32_t*, zet_typed_value_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupGetGlobalTimestampsExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupGetGlobalTimestampsExp_t)( zet_metric_group_handle_t, ze_bool_t, uint64_t*, uint64_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupGetExportDataExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupGetExportDataExp_t)( zet_metric_group_handle_t, const uint8_t*, size_t, size_t*, uint8_t * ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupCalculateMetricExportDataExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupCalculateMetricExportDataExp_t)( ze_driver_handle_t, zet_metric_group_calculation_type_t, size_t, const uint8_t*, zet_metric_calculate_exp_desc_t*, uint32_t*, uint32_t*, uint32_t*, zet_typed_value_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupCreateExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupCreateExp_t)( zet_device_handle_t, const char*, const char*, zet_metric_group_sampling_type_flags_t, zet_metric_group_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupAddMetricExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupAddMetricExp_t)( zet_metric_group_handle_t, zet_metric_handle_t, size_t *, char* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupRemoveMetricExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupRemoveMetricExp_t)( zet_metric_group_handle_t, zet_metric_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupCloseExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupCloseExp_t)( zet_metric_group_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricGroupDestroyExp typedef ze_result_t (ZE_APICALL *zet_pfnMetricGroupDestroyExp_t)( zet_metric_group_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of MetricGroupExp functions pointers typedef struct _zet_metric_group_exp_dditable_t { zet_pfnMetricGroupCalculateMultipleMetricValuesExp_t pfnCalculateMultipleMetricValuesExp; zet_pfnMetricGroupGetGlobalTimestampsExp_t pfnGetGlobalTimestampsExp; zet_pfnMetricGroupGetExportDataExp_t pfnGetExportDataExp; zet_pfnMetricGroupCalculateMetricExportDataExp_t pfnCalculateMetricExportDataExp; zet_pfnMetricGroupCreateExp_t pfnCreateExp; zet_pfnMetricGroupAddMetricExp_t pfnAddMetricExp; zet_pfnMetricGroupRemoveMetricExp_t pfnRemoveMetricExp; zet_pfnMetricGroupCloseExp_t pfnCloseExp; zet_pfnMetricGroupDestroyExp_t pfnDestroyExp; } zet_metric_group_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricGroupExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricGroupExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_group_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetMetricGroupExpProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricGroupExpProcAddrTable_t)( ze_api_version_t, zet_metric_group_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricStreamerOpen typedef ze_result_t (ZE_APICALL *zet_pfnMetricStreamerOpen_t)( zet_context_handle_t, zet_device_handle_t, zet_metric_group_handle_t, zet_metric_streamer_desc_t*, ze_event_handle_t, zet_metric_streamer_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricStreamerClose typedef ze_result_t (ZE_APICALL *zet_pfnMetricStreamerClose_t)( zet_metric_streamer_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricStreamerReadData typedef ze_result_t (ZE_APICALL *zet_pfnMetricStreamerReadData_t)( zet_metric_streamer_handle_t, uint32_t, size_t*, uint8_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of MetricStreamer functions pointers typedef struct _zet_metric_streamer_dditable_t { zet_pfnMetricStreamerOpen_t pfnOpen; zet_pfnMetricStreamerClose_t pfnClose; zet_pfnMetricStreamerReadData_t pfnReadData; } zet_metric_streamer_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricStreamer table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricStreamerProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_streamer_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetMetricStreamerProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricStreamerProcAddrTable_t)( ze_api_version_t, zet_metric_streamer_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricQueryPoolCreate typedef ze_result_t (ZE_APICALL *zet_pfnMetricQueryPoolCreate_t)( zet_context_handle_t, zet_device_handle_t, zet_metric_group_handle_t, const zet_metric_query_pool_desc_t*, zet_metric_query_pool_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricQueryPoolDestroy typedef ze_result_t (ZE_APICALL *zet_pfnMetricQueryPoolDestroy_t)( zet_metric_query_pool_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of MetricQueryPool functions pointers typedef struct _zet_metric_query_pool_dditable_t { zet_pfnMetricQueryPoolCreate_t pfnCreate; zet_pfnMetricQueryPoolDestroy_t pfnDestroy; } zet_metric_query_pool_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricQueryPool table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricQueryPoolProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_query_pool_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetMetricQueryPoolProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricQueryPoolProcAddrTable_t)( ze_api_version_t, zet_metric_query_pool_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricQueryCreate typedef ze_result_t (ZE_APICALL *zet_pfnMetricQueryCreate_t)( zet_metric_query_pool_handle_t, uint32_t, zet_metric_query_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricQueryDestroy typedef ze_result_t (ZE_APICALL *zet_pfnMetricQueryDestroy_t)( zet_metric_query_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricQueryReset typedef ze_result_t (ZE_APICALL *zet_pfnMetricQueryReset_t)( zet_metric_query_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetMetricQueryGetData typedef ze_result_t (ZE_APICALL *zet_pfnMetricQueryGetData_t)( zet_metric_query_handle_t, size_t*, uint8_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of MetricQuery functions pointers typedef struct _zet_metric_query_dditable_t { zet_pfnMetricQueryCreate_t pfnCreate; zet_pfnMetricQueryDestroy_t pfnDestroy; zet_pfnMetricQueryReset_t pfnReset; zet_pfnMetricQueryGetData_t pfnGetData; } zet_metric_query_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricQuery table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricQueryProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_query_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetMetricQueryProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetMetricQueryProcAddrTable_t)( ze_api_version_t, zet_metric_query_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetTracerExpCreate typedef ze_result_t (ZE_APICALL *zet_pfnTracerExpCreate_t)( zet_context_handle_t, const zet_tracer_exp_desc_t*, zet_tracer_exp_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetTracerExpDestroy typedef ze_result_t (ZE_APICALL *zet_pfnTracerExpDestroy_t)( zet_tracer_exp_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetTracerExpSetPrologues typedef ze_result_t (ZE_APICALL *zet_pfnTracerExpSetPrologues_t)( zet_tracer_exp_handle_t, zet_core_callbacks_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetTracerExpSetEpilogues typedef ze_result_t (ZE_APICALL *zet_pfnTracerExpSetEpilogues_t)( zet_tracer_exp_handle_t, zet_core_callbacks_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetTracerExpSetEnabled typedef ze_result_t (ZE_APICALL *zet_pfnTracerExpSetEnabled_t)( zet_tracer_exp_handle_t, ze_bool_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of TracerExp functions pointers typedef struct _zet_tracer_exp_dditable_t { zet_pfnTracerExpCreate_t pfnCreate; zet_pfnTracerExpDestroy_t pfnDestroy; zet_pfnTracerExpSetPrologues_t pfnSetPrologues; zet_pfnTracerExpSetEpilogues_t pfnSetEpilogues; zet_pfnTracerExpSetEnabled_t pfnSetEnabled; } zet_tracer_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's TracerExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetTracerExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_tracer_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetTracerExpProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetTracerExpProcAddrTable_t)( ze_api_version_t, zet_tracer_exp_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDebugAttach typedef ze_result_t (ZE_APICALL *zet_pfnDebugAttach_t)( zet_device_handle_t, const zet_debug_config_t*, zet_debug_session_handle_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDebugDetach typedef ze_result_t (ZE_APICALL *zet_pfnDebugDetach_t)( zet_debug_session_handle_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDebugReadEvent typedef ze_result_t (ZE_APICALL *zet_pfnDebugReadEvent_t)( zet_debug_session_handle_t, uint64_t, zet_debug_event_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDebugAcknowledgeEvent typedef ze_result_t (ZE_APICALL *zet_pfnDebugAcknowledgeEvent_t)( zet_debug_session_handle_t, const zet_debug_event_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDebugInterrupt typedef ze_result_t (ZE_APICALL *zet_pfnDebugInterrupt_t)( zet_debug_session_handle_t, ze_device_thread_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDebugResume typedef ze_result_t (ZE_APICALL *zet_pfnDebugResume_t)( zet_debug_session_handle_t, ze_device_thread_t ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDebugReadMemory typedef ze_result_t (ZE_APICALL *zet_pfnDebugReadMemory_t)( zet_debug_session_handle_t, ze_device_thread_t, const zet_debug_memory_space_desc_t*, size_t, void* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDebugWriteMemory typedef ze_result_t (ZE_APICALL *zet_pfnDebugWriteMemory_t)( zet_debug_session_handle_t, ze_device_thread_t, const zet_debug_memory_space_desc_t*, size_t, const void* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDebugGetRegisterSetProperties typedef ze_result_t (ZE_APICALL *zet_pfnDebugGetRegisterSetProperties_t)( zet_device_handle_t, uint32_t*, zet_debug_regset_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDebugReadRegisters typedef ze_result_t (ZE_APICALL *zet_pfnDebugReadRegisters_t)( zet_debug_session_handle_t, ze_device_thread_t, uint32_t, uint32_t, uint32_t, void* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDebugWriteRegisters typedef ze_result_t (ZE_APICALL *zet_pfnDebugWriteRegisters_t)( zet_debug_session_handle_t, ze_device_thread_t, uint32_t, uint32_t, uint32_t, void* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetDebugGetThreadRegisterSetProperties typedef ze_result_t (ZE_APICALL *zet_pfnDebugGetThreadRegisterSetProperties_t)( zet_debug_session_handle_t, ze_device_thread_t, uint32_t*, zet_debug_regset_properties_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Debug functions pointers typedef struct _zet_debug_dditable_t { zet_pfnDebugAttach_t pfnAttach; zet_pfnDebugDetach_t pfnDetach; zet_pfnDebugReadEvent_t pfnReadEvent; zet_pfnDebugAcknowledgeEvent_t pfnAcknowledgeEvent; zet_pfnDebugInterrupt_t pfnInterrupt; zet_pfnDebugResume_t pfnResume; zet_pfnDebugReadMemory_t pfnReadMemory; zet_pfnDebugWriteMemory_t pfnWriteMemory; zet_pfnDebugGetRegisterSetProperties_t pfnGetRegisterSetProperties; zet_pfnDebugReadRegisters_t pfnReadRegisters; zet_pfnDebugWriteRegisters_t pfnWriteRegisters; zet_pfnDebugGetThreadRegisterSetProperties_t pfnGetThreadRegisterSetProperties; } zet_debug_dditable_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Debug table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDebugProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_debug_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for zetGetDebugProcAddrTable typedef ze_result_t (ZE_APICALL *zet_pfnGetDebugProcAddrTable_t)( ze_api_version_t, zet_debug_dditable_t* ); /////////////////////////////////////////////////////////////////////////////// /// @brief Container for all DDI tables typedef struct _zet_dditable_t { zet_metric_programmable_exp_dditable_t MetricProgrammableExp; zet_metric_tracer_exp_dditable_t MetricTracerExp; zet_metric_decoder_exp_dditable_t MetricDecoderExp; zet_device_dditable_t Device; zet_device_exp_dditable_t DeviceExp; zet_context_dditable_t Context; zet_command_list_dditable_t CommandList; zet_module_dditable_t Module; zet_kernel_dditable_t Kernel; zet_metric_dditable_t Metric; zet_metric_exp_dditable_t MetricExp; zet_metric_group_dditable_t MetricGroup; zet_metric_group_exp_dditable_t MetricGroupExp; zet_metric_streamer_dditable_t MetricStreamer; zet_metric_query_pool_dditable_t MetricQueryPool; zet_metric_query_dditable_t MetricQuery; zet_tracer_exp_dditable_t TracerExp; zet_debug_dditable_t Debug; } zet_dditable_t; /// @brief Container for all DDI tables with version and tables set by the Driver typedef struct _zet_dditable_driver_t { ze_api_version_t version; uint8_t isValidFlag; zet_metric_programmable_exp_dditable_t * MetricProgrammableExp; zet_metric_tracer_exp_dditable_t * MetricTracerExp; zet_metric_decoder_exp_dditable_t * MetricDecoderExp; zet_device_dditable_t * Device; zet_device_exp_dditable_t * DeviceExp; zet_context_dditable_t * Context; zet_command_list_dditable_t * CommandList; zet_module_dditable_t * Module; zet_kernel_dditable_t * Kernel; zet_metric_dditable_t * Metric; zet_metric_exp_dditable_t * MetricExp; zet_metric_group_dditable_t * MetricGroup; zet_metric_group_exp_dditable_t * MetricGroupExp; zet_metric_streamer_dditable_t * MetricStreamer; zet_metric_query_pool_dditable_t * MetricQueryPool; zet_metric_query_dditable_t * MetricQuery; zet_tracer_exp_dditable_t * TracerExp; zet_debug_dditable_t * Debug; } zet_dditable_driver_t; #if defined(__cplusplus) } // extern "C" #endif #endif // _ZET_DDI_Hlevel-zero-1.20.6/os_release_info.cmake000066400000000000000000000134751475521542100200420ustar00rootroot00000000000000# Copyright (C) 2020 Intel Corporation # SPDX-License-Identifier: MIT # if(NOT DEFINED _os_release_info) set(_os_release_info TRUE) # os_release_info.cmake - Function to dump OS name and version # This file has no dependencies on other files (e.g., functions or definitions) # of the local cmake environment. # Set cmake policies for at least this level: cmake_minimum_required(VERSION 3.5.0) # Function get_os_release_info - Determine and return OS name and version # # Args: # 1. the name of a variable to receive os_name # 2. the name of a variable to receive os_version # # Return values: (Quotation marks are always stripped). # Upon failure, return values are null strings. # # Examples: # os_name os_version # -------------- ------- # clear-linux-os 21180 (Changes twice daily) # ubuntu 12.04 16.04 17.10 18.04 # fedora 27 # centos 6.9 7.4.1708 # # Potential sources are tried (in order of preference) until a # suitable one is found. # Implementation documentation: # # The potential sources, in order, are as follows. # - /etc/centos-release # Centos 7 also has /etc/os-release. File /etc/os-release is less # precise about the Centos version (e.g., "7" instead of "7.4.1708"). # For that reason, this file is checked first. # Examples: # CentOS release 6.9 (Final) # CentOS Linux release 7.4.1708 (Core) # - /usr/lib/os-release # Present for Clear Linux, modern Fedora, and Ubuntu since some time # between 14.04 and 16.04. The ID and VERSION_ID values are used. # Examples: # ID=clear-linux-os VERSION_ID=21180 # ID=fedora VERSION_ID=27 # ID=ubuntu VERSION_ID="14.04" # ID=ubuntu VERSION_ID="16.04" # ID="ubuntu" VERSION_ID="17.10" # - /etc/os-release - Same form as (sometimes a link to) /usr/lib/os-release # ID="Ubuntu" VERSION_ID="12.04" # ID="Ubuntu" VERSION_ID="14.04" # with a symbolic link: /etc/os-release -> ../usr/lib/os-release # ID="CentOS Linux" VERSION_ID="7" Also: ID_LIKE="rhel fedora" # - /etc/lsb-release # For Centos, not too meaningful. # Other "OS"s are more reasonable: # DISTRIB_ID=Ubuntu DISTRIB_RELEASE=12.04 # DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 # DISTRIB_ID=Ubuntu DISTRIB_RELEASE=17.10 function(get_os_release_info _vn_id _vn_version_id _vn_codename) set(_var_id "") set(_var_version_id "") set(_var_codename "") if("${_var_id}" STREQUAL "") set(file_path "/etc/centos-release") if(EXISTS "${file_path}") # Example: CentOS release 6.9 (Final) file(STRINGS "${file_path}" file_list LIMIT_COUNT 1) list(GET file_list 0 file_line) # Remove all parenthesized items. string(REGEX REPLACE "\\([^)]+\\)" "" file_line "${file_line}") # Extract start and end, discard optional "version" or "release" string(REGEX MATCH "^([A-Za-z0-9_]+)( +(version|release))? +(.*)$" _dummy "${file_line}") # 1 2 3 4 set(_var_id "${CMAKE_MATCH_1}") set(_var_version_id "${CMAKE_MATCH_4}") endif() endif() if("${_var_id}" STREQUAL "") if(EXISTS "/usr/lib/os-release") set(file_path "/usr/lib/os-release") elseif(EXISTS "/etc/os-release") set(file_path "/etc/os-release") else() set(file_path "") endif() if(NOT "${file_path}" STREQUAL "") file(STRINGS "${file_path}" data_list REGEX "^(ID|VERSION_ID|VERSION_CODENAME)=") # Look for lines like "ID="..." and VERSION_ID="..." foreach(_var ${data_list}) if("${_var}" MATCHES "^(ID)=(.*)$") set(_var_id "${CMAKE_MATCH_2}") elseif("${_var}" MATCHES "^(VERSION_ID)=(.*)$") set(_var_version_id "${CMAKE_MATCH_2}") elseif("${_var}" MATCHES "^(VERSION_CODENAME)=(.*)$") set(_var_codename "${CMAKE_MATCH_2}") endif() endforeach() endif() endif() if("${_var_id}" STREQUAL "") set(file_path "/etc/lsb-release") if(EXISTS "${file_path}") file(STRINGS "${file_path}" data_list REGEX "^(DISTRIB_ID|DISTRIB_RELEASE|DISTRIB_CODENAME)=") # Look for lines like "DISTRIB_ID="..." and DISTRIB_RELEASE="..." foreach(_var ${data_list}) if("${_var}" MATCHES "^(DISTRIB_ID)=(.*)$") set(_var_id "${CMAKE_MATCH_2}") elseif("${_var}" MATCHES "^(DISTRIB_RELEASE)=(.*)$") set(_var_version_id "${CMAKE_MATCH_2}") elseif("${_var}" MATCHES "^(DISTRIB_CODENAME)=(.*)$") set(_var_codename "${CMAKE_MATCH_2}") endif() endforeach() endif() endif() string(TOLOWER "${_var_id}" "_var_id") string(STRIP "${_var_id}" _var_id) string(STRIP "${_var_version_id}" _var_version_id) string(STRIP "${_var_codename}" _var_codename) # Remove any enclosing quotation marks string(REGEX REPLACE "^\"(.*)\"$" "\\1" _var_id "${_var_id}") string(REGEX REPLACE "^\"(.*)\"$" "\\1" _var_version_id "${_var_version_id}") string(REGEX REPLACE "^\"(.*)\"$" "\\1" _var_codename "${_var_codename}") if(NOT "${_vn_id}" STREQUAL "") set(${_vn_id} "${_var_id}" PARENT_SCOPE) endif() if(NOT "${_vn_version_id}" STREQUAL "") set(${_vn_version_id} "${_var_version_id}" PARENT_SCOPE) endif() if(NOT "${_vn_codename}" STREQUAL "") set(${_vn_codename} "${_var_codename}" PARENT_SCOPE) endif() endfunction() endif(NOT DEFINED _os_release_info) level-zero-1.20.6/samples/000077500000000000000000000000001475521542100153365ustar00rootroot00000000000000level-zero-1.20.6/samples/CMakeLists.txt000066400000000000000000000001301475521542100200700ustar00rootroot00000000000000include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) add_subdirectory(zello_world) level-zero-1.20.6/samples/include/000077500000000000000000000000001475521542100167615ustar00rootroot00000000000000level-zero-1.20.6/samples/include/zello_init.h000066400000000000000000000120221475521542100212770ustar00rootroot00000000000000/* * * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include #include #include #include "ze_api.h" #include "zet_api.h" #include "loader/ze_loader.h" #include "zello_log.h" ////////////////////////////////////////////////////////////////////////// inline bool argparse( int argc, char *argv[], const char *shortName, const char *longName ) { char **arg = &argv[ 1 ]; char **argE = &argv[ argc ]; for( ; arg != argE; ++arg ) if( ( 0 == strcmp( *arg, shortName ) ) || ( 0 == strcmp( *arg, longName ) ) ) return true; return false; } ////////////////////////////////////////////////////////////////////////// inline bool init_ze( bool legacy_init , uint32_t &driverCount, ze_init_driver_type_desc_t &driverTypeDesc) { ze_result_t result; // Initialize the driver if (legacy_init) { result = zeInit(0); } else { result = zeInitDrivers(&driverCount, nullptr, &driverTypeDesc); } if(result != ZE_RESULT_SUCCESS) { std::cout << "Driver not initialized: " << to_string(result) << std::endl; return false; } std::cout << "Driver initialized.\n"; return true; } ////////////////////////////////////////////////////////////////////////// inline ze_device_handle_t findDevice( ze_driver_handle_t pDriver, ze_device_type_t type) { // get all devices uint32_t deviceCount = 0; zeDeviceGet(pDriver, &deviceCount, nullptr); std::vector devices(deviceCount); zeDeviceGet(pDriver, &deviceCount, devices.data()); ze_device_handle_t found = nullptr; // for each device, find the first one matching the type for(uint32_t device = 0; device < deviceCount; ++device) { auto phDevice = devices[device]; ze_device_properties_t device_properties = {}; device_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES; zeDeviceGetProperties(phDevice, &device_properties); if(type == device_properties.type) { found = phDevice; ze_driver_properties_t driver_properties = {}; driver_properties.stype = ZE_STRUCTURE_TYPE_DRIVER_PROPERTIES; zeDriverGetProperties(pDriver, &driver_properties); std::cout << "Found "<< to_string(type) << " device..." << "\n"; std::cout << "Driver version: " << driver_properties.driverVersion << "\n"; ze_api_version_t version = {}; zeDriverGetApiVersion(pDriver, &version); std::cout << "API version: " << to_string(version) << "\n"; std::cout << to_string(device_properties) << "\n"; ze_device_compute_properties_t compute_properties = {}; compute_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_COMPUTE_PROPERTIES; zeDeviceGetComputeProperties(phDevice, &compute_properties); std::cout << to_string(compute_properties) << "\n"; uint32_t memoryCount = 0; zeDeviceGetMemoryProperties(phDevice, &memoryCount, nullptr); auto pMemoryProperties = new ze_device_memory_properties_t[memoryCount]; for( uint32_t mem = 0; mem < memoryCount; ++mem ) { pMemoryProperties[mem].stype = ZE_STRUCTURE_TYPE_DEVICE_MEMORY_PROPERTIES; pMemoryProperties[mem].pNext = nullptr; } zeDeviceGetMemoryProperties(phDevice, &memoryCount, pMemoryProperties); for( uint32_t mem = 0; mem < memoryCount; ++mem ) { std::cout << to_string( pMemoryProperties[ mem ] ) << "\n"; } delete[] pMemoryProperties; ze_device_memory_access_properties_t memory_access_properties = {}; memory_access_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_MEMORY_ACCESS_PROPERTIES; zeDeviceGetMemoryAccessProperties(phDevice, &memory_access_properties); std::cout << to_string( memory_access_properties ) << "\n"; uint32_t cacheCount = 0; zeDeviceGetCacheProperties(phDevice, &cacheCount, nullptr ); auto pCacheProperties = new ze_device_cache_properties_t[cacheCount]; for( uint32_t cache = 0; cache < cacheCount; ++cache ) { pCacheProperties[cache].stype = ZE_STRUCTURE_TYPE_DEVICE_CACHE_PROPERTIES; pCacheProperties[cache].pNext = nullptr; } zeDeviceGetCacheProperties(phDevice, &cacheCount, pCacheProperties); for( uint32_t cache = 0; cache < cacheCount; ++cache ) { std::cout << to_string( pCacheProperties[ cache ] ) << "\n"; } delete[] pCacheProperties; ze_device_image_properties_t image_properties = {}; image_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_IMAGE_PROPERTIES; zeDeviceGetImageProperties(phDevice, &image_properties); std::cout << to_string( image_properties ) << "\n"; break; } } return found; } level-zero-1.20.6/samples/include/zello_log.h000066400000000000000000000750661475521542100211360ustar00rootroot00000000000000/* * * Copyright (C) 2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include #include #include "ze_api.h" #include "zet_api.h" std::string to_string( const ze_structure_type_t val ) { std::string str; switch( val ) { case ZE_STRUCTURE_TYPE_DRIVER_PROPERTIES: str = "DRIVER_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_DRIVER_IPC_PROPERTIES: str = "DRIVER_IPC_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES: str = "DEVICE_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_DEVICE_COMPUTE_PROPERTIES: str = "DEVICE_COMPUTE_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_DEVICE_MODULE_PROPERTIES: str = "DEVICE_MODULE_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_COMMAND_QUEUE_GROUP_PROPERTIES: str = "COMMAND_QUEUE_GROUP_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_DEVICE_MEMORY_PROPERTIES: str = "DEVICE_MEMORY_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_DEVICE_MEMORY_ACCESS_PROPERTIES: str = "DEVICE_MEMORY_ACCESS_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_DEVICE_CACHE_PROPERTIES: str = "DEVICE_CACHE_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_DEVICE_IMAGE_PROPERTIES: str = "DEVICE_IMAGE_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_DEVICE_P2P_PROPERTIES: str = "DEVICE_P2P_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_DEVICE_EXTERNAL_MEMORY_PROPERTIES: str = "DEVICE_EXTERNAL_MEMORY_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_CONTEXT_DESC: str = "CONTEXT_DESC"; break; case ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC: str = "COMMAND_QUEUE_DESC"; break; case ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC: str = "COMMAND_LIST_DESC"; break; case ZE_STRUCTURE_TYPE_EVENT_POOL_DESC: str = "EVENT_POOL_DESC"; break; case ZE_STRUCTURE_TYPE_EVENT_DESC: str = "EVENT_DESC"; break; case ZE_STRUCTURE_TYPE_FENCE_DESC: str = "FENCE_DESC"; break; case ZE_STRUCTURE_TYPE_IMAGE_DESC: str = "IMAGE_DESC"; break; case ZE_STRUCTURE_TYPE_IMAGE_PROPERTIES: str = "IMAGE_PROPERTIES"; break; case ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC: str = "DEVICE_MEM_ALLOC_DESC"; break; default: str = "?"; break; }; return str; } std::string to_string( const ze_device_uuid_t val ) { std::string str; str += "device_uuid_t::id : "; { std::string tmp; for( auto& entry : val.id ) { tmp += std::to_string( entry ); tmp += ", "; } str += "[ " + tmp.substr( 0, tmp.size() - 2 ) + " ]";; } str += "\n"; return str; } std::string to_string(const ze_device_cache_property_flag_t val ) { const auto bits = static_cast( val ); std::string str; if( 0 == bits ) str += "0 | "; if( static_cast(ZE_DEVICE_CACHE_PROPERTY_FLAG_USER_CONTROL) & bits ) str += "CACHE_PROPERTY_FLAG_USER_CONTROL | "; return ( str.size() > 3 ) ? "Device::{ " + str.substr(0, str.size() - 3) + " }" : "Device::{ ? }"; } std::string to_string( ze_device_cache_properties_t val ) { std::string str; str += "ze_device_cache_properties_t.stype : "; str += to_string(val.stype); str += "\n"; str += "ze_device_cache_properties_t.pNext : "; { std::stringstream ss; ss << "0x" << std::hex << reinterpret_cast(val.pNext); str += ss.str(); } str += "\n"; str += "ze_device_cache_properties_t.flags : "; str += to_string((ze_device_cache_property_flag_t)val.flags); str += "\n"; str += "ze_device_cache_properties_t.cacheSize : "; str += std::to_string(val.cacheSize); str += "\n"; return str; } /////////////////////////////////////////////////////////////////////////////// /// @brief Converts Device::image_properties_t to std::string std::string to_string( ze_device_image_properties_t val ) { std::string str; str += "ze_device_image_properties_t.stype : "; str += to_string(val.stype); str += "\n"; str += "ze_device_image_properties_t.pNext : "; { std::stringstream ss; ss << "0x" << std::hex << reinterpret_cast(val.pNext); str += ss.str(); } str += "\n"; str += "ze_device_image_properties_t.maxImageDims1D : "; str += std::to_string(val.maxImageDims1D); str += "\n"; str += "ze_device_image_properties_t.maxImageDims2D : "; str += std::to_string(val.maxImageDims2D); str += "\n"; str += "ze_device_image_properties_t.maxImageDims3D : "; str += std::to_string(val.maxImageDims3D); str += "\n"; str += "ze_device_image_properties_t.maxImageBufferSize : "; str += std::to_string(val.maxImageBufferSize); str += "\n"; str += "ze_device_image_properties_t.maxImageArraySlices : "; str += std::to_string(val.maxImageArraySlices); str += "\n"; str += "ze_device_image_properties_t.maxSamplers : "; str += std::to_string(val.maxSamplers); str += "\n"; str += "ze_device_image_properties_t.maxReadImageArgs : "; str += std::to_string(val.maxReadImageArgs); str += "\n"; str += "ze_device_image_properties_t.maxWriteImageArgs : "; str += std::to_string(val.maxWriteImageArgs); str += "\n"; return str; } std::string to_string( ze_memory_access_cap_flag_t val ) { const auto bits = static_cast( val ); std::string str; if( 0 == bits ) str += "0 | "; if( static_cast(ZE_MEMORY_ACCESS_CAP_FLAG_RW) & bits ) str += "MEMORY_ACCESS_CAP_FLAG_RW | "; if( static_cast(ZE_MEMORY_ACCESS_CAP_FLAG_ATOMIC) & bits ) str += "MEMORY_ACCESS_CAP_FLAG_ATOMIC | "; if( static_cast(ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT) & bits ) str += "MEMORY_ACCESS_CAP_FLAG_CONCURRENT | "; if( static_cast(ZE_MEMORY_ACCESS_CAP_FLAG_CONCURRENT_ATOMIC) & bits ) str += "MEMORY_ACCESS_CAP_FLAG_CONCURRENT_ATOMIC | "; return ( str.size() > 3 ) ? "Device::{ " + str.substr(0, str.size() - 3) + " }" : "Device::{ ? }"; } std::string to_string( ze_device_memory_access_properties_t val ) { std::string str; str += "ze_device_memory_access_properties_t.stype : "; str += to_string(val.stype); str += "\n"; str += "ze_device_memory_access_properties_t.pNext : "; { std::stringstream ss; ss << "0x" << std::hex << reinterpret_cast(val.pNext); str += ss.str(); } str += "\n"; str += "ze_device_memory_access_properties_t.hostAllocCapabilities : "; str += to_string((ze_memory_access_cap_flag_t)val.hostAllocCapabilities); str += "\n"; str += "ze_device_memory_access_properties_t.deviceAllocCapabilities : "; str += to_string((ze_memory_access_cap_flag_t)val.deviceAllocCapabilities); str += "\n"; str += "ze_device_memory_access_properties_t.sharedSingleDeviceAllocCapabilities : "; str += to_string((ze_memory_access_cap_flag_t)val.sharedSingleDeviceAllocCapabilities); str += "\n"; str += "ze_device_memory_access_properties_t.sharedCrossDeviceAllocCapabilities : "; str += to_string((ze_memory_access_cap_flag_t)val.sharedCrossDeviceAllocCapabilities); str += "\n"; str += "ze_device_memory_access_properties_t.sharedSystemAllocCapabilities : "; str += to_string((ze_memory_access_cap_flag_t)val.sharedSystemAllocCapabilities); str += "\n"; return str; } std::string to_string( ze_device_memory_property_flag_t val ) { const auto bits = static_cast( val ); std::string str; if( 0 == bits ) str += "0 | "; if( static_cast(ZE_DEVICE_MEMORY_PROPERTY_FLAG_TBD) & bits ) str += "MEMORY_PROPERTY_FLAG_TBD | "; return ( str.size() > 3 ) ? "Device::{ " + str.substr(0, str.size() - 3) + " }" : "Device::{ ? }"; } std::string to_string( const ze_device_memory_properties_t val ) { std::string str; str += "stype : "; str += to_string(val.stype); str += "\n"; str += "pNext : "; { std::stringstream ss; ss << "0x" << std::hex << reinterpret_cast(val.pNext); str += ss.str(); } str += "\n"; str += "flags : "; str += to_string((ze_device_memory_property_flag_t)val.flags); str += "\n"; str += "maxClockRate : "; str += std::to_string(val.maxClockRate); str += "\n"; str += "maxBusWidth : "; str += std::to_string(val.maxBusWidth); str += "\n"; str += "totalSize : "; str += std::to_string(val.totalSize); str += "\n"; str += "name : "; str += val.name; str += "\n"; return str; } std::string to_string( const ze_device_compute_properties_t val ) { std::string str; str += "stype : "; str += to_string(val.stype); str += "\n"; str += "pNext : "; { std::stringstream ss; ss << "0x" << std::hex << reinterpret_cast(val.pNext); str += ss.str(); } str += "\n"; str += "maxTotalGroupSize : "; str += std::to_string(val.maxTotalGroupSize); str += "\n"; str += "maxGroupSizeX : "; str += std::to_string(val.maxGroupSizeX); str += "\n"; str += "maxGroupSizeY : "; str += std::to_string(val.maxGroupSizeY); str += "\n"; str += "maxGroupSizeZ : "; str += std::to_string(val.maxGroupSizeZ); str += "\n"; str += "maxGroupCountX : "; str += std::to_string(val.maxGroupCountX); str += "\n"; str += "maxGroupCountY : "; str += std::to_string(val.maxGroupCountY); str += "\n"; str += "maxGroupCountZ : "; str += std::to_string(val.maxGroupCountZ); str += "\n"; str += "maxSharedLocalMemory : "; str += std::to_string(val.maxSharedLocalMemory); str += "\n"; str += "numSubGroupSizes : "; str += std::to_string(val.numSubGroupSizes); str += "\n"; str += "subGroupSizes : "; { std::string tmp; for( auto& entry : val.subGroupSizes ) { tmp += std::to_string( entry ); tmp += ", "; } str += "[ " + tmp.substr( 0, tmp.size() - 2 ) + " ]";; } str += "\n"; return str; } std::string to_string( const ze_device_type_t val ) { std::string str; switch( val ) { case ZE_DEVICE_TYPE_GPU: str = "ZE_DEVICE_TYPE_GPU"; break; case ZE_DEVICE_TYPE_CPU: str = "ZE_DEVICE_TYPE_CPU"; break; case ZE_DEVICE_TYPE_FPGA: str = "ZE_DEVICE_TYPE_FPGA"; break; case ZE_DEVICE_TYPE_MCA: str = "ZE_DEVICE_TYPE_MCA"; break; default: str = "?"; break; }; return str; } std::string to_string( ze_device_property_flag_t val ) { const auto bits = static_cast( val ); std::string str; if( 0 == bits ) str += "0 | "; if( static_cast(ZE_DEVICE_PROPERTY_FLAG_INTEGRATED) & bits ) str += "PROPERTY_FLAG_INTEGRATED | "; if( static_cast(ZE_DEVICE_PROPERTY_FLAG_SUBDEVICE) & bits ) str += "PROPERTY_FLAG_SUBDEVICE | "; if( static_cast(ZE_DEVICE_PROPERTY_FLAG_ECC) & bits ) str += "PROPERTY_FLAG_ECC | "; if( static_cast(ZE_DEVICE_PROPERTY_FLAG_ONDEMANDPAGING) & bits ) str += "PROPERTY_FLAG_ONDEMANDPAGING | "; return ( str.size() > 3 ) ? "Device::{ " + str.substr(0, str.size() - 3) + " }" : "Device::{ ? }"; } std::string to_string(const ze_device_properties_t val) { std::string str; str += "Device::properties_t::stype : "; str += to_string(val.stype); str += "\n"; str += "Device::properties_t::pNext : "; { std::stringstream ss; ss << "0x" << std::hex << reinterpret_cast(val.pNext); str += ss.str(); } str += "\n"; str += "Device::properties_t::type : "; str += to_string(val.type); str += "\n"; str += "Device::properties_t::vendorId : "; str += std::to_string(val.vendorId); str += "\n"; str += "Device::properties_t::deviceId : "; str += std::to_string(val.deviceId); str += "\n"; str += "Device::properties_t::flags : "; str += to_string((ze_device_property_flag_t)val.flags); str += "\n"; str += "Device::properties_t::subdeviceId : "; str += std::to_string(val.subdeviceId); str += "\n"; str += "Device::properties_t::coreClockRate : "; str += std::to_string(val.coreClockRate); str += "\n"; str += "Device::properties_t::maxMemAllocSize : "; str += std::to_string(val.maxMemAllocSize); str += "\n"; str += "Device::properties_t::maxHardwareContexts : "; str += std::to_string(val.maxHardwareContexts); str += "\n"; str += "Device::properties_t::maxCommandQueuePriority : "; str += std::to_string(val.maxCommandQueuePriority); str += "\n"; str += "Device::properties_t::numThreadsPerEU : "; str += std::to_string(val.numThreadsPerEU); str += "\n"; str += "Device::properties_t::physicalEUSimdWidth : "; str += std::to_string(val.physicalEUSimdWidth); str += "\n"; str += "Device::properties_t::numEUsPerSubslice : "; str += std::to_string(val.numEUsPerSubslice); str += "\n"; str += "Device::properties_t::numSubslicesPerSlice : "; str += std::to_string(val.numSubslicesPerSlice); str += "\n"; str += "Device::properties_t::numSlices : "; str += std::to_string(val.numSlices); str += "\n"; str += "Device::properties_t::timerResolution : "; str += std::to_string(val.timerResolution); str += "\n"; str += "Device::properties_t::timestampValidBits : "; str += std::to_string(val.timestampValidBits); str += "\n"; str += "Device::properties_t::kernelTimestampValidBits : "; str += std::to_string(val.kernelTimestampValidBits); str += "\n"; str += "Device::properties_t::uuid : "; str += to_string(val.uuid); str += "\n"; str += "Device::properties_t::name : "; str += val.name; str += "\n"; return str; } std::string to_string(const ze_api_version_t version) { std::stringstream ss; ss << ZE_MAJOR_VERSION(version) << "." << ZE_MINOR_VERSION(version); return ss.str(); } std::string to_string(const ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { return "ZE_RESULT_SUCCESS"; } else if (result == ZE_RESULT_NOT_READY) { return "ZE_RESULT_NOT_READY"; } else if (result == ZE_RESULT_ERROR_UNINITIALIZED) { return "ZE_RESULT_ERROR_UNINITIALIZED"; } else if (result == ZE_RESULT_ERROR_DEVICE_LOST) { return "ZE_RESULT_ERROR_DEVICE_LOST"; } else if (result == ZE_RESULT_ERROR_INVALID_ARGUMENT) { return "ZE_RESULT_ERROR_INVALID_ARGUMENT"; } else if (result == ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY) { return "ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"; } else if (result == ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY) { return "ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"; } else if (result == ZE_RESULT_ERROR_MODULE_BUILD_FAILURE) { return "ZE_RESULT_ERROR_MODULE_BUILD_FAILURE"; } else if (result == ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS) { return "ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS"; } else if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { return "ZE_RESULT_ERROR_NOT_AVAILABLE"; } else if (result == ZE_RESULT_ERROR_UNSUPPORTED_VERSION) { return "ZE_RESULT_ERROR_UNSUPPORTED_VERSION"; } else if (result == ZE_RESULT_ERROR_UNSUPPORTED_FEATURE) { return "ZE_RESULT_ERROR_UNSUPPORTED_FEATURE"; } else if (result == ZE_RESULT_ERROR_INVALID_NULL_HANDLE) { return "ZE_RESULT_ERROR_INVALID_NULL_HANDLE"; } else if (result == ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE) { return "ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"; } else if (result == ZE_RESULT_ERROR_INVALID_NULL_POINTER) { return "ZE_RESULT_ERROR_INVALID_NULL_POINTER"; } else if (result == ZE_RESULT_ERROR_INVALID_SIZE) { return "ZE_RESULT_ERROR_INVALID_SIZE"; } else if (result == ZE_RESULT_ERROR_UNSUPPORTED_SIZE) { return "ZE_RESULT_ERROR_UNSUPPORTED_SIZE"; } else if (result == ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT) { return "ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"; } else if (result == ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT) { return "ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"; } else if (result == ZE_RESULT_ERROR_INVALID_ENUMERATION) { return "ZE_RESULT_ERROR_INVALID_ENUMERATION"; } else if (result == ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION) { return "ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION"; } else if (result == ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT) { return "ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT"; } else if (result == ZE_RESULT_ERROR_INVALID_NATIVE_BINARY) { return "ZE_RESULT_ERROR_INVALID_NATIVE_BINARY"; } else if (result == ZE_RESULT_ERROR_INVALID_GLOBAL_NAME) { return "ZE_RESULT_ERROR_INVALID_GLOBAL_NAME"; } else if (result == ZE_RESULT_ERROR_INVALID_KERNEL_NAME) { return "ZE_RESULT_ERROR_INVALID_KERNEL_NAME"; } else if (result == ZE_RESULT_ERROR_INVALID_FUNCTION_NAME) { return "ZE_RESULT_ERROR_INVALID_FUNCTION_NAME"; } else if (result == ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION) { return "ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION"; } else if (result == ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION) { return "ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION"; } else if (result == ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX) { return "ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX"; } else if (result == ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE) { return "ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE"; } else if (result == ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE) { return "ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE"; } else if (result == ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE) { return "ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE"; } else if (result == ZE_RESULT_ERROR_OVERLAPPING_REGIONS) { return "ZE_RESULT_ERROR_OVERLAPPING_REGIONS"; } else if (result == ZE_RESULT_ERROR_UNKNOWN) { return "ZE_RESULT_ERROR_UNKNOWN"; } else { return "Unknown ze_result_t value: " + std::to_string(static_cast(result)); } } std::string to_string(const ze_bool_t ze_bool) { if (ze_bool) { return "True"; } else { return "False"; } } std::string to_string(const ze_command_queue_flag_t flags) { if (flags == 0) { return "Default"; } else if (flags == ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY) { return "ZE_COMMAND_QUEUE_FLAG_EXPLICIT_ONLY"; } else if (flags == ZE_COMMAND_QUEUE_FLAG_FORCE_UINT32) { return "ZE_COMMAND_QUEUE_FLAG_FORCE_UINT32"; } else { return "Unknown ze_command_queue_flag_t value: " + std::to_string(static_cast(flags)); } } std::string to_string(const ze_command_queue_mode_t mode) { if (mode == ZE_COMMAND_QUEUE_MODE_DEFAULT) { return "ZE_COMMAND_QUEUE_MODE_DEFAULT"; } else if (mode == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS) { return "ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS"; } else if (mode == ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS) { return "ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS"; } else { return "Unknown ze_command_queue_mode_t value: " + std::to_string(static_cast(mode)); } } std::string to_string(const ze_command_queue_priority_t priority) { if (priority == ZE_COMMAND_QUEUE_PRIORITY_NORMAL) { return "ZE_COMMAND_QUEUE_PRIORITY_NORMAL"; } else if (priority == ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_LOW) { return "ZE_COMMAND_QUEUE_PRIORITY_LOW"; } else if (priority == ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH) { return "ZE_COMMAND_QUEUE_PRIORITY_HIGH"; } else { return "Unknown ze_command_queue_priority_t value: " + std::to_string(static_cast(priority)); } } std::string to_string(const ze_image_format_layout_t layout) { if (layout == ZE_IMAGE_FORMAT_LAYOUT_8) { return "ZE_IMAGE_FORMAT_LAYOUT_8"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_16) { return "ZE_IMAGE_FORMAT_LAYOUT_16"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_32) { return "ZE_IMAGE_FORMAT_LAYOUT_32"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_8_8) { return "ZE_IMAGE_FORMAT_LAYOUT_8_8"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8) { return "ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_16_16) { return "ZE_IMAGE_FORMAT_LAYOUT_16_16"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_16_16_16_16) { return "ZE_IMAGE_FORMAT_LAYOUT_16_16_16_16"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_32_32) { return "ZE_IMAGE_FORMAT_LAYOUT_32_32"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_32_32_32_32) { return "ZE_IMAGE_FORMAT_LAYOUT_32_32_32_32"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_10_10_10_2) { return "ZE_IMAGE_FORMAT_LAYOUT_10_10_10_2"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_11_11_10) { return "ZE_IMAGE_FORMAT_LAYOUT_11_11_10"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_5_6_5) { return "ZE_IMAGE_FORMAT_LAYOUT_5_6_5"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_5_5_5_1) { return "ZE_IMAGE_FORMAT_LAYOUT_5_5_5_1"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_4_4_4_4) { return "ZE_IMAGE_FORMAT_LAYOUT_4_4_4_4"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_Y8) { return "ZE_IMAGE_FORMAT_LAYOUT_Y8"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_NV12) { return "ZE_IMAGE_FORMAT_LAYOUT_NV12"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_YUYV) { return "ZE_IMAGE_FORMAT_LAYOUT_YUYV"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_VYUY) { return "ZE_IMAGE_FORMAT_LAYOUT_VYUY"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_YVYU) { return "ZE_IMAGE_FORMAT_LAYOUT_YVYU"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_UYVY) { return "ZE_IMAGE_FORMAT_LAYOUT_UYVY"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_AYUV) { return "ZE_IMAGE_FORMAT_LAYOUT_AYUV"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_P010) { return "ZE_IMAGE_FORMAT_LAYOUT_P010"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_Y410) { return "ZE_IMAGE_FORMAT_LAYOUT_Y410"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_P012) { return "ZE_IMAGE_FORMAT_LAYOUT_P012"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_Y16) { return "ZE_IMAGE_FORMAT_LAYOUT_Y16"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_P016) { return "ZE_IMAGE_FORMAT_LAYOUT_P016"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_Y216) { return "ZE_IMAGE_FORMAT_LAYOUT_Y216"; } else if (layout == ZE_IMAGE_FORMAT_LAYOUT_P216) { return "ZE_IMAGE_FORMAT_LAYOUT_P216"; } else { return "Unknown ze_image_format_layout_t value: " + std::to_string(static_cast(layout)); } } ze_image_format_layout_t to_layout(const std::string layout) { if (layout == "8") { return ZE_IMAGE_FORMAT_LAYOUT_8; } else if (layout == "16") { return ZE_IMAGE_FORMAT_LAYOUT_16; } else if (layout == "32") { return ZE_IMAGE_FORMAT_LAYOUT_32; } else if (layout == "8_8") { return ZE_IMAGE_FORMAT_LAYOUT_8_8; } else if (layout == "8_8_8_8") { return ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8; } else if (layout == "16_16") { return ZE_IMAGE_FORMAT_LAYOUT_16_16; } else if (layout == "16_16_16_16") { return ZE_IMAGE_FORMAT_LAYOUT_16_16_16_16; } else if (layout == "32_32") { return ZE_IMAGE_FORMAT_LAYOUT_32_32; } else if (layout == "32_32_32_32") { return ZE_IMAGE_FORMAT_LAYOUT_32_32_32_32; } else if (layout == "10_10_10_2") { return ZE_IMAGE_FORMAT_LAYOUT_10_10_10_2; } else if (layout == "11_11_10") { return ZE_IMAGE_FORMAT_LAYOUT_11_11_10; } else if (layout == "5_6_5") { return ZE_IMAGE_FORMAT_LAYOUT_5_6_5; } else if (layout == "5_5_5_1") { return ZE_IMAGE_FORMAT_LAYOUT_5_5_5_1; } else if (layout == "4_4_4_4") { return ZE_IMAGE_FORMAT_LAYOUT_4_4_4_4; } else if (layout == "Y8") { return ZE_IMAGE_FORMAT_LAYOUT_Y8; } else if (layout == "NV12") { return ZE_IMAGE_FORMAT_LAYOUT_NV12; } else if (layout == "YUYV") { return ZE_IMAGE_FORMAT_LAYOUT_YUYV; } else if (layout == "VYUY") { return ZE_IMAGE_FORMAT_LAYOUT_VYUY; } else if (layout == "YVYU") { return ZE_IMAGE_FORMAT_LAYOUT_YVYU; } else if (layout == "UYVY") { return ZE_IMAGE_FORMAT_LAYOUT_UYVY; } else if (layout == "AYUV") { return ZE_IMAGE_FORMAT_LAYOUT_AYUV; } else if (layout == "P010") { return ZE_IMAGE_FORMAT_LAYOUT_P010; } else if (layout == "Y410") { return ZE_IMAGE_FORMAT_LAYOUT_Y410; } else if (layout == "P012") { return ZE_IMAGE_FORMAT_LAYOUT_P012; } else if (layout == "Y16") { return ZE_IMAGE_FORMAT_LAYOUT_Y16; } else if (layout == "P016") { return ZE_IMAGE_FORMAT_LAYOUT_P016; } else if (layout == "Y216") { return ZE_IMAGE_FORMAT_LAYOUT_Y216; } else if (layout == "P216") { return ZE_IMAGE_FORMAT_LAYOUT_P216; } else { std::cout << "Unknown ze_image_format_layout_t value: " << layout; return static_cast(-1); } } std::string to_string(const ze_image_format_type_t type) { if (type == ZE_IMAGE_FORMAT_TYPE_UINT) { return "ZE_IMAGE_FORMAT_TYPE_UINT"; } else if (type == ZE_IMAGE_FORMAT_TYPE_SINT) { return "ZE_IMAGE_FORMAT_TYPE_SINT"; } else if (type == ZE_IMAGE_FORMAT_TYPE_UNORM) { return "ZE_IMAGE_FORMAT_TYPE_UNORM"; } else if (type == ZE_IMAGE_FORMAT_TYPE_SNORM) { return "ZE_IMAGE_FORMAT_TYPE_SNORM"; } else if (type == ZE_IMAGE_FORMAT_TYPE_FLOAT) { return "ZE_IMAGE_FORMAT_TYPE_FLOAT"; } else { return "Unknown ze_image_format_type_t value: " + std::to_string(static_cast(type)); } } ze_image_format_type_t to_format_type(const std::string format_type) { if (format_type == "UINT") { return ZE_IMAGE_FORMAT_TYPE_UINT; } else if (format_type == "SINT") { return ZE_IMAGE_FORMAT_TYPE_SINT; } else if (format_type == "UNORM") { return ZE_IMAGE_FORMAT_TYPE_UNORM; } else if (format_type == "SNORM") { return ZE_IMAGE_FORMAT_TYPE_SNORM; } else if (format_type == "FLOAT") { return ZE_IMAGE_FORMAT_TYPE_FLOAT; } else { std::cout << "Unknown ze_image_format_type_t value: "; return (static_cast(-1)); } } std::string to_string(const ze_image_format_swizzle_t swizzle) { if (swizzle == ZE_IMAGE_FORMAT_SWIZZLE_R) { return "ZE_IMAGE_FORMAT_SWIZZLE_R"; } else if (swizzle == ZE_IMAGE_FORMAT_SWIZZLE_G) { return "ZE_IMAGE_FORMAT_SWIZZLE_G"; } else if (swizzle == ZE_IMAGE_FORMAT_SWIZZLE_B) { return "ZE_IMAGE_FORMAT_SWIZZLE_B"; } else if (swizzle == ZE_IMAGE_FORMAT_SWIZZLE_A) { return "ZE_IMAGE_FORMAT_SWIZZLE_A"; } else if (swizzle == ZE_IMAGE_FORMAT_SWIZZLE_0) { return "ZE_IMAGE_FORMAT_SWIZZLE_0"; } else if (swizzle == ZE_IMAGE_FORMAT_SWIZZLE_1) { return "ZE_IMAGE_FORMAT_SWIZZLE_1"; } else if (swizzle == ZE_IMAGE_FORMAT_SWIZZLE_X) { return "ZE_IMAGE_FORMAT_SWIZZLE_X"; } else { return "Unknown ze_image_format_swizzle_t value: " + std::to_string(static_cast(swizzle)); } } std::string to_string(const ze_image_flag_t flag) { std::string flags = ""; if (flag & ZE_IMAGE_FLAG_KERNEL_WRITE) { flags.append("|ZE_IMAGE_FLAG_KERNEL_WRITE|"); } if (flag & ZE_IMAGE_FLAG_BIAS_UNCACHED) { flags.append("|ZE_IMAGE_FLAG_BIAS_UNCACHED|"); } return flags; } ze_image_flag_t to_flag(const std::string flag) { // by default setting to READ ze_image_flag_t image_flags = {}; // check if "READ" position is found in flag string if (flag.find("WRITE") != std::string::npos) { image_flags = static_cast(image_flags | ZE_IMAGE_FLAG_KERNEL_WRITE); } if (flag.find("UNCACHED") != std::string::npos) { image_flags = static_cast(image_flags | ZE_IMAGE_FLAG_BIAS_UNCACHED); } return image_flags; } std::string to_string(const ze_image_type_t type) { if (type == ZE_IMAGE_TYPE_1D) { return "ZE_IMAGE_TYPE_1D"; } else if (type == ZE_IMAGE_TYPE_2D) { return "ZE_IMAGE_TYPE_2D"; } else if (type == ZE_IMAGE_TYPE_3D) { return "ZE_IMAGE_TYPE_3D"; } else if (type == ZE_IMAGE_TYPE_1DARRAY) { return "ZE_IMAGE_TYPE_1DARRAY"; } else if (type == ZE_IMAGE_TYPE_2DARRAY) { return "ZE_IMAGE_TYPE_2DARRAY"; } else { return "Unknown ze_image_type_t value: " + std::to_string(static_cast(type)); } } ze_image_type_t to_image_type(const std::string type) { if (type == "1D") { return ZE_IMAGE_TYPE_1D; } else if (type == "2D") { return ZE_IMAGE_TYPE_2D; } else if (type == "3D") { return ZE_IMAGE_TYPE_3D; } else if (type == "1DARRAY") { return ZE_IMAGE_TYPE_1DARRAY; } else if (type == "2DARRAY") { return ZE_IMAGE_TYPE_2DARRAY; } else { std::cout << "Unknown ze_image_type_t value: "; return (static_cast(-1)); } } std::string to_string(const ze_device_fp_flags_t capabilities) { std::string capabilities_str = ""; if (capabilities == 0) { capabilities_str.append("|NONE|"); return capabilities_str; } if (capabilities & ZE_DEVICE_FP_FLAG_DENORM) { capabilities_str.append("|ZE_DEVICE_FP_FLAG_DENORM|"); } if (capabilities & ZE_DEVICE_FP_FLAG_INF_NAN) { capabilities_str.append("|ZE_DEVICE_FP_FLAG_INF_NAN|"); } if (capabilities & ZE_DEVICE_FP_FLAG_ROUND_TO_NEAREST) { capabilities_str.append("|ZE_DEVICE_FP_FLAG_ROUND_TO_NEAREST|"); } if (capabilities & ZE_DEVICE_FP_FLAG_ROUND_TO_ZERO) { capabilities_str.append("|ZE_DEVICE_FP_FLAG_ROUND_TO_ZERO|"); } if (capabilities & ZE_DEVICE_FP_FLAG_ROUND_TO_INF) { capabilities_str.append("|ZE_DEVICE_FP_FLAG_ROUND_TO_INF|"); } if (capabilities & ZE_DEVICE_FP_FLAG_FMA) { capabilities_str.append("|ZE_DEVICE_FP_FLAG_FMA|"); } if (capabilities & ZE_DEVICE_FP_FLAG_ROUNDED_DIVIDE_SQRT) { capabilities_str.append("|ZE_DEVICE_FP_FLAG_ROUNDED_DIVIDE_SQRT|"); } if (capabilities & ZE_DEVICE_FP_FLAG_SOFT_FLOAT) { capabilities_str.append("|ZE_DEVICE_FP_FLAG_SOFT_FLOAT|"); } return capabilities_str; } std::string to_string(const ze_driver_uuid_t uuid) { std::ostringstream result; result << "{"; for (int i = 0; i < ZE_MAX_DRIVER_UUID_SIZE; i++) { result << "0x" << std::hex << uuid.id[i] << ","; } result << "\b}"; return result.str(); } std::string to_string(const ze_native_kernel_uuid_t uuid) { std::ostringstream result; result << "{"; for (int i = 0; i < ZE_MAX_NATIVE_KERNEL_UUID_SIZE; i++) { result << "0x" << std::hex << uuid.id[i] << ","; } result << "\b}"; return result.str(); }level-zero-1.20.6/samples/zello_world/000077500000000000000000000000001475521542100176725ustar00rootroot00000000000000level-zero-1.20.6/samples/zello_world/CMakeLists.txt000066400000000000000000000006101475521542100224270ustar00rootroot00000000000000set(TARGET_NAME zello_world) add_executable(${TARGET_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/zello_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 ${TARGET_LOADER_NAME} ${CMAKE_DL_LIBS} ) level-zero-1.20.6/samples/zello_world/zello_world.cpp000066400000000000000000000153501475521542100227360ustar00rootroot00000000000000/* * * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include #include #include "zello_init.h" void print_loader_versions(){ zel_component_version_t *versions; size_t size = 0; zelLoaderGetVersions(&size, nullptr); std::cout << "zelLoaderGetVersions number of components found: " << size << std::endl; versions = new zel_component_version_t[size]; zelLoaderGetVersions(&size, versions); for(size_t i = 0; i < size; i++){ std::cout << "Version " << i << std::endl; std::cout << "Name: " << versions[i].component_name << std::endl; std::cout << "Major: " << versions[i].component_lib_version.major << std::endl; std::cout << "Minor: " << versions[i].component_lib_version.minor << std::endl; std::cout << "Patch: " << versions[i].component_lib_version.patch << std::endl; } delete[] versions; } #if defined(_WIN32) #define putenv_safe _putenv #else #define putenv_safe putenv #endif ////////////////////////////////////////////////////////////////////////// int main( int argc, char *argv[] ) { bool tracing_runtime_enabled = false; bool legacy_init = false; if( argparse( argc, argv, "-null", "--enable_null_driver" ) ) { putenv_safe( const_cast( "ZE_ENABLE_NULL_DRIVER=1" ) ); } if( argparse( argc, argv, "-ldr", "--force_loader_intercepts" ) ) { putenv_safe( const_cast( "ZE_ENABLE_LOADER_INTERCEPT=1" ) ); } if( argparse( argc, argv, "-val", "--enable_validation_layer" ) ) { putenv_safe( const_cast( "ZE_ENABLE_VALIDATION_LAYER=1" ) ); putenv_safe( const_cast( "ZE_ENABLE_PARAMETER_VALIDATION=1" ) ); } if( argparse( argc, argv, "-trace", "--enable_tracing_layer" ) ) { putenv_safe( const_cast( "ZE_ENABLE_TRACING_LAYER=1" ) ); } if( argparse( argc, argv, "-tracerun", "--enable_tracing_layer_runtime" ) ) { tracing_runtime_enabled = true; } if( argparse( argc, argv, "-legacy_init", "--enable_legacy_init" ) ) { legacy_init = true; } ze_result_t status; const ze_device_type_t type = ZE_DEVICE_TYPE_GPU; ze_init_driver_type_desc_t driverTypeDesc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; driverTypeDesc.flags = ZE_INIT_DRIVER_TYPE_FLAG_GPU; driverTypeDesc.pNext = nullptr; ze_driver_handle_t pDriver = nullptr; ze_device_handle_t pDevice = nullptr; uint32_t driverCount = 0; if( init_ze(legacy_init, driverCount, driverTypeDesc) ) { print_loader_versions(); if (tracing_runtime_enabled) { std::cout << "Enabling Tracing Layer after init" << std::endl; status = zelEnableTracingLayer(); if(status != ZE_RESULT_SUCCESS) { std::cout << "zelEnableTracingLayer Failed with return code: " << to_string(status) << std::endl; exit(1); } } std::vector drivers; if (legacy_init) { status = zeDriverGet(&driverCount, nullptr); if(status != ZE_RESULT_SUCCESS) { std::cout << "zeDriverGet Failed with return code: " << to_string(status) << std::endl; exit(1); } drivers.resize(driverCount); status = zeDriverGet( &driverCount, drivers.data() ); if(status != ZE_RESULT_SUCCESS) { std::cout << "zeDriverGet Failed with return code: " << to_string(status) << std::endl; exit(1); } } else { drivers.resize(driverCount); status = zeInitDrivers( &driverCount, drivers.data(), &driverTypeDesc); if(status != ZE_RESULT_SUCCESS) { std::cout << "zeInitDrivers Failed with return code: " << to_string(status) << std::endl; exit(1); } } for( uint32_t driver = 0; driver < driverCount; ++driver ) { pDriver = drivers[driver]; pDevice = findDevice( pDriver, type ); if( pDevice ) { break; } } } if( !pDevice ) { std::cout << "Did NOT find matching " << to_string(type) <<" device!" << "\n"; return -1; } // Create the context ze_context_handle_t context; ze_context_desc_t context_desc = {}; context_desc.stype = ZE_STRUCTURE_TYPE_CONTEXT_DESC; status = zeContextCreate(pDriver, &context_desc, &context); if(status != ZE_RESULT_SUCCESS) { std::cout << "zeContextCreate Failed with return code: " << to_string(status) << std::endl; exit(1); } // Create an immediate command list for direct submission ze_command_queue_desc_t altdesc = {}; altdesc.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC; ze_command_list_handle_t command_list = {}; status = zeCommandListCreateImmediate(context, pDevice, &altdesc, &command_list); if(status != ZE_RESULT_SUCCESS) { std::cout << "zeCommandListCreateImmediate Failed with return code: " << to_string(status) << std::endl; exit(1); } // Create an event to be signaled by the device ze_event_pool_desc_t ep_desc = {}; ep_desc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; ep_desc.count = 1; ep_desc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; ze_event_desc_t ev_desc = {}; ev_desc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC; ev_desc.signal = ZE_EVENT_SCOPE_FLAG_HOST; ev_desc.wait = ZE_EVENT_SCOPE_FLAG_HOST; ze_event_handle_t event; ze_event_pool_handle_t event_pool; status = zeEventPoolCreate(context, &ep_desc, 1, &pDevice, &event_pool); if(status != ZE_RESULT_SUCCESS) { std::cout << "zeEventPoolCreate Failed with return code: " << to_string(status) << std::endl; exit(1); } status = zeEventCreate(event_pool, &ev_desc, &event); if(status != ZE_RESULT_SUCCESS) { std::cout << "zeEventCreate Failed with return code: " << to_string(status) << std::endl; exit(1); } // signal the event from the device and wait for completion zeCommandListAppendSignalEvent(command_list, event); zeEventHostSynchronize(event, UINT64_MAX ); std::cout << "Congratulations, the device completed execution!\n"; zeContextDestroy(context); zeCommandListDestroy(command_list); zeEventDestroy(event); zeEventPoolDestroy(event_pool); if (tracing_runtime_enabled) { std::cout << "Disable Tracing Layer after init" << std::endl; status = zelDisableTracingLayer(); if(status != ZE_RESULT_SUCCESS) { std::cout << "zelDisableTracingLayer Failed with return code: " << to_string(status) << std::endl; exit(1); } } return 0; }level-zero-1.20.6/scripts/000077500000000000000000000000001475521542100153615ustar00rootroot00000000000000level-zero-1.20.6/scripts/generate_checker.py000077500000000000000000000034211475521542100212140ustar00rootroot00000000000000""" Copyright (C) 2024 Intel Corporation SPDX-License-Identifier: MIT """ import os import re import util import argparse templates_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "templates/checker/") """ generates checker files from the templates """ if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("name", type=str, help="Name of your Validation Layer checker in the form of 'CheckerName'.") parser.add_argument("out_dir", type=str, help="Root of the loader repository.") args = parser.parse_args() name = args.name env_name = name.upper() srcpath = os.path.join(args.out_dir, "source/layers/validation/checkers/") srcpath = os.path.join(srcpath, name) if not os.path.exists(srcpath): os.makedirs(srcpath) print("Generating Checker Template for %s\n" %(name)) loc = 0 template = "template.h.mako" fin = os.path.join(templates_dir, template) filename = "zel_%s_checker.h"%(name) fout = os.path.join(srcpath, filename) print("Generating %s..."%fout) loc += util.makoWrite( fin, fout, name=name) template = "template.cpp.mako" fin = os.path.join(templates_dir, template) filename = "zel_%s_checker.cpp"%(name) fout = os.path.join(srcpath, filename) print("Generating %s..."%fout) loc += util.makoWrite( fin, fout, name=name, env_name=env_name) template = "template.cmake.mako" fin = os.path.join(templates_dir, template) filename = "CMakeLists.txt" fout = os.path.join(srcpath, filename) print("Generating %s..."%fout) loc += util.makoWrite( fin, fout, name=name, TARGET_NAME="${TARGET_NAME}", CMAKE_CURRENT_LIST_DIR="${CMAKE_CURRENT_LIST_DIR}")level-zero-1.20.6/scripts/generate_code.py000066400000000000000000000240271475521542100205240ustar00rootroot00000000000000""" Copyright (C) 2019-2021 Intel Corporation SPDX-License-Identifier: MIT """ import os import re import util templates_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "templates") tracing_templates_dir = os.path.join(templates_dir, "tracing") validation_templates_dir = os.path.join(templates_dir, "validation") """ generates c/c++ files from the specification documents """ def _mako_ddi_cpp(path, namespace, tags, version, specs, meta): template = "ddi.h.mako" fin = os.path.join(templates_dir, template) filename = "%s_ddi.h"%(namespace) fout = os.path.join(path, filename) print("Generating %s..."%fout) return util.makoWrite( fin, fout, ver=version, namespace=namespace, tags=tags, specs=specs, meta=meta) """ generates c/c++ files from the specification documents """ def _mako_lib_cpp(path, namespace, tags, version, specs, meta): loc = 0 template = "libapi.cpp.mako" fin = os.path.join(templates_dir, template) name = "%s_libapi"%(namespace) filename = "%s.cpp"%(name) fout = os.path.join(path, filename) print("Generating %s..."%fout) loc += util.makoWrite( fin, fout, name = name, ver=version, namespace=namespace, tags=tags, specs=specs, meta = meta) template = "libddi.cpp.mako" fin = os.path.join(templates_dir, template) name = "%s_libddi"%(namespace) filename = "%s.cpp"%(name) fout = os.path.join(path, filename) print("Generating %s..."%fout) loc += util.makoWrite( fin, fout, name=name, ver=version, namespace=namespace, tags=tags, specs=specs, meta=meta) return loc """ generates c/c++ files from the specification documents """ def _mako_wrapper_cpp(path, namespace, tags, version, specs, meta): loc = 0 template = "wprapi.cpp.mako" fin = os.path.join(templates_dir, template) name = "%s_wprapi"%(namespace) filename = "%s.cpp"%(name) fout = os.path.join(path, filename) print("Generating %s..."%fout) loc += util.makoWrite( fin, fout, name = name, ver=version, namespace=namespace, tags=tags, specs=specs, meta = meta) return loc """ generates c/c++ files from the specification documents """ def _mako_loader_cpp(path, namespace, tags, version, specs, meta): print("make_loader_cpp path %s namespace %s version %s\n" %(path, namespace, version)) loc = 0 template = "ldrddi.h.mako" fin = os.path.join(templates_dir, template) name = "%s_ldrddi"%(namespace) filename = "%s.h"%(name) fout = os.path.join(path, filename) print("Generating %s..."%fout) loc += util.makoWrite( fin, fout, name=name, ver=version, namespace=namespace, tags=tags, specs=specs, meta=meta) template = "ldrddi.cpp.mako" fin = os.path.join(templates_dir, template) name = "%s_ldrddi"%(namespace) filename = "%s.cpp"%(name) fout = os.path.join(path, filename) print("Generating %s..."%fout) loc += util.makoWrite( fin, fout, name=name, ver=version, namespace=namespace, tags=tags, specs=specs, meta=meta) return loc """ generates c/c++ files from the specification documents """ # 'input_file_name' : (output_dir, output_filename) validation_files = { 'valddi.cpp.mako': ('','valddi.cpp'), 'entry_points.h.mako' : ('common', 'entry_points.h'), 'param.cpp.mako' : ('checkers/parameter_validation', 'parameter_validation.cpp'), 'param.h.mako' : ('checkers/parameter_validation', 'parameter_validation.h'), 'handle_lifetime.h.mako' : ('handle_lifetime_tracking', 'handle_lifetime.h'), 'handle_lifetime.cpp.mako' : ('handle_lifetime_tracking', 'handle_lifetime.cpp') } def _mako_validation_layer_cpp(path, namespace, tags, version, specs, meta): loc = 0 for input_file in validation_files: dstpath = os.path.join(path, "validation") os.makedirs(dstpath, exist_ok=True) template = input_file fin = os.path.join(validation_templates_dir, template) filename = "%s_%s"%(namespace, validation_files[input_file][1]) dstpath = os.path.join(dstpath, validation_files[input_file][0]) fout = os.path.join(dstpath, filename) print("Generating %s..."%fout) loc += util.makoWrite( fin, fout, name=filename, ver=version, namespace=namespace, tags=tags, specs=specs, meta=meta) return loc """ generates c/c++ files from the specification documents """ def _mako_tracing_layer_h(path, namespace, tags, version, specs, meta): dstpath = os.path.join(path, "layers") os.makedirs(dstpath, exist_ok=True) template = "trc_setters.h.mako" fin = os.path.join(tracing_templates_dir, template) name = "zel_tracing_register_cb" filename = "%s.h"%(name) fout = os.path.join(dstpath, filename) print("Generating %s..."%fout) return util.makoWrite( fin, fout, name=name, ver=version, namespace=namespace, tags=tags, specs=specs, meta=meta) """ generates c/c++ files from the specification documents """ def _mako_tracing_layer_cpp(path, namespace, tags, version, specs, meta): dstpath = os.path.join(path, "tracing") os.makedirs(dstpath, exist_ok=True) template = "trcddi.cpp.mako" fin = os.path.join(tracing_templates_dir, template) name = "%s_trcddi"%(namespace) filename = "%s.cpp"%(name) fout = os.path.join(dstpath, filename) print("Generating %s..."%fout) loc = util.makoWrite( fin, fout, name=name, ver=version, namespace=namespace, tags=tags, specs=specs, meta=meta) template = "trc_setters.cpp.mako" fin = os.path.join(tracing_templates_dir, template) name = "ze_tracing_register_cb" filename = "%s.cpp"%(name) fout = os.path.join(dstpath, filename) print("Generating %s..."%fout) loc += util.makoWrite( fin, fout, name=name, ver=version, namespace=namespace, tags=tags, specs=specs, meta=meta) template = "trc_cb_struct.h.mako" fin = os.path.join(tracing_templates_dir, template) name = "ze_tracing_cb_structs" filename = "%s.h"%(name) fout = os.path.join(dstpath, filename) print("Generating %s..."%fout) loc += util.makoWrite( fin, fout, name=name, ver=version, namespace=namespace, tags=tags, specs=specs, meta=meta) return loc """ generates c/c++ files from the specification documents """ def _mako_tracing_lib_cpp(path, namespace, tags, version, specs, meta): dstpath = os.path.join(path, "lib") os.makedirs(dstpath, exist_ok=True) template = "trc_register_cb_libapi.cpp.mako" fin = os.path.join(tracing_templates_dir, template) name = "ze_tracing_register_cb_libapi" filename = "%s.cpp"%(name) fout = os.path.join(dstpath, filename) print("Generating %s..."%fout) return util.makoWrite( fin, fout, name=name, ver=version, namespace=namespace, tags=tags, specs=specs, meta=meta) """ generates c/c++ files from the specification documents """ def _mako_null_driver_cpp(path, namespace, tags, version, specs, meta): dstpath = os.path.join(path, "null") os.makedirs(dstpath, exist_ok=True) template = "nullddi.cpp.mako" fin = os.path.join(templates_dir, template) name = "%s_nullddi"%(namespace) filename = "%s.cpp"%(name) fout = os.path.join(dstpath, filename) print("Generating %s..."%fout) return util.makoWrite( fin, fout, name=name, ver=version, namespace=namespace, tags=tags, specs=specs, meta=meta) """ Entry-point: generates lib code """ def generate_lib(path, section, namespace, tags, version, specs, meta): dstpath = os.path.join(path, "lib") os.makedirs(dstpath, exist_ok=True) loc = 0 loc += _mako_lib_cpp(dstpath, namespace, tags, version, specs, meta) print("Generated %s lines of code.\n"%loc) """ Entry-point: generates loader for level_zero driver """ def generate_loader(path, section, namespace, tags, version, specs, meta): dstpath = os.path.join(path, "loader") os.makedirs(dstpath, exist_ok=True) loc = 0 loc += _mako_loader_cpp(dstpath, namespace, tags, version, specs, meta) print("Generated %s lines of code.\n"%loc) """ Entry-point: generates layers for level_zero driver """ def generate_layers(path, section, namespace, tags, version, specs, meta): print("GL section %s\n"%section) print("GL namespace %s\n"%namespace) layer_dstpath = os.path.join(path, "layers") include_dstpath = os.path.join(path, "../include") os.makedirs(layer_dstpath, exist_ok=True) os.makedirs(include_dstpath, exist_ok=True) loc = 0 loc += _mako_validation_layer_cpp(layer_dstpath, namespace, tags, version, specs, meta) print("VALIDATION Generated %s lines of code.\n"%loc) if section == "core": loc += _mako_tracing_layer_cpp(layer_dstpath, namespace, tags, version, specs, meta) print("TRACING Generated %s lines of code.\n"%loc) loc += _mako_tracing_lib_cpp(path, namespace, tags, version, specs, meta) print("TRACING Generated %s lines of code.\n"%loc) loc += _mako_tracing_layer_h(include_dstpath, namespace, tags, version, specs, meta) print("TRACING header Generated %s lines of code.\n"%loc) """ Entry-point: generates drivers for level_zero driver """ def generate_drivers(path, section, namespace, tags, version, specs, meta): dstpath = os.path.join(path, "drivers") os.makedirs(dstpath, exist_ok=True) loc = 0 loc += _mako_null_driver_cpp(dstpath, namespace, tags, version, specs, meta) print("Generated %s lines of code.\n"%loc) level-zero-1.20.6/scripts/json2src.py000077500000000000000000000052251475521542100175050ustar00rootroot00000000000000#! /usr/bin/env python3 """ Copyright (C) 2019-2021 Intel Corporation SPDX-License-Identifier: MIT """ import argparse import util import generate_code import os, sys import time import json """ helper for adding mutually-exclusive boolean arguments "--name" and "--skip-name" """ def add_argument(parser, name, help, default=False): group = parser.add_mutually_exclusive_group(required=False) group.add_argument("--" + name, dest=name, help="Enable "+help, action="store_true") group.add_argument("--skip-" + name, dest=name, help="Skip "+help, action="store_false") parser.set_defaults(**{name:default}) if __name__ == '__main__': parser = argparse.ArgumentParser() add_argument(parser, "lib", "generation of lib files.", True) add_argument(parser, "loader", "generation of loader files.", True) add_argument(parser, "layers", "generation of validation layer files.", True) add_argument(parser, "drivers", "generation of null driver files.", True) parser.add_argument("--debug", action='store_true', help="dump intermediate data to disk.") parser.add_argument("--sections", type=list, default=None, help="Optional list of sections for which to generate source, default is all") parser.add_argument("--ver", type=str, default="1.0", help="specification version to generate.") parser.add_argument('--api-json', nargs='?', type=argparse.FileType('r'), default=sys.stdin, help="JSON file containing the API specification, by default read from stdin") parser.add_argument("out_dir", type=str, help="Root of the loader repository.") args = parser.parse_args() input = json.loads(args.api_json.read()) start = time.time() srcpath = os.path.join(args.out_dir, "source") for idx, specs in enumerate(input['specs']): config = input['configs'][idx] if args.sections == None or config['name'] in args.sections: if args.lib: generate_code.generate_lib(srcpath, config['name'], config['namespace'], config['tags'], args.ver, specs, input['meta']) if args.loader: generate_code.generate_loader(srcpath, config['name'], config['namespace'], config['tags'], args.ver, specs, input['meta']) if args.layers: generate_code.generate_layers(srcpath, config['name'], config['namespace'], config['tags'], args.ver, specs, input['meta']) if args.drivers: generate_code.generate_drivers(srcpath, config['name'], config['namespace'], config['tags'], args.ver, specs, input['meta']) if args.debug: util.makoFileListWrite("generated.json") print("\nCompleted in %.1f seconds!"%(time.time() - start)) level-zero-1.20.6/scripts/templates/000077500000000000000000000000001475521542100173575ustar00rootroot00000000000000level-zero-1.20.6/scripts/templates/checker/000077500000000000000000000000001475521542100207635ustar00rootroot00000000000000level-zero-1.20.6/scripts/templates/checker/template.cmake.mako000066400000000000000000000002361475521542100245270ustar00rootroot00000000000000target_sources(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/zel_${name}_checker.h ${CMAKE_CURRENT_LIST_DIR}/zel_${name}_checker.cpp )level-zero-1.20.6/scripts/templates/checker/template.cpp.mako000066400000000000000000000022161475521542100242310ustar00rootroot00000000000000/* * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_${name}_checker.cpp * */ #include "zel_${name}_checker.h" namespace validation_layer { class ${name}Checker ${name}_checker; ${name}Checker::${name}Checker() { enable${name} = getenv_tobool( "ZEL_ENABLE_${env_name}_CHECKER" ); if(enable${name}) { ${name}Checker::ZE${name}Checker *zeChecker = new ${name}Checker::ZE${name}Checker; ${name}Checker::ZES${name}Checker *zesChecker = new ${name}Checker::ZES${name}Checker; ${name}Checker::ZET${name}Checker *zetChecker = new ${name}Checker::ZET${name}Checker; ${name}_checker.zeValidation = zeChecker; ${name}_checker.zetValidation = zetChecker; ${name}_checker.zesValidation = zesChecker; validation_layer::context.validationHandlers.push_back(&${name}_checker); } } ${name}Checker::~${name}Checker() { if(enable${name}) { delete ${name}_checker.zeValidation; delete ${name}_checker.zetValidation; delete ${name}_checker.zesValidation; } } }level-zero-1.20.6/scripts/templates/checker/template.h.mako000066400000000000000000000012701475521542100236750ustar00rootroot00000000000000/* * * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_${name}_checker.h * */ #pragma once #include #include "ze_api.h" #include "ze_validation_layer.h" namespace validation_layer { class __zedlllocal ${name}Checker : public validationChecker{ public: ${name}Checker(); ~${name}Checker(); class ZE${name}Checker : public ZEValidationEntryPoints {}; class ZES${name}Checker : public ZESValidationEntryPoints {}; class ZET${name}Checker : public ZETValidationEntryPoints {}; bool enable${name} = false; }; extern class ${name}Checker ${name}_checker; }level-zero-1.20.6/scripts/templates/ddi.h.mako000066400000000000000000000053061475521542100212220ustar00rootroot00000000000000<% import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${n}_ddi.h * */ #ifndef _${N}_DDI_H #define _${N}_DDI_H #if defined(__cplusplus) #pragma once #endif #include "${n}_api.h" #if defined(__cplusplus) extern "C" { #endif %for tbl in th.get_pfntables(specs, meta, n, tags): %for obj in tbl['functions']: /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for ${th.make_func_name(n, tags, obj)} %if 'condition' in obj: #if ${th.subt(n, tags, obj['condition'])} %endif typedef ${x}_result_t (${X}_APICALL *${th.make_pfn_type(n, tags, obj)})( %for line in th.make_param_lines(n, tags, obj, format=["type", "delim"]): ${line} %endfor ); %if 'condition' in obj: #endif // ${th.subt(n, tags, obj['condition'])} %endif %endfor /////////////////////////////////////////////////////////////////////////////// /// @brief Table of ${tbl['name']} functions pointers typedef struct _${tbl['type']} { %for obj in tbl['functions']: %if 'condition' in obj: #if ${th.subt(n, tags, obj['condition'])} %endif ${th.append_ws(th.make_pfn_type(n, tags, obj), 59)} ${th.make_pfn_name(n, tags, obj)}; %if 'condition' in obj: #else ${th.append_ws("void*", 59)} ${th.make_pfn_name(n, tags, obj)}; #endif // ${th.subt(n, tags, obj['condition'])} %endif %endfor } ${tbl['type']}; /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ${tbl['name']} table /// with current process' addresses /// /// @returns /// - ::${X}_RESULT_SUCCESS /// - ::${X}_RESULT_ERROR_UNINITIALIZED /// - ::${X}_RESULT_ERROR_INVALID_NULL_POINTER /// - ::${X}_RESULT_ERROR_UNSUPPORTED_VERSION ${X}_DLLEXPORT ${x}_result_t ${X}_APICALL ${tbl['export']['name']}( %for line in th.make_param_lines(n, tags, tbl['export']): ${line} %endfor ); /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for ${tbl['export']['name']} typedef ${x}_result_t (${X}_APICALL *${tbl['pfn']})( %for line in th.make_param_lines(n, tags, tbl['export'], format=["type", "delim"]): ${line} %endfor ); %endfor /////////////////////////////////////////////////////////////////////////////// /// @brief Container for all DDI tables typedef struct _${n}_dditable_t { %for tbl in th.get_pfntables(specs, meta, n, tags): ${th.append_ws(tbl['type'], 35)} ${tbl['name']}; %endfor } ${n}_dditable_t; #if defined(__cplusplus) } // extern "C" #endif #endif // _${N}_DDI_Hlevel-zero-1.20.6/scripts/templates/helper.py000066400000000000000000002006361475521542100212170ustar00rootroot00000000000000""" Copyright (C) 2019-2021 Intel Corporation SPDX-License-Identifier: MIT """ import re """ Extracts traits from a spec object """ class obj_traits: @staticmethod def is_function(obj): try: return True if re.match(r"function", obj['type']) else False except: return False @staticmethod def is_function_with_input_handles(obj): try: if re.match(r"function", obj['type']): for param in obj['params']: if param_traits.is_input(param) and type_traits.is_handle(param['type']): return True return False except: return False @staticmethod def is_class(obj): try: return True if re.match(r"class", obj['type']) else False except: return False @staticmethod def is_experimental(obj): try: return True if re.search("Exp[0-9]*$", obj['name']) else False except: return False @staticmethod def class_name(obj): try: return obj['class'] except: return None """ Extracts traits from a class name """ class class_traits: @staticmethod def is_global(name, tags): try: return True if name in tags else False except: return False @staticmethod def is_namespace(name, namespace, tags): try: return tags[name] == namespace except: return False @staticmethod def is_singleton(item): try: return "singleton" == item['attribute'] except: return False @staticmethod def get_handle(item, meta): try: return meta['class'][item['name']]['handle'][0] except: return "" """ Extracts traits from a type name """ class type_traits: RE_HANDLE = r"(.*)handle_t" RE_IPC = r"(.*)ipc(.*)handle_t" RE_POINTER = r"(.*\w+)\*+" RE_DESC = r"(.*)desc_t.*" RE_PROPS = r"(.*)properties_t.*" RE_FLAGS = r"(.*)flags_t" RE_COUNTERS = r"(.*)counters_t" RE_PORT_CONFIG = r"(.*)port_config_t" RE_FAN_CONFIG = r"(.*)fan_config_t" RE_RAS_CONFIG = r"(.*)ras_config_t" RE_TEMP_CONFIG = r"(.*)temp_config_t" RE_DEVICE_STATE = r"(.*)device_state_t" RE_PROCESS_STATE = r"(.*)process_state_t" RE_PCI_STATE = r"(.*)pci_state_t" RE_FABRIC_PORT_STATE = r"(.*)fabric_port_state_t" RE_FREQ_STATE = r"(.*)freq_state_t" RE_LED_STATE = r"(.*)led_state_t" RE_MEM_STATE = r"(.*)mem_state_t" RE_PSU_STATE = r"(.*)psu_state_t" RE_RAS_STATE = r"(.*)ras_state_t" RE_CAPABILITIES = r"(.*)capabilities_t" RE_PROPS_EXP = r"(.*)properties_exp_t" @staticmethod def base(name): return _remove_const_ptr(name) @classmethod def is_handle(cls, name): try: return True if re.match(cls.RE_HANDLE, name) else False except: return False @classmethod def is_ipc_handle(cls, name): try: return True if re.match(cls.RE_IPC, name) else False except: return False @staticmethod def is_class_handle(name, meta): try: name = _remove_const_ptr(name) return len(meta['handle'][name]['class']) > 0 except: return False @classmethod def is_pointer(cls, name): try: return True if re.match(cls.RE_POINTER, name) else False except: return False @classmethod def is_descriptor(cls, name): try: return True if re.match(cls.RE_DESC, name) else False except: return False @classmethod def is_properties(cls, name): try: return True if re.match(cls.RE_PROPS, name) else False except: return False @classmethod def is_counters(cls, name): try: return True if re.match(cls.RE_COUNTERS, name) else False except: return False @classmethod def is_port_config(cls, name): try: return True if re.match(cls.RE_PORT_CONFIG, name) else False except: return False @classmethod def is_fan_config(cls, name): try: return True if re.match(cls.RE_FAN_CONFIG, name) else False except: return False @classmethod def is_ras_config(cls, name): try: return True if re.match(cls.RE_RAS_CONFIG, name) else False except: return False @classmethod def is_temp_config(cls, name): try: return True if re.match(cls.RE_TEMP_CONFIG, name) else False except: return False @classmethod def is_device_state(cls, name): try: return True if re.match(cls.RE_DEVICE_STATE, name) else False except: return False @classmethod def is_process_state(cls, name): try: return True if re.match(cls.RE_PROCESS_STATE, name) else False except: return False @classmethod def is_pci_state(cls, name): try: return True if re.match(cls.RE_PCI_STATE, name) else False except: return False @classmethod def is_fabric_port_state(cls, name): try: return True if re.match(cls.RE_FABRIC_PORT_STATE, name) else False except: return False @classmethod def is_freq_state(cls, name): try: return True if re.match(cls.RE_FREQ_STATE, name) else False except: return False @classmethod def is_led_state(cls, name): try: return True if re.match(cls.RE_LED_STATE, name) else False except: return False @classmethod def is_mem_state(cls, name): try: return True if re.match(cls.RE_MEM_STATE, name) else False except: return False @classmethod def is_psu_state(cls, name): try: return True if re.match(cls.RE_PSU_STATE, name) else False except: return False @classmethod def is_ras_state(cls, name): try: return True if re.match(cls.RE_RAS_STATE, name) else False except: return False @classmethod def is_properties_exp(cls, name): try: return True if re.match(cls.RE_PROPS_EXP, name) else False except: return False @classmethod def is_capabilities(cls, name): try: return True if re.match(cls.RE_CAPABILITIES, name) else False except: return False @classmethod def is_flags(cls, name): try: return True if re.match(cls.RE_FLAGS, name) else False except: return False @staticmethod def is_known(name, meta): try: name = _remove_const_ptr(name) for group in meta: if name in meta[group]: return True return False except: return False @staticmethod def is_enum(name, meta): try: name = _remove_const_ptr(name) if name in meta['enum']: return True return False except: return False @staticmethod def is_struct(name, meta): try: name = _remove_const_ptr(name) if name in meta['struct']: return True return False except: return False @staticmethod def find_class_name(name, meta): try: name = _remove_const_ptr(name) for group in meta: if name in meta[group]: return meta[group][name]['class'] return None except: return None """ Extracts traits from a value name """ class value_traits: RE_VERSION = r"\$X_MAKE_VERSION\(\s*(\d+)\s*\,\s*(\d+)\s*\)" RE_BIT = r".*BIT\(\s*(.*)\s*\)" RE_HEX = r"0x\w+" RE_MACRO = r"(\$\w+)\(.*\)" RE_ARRAY = r"(.*)\[(.*)\]" @classmethod def is_ver(cls, name): try: return True if re.match(cls.RE_VERSION, name) else False except: return False @classmethod def get_major_ver(cls, name): try: return int(re.sub(cls.RE_VERSION, r"\1", name)) except: return 0 @classmethod def get_minor_ver(cls, name): try: return int(re.sub(cls.RE_VERSION, r"\2", name)) except: return 0 @classmethod def is_bit(cls, name): try: return True if re.match(cls.RE_BIT, name) else False except: return False @classmethod def get_bit_count(cls, name): try: return int(re.sub(cls.RE_BIT, r"\1", name)) except: return 0 @classmethod def is_hex(cls, name): try: return True if re.match(cls.RE_HEX, name) else False except: return False @classmethod def is_macro(cls, name, meta): try: name = cls.get_macro_name(name) name = cls.get_array_length(name) return True if name in meta['macro'] else False except: return False @classmethod def get_macro_name(cls, name): try: return re.sub(cls.RE_MACRO, r"\1", name) # 'NAME()' -> 'NAME' except: return name @classmethod def is_array(cls, name): try: return True if re.match(cls.RE_ARRAY, name) else False except: return False @classmethod def get_array_name(cls, name): try: return re.sub(cls.RE_ARRAY, r"\1", name) # 'name[len]' -> 'name' except: return name @classmethod def get_array_length(cls, name): try: return re.sub(cls.RE_ARRAY, r"\2", name) # 'name[len]' -> 'len' except: return name @classmethod def find_enum_name(cls, name, meta): try: name = cls.get_array_name(name) # if the value is an etor, return the name of the enum for e in meta['enum']: if name in meta['enum'][e]['etors']: return e return None except: return None """ Extracts traits from a parameter object """ class param_traits: RE_MBZ = r".*\[mbz\].*" RE_IN = r"^\[in\].*" RE_OUT = r"^\[out\].*" RE_INOUT = r"^\[in,out\].*" RE_OPTIONAL = r".*\[optional\].*" RE_RANGE = r".*\[range\((.+),\s*(.+)\)\][\S\s]*" RE_RELEASE = r".*\[release\].*" @classmethod def is_mbz(cls, item): try: return True if re.match(cls.RE_MBZ, item['desc']) else False except: return False @classmethod def is_input(cls, item): try: return True if re.match(cls.RE_IN, item['desc']) else False except: return False @classmethod def is_output(cls, item): try: return True if re.match(cls.RE_OUT, item['desc']) else False except: return False @classmethod def is_inoutput(cls, item): try: return True if re.match(cls.RE_INOUT, item['desc']) else False except: return False @classmethod def is_optional(cls, item): try: return True if re.match(cls.RE_OPTIONAL, item['desc']) else False except: return False @classmethod def is_range(cls, item): try: return True if re.match(cls.RE_RANGE, item['desc']) else False except: return False @classmethod def range_start(cls, item): try: return re.sub(cls.RE_RANGE, r"\1", item['desc']) except: return None @classmethod def range_end(cls, item): try: return re.sub(cls.RE_RANGE, r"\2", item['desc']) except: return None @classmethod def is_release(cls, item): try: return True if re.match(cls.RE_RELEASE, item['desc']) else False except: return False """ Extracts traits from a function object """ class function_traits: @staticmethod def is_static(item): try: return True if re.match(r"static", item['decl']) else False except: return False @staticmethod def is_global(item, tags): try: return True if item['class'] in tags else False except: return False """ Public: substitues each tag['key'] with tag['value'] if cpp, then remove each tag['key'] if matches namespace if comment, then insert doxygen '::' notation at beginning (for autogen links) """ def subt(namespace, tags, string, comment=False, cpp=False, remove_namespace=False): for key, value in tags.items(): if comment or not cpp: # generating c names string = re.sub(r"-%s"%re.escape(key), "-"+value, string) # hack for compile options repl = "::"+value if comment and "$OneApi" != key else value # replace tag; e.g., "$x" -> "xe" string = re.sub(re.escape(key), repl, string) string = re.sub(re.escape(key.upper()), repl.upper(), string) elif re.match(namespace, value): # generating c++ names and tag matches current namespace repl = "" # remove tags; e.g., "$x" -> "" string = re.sub(r"%s_?"%re.escape(key), repl, string) string = re.sub(r"%s_?"%re.escape(key.upper()), repl.upper(), string) elif remove_namespace: # generating c++ names and tags do _not_ match current namespace repl = "" # remove namespace; e.g. "$x" -> "" string = re.sub(r"%s_?"%re.escape(key), repl, string) string = re.sub(r"%s_?"%re.escape(key.upper()), repl.upper(), string) else: # generating c++ names and tags do _not_ match current namespace repl = value+"::" # add namespace; e.g. "$x" -> "xe::" string = re.sub(r"%s_?"%re.escape(key), repl, string) string = re.sub(r"%s_?"%re.escape(key.upper()), repl.upper(), string) return string """ Public: appends whitespace (in multiples of 4) to the end of the string, until len(string) > count """ def append_ws(string, count): while len(string) > count: count = count + 4 string = '{str: <{width}}'.format(str=string, width=count) return string """ Public: split the line of text into a list of strings, where each length of each entry is less-than count """ def split_line(line, ch_count): if not line: return [""] RE_NEWLINE = r"(.*)\n(.*)" words = line.split(" ") lines = [] word_list = [] for word in words: if re.match(RE_NEWLINE, word): prologue = re.sub(RE_NEWLINE,r"\1",word) epilogue = re.sub(RE_NEWLINE,r"\2",word) word_list.append(prologue) lines.append(" ".join(word_list)) word_list = [] if len(epilogue): word_list.append(epilogue) elif sum(map(len, word_list)) + len(word_list) + len(word) <= ch_count: word_list.append(word) else: lines.append(" ".join(word_list)) word_list = [word] if len(word_list): lines.append(" ".join(word_list)) return lines """ Private: converts string from camelCase to snake_case """ def _camel_to_snake(name): str = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) str = re.sub('([a-z0-9])([A-Z])', r'\1_\2', str).lower() return str """ Public: removes items from the list with the key and whose value do not match filter """ def filter_items(lst, key, filter): flst = [] for item in lst: if key in item: if filter == item[key]: flst.append(item) return flst """ Public: returns a list of items with key from a list of dict """ def extract_items(lst, key): klst = [] for item in lst: if key in item: klst.append(item[key]) return klst """ Public: returns a list of all objects of type in all specs """ def extract_objs(specs, value): objs = [] for s in specs: for obj in s['objects']: if re.match(value, obj['type']): objs.append(obj) return objs """ Private: removes 'const' from c++ type """ def _remove_const(name): name = name.split(" ")[-1] return name """ Private: removes '*' from c++ type """ def _remove_ptr(name, last=True): if last: name = re.sub(r"(.*)\*$", r"\1", name) # removes only last '*' else: name = re.sub(r"\*", "", name) # removes all '*' return name """ Private: removes 'const' and '*' from c++ type """ def _remove_const_ptr(name): name = _remove_ptr(_remove_const(name)) return name """ Private: adds class name to type e.g., "const type*" -> "const cname::type*" """ def _add_class(name, cname): words = name.split(" ") words[-1] = "%s::%s"%(cname, words[-1]) return " ".join(words) """ Private: removes class name from type e.g., "const cls_type*" -> "const type*" """ def _remove_class(name, cname, upper_case=False): if cname: cname = _camel_to_snake(cname) if upper_case: cname = cname.upper() RE_CLS = r"(.*)(%s_)(\w+)"%cname # remove "cls_" part if re.match(RE_CLS, name): name = re.sub(RE_CLS, r"\1\3", name) return name """ Public: returns c/c++ name of macro """ def make_macro_name(namespace, tags, obj, params=True): if params: return subt(namespace, tags, obj['name']) else: name = re.sub(r"(.*)\(.*", r"\1", obj['name']) # remove '()' part return subt(namespace, tags, name) """ Public: returns c/c++ name of enums, structs, unions, typedefs... """ def make_type_name(namespace, tags, obj, cpp=False): name = subt(namespace, tags, obj['name'], cpp=cpp) # if c++, remove class part of name if cpp and 'class' in obj: cname = subt(namespace, tags, obj['class'], cpp=cpp) name = _remove_class(name, cname) return name """ Public: returns c/c++ name of enums... """ def make_enum_name(namespace, tags, obj, cpp=False): name = make_type_name(namespace, tags, obj, cpp) if type_traits.is_flags(obj['name']): name = re.sub(r"flags", r"flag", name) return name """ Public: returns c/c++ name of etor """ def make_etor_name(namespace, tags, enum, etor, cpp=False, py=False, meta=None): if cpp or py: # if c++, remove the verbose enum part of the etor if type_traits.is_flags(enum) and not py: # e.g., "CLS_ENUM_NAME_ETOR_NAME" -> "ENUM_NAME_ETOR_NAME" cname = type_traits.find_class_name(enum, meta) cname = subt(namespace, tags, cname, cpp=cpp) name = subt(namespace, tags, etor, cpp=cpp) name = _remove_class(name, cname, upper_case=True) else: # e.g., "ENUM_NAME_ETOR_NAME" -> "ETOR_NAME" if type_traits.is_flags(enum): prefix = re.sub(r"(\w+)_flags_t", r"\1_flag", subt(namespace, tags, enum, cpp=cpp)).upper() else: prefix = re.sub(r"(\w+)_t", r"\1", subt(namespace, tags, enum, cpp=cpp)).upper() name = re.sub(r"%s_(\w+)"%prefix, r"\1", subt(namespace, tags, etor, cpp=cpp)) name = re.sub(r"^(\d+\w*)", r"_\1", name) else: name = subt(namespace, tags, etor, cpp=cpp) return name """ Private: returns c/c++ name of value """ def _get_value_name(namespace, tags, value, cpp, meta, is_array_size=False, cbase=None): if cpp: if value_traits.is_macro(value, meta): value = subt(namespace, tags, value) else: name = value_traits.find_enum_name(value, meta) if name: # e.g., "ETOR_NAME" -> "ENUM_NAME::ETOR_NAME" enum = subt(namespace, tags, name, cpp=cpp) # e.g., "CLS_ENUM_NAME" -> "ENUM_NAME" cname = type_traits.find_class_name(name, meta) cname = subt(namespace, tags, cname, cpp=cpp) enum = _remove_class(enum, cname) if cname and cbase: cbase = subt(namespace, tags, cbase, cpp=cpp) if cbase == cname: enum = _remove_class(enum, cname) else: enum = "%s::%s"%(cname, enum) if is_array_size: value = "static_cast(%s::%s)"%(enum, make_etor_name(namespace, tags, name, value, cpp=cpp, meta=meta)) else: value = "%s::%s"%(enum, make_etor_name(namespace, tags, name, value, cpp=cpp, meta=meta)) else: value = subt(namespace, tags, value, cpp=cpp) else: value = subt(namespace, tags, value, cpp=cpp) return value """ Public: returns a list of strings for declaring each enumerator in an enumeration c++ format: "ETOR_NAME = VALUE, ///< DESCRIPTION" python format: "ETOR_NAME = VALUE, ## DESCRIPTION" """ def make_etor_lines(namespace, tags, obj, cpp=False, py=False, meta=None): lines = [] for item in obj['etors']: name = make_etor_name(namespace, tags, obj['name'], item['name'], cpp, py, meta) if 'value' in item: delim = "," if not py else "" value = _get_value_name(namespace, tags, item['value'], cpp, meta, cbase=obj_traits.class_name(obj)) prologue = "%s = %s%s"%(name, value, delim) elif py: prologue = "%s = auto()"%(name) else: prologue = "%s,"%(name) comment_style = "##" if py else "///<" for line in split_line(subt(namespace, tags, item['desc'], True, cpp), 70): lines.append("%s%s %s"%(append_ws(prologue, 48), comment_style, line)) prologue = "" if cpp and not type_traits.is_flags(obj['name']): lines.append("FORCE_UINT32 = 0x7fffffff") elif not py: lines.append("%sFORCE_UINT32 = 0x7fffffff"%make_enum_name(namespace, tags, obj, cpp)[:-1].upper()) return lines """ Public: determines whether the enumeration represents a bitfield """ def is_enum_bitfield(obj): for item in obj['etors']: if 'value' in item and value_traits.is_bit(item['value']): return True return False """ Public: returns c/c++ name of any type """ def get_type_name(namespace, tags, obj, item, cpp=False, meta=None, handle_to_class=True): name = subt(namespace, tags, item, cpp=cpp) if cpp: cname = type_traits.find_class_name(item, meta) if cname: is_global = class_traits.is_global(cname, tags) is_namespace = class_traits.is_namespace(cname, namespace, tags) # cname == namespace? e.g., cname == "$x" is_handle = type_traits.is_handle(item) is_inscope = False if obj_traits.is_class(obj): # if the obj _is_ a class is_inscope = cname == obj['name'] # then is the item's class this obj? elif not is_global: # else if the obj belongs to a class is_inscope = cname == obj_traits.class_name(obj) # then is the item's class the same as the obj? cname_no_namespace = subt(namespace, tags, cname, cpp=cpp, remove_namespace=True) cname = subt(namespace, tags, cname, cpp=cpp) # remove tags from class name if not (is_global or is_namespace or is_handle or is_inscope): # need to prepend the class name to the type after removing namespace from the type name = subt(namespace, tags, item, cpp=cpp, remove_namespace=True) name = _remove_class(name, cname_no_namespace) name = _add_class(name, cname) elif handle_to_class and is_handle and not obj_traits.is_class(obj): # convert handles to class pointers name = re.sub(r"(const\s*)?(\w*:?:?\w+)(\**)", r"\1%s*\3"%cname, name) # e.g., const name* -> const cname** if not is_handle: # remove the verbose class part from the type name name = _remove_class(name, cname) return name """ Private: returns c/c++ name of any type """ def _get_type_name(namespace, tags, obj, item, cpp=False, meta=None, handle_to_class=True): return get_type_name(namespace, tags, obj, item['type'], cpp, meta, handle_to_class) """ Private: returns python c_type name of any type """ def get_ctype_name(namespace, tags, item): name = subt(namespace, tags, item['type']) name = _remove_const(name) name = re.sub(r"void\*", "c_void_p", name) name = re.sub(r"char\*", "c_char_p", name) name = re.sub(r"uint8_t", "c_ubyte", name) name = re.sub(r"uint16_t", "c_ushort", name) name = re.sub(r"uint32_t", "c_ulong", name) name = re.sub(r"uint64_t", "c_ulonglong", name) name = re.sub(r"size_t", "c_size_t", name) name = re.sub(r"float", "c_float", name) name = re.sub(r"double", "c_double", name) name = re.sub(r"\bchar", "c_char", name) name = re.sub(r"\bint", "c_int", name) if type_traits.is_pointer(name): name = _remove_ptr(name) name = "POINTER(%s)"%name elif 'name' in item and value_traits.is_array(item['name']): length = subt(namespace, tags, value_traits.get_array_length(item['name'])) name = "%s * %s"%(name, length) return name """ Public: returns c/c++ name of member of struct/class """ def make_member_name(namespace, tags, item, prefix="", cpp=False, meta=None, remove_array=False, cbase=None): if cpp and value_traits.is_macro(item['name'], meta): name = subt(namespace, tags, item['name']) elif cpp and value_traits.is_array(item['name']): name = value_traits.get_array_name(item['name']) name = subt(namespace, tags, name) alength = value_traits.get_array_length(item['name']) alength = _get_value_name(namespace, tags, alength, cpp, meta, is_array_size=True, cbase=cbase) name = "%s[%s]"%(name, alength) else: name = subt(namespace, tags, prefix+item['name'], cpp=cpp) if remove_array: name = value_traits.get_array_name(name) return name """ Public: returns a list of strings for each member of a structure or class c++ format: "TYPE NAME = INIT, ///< DESCRIPTION" python format: "("NAME", TYPE)" ## DESCRIPTION" """ def make_member_lines(namespace, tags, obj, prefix="", cpp=False, py=False, meta=None): lines = [] if 'members' not in obj: return lines for i, item in enumerate(obj['members']): name = make_member_name(namespace, tags, item, prefix, cpp, meta, remove_array=py, cbase=obj_traits.class_name(obj)) if py: tname = get_ctype_name(namespace, tags, item) else: tname = _get_type_name(namespace, tags, obj, item, cpp, meta) if cpp and 'init' in item: value = _get_value_name(namespace, tags, item['init'], cpp, meta, cbase=obj_traits.class_name(obj)) prologue = "%s %s = %s;"%(tname, name, value) elif py: delim = "," if i < (len(obj['members'])-1) else "" prologue = "(\"%s\", %s)%s"%(name, tname, delim) else: prologue = "%s %s;"%(tname, name) comment_style = "##" if py else "///<" ws_count = 64 if py else 48 for line in split_line(subt(namespace, tags, item['desc'], True, cpp), 70): lines.append("%s%s %s"%(append_ws(prologue, ws_count), comment_style, line)) prologue = "" return lines """ Public: returns a list of c++ strings for each member of a class format: "auto getNAME( void ) const { return MEMBER; }" """ def make_member_function_lines(namespace, tags, obj, prefix=""): lines = [] if 'members' not in obj: return lines for item in obj['members']: name = subt(namespace, tags, item['name'], cpp=True) is_pointer = type_traits.is_pointer(item['type']) if is_pointer and re.match(r"p\w+", name): # if this is a pointer and starts with 'p', fname = name[1:].title() # then remove the 'p' part of the name else: fname = name.title() lines.append("auto get%s( void ) const { return %s; }"%(fname, prefix+name)) return lines """ Private: returns the list of parameters, filtering based on desc tags """ def _filter_param_list(params, filters1=["[in]", "[in,out]", "[out]"], filters2=[""]): lst = [] for p in params: for f1 in filters1: if f1 in p['desc']: for f2 in filters2: if f2 in p['desc']: lst.append(p) break break return lst """ Private: returns c/c++ name of parameter """ def _get_param_name(namespace, tags, item, cpp): name = subt(namespace, tags, item['name'], cpp=cpp) if cpp and type_traits.is_handle(item['type']): name = re.sub(r"\bh([A-Z]\w+)", r"p\1", name) # change "hName" to "pName" name = re.sub(r"\bph([A-Z]\w+)", r"pp\1", name) # change "phName" to "ppName" if param_traits.is_output(item) and not param_traits.is_optional(item): name = re.sub(r"p(p[A-Z]\w+)", r"\1", name) #change ppName to pName return name def get_func_descs(namespace, tags, obj): descs = [] for item in obj['params']: if ( type_traits.is_descriptor(item['type']) or type_traits.is_properties(item['type']) or type_traits.is_counters(item['type']) or type_traits.is_port_config(item['type']) or type_traits.is_fan_config(item['type']) or type_traits.is_ras_config(item['type']) or type_traits.is_temp_config(item['type']) or type_traits.is_device_state(item['type']) or type_traits.is_process_state(item['type']) or type_traits.is_pci_state(item['type']) or type_traits.is_fabric_port_state(item['type']) or type_traits.is_freq_state(item['type']) or type_traits.is_led_state(item['type']) or type_traits.is_mem_state(item['type']) or type_traits.is_psu_state(item['type']) or type_traits.is_ras_state(item['type']) or type_traits.is_capabilities(item['type']) or type_traits.is_properties_exp(item['type'])): name = _get_param_name(namespace, tags, item, False) descs.append(name) return descs """ Public: returns a list of c++ strings for each parameter of a function format: "TYPE NAME = INIT, ///< DESCRIPTION" """ def make_param_lines(namespace, tags, obj, cpp=False, py=False, decl=False, meta=None, format=["type", "name", "init", "delim", "desc"], delim=","): lines = [] if cpp: is_static = function_traits.is_static(obj) is_global = function_traits.is_global(obj, tags) params = obj['params'] if is_static or is_global else obj['params'][1:] params = _filter_param_list(params, ["[in]", "[in,out]"]) + _filter_param_list(params, ["[out]"], ["[optional"]) else: params = obj['params'] for i, item in enumerate(params): name = _get_param_name(namespace, tags, item, cpp=cpp) if py: tname = get_ctype_name(namespace, tags, item) else: tname = _get_type_name(namespace, tags, obj, item, cpp, meta) init = "" local = "Local" if type_traits.is_pointer(item['type']) and type_traits.is_handle(item['type']) and param_traits.is_input(item) else "" if cpp: if decl and param_traits.is_optional(item): is_pointer = type_traits.is_pointer(item['type']) is_handle = type_traits.is_handle(item['type']) if is_pointer or is_handle: init += "= nullptr" else: init += "= 0" words = [] if "local" in format: name += local if "type*" in format: words.append(tname+"*") name = "p"+name elif "type" in format: words.append(tname) if "name" in format: words.append(name) if "init" in format and len(init) > 0: words.append(init) prologue = " ".join(words) if "delim" in format: if i < len(params)-1: prologue += delim if "desc" in format: desc = item['desc'] if cpp: desc = re.sub(r"handle of", r"pointer to", desc) for line in split_line(subt(namespace, tags, desc, True, cpp), 70): lines.append("%s///< %s"%(append_ws(prologue, 48), line)) prologue = "" else: lines.append(prologue) if "type" in format and len(lines) == 0 and not py: lines = ["void"] return lines """ Public: returns a string of c++ template parameters format: "TPARAM0, TPARAM1" """ def make_tparams_line(namespace, tags, obj): line = ", ".join(obj['tparams']) return subt(namespace, tags, line, cpp=True) """ Public: returns True if ctor has parameters """ def has_ctor_params(obj): params = _filter_param_list(obj['members'] if 'members' in obj else [], ["[in]"]) return len(params) > 0 """ Public: returns a list of c++ strings for ctor parameters of members format: "TYPE NAME, ///< DESCRIPTION" """ def make_ctor_param_lines(namespace, tags, obj, meta=None, format=["type", "name", "delim", "desc"]): lines = [] params = _filter_param_list(obj['members'] if 'members' in obj else [], ["[in]"]) for i, item in enumerate(params): name = subt(namespace, tags, item['name']) tname = _get_type_name(namespace, tags, obj, item, True, meta) if type_traits.is_descriptor(tname): tname = "const %s*"%tname # e.g., "xe_event_desc_t*" -> "const desc_t*" words = [] if "type" in format: words.append(tname) if "name" in format: words.append(name) prologue = " ".join(words) if "delim" in format: if i < len(params)-1: prologue += "," if "desc" in format: for line in split_line(subt(namespace, tags, item['desc'], True), 70): lines.append("%s///< %s"%(append_ws(prologue, 48), line)) prologue = "" else: lines.append(prologue) if "type" in format and len(lines) == 0: lines = ["void"] return lines """ Public: returns a list of c++ strings for initializing members from ctor parameters of members format: "MEMBER( NAME )," """ def make_ctor_param_init_lines(namespace, tags, obj, prefix="", meta=None): lines = [] params = _filter_param_list(obj['members'] if 'members' in obj else [], ["[in]"]) for i, item in enumerate(params): name = subt(namespace, tags, item['name']) tname = _get_type_name(namespace, tags, obj, item, cpp=True, meta=meta) member = prefix+name if type_traits.is_descriptor(tname): name = "( %s ) ? *%s : desc_t{}"%(name, name) delim = "," if i < len(params)-1 else "" lines.append("%s( %s )%s"%(member, name, delim)) return lines """ Private: returns c/c++ name of local variable from parameter name """ def _get_local_name(name): name = re.sub(r"\bp([A-Z]\w+)", r"\1", name) # change pName to Name name = re.sub(r"\bp([hA-Z]\w+)", r"\1", name) # change phName to hName name = re.sub(r"\bp(p[A-Z]\w+)", r"\1", name) # change ppName to pName name = name[0].lower() + name[1:] # change Name to name return name """ Public: returns a list of dict for declaring local variables in c++ wrapper """ def make_wrapper_params(namespace, tags, obj, meta, specs): params = [] returns = [] numSelf = 0 # if the input parameter is a class, # then need to use getHandle # if the input parameter is an array of classes # then need to create a std::vector of handles # if the output parameter is a class, # then need to create a local handle then call the ctor # if the output parameter is an array of classes # then need to create a std::vector to receive handles(s) then call the ctor for each # if the parameter is an input and the cpp type is different than the c type, # then need to use static_cast or reinterpret_cast # if the parameter is an output # then need to create a local variable is_static = function_traits.is_static(obj) is_global = function_traits.is_global(obj, tags) for i, item in enumerate(obj['params']): c_name = _get_param_name(namespace, tags, item, cpp=False) cpp_name = _get_param_name(namespace, tags, item, cpp=True) c_tname = _get_type_name(namespace, tags, obj, item, cpp=False, meta=meta) cpp_tname = _get_type_name(namespace, tags, obj, item, cpp=True, meta=meta, handle_to_class=False) cpp_cname = _get_type_name(namespace, tags, obj, item, cpp=True, meta=meta) local_name = _get_local_name(c_name) if param_traits.is_range(item): range_start = param_traits.range_start(item) range_end = param_traits.range_end(item) if type_traits.is_class_handle(item['type'], meta): if param_traits.is_output(item) or param_traits.is_inoutput(item): if param_traits.is_optional(item): params.append({ 'local': local_name, 'ctype': _remove_const_ptr(c_tname), 'cpptype': _remove_const_ptr(cpp_tname), 'range': (range_start, range_end), 'optional': True, 'arg': "%s.data()"%(local_name), 'class': _remove_ptr(cpp_cname, False), 'ctor': _make_ctor(namespace, tags, item, obj, meta, specs), 'name': cpp_name }) else: params.append({ 'local': local_name, 'ctype': _remove_const_ptr(c_tname), 'cpptype': _remove_const_ptr(cpp_tname), 'range': (range_start, range_end), 'optional': False, 'arg': "%s.data()"%(local_name), 'class': _remove_ptr(cpp_cname, False), 'ctor': _make_ctor(namespace, tags, item, obj, meta, specs), 'name': cpp_name }) if param_traits.is_output(item): returns.append(cpp_name) elif param_traits.is_optional(item): params.append({ 'local': local_name, 'ctype': _remove_const_ptr(c_tname), 'cpptype': _remove_const_ptr(cpp_tname), 'range': (range_start, range_end), 'init': cpp_name, 'optional': True, 'arg': "%s.data()"%(local_name) }) else: params.append({ 'local': local_name, 'ctype': _remove_const_ptr(c_tname), 'cpptype': _remove_const_ptr(cpp_tname), 'range': (range_start, range_end), 'init': cpp_name, 'optional': False, 'arg': "%s.data()"%(local_name) }) elif param_traits.is_output(item): params.append({ 'local': local_name, 'ctype': _remove_const_ptr(c_tname), 'cpptype': _remove_const_ptr(cpp_tname), 'range': (range_start, range_end), 'optional': param_traits.is_optional(item), 'arg': "%s.data()"%(local_name) }) returns.append(cpp_name) elif c_tname != cpp_tname: params.append({ 'arg': "reinterpret_cast<%s>( %s )"%(c_tname, cpp_name) }) else: params.append({ 'arg': cpp_name }) else: if type_traits.is_class_handle(item['type'], meta): is_this_handle = type_traits.find_class_name(item['type'], meta) == obj_traits.class_name(obj) if param_traits.is_output(item): if param_traits.is_optional(item): params.append({ 'local': local_name, 'ctype': _remove_const_ptr(c_tname), 'cpptype': _remove_const_ptr(cpp_tname), 'optional': True, 'arg': "( %s ) ? &%s : nullptr"%(cpp_name, local_name), 'release': False, 'class': _remove_ptr(cpp_cname, False), 'ctor': _make_ctor(namespace, tags, item, obj, meta, specs), 'name': cpp_name }) else: params.append({ 'local': local_name, 'ctype': _remove_const_ptr(c_tname), 'cpptype': _remove_const_ptr(cpp_tname), 'optional': False, 'arg': "&%s"%(local_name), 'release': False, 'class': _remove_ptr(cpp_cname, False), 'ctor': _make_ctor(namespace, tags, item, obj, meta, specs), 'name': cpp_name }) returns.append(cpp_name) elif param_traits.is_optional(item): params.append({ 'arg': "( %s ) ? reinterpret_cast<%s>( %s->getHandle() ) : nullptr"%(cpp_name, c_tname, cpp_name) }) elif (not is_static and not is_global) and is_this_handle: numSelf += 1 if numSelf == 1: params.append({ 'arg': "reinterpret_cast<%s>( getHandle() )"%(c_tname) }) else: params.append({ 'arg': "reinterpret_cast<%s>( %s->getHandle() )"%(c_tname, cpp_name) }) elif param_traits.is_release(item): params.append({ 'arg': "reinterpret_cast<%s>( %s->getHandle() )"%(c_tname, cpp_name), 'release': True, 'class': _remove_ptr(cpp_cname, False), 'name': cpp_name }) else: params.append({ 'arg': "reinterpret_cast<%s>( %s->getHandle() )"%(c_tname, cpp_name) }) elif param_traits.is_output(item): params.append({ 'local': local_name, 'ctype': _remove_const_ptr(c_tname), 'cpptype': _remove_const_ptr(cpp_tname), 'arg': "&%s"%(local_name), 'name': local_name }) if c_tname != cpp_tname: if type_traits.is_pointer(_remove_ptr(item['type'])) or (type_traits.is_handle(item['type']) and not type_traits.is_ipc_handle(item['type'])): returns.append("reinterpret_cast<%s>( %s )"%(_remove_const_ptr(cpp_tname), local_name)) else: returns.append("*reinterpret_cast<%s*>( &%s )"%(_remove_const_ptr(cpp_tname), local_name)) else: returns.append(local_name) elif c_tname != cpp_tname: if type_traits.is_ipc_handle(item['type']): params.append({ 'arg': "*reinterpret_cast<%s*>( &%s )"%(c_tname, cpp_name) }) elif type_traits.is_pointer(item['type']) or type_traits.is_handle(item['type']): params.append({ 'arg': "reinterpret_cast<%s>( %s )"%(c_tname, cpp_name) }) elif type_traits.is_struct(item['type'], meta): params.append({ 'arg': "*reinterpret_cast<%s*>( &%s )"%(c_tname, cpp_name) }) else: params.append({ 'arg': "static_cast<%s>( %s )"%(c_tname, cpp_name) }) else: params.append({ 'arg': cpp_name }) if len(returns) == 0: rvalue = "" elif len(returns) > 1: rvalue = "std::make_tuple( %s )"%", ".join(returns) else: rvalue = "%s"%returns[0] return params, rvalue """ Private: returns a ctor dict in c++ wrapper """ def _make_ctor(namespace, tags, item, obj, meta, specs): cobj = next(iter(filter_items(extract_objs(specs, 'class'), 'name', type_traits.find_class_name(item['type'], meta))), None) is_singleton = class_traits.is_singleton(cobj) fty_name = "g_%sFactory"%make_class_name(namespace, tags, cobj) if obj_traits.class_name(obj) in meta['class'][cobj['name']].get('child',[]): cobj2 = next(iter(filter_items(extract_objs(specs, 'class'), 'name', obj_traits.class_name(obj))), None) is_singleton = class_traits.is_singleton(cobj2) fty_name = "g_%sFactory"%make_class_name(namespace, tags, cobj2) return { 'params': _make_wrapper_ctor_params(namespace, tags, item, obj, cobj, meta), 'factory': fty_name if is_singleton else "" } """ Private: returns a list of c++ strings of ctor arguments in c++ wrapper """ def _make_wrapper_ctor_params(namespace, tags, item, obj, cobj, meta): params = [] is_static = function_traits.is_static(obj) is_global = function_traits.is_global(obj, tags) # generate list of names for each parameter of the current function oparams = [ _get_param_name(namespace, tags, oparam, cpp=True) for oparam in obj['params'] ] # walk the ctor parameter names cparams = make_ctor_param_lines(namespace, tags, cobj, meta=meta, format=['name']) for i, name in enumerate(cparams): if name == "handle": c_name = _get_param_name(namespace, tags, item, cpp=False) local_name = _get_local_name(c_name) cpp_tname = _get_type_name(namespace, tags, obj, item, cpp=True, meta=meta, handle_to_class=False) if param_traits.is_range(item): params.append("reinterpret_cast<%s>( %s[ i ] )"%(_remove_const_ptr(cpp_tname), local_name)) else: params.append("reinterpret_cast<%s>( %s )"%(_remove_const_ptr(cpp_tname), local_name)) elif name in oparams: if (not is_static and not is_global) and (0 == oparams.index(name)): params.append("this") else: params.append(name) else: if (not is_static and not is_global): params.append("m_"+name) else: params.append("nullptr") return params """ Public: returns a list of strings for the description format: "@brief DESCRIPTION" """ def make_desc_lines(namespace, tags, obj, cpp=False): lines = [] prologue = "@brief" for line in split_line(subt(namespace, tags, obj['desc'], True, cpp), 70): lines.append("%s %s"%(prologue, line)) prologue = " " return lines """ Public: returns a list of strings for the detailed description format: "@details DESCRIPTION" """ def make_details_lines(namespace, tags, obj, cpp=False): lines = [] if 'details' in obj: lines.append("") lines.append("@details") for item in obj['details']: if isinstance(item, dict): for key, values in item.items(): prologue = " -" for line in split_line(subt(namespace, tags, key, True, cpp), 70): lines.append("%s %s"%(prologue, line)) prologue = " " for val in values: prologue = " +" for line in split_line(subt(namespace, tags, val, True, cpp), 66): lines.append("%s %s"%(prologue, line)) prologue = " " else: prologue = " -" for line in split_line(subt(namespace, tags, item, True, cpp), 70): lines.append("%s %s"%(prologue, line)) prologue = " " if 'analogue' in obj: lines.append("") lines.append("@remarks") lines.append(" _Analogues_") for line in obj['analogue']: lines.append(" - %s"%line) return lines """ Public: returns a dict of auto-generated c++ parameter validation checks """ def make_param_checks(namespace, tags, obj, cpp=False, meta=None): checks = {} for item in obj.get('returns', []): for key, values in item.items(): key = subt(namespace, tags, key, False, cpp) for val in values: code = re.match(r"^\`(.*)\`$", val) if code: if key not in checks: checks[key] = [] checks[key].append(subt(namespace, tags, code.group(1), False, cpp)) return checks """ Public: returns a list of strings for possible return values """ def make_returns_lines(namespace, tags, obj, cpp=False, meta=None): lines = [] if cpp: params = _filter_param_list(obj['params'], ["[out]"]) if len(params) > 0: lines.append("@returns") for p in params: desc = re.sub(r"\[.*\](.*)", r"\1", p['desc']) tname = _remove_const_ptr(_get_type_name(namespace, tags, obj, p, cpp, meta)) lines.append(" - %s"%subt(namespace, tags, "%s:%s"%(tname, desc), True, cpp)) lines.append("") for item in obj.get('returns', []): for key, values in item.items(): if "$X_RESULT_NOT_READY" == key: if len(lines) == 0: lines.append("@returns") lines.append(" - %s"%subt(namespace, tags, "$x_bool_t:'0' when $X_RESULT_NOT_READY", cpp=cpp)) lines.append("@throws result_t") else: lines.append("@returns") for item in obj.get('returns', []): for key, values in item.items(): lines.append(" - %s"%subt(namespace, tags, key, True, cpp)) for val in values: lines.append(" + %s"%subt(namespace, tags, val, True, cpp)) return lines """ Public: returns c++ string for declaring function return type """ def make_return_type(namespace, tags, obj, cpp=False, decl=False, meta=None): # only "return" the parameters declared as "out" params = _filter_param_list(obj['params'], ["[out]"]) types = [] for p in params: if not param_traits.is_optional(p): tname = _remove_const_ptr(_get_type_name(namespace, tags, obj, p, cpp, meta)) if cpp: cname = type_traits.find_class_name(p['type'], meta) is_handle = type_traits.is_handle(p['type']) if cname and not decl and not is_handle: # need to prepend the class name to the type tname = _add_class(tname, subt(namespace, tags, cname, cpp=cpp)) elif cname and is_handle: # convert handles to class pointers tname = _remove_const_ptr(_get_type_name(namespace, tags, obj, p, cpp, meta)) types.append(tname) for item in obj.get('returns', []): for key, values in item.items(): if "$X_RESULT_NOT_READY" == key: types.append(subt(namespace, tags, "$x_bool_t", cpp=cpp)) if len(types) == 0: # if none exist, then just return "void" return "void" elif len(types) > 1: # if more than one return value, then return a tuple of values return "std::tuple<%s>"%", ".join(types) else: return types[0] """ Public: returns the name of a function """ def make_func_name(namespace, tags, obj, cpp=False): if not cpp: cname = obj_traits.class_name(obj) else: cname = "" return subt(namespace, tags, "%s%s"%(cname, obj['name']), cpp=cpp) """ Public: returns the name of a function """ def make_tracing_func_name(namespace, tags, obj): cname = obj_traits.class_name(obj) x_tag = tags['$x'] tags['$x'] = '' #temporaly remove namespace tag so funx doesn't contain "ze" fname = subt(namespace, tags, "%s%s"%(cname, obj['name']), cpp=False) fname = "zelTracer" + fname + "RegisterCallback" tags['$x'] = x_tag return fname """ Public: returns the name of a function pointer """ def make_pfn_name(namespace, tags, obj): return subt(namespace, tags, "pfn%s"%obj['name']) """ Public: returns the name of a function pointer """ def make_pfncb_name(namespace, tags, obj): return subt(namespace, tags, "pfn%sCb"%obj['name']) """ Public: returns the name of a function pointer """ def make_pfn_type(namespace, tags, obj, epilogue=""): newtags = dict() for key, value in tags.items(): if re.match(namespace, value): newtags[key] = "pfn" return "%s_%s%s_t"%(namespace, make_func_name(namespace, newtags, obj), epilogue) """ Public: returns the name of a function pointer """ def make_pfncb_type(namespace, tags, obj): return make_pfn_type(namespace, tags, obj, epilogue="Cb") """ Public: returns the name of a function pointer """ def make_pfncb_param_type(namespace, tags, obj): return "%s_params_t"%_camel_to_snake(make_func_name(namespace, tags, obj)) """ Public: returns the name of a class """ def make_class_name(namespace, tags, obj): name = subt(namespace, tags, obj['name'], cpp=True) return name """ Public: returns a c++ string for the declaration of a base class """ def make_baseclass_decl(namespace, tags, obj): if 'base' in obj: return " : public %s"%(subt(namespace, tags, obj['base'], cpp=True)) return "" """ Public: returns a c++ string for the declaration of a base class ctor """ def make_baseclass_ctor(namespace, tags, obj): base = subt(namespace, tags, obj['base'], cpp=True) ctor = base.split("::")[-1] return "%s::%s"%(base, ctor) """ Public: returns a list of all function objs for the specified class and version """ def get_class_function_objs(specs, cname, minVersion = 0, maxVersion = 9999): objects = [] for s in specs: for obj in s['objects']: is_function = obj_traits.is_function(obj) match_cls = cname == obj_traits.class_name(obj) if is_function and match_cls: func_ver = float(obj.get('version',"1.0")) if func_ver <= maxVersion and func_ver >= minVersion: objects.append(obj) return sorted(objects, key=lambda obj: (float(obj.get('version',"1.0"))*10000) + int(obj.get('ordinal',"100"))) """ Public: returns a list of all non-experimental function objs and a list of experimental function objs for the specified class """ def get_class_function_objs_exp(specs, cname): objects = [] exp_objects = [] optional = True for s in specs: for obj in s['objects']: is_function = obj_traits.is_function(obj) match_cls = cname == obj_traits.class_name(obj) if is_function and match_cls: if obj_traits.is_experimental(obj): exp_objects.append(obj) else: objects.append(obj) if obj.get('version',"1.0") == "1.0": optional = False objects = sorted(objects, key=lambda obj: (float(obj.get('version',"1.0"))*10000) + int(obj.get('ordinal',"100"))) exp_objects = sorted(exp_objects, key=lambda obj: (float(obj.get('version',"1.0"))*10000) + int(obj.get('ordinal',"100"))) return objects, exp_objects, optional """ Public: returns string name of DDI table for function object """ def get_table_name(namespace, tags, obj): cname = obj_traits.class_name(obj) if obj_traits.is_experimental(obj): cname=cname+"Exp" name = subt(namespace, tags, cname, cpp=True) # i.e., "$x" -> "" name = name if len(name) > 0 else "Global" return name """ Public: returns string name of callback table for function object """ def get_callback_table_name(namespace, tags, obj): cname = obj_traits.class_name(obj) name = subt(namespace, tags, cname, cpp=True) # i.e., "$x" -> "" name = name if len(name) > 0 else "Global" return name """ Public: returns a list of dict of each pfntables needed """ def get_pfntables(specs, meta, namespace, tags): tables = [] for cname in sorted(meta['class'], key=lambda x: meta['class'][x]['ordinal']): objs, exp_objs, optional = get_class_function_objs_exp(specs, cname) if len(objs) > 0: name = get_table_name(namespace, tags, objs[0]) table = "%s_%s_dditable_t"%(namespace, _camel_to_snake(name)) params = [] params.append({ 'type': "$x_api_version_t", 'name': "version", 'desc': "[in] API version requested" }) params.append({ 'type': "%s*"%table, 'name': "pDdiTable", 'desc': "[in,out] pointer to table of DDI function pointers" }) export = { 'name': "%sGet%sProcAddrTable"%(namespace, name), 'params': params } pfn = "%s_pfnGet%sProcAddrTable_t"%(namespace, name) tables.append({ 'name': name, 'type': table, 'export': export, 'pfn': pfn, 'functions': objs, 'experimental': False, 'optional': optional }) if len(exp_objs) > 0: name = get_table_name(namespace, tags, exp_objs[0]) table = "%s_%s_dditable_t"%(namespace, _camel_to_snake(name)) params = [] params.append({ 'type': "$x_api_version_t", 'name': "version", 'desc': "[in] API version requested" }) params.append({ 'type': "%s*"%table, 'name': "pDdiTable", 'desc': "[in,out] pointer to table of DDI function pointers" }) export = { 'name': "%sGet%sProcAddrTable"%(namespace, name), 'params': params } pfn = "%s_pfnGet%sProcAddrTable_t"%(namespace, name) tables.append({ 'name': name, 'type': table, 'export': export, 'pfn': pfn, 'functions': exp_objs, 'experimental': True, 'optional': True }) return tables """ Public: returns a list of dict of each pfntables """ def get_zel_pfncbtables(specs, meta, namespace, tags): tables = [] for cname in sorted(meta['class'], key=lambda x: meta['class'][x]['ordinal']): objs = get_class_function_objs(specs, cname, 1.0, 9999) if len(objs) > 0: name = get_table_name(namespace, tags, {'class': cname}) table = "zel_%s_callbacks_t"%(_camel_to_snake(name)) tables.append({ 'name': name, 'type': table, 'functions': objs }) return tables """ Public: returns a list of dict of each pfntables for all APIs introduced after 1.0 """ def get_new_pfncbtables(specs, meta, namespace, tags): tables = [] for cname in sorted(meta['class'], key=lambda x: meta['class'][x]['ordinal']): objs = get_class_function_objs(specs, cname, 1.1, 9999) if len(objs) > 0: name = get_table_name(namespace, tags, {'class': cname}) table = "%s_%s_callbacks_t"%(namespace, _camel_to_snake(name)) tables.append({ 'name': name, 'type': table, 'functions': objs }) return tables """ Public: returns a list of dict for converting loader input parameters """ def get_loader_prologue(namespace, tags, obj, meta): prologue = [] params = _filter_param_list(obj['params'], ["[in]"]) for item in params: if param_traits.is_mbz(item): continue if type_traits.is_class_handle(item['type'], meta): name = subt(namespace, tags, item['name']) tname = _remove_const_ptr(subt(namespace, tags, item['type'])) # e.g., "xe_device_handle_t" -> "xe_device_object_t" obj_name = re.sub(r"(\w+)_handle_t", r"\1_object_t", tname) fty_name = re.sub(r"(\w+)_handle_t", r"\1_factory", tname) if type_traits.is_pointer(item['type']): range_start = param_traits.range_start(item) range_end = param_traits.range_end(item) prologue.append({ 'name': name, 'obj': obj_name, 'range': (range_start, range_end), 'type': tname, 'factory': fty_name }) else: prologue.append({ 'name': name, 'obj': obj_name, 'optional': param_traits.is_optional(item) }) return prologue """ Public: returns a list of dict for converting loader output parameters """ def get_loader_epilogue(namespace, tags, obj, meta): epilogue = [] for i, item in enumerate(obj['params']): if param_traits.is_mbz(item): continue if param_traits.is_release(item) or param_traits.is_output(item) or param_traits.is_inoutput(item): if type_traits.is_class_handle(item['type'], meta): name = subt(namespace, tags, item['name']) tname = _remove_const_ptr(subt(namespace, tags, item['type'])) obj_name = re.sub(r"(\w+)_handle_t", r"\1_object_t", tname) fty_name = re.sub(r"(\w+)_handle_t", r"\1_factory", tname) if param_traits.is_range(item): range_start = param_traits.range_start(item) range_end = param_traits.range_end(item) epilogue.append({ 'name': name, 'type': tname, 'obj': obj_name, 'factory': fty_name, 'release': param_traits.is_release(item), 'range': (range_start, range_end) }) else: epilogue.append({ 'name': name, 'type': tname, 'obj': obj_name, 'factory': fty_name, 'release': param_traits.is_release(item), 'optional': param_traits.is_optional(item) }) return epilogue """ Public: returns true if proc table is added after 1.0 """ def isNewProcTable(tableName): return tableName in ["zesGetGlobalProcAddrTable","zesGetOverclockProcAddrTable","zesGetVFManagementProcAddrTable"]level-zero-1.20.6/scripts/templates/ldrddi.cpp.mako000066400000000000000000000457721475521542100222720ustar00rootroot00000000000000<%! import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name}.cpp * */ #include "${x}_loader_internal.h" namespace loader { %for obj in th.extract_objs(specs, r"function"): /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for ${th.make_func_name(n, tags, obj)} %if 'condition' in obj: #if ${th.subt(n, tags, obj['condition'])} %endif __${x}dlllocal ${x}_result_t ${X}_APICALL ${th.make_func_name(n, tags, obj)}( %for line in th.make_param_lines(n, tags, obj): ${line} %endfor ) { ${x}_result_t result = ${X}_RESULT_SUCCESS;<% add_local = False arrays_to_delete = [] %> %if re.match(r"Init", obj['name']) and not re.match(r"\w+InitDrivers$", th.make_func_name(n, tags, obj)): bool atLeastOneDriverValid = false; %if namespace != "zes": for( auto& drv : loader::context->zeDrivers ) %else: for( auto& drv : *loader::context->sysmanInstanceDrivers ) %endif { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; drv.initStatus = drv.dditable.${n}.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); if(drv.initStatus == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; } if(!atLeastOneDriverValid) result=ZE_RESULT_ERROR_UNINITIALIZED; %elif re.match(r"\w+DriverGet$", th.make_func_name(n, tags, obj)) or re.match(r"\w+InitDrivers$", th.make_func_name(n, tags, obj)): uint32_t total_driver_handle_count = 0; %if namespace != "zes": for( auto& drv : loader::context->zeDrivers ) %else: for( auto& drv : *loader::context->sysmanInstanceDrivers ) %endif { %if not re.match(r"\w+InitDrivers$", th.make_func_name(n, tags, obj)): if(drv.initStatus != ZE_RESULT_SUCCESS) continue; %else: if (!drv.dditable.${n}.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}) { %if re.match(r"\w+InitDrivers$", th.make_func_name(n, tags, obj)): drv.initDriversStatus = ${X}_RESULT_ERROR_UNINITIALIZED; %else: drv.initStatus = ${X}_RESULT_ERROR_UNINITIALIZED; %endif continue; } %endif if( ( 0 < *${obj['params'][0]['name']} ) && ( *${obj['params'][0]['name']} == total_driver_handle_count)) break; uint32_t library_driver_handle_count = 0; %if re.match(r"\w+InitDrivers$", th.make_func_name(n, tags, obj)): result = drv.dditable.${n}.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}( &library_driver_handle_count, nullptr, desc ); %else: result = drv.dditable.${n}.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}( &library_driver_handle_count, nullptr ); %endif if( ${X}_RESULT_SUCCESS != result ) { // If Get Drivers fails with Uninitialized, then update the driver init status to prevent reporting this driver in the next get call. if (${X}_RESULT_ERROR_UNINITIALIZED == result) { %if re.match(r"\w+InitDrivers$", th.make_func_name(n, tags, obj)): drv.initDriversStatus = result; %else: drv.initStatus = result; %endif } continue; } if( nullptr != ${obj['params'][1]['name']} && *${obj['params'][0]['name']} !=0) { if( total_driver_handle_count + library_driver_handle_count > *${obj['params'][0]['name']}) { library_driver_handle_count = *${obj['params'][0]['name']} - total_driver_handle_count; } %if re.match(r"\w+InitDrivers$", th.make_func_name(n, tags, obj)): result = drv.dditable.${n}.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}( &library_driver_handle_count, &${obj['params'][1]['name']}[ total_driver_handle_count ], desc ); %else: result = drv.dditable.${n}.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}( &library_driver_handle_count, &${obj['params'][1]['name']}[ total_driver_handle_count ] ); %endif if( ${X}_RESULT_SUCCESS != result ) break; drv.driverInuse = true; try { for( uint32_t i = 0; i < library_driver_handle_count; ++i ) { uint32_t driver_index = total_driver_handle_count + i; ${obj['params'][1]['name']}[ driver_index ] = reinterpret_cast<${n}_driver_handle_t>( context->${n}_driver_factory.getInstance( ${obj['params'][1]['name']}[ driver_index ], &drv.dditable ) ); } } catch( std::bad_alloc& ) { result = ${X}_RESULT_ERROR_OUT_OF_HOST_MEMORY; } } total_driver_handle_count += library_driver_handle_count; } // If the last driver get failed, but at least one driver succeeded, then return success with total count. if( ${X}_RESULT_SUCCESS == result || total_driver_handle_count > 0) *${obj['params'][0]['name']} = total_driver_handle_count; if (total_driver_handle_count > 0) { result = ${X}_RESULT_SUCCESS; } %else: %for i, item in enumerate(th.get_loader_prologue(n, tags, obj, meta)): %if 0 == i: // extract driver's function pointer table %if 'range' in item: auto dditable = reinterpret_cast<${item['obj']}*>( ${item['name']}[ 0 ] )->dditable; %else: auto dditable = reinterpret_cast<${item['obj']}*>( ${item['name']} )->dditable; %endif auto ${th.make_pfn_name(n, tags, obj)} = dditable->${n}.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}; if( nullptr == ${th.make_pfn_name(n, tags, obj)} ) return ${X}_RESULT_ERROR_UNINITIALIZED; %endif %if 'range' in item: <% add_local = True%>// convert loader handles to driver handles auto ${item['name']}Local = new ${item['type']} [${item['range'][1]}]; <% arrays_to_delete.append(item['name']+ 'Local') %>for( size_t i = ${item['range'][0]}; ( nullptr != ${item['name']} ) && ( i < ${item['range'][1]} ); ++i ) ${item['name']}Local[ i ] = reinterpret_cast<${item['obj']}*>( ${item['name']}[ i ] )->handle; %else: %if item['optional']: // convert loader handle to driver handle ${item['name']} = ( ${item['name']} ) ? reinterpret_cast<${item['obj']}*>( ${item['name']} )->handle : nullptr; %else: %if re.match(r"\w+ImageDestroy$", th.make_func_name(n, tags, obj)): // remove the handle from the kernel arugment map { std::lock_guard lock(context->image_handle_map_lock); context->image_handle_map.erase(reinterpret_cast(hImage)); } %endif %if re.match(r"\w+SamplerDestroy$", th.make_func_name(n, tags, obj)): // remove the handle from the kernel arugment map { std::lock_guard lock(context->sampler_handle_map_lock); context->sampler_handle_map.erase(reinterpret_cast(hSampler)); } %endif // convert loader handle to driver handle ${item['name']} = reinterpret_cast<${item['obj']}*>( ${item['name']} )->handle; %endif %endif %endfor %if re.match(r"\w+KernelSetArgumentValue$", th.make_func_name(n, tags, obj)): // convert pArgValue to correct handle if applicable void *internalArgValue = const_cast(pArgValue); if (pArgValue) { // check if the arg value is a translated handle ze_image_object_t **imageHandle = static_cast(internalArgValue); ze_sampler_object_t **samplerHandle = static_cast(internalArgValue); { std::lock_guard image_lock(context->image_handle_map_lock); std::lock_guard sampler_lock(context->sampler_handle_map_lock); if( context->image_handle_map.find(*imageHandle) != context->image_handle_map.end() ) { internalArgValue = &context->image_handle_map[*imageHandle]; } else if( context->sampler_handle_map.find(*samplerHandle) != context->sampler_handle_map.end() ) { internalArgValue = &context->sampler_handle_map[*samplerHandle]; } } } %endif ## Workaround due to incorrect defintion of phWaitEvents in the ze headers which missed the range values. ## To be removed once the headers have been updated in a new spec release. %if re.match(r"\w+CommandListAppendMetricQueryEnd$", th.make_func_name(n, tags, obj)): // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendMetricQueryEnd( hCommandList, hMetricQuery, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; %else: // forward to device-driver %if add_local: result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name", "local"]))} ); %for array_name in arrays_to_delete: delete []${array_name}; %endfor %else: %if re.match(r"\w+KernelSetArgumentValue$", th.make_func_name(n, tags, obj)): result = pfnSetArgumentValue( hKernel, argIndex, argSize, const_cast(internalArgValue) ); %else: result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); %endif %endif %endif <% del arrays_to_delete del add_local%> %for i, item in enumerate(th.get_loader_epilogue(n, tags, obj, meta)): %if 0 == i: %if not re.match(r"\w+ModuleDynamicLink$", th.make_func_name(n, tags, obj)) and not re.match(r"\w+ModuleCreate$", th.make_func_name(n, tags, obj)): if( ${X}_RESULT_SUCCESS != result ) return result; %endif %endif %if item['release']: // release loader handle context->${item['factory']}.release( ${item['name']} ); %else: try { %if 'range' in item: // convert driver handles to loader handles for( size_t i = ${item['range'][0]}; ( nullptr != ${item['name']} ) && ( i < ${item['range'][1]} ); ++i ) ${item['name']}[ i ] = reinterpret_cast<${item['type']}>( context->${item['factory']}.getInstance( ${item['name']}[ i ], dditable ) ); %else: // convert driver handle to loader handle %if item['optional']: if( nullptr != ${item['name']} ) *${item['name']} = reinterpret_cast<${item['type']}>( context->${item['factory']}.getInstance( *${item['name']}, dditable ) ); %else: %if re.match(r"\w+ImageCreate$", th.make_func_name(n, tags, obj)) or re.match(r"\w+SamplerCreate$", th.make_func_name(n, tags, obj)) or re.match(r"\w+ImageViewCreateExp$", th.make_func_name(n, tags, obj)): ${item['type']} internalHandlePtr = *${item['name']}; %endif *${item['name']} = reinterpret_cast<${item['type']}>( context->${item['factory']}.getInstance( *${item['name']}, dditable ) ); %if re.match(r"\w+ImageCreate$", th.make_func_name(n, tags, obj)) or re.match(r"\w+ImageViewCreateExp$", th.make_func_name(n, tags, obj)): // convert loader handle to driver handle and store in map { std::lock_guard lock(context->image_handle_map_lock); context->image_handle_map.insert({context->ze_image_factory.getInstance( internalHandlePtr, dditable ), internalHandlePtr}); } %endif %if re.match(r"\w+SamplerCreate$", th.make_func_name(n, tags, obj)): // convert loader handle to driver handle and store in map { std::lock_guard lock(context->sampler_handle_map_lock); context->sampler_handle_map.insert({context->ze_sampler_factory.getInstance( internalHandlePtr, dditable ), internalHandlePtr}); } %endif %endif %endif } catch( std::bad_alloc& ) { result = ${X}_RESULT_ERROR_OUT_OF_HOST_MEMORY; } %endif %if 0 == i: %if re.match(r"\w+ModuleDynamicLink$", th.make_func_name(n, tags, obj)) or re.match(r"\w+ModuleCreate$", th.make_func_name(n, tags, obj)): if( ${X}_RESULT_SUCCESS != result ) return result; %endif %endif %endfor %endif return result; } %if 'condition' in obj: #endif // ${th.subt(n, tags, obj['condition'])} %endif %endfor } // namespace loader #if defined(__cplusplus) extern "C" { #endif %for tbl in th.get_pfntables(specs, meta, n, tags): /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ${tbl['name']} table /// with current process' addresses /// /// @returns /// - ::${X}_RESULT_SUCCESS /// - ::${X}_RESULT_ERROR_UNINITIALIZED /// - ::${X}_RESULT_ERROR_INVALID_NULL_POINTER /// - ::${X}_RESULT_ERROR_UNSUPPORTED_VERSION ${X}_DLLEXPORT ${x}_result_t ${X}_APICALL ${tbl['export']['name']}( %for line in th.make_param_lines(n, tags, tbl['export']): ${line} %endfor ) { %if namespace != "zes": if( loader::context->zeDrivers.size() < 1 ) { %else: if( loader::context->sysmanInstanceDrivers->size() < 1 ) { %endif return ${X}_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ${X}_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ${X}_RESULT_ERROR_UNSUPPORTED_VERSION; ${x}_result_t result = ${X}_RESULT_SUCCESS; %if tbl['experimental'] is False: #//Experimental Tables may not be implemented in driver bool atLeastOneDriverValid = false; %endif // Load the device-driver DDI tables %if namespace != "zes": for( auto& drv : loader::context->zeDrivers ) %else: for( auto& drv : *loader::context->sysmanInstanceDrivers ) %endif { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast<${tbl['pfn']}>( GET_FUNCTION_PTR( drv.handle, "${tbl['export']['name']}") ); if(!getTable) %if th.isNewProcTable(tbl['export']['name']) is True: { atLeastOneDriverValid = true; //It is valid to not have this proc addr table continue; } %else: continue; %endif %if tbl['experimental'] is False: #//Experimental Tables may not be implemented in driver auto getTableResult = getTable( version, &drv.dditable.${n}.${tbl['name']}); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; %if namespace != "zes": %if tbl['name'] == "Global": if (drv.dditable.ze.Global.pfnInitDrivers) { loader::context->initDriversSupport = true; } %endif %endif %else: result = getTable( version, &drv.dditable.${n}.${tbl['name']}); %endif } %if tbl['experimental'] is False: #//Experimental Tables may not be implemented in driver if(!atLeastOneDriverValid) result = ${X}_RESULT_ERROR_UNINITIALIZED; else result = ${X}_RESULT_SUCCESS; %endif if( ${X}_RESULT_SUCCESS == result ) { %if namespace != "zes": if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) %else: if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) %endif { // return pointers to loader's DDIs %for obj in tbl['functions']: %if 'condition' in obj: #if ${th.subt(n, tags, obj['condition'])} %endif pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = loader::${th.make_func_name(n, tags, obj)}; %if 'condition' in obj: #else pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = nullptr; #endif %endif %endfor } else { // return pointers directly to driver's DDIs %if namespace != "zes": *pDdiTable = loader::context->zeDrivers.front().dditable.${n}.${tbl['name']}; %else: *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.${n}.${tbl['name']}; %endif } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ${X}_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast<${tbl['pfn']}>( GET_FUNCTION_PTR(loader::context->validationLayer, "${tbl['export']['name']}") ); if(!getTable) return ${X}_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } %if namespace == "ze": // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ${X}_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast<${tbl['pfn']}>( GET_FUNCTION_PTR(loader::context->tracingLayer, "${tbl['export']['name']}") ); if(!getTable) return ${X}_RESULT_ERROR_UNINITIALIZED; ${tbl['type']} dditable; memcpy(&dditable, pDdiTable, sizeof(${tbl['type']})); result = getTable( version, &dditable ); loader::context->tracing_dditable.${n}.${tbl['name']} = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } %endif return result; } %endfor #if defined(__cplusplus) }; #endif level-zero-1.20.6/scripts/templates/ldrddi.h.mako000066400000000000000000000014741475521542100217260ustar00rootroot00000000000000<%! import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name}.h * */ #pragma once namespace loader { /////////////////////////////////////////////////////////////////////////////// %for obj in th.extract_objs(specs, r"handle"): %if 'class' in obj: <% _handle_t = th.subt(n, tags, obj['name']) _object_t = re.sub(r"(\w+)_handle_t", r"\1_object_t", _handle_t) _factory_t = re.sub(r"(\w+)_handle_t", r"\1_factory_t", _handle_t) %>using ${th.append_ws(_object_t, 35)} = object_t < ${_handle_t} >; using ${th.append_ws(_factory_t, 35)} = singleton_factory_t < ${_object_t}, ${_handle_t} >; %endif %endfor } level-zero-1.20.6/scripts/templates/libapi.cpp.mako000066400000000000000000000122221475521542100222500ustar00rootroot00000000000000<%! import re from templates import helper as th def define_dbg(obj, tags): if re.match("class", obj['type']): return True if 'class' not in obj or obj['class'] in tags: return re.match("enum", obj['type']) or re.match("struct|union", obj['type']) return False %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name}.cpp * * @brief C++ static library for ${n} * */ #include "${x}_lib.h" extern "C" { %for s in specs: ## FUNCTION ################################################################### %for obj in th.filter_items(s['objects'], 'type', 'function'): /////////////////////////////////////////////////////////////////////////////// %if 'condition' in obj: #if ${th.subt(n, tags, obj['condition'])} %endif %for line in th.make_desc_lines(n, tags, obj): /// ${line} %endfor %for line in th.make_details_lines(n, tags, obj): /// ${line} %endfor /// %for line in th.make_returns_lines(n, tags, obj, meta=meta): /// ${line} %endfor ${x}_result_t ${X}_APICALL ${th.make_func_name(n, tags, obj)}( %for line in th.make_param_lines(n, tags, obj): ${line} %endfor ) { %if re.match("Init", obj['name']): %if re.match("zes", n): static ${x}_result_t result = ${X}_RESULT_SUCCESS; std::call_once(${x}_lib::context->initOnceSysMan, [flags]() { result = ${x}_lib::context->Init(flags, true, nullptr); }); if( ${X}_RESULT_SUCCESS != result ) return result; if(ze_lib::destruction) { return ${X}_RESULT_ERROR_UNINITIALIZED; } auto ${th.make_pfn_name(n, tags, obj)} = ${x}_lib::context->${n}DdiTable.load()->${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}; if( nullptr == ${th.make_pfn_name(n, tags, obj)} ) { if(!ze_lib::context->isInitialized) return ${X}_RESULT_ERROR_UNINITIALIZED; else return ${X}_RESULT_ERROR_UNSUPPORTED_FEATURE; } return ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); } %else: %if re.match("InitDrivers", obj['name']): ${x}_result_t result = ${X}_RESULT_SUCCESS; std::call_once(${x}_lib::context->initOnceDrivers, [desc,&result]() { result = ${x}_lib::context->Init(0, false, desc); return result; }); if (result != ${X}_RESULT_SUCCESS) { return result; } if(ze_lib::destruction) { return ${X}_RESULT_ERROR_UNINITIALIZED; } auto ${th.make_pfn_name(n, tags, obj)} = ${x}_lib::context->${n}DdiTable.load()->${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}; if( nullptr == ${th.make_pfn_name(n, tags, obj)} ) { if(!ze_lib::context->isInitialized) return ${X}_RESULT_ERROR_UNINITIALIZED; else return ${X}_RESULT_ERROR_UNSUPPORTED_FEATURE; } result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); if (result == ${X}_RESULT_SUCCESS) { if (phDrivers) { ze_lib::context->${n}Inuse = true; } } return result; %else: static ${x}_result_t result = ${X}_RESULT_SUCCESS; std::call_once(${x}_lib::context->initOnce, [flags]() { result = ${x}_lib::context->Init(flags, false, nullptr); if( ${X}_RESULT_SUCCESS != result ) return result; if(ze_lib::destruction) { return ${X}_RESULT_ERROR_UNINITIALIZED; } auto ${th.make_pfn_name(n, tags, obj)} = ${x}_lib::context->${n}DdiTable.load()->${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}; if( nullptr == ${th.make_pfn_name(n, tags, obj)} ) { if(!ze_lib::context->isInitialized) return ${X}_RESULT_ERROR_UNINITIALIZED; else return ${X}_RESULT_ERROR_UNSUPPORTED_FEATURE; } result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); return result; }); if(ze_lib::destruction) { result = ${X}_RESULT_ERROR_UNINITIALIZED; } return result; %endif } %endif %else: if(ze_lib::destruction) { return ${X}_RESULT_ERROR_UNINITIALIZED; } %if re.match(r"\w+DriverGet$", th.make_func_name(n, tags, obj)): if (${x}_lib::context->${n}DdiTable == nullptr) { return ${X}_RESULT_ERROR_UNINITIALIZED; } %endif auto ${th.make_pfn_name(n, tags, obj)} = ${x}_lib::context->${n}DdiTable.load()->${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}; if( nullptr == ${th.make_pfn_name(n, tags, obj)} ) { if(!ze_lib::context->isInitialized) return ${X}_RESULT_ERROR_UNINITIALIZED; else return ${X}_RESULT_ERROR_UNSUPPORTED_FEATURE; } %if re.match(r"\w+DriverGet$", th.make_func_name(n, tags, obj)): ze_lib::context->${n}Inuse = true; %endif return ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); } %endif %if 'condition' in obj: #endif // ${th.subt(n, tags, obj['condition'])} %endif %endfor %endfor } // extern "C" level-zero-1.20.6/scripts/templates/libddi.cpp.mako000066400000000000000000000035541475521542100222470ustar00rootroot00000000000000<%! import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name}.cpp * */ #include "${x}_lib.h" #ifndef DYNAMIC_LOAD_LOADER #include "${n}_ddi.h" #endif namespace ${x}_lib { /////////////////////////////////////////////////////////////////////////////// #ifdef DYNAMIC_LOAD_LOADER __zedlllocal ${x}_result_t context_t::${n}DdiTableInit() { ${x}_result_t result = ${X}_RESULT_SUCCESS; %for tbl in th.get_pfntables(specs, meta, n, tags): if( ${X}_RESULT_SUCCESS == result ) { %if tbl['optional'] == True: // Optional auto getTable = reinterpret_cast<${tbl['pfn']}>( GET_FUNCTION_PTR(loader, "${tbl['export']['name']}") ); getTable( ${X}_API_VERSION_CURRENT, &initial${n}DdiTable.${tbl['name']} ); %else: auto getTable = reinterpret_cast<${tbl['pfn']}>( GET_FUNCTION_PTR(loader, "${tbl['export']['name']}") ); result = getTable( ${X}_API_VERSION_CURRENT, &initial${n}DdiTable.${tbl['name']} ); %endif } %endfor return result; } #else __zedlllocal ${x}_result_t context_t::${n}DdiTableInit() { ${x}_result_t result = ${X}_RESULT_SUCCESS; %for tbl in th.get_pfntables(specs, meta, n, tags): if( ${X}_RESULT_SUCCESS == result ) { %if tbl['optional'] == True: // Optional ${tbl['export']['name']}( ${X}_API_VERSION_CURRENT, &initial${n}DdiTable.${tbl['name']} ); %else: result = ${tbl['export']['name']}( ${X}_API_VERSION_CURRENT, &initial${n}DdiTable.${tbl['name']} ); %endif } %endfor return result; } #endif } // namespace ${x}_lib level-zero-1.20.6/scripts/templates/nullddi.cpp.mako000066400000000000000000000120621475521542100224450ustar00rootroot00000000000000<%! import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name}.cpp * */ #include "${x}_null.h" #include namespace driver { %for obj in th.extract_objs(specs, r"function"): /////////////////////////////////////////////////////////////////////////////// <% fname = th.make_func_name(n, tags, obj) %>/// @brief Intercept function for ${fname} %if 'condition' in obj: #if ${th.subt(n, tags, obj['condition'])} %endif __${x}dlllocal ${x}_result_t ${X}_APICALL ${fname}( %for line in th.make_param_lines(n, tags, obj): ${line} %endfor ) { ${x}_result_t result = ${X}_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto ${th.make_pfn_name(n, tags, obj)} = context.${n}DdiTable.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}; if( nullptr != ${th.make_pfn_name(n, tags, obj)} ) { result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); } else { // generic implementation %if re.match("Init", obj['name']): %if re.match("InitDrivers", obj['name']): auto driver_type = getenv_string( "ZEL_TEST_NULL_DRIVER_TYPE" ); if (std::strcmp(driver_type.c_str(), "GPU") == 0) { if (!(desc->flags & ZE_INIT_DRIVER_TYPE_FLAG_GPU)) { return ${X}_RESULT_ERROR_UNINITIALIZED; } } if (std::strcmp(driver_type.c_str(), "NPU") == 0) { if (!(desc->flags & ZE_INIT_DRIVER_TYPE_FLAG_NPU)) { return ${X}_RESULT_ERROR_UNINITIALIZED; } } if (phDrivers == nullptr) { *pCount = 1; } %else: auto driver_type = getenv_string( "ZEL_TEST_NULL_DRIVER_TYPE" ); if (std::strcmp(driver_type.c_str(), "GPU") == 0) { if (!(flags & ZE_INIT_FLAG_GPU_ONLY)) { return ${X}_RESULT_ERROR_UNINITIALIZED; } } if (std::strcmp(driver_type.c_str(), "NPU") == 0) { if (!(flags & ZE_INIT_FLAG_VPU_ONLY)) { return ${X}_RESULT_ERROR_UNINITIALIZED; } } %endif %endif %for item in th.get_loader_epilogue(n, tags, obj, meta): %if 'range' in item: for( size_t i = ${item['range'][0]}; ( nullptr != ${item['name']} ) && ( i < ${item['range'][1]} ); ++i ) ${item['name']}[ i ] = reinterpret_cast<${item['type']}>( context.get() ); %elif not item['release']: %if item['optional']: if( nullptr != ${item['name']} ) *${item['name']} = reinterpret_cast<${item['type']}>( context.get() ); %else: *${item['name']} = reinterpret_cast<${item['type']}>( context.get() ); %endif %endif %endfor } return result; } %if 'condition' in obj: #endif // ${th.subt(n, tags, obj['condition'])} %endif %endfor } // namespace driver #if defined(__cplusplus) extern "C" { #endif %for tbl in th.get_pfntables(specs, meta, n, tags): /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ${tbl['name']} table /// with current process' addresses /// /// @returns /// - ::${X}_RESULT_SUCCESS /// - ::${X}_RESULT_ERROR_INVALID_NULL_POINTER /// - ::${X}_RESULT_ERROR_UNSUPPORTED_VERSION ${X}_DLLEXPORT ${x}_result_t ${X}_APICALL ${tbl['export']['name']}( %for line in th.make_param_lines(n, tags, tbl['export']): ${line} %endfor ) { if( nullptr == pDdiTable ) return ${X}_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ${X}_RESULT_ERROR_UNSUPPORTED_VERSION; ${x}_result_t result = ${X}_RESULT_SUCCESS; % if tbl['name'] == 'Global' and n == 'ze': pDdiTable->pfnInit = driver::zeInit; auto missing_api = getenv_string( "ZEL_TEST_MISSING_API" ); if (std::strcmp(missing_api.c_str(), "zeInitDrivers") == 0) { pDdiTable->pfnInitDrivers = nullptr; } else { pDdiTable->pfnInitDrivers = driver::zeInitDrivers; } %else: %for obj in tbl['functions']: %if 'condition' in obj: #if ${th.subt(n, tags, obj['condition'])} %endif pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = driver::${th.make_func_name(n, tags, obj)}; %if 'condition' in obj: #else pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = nullptr; #endif %endif %endfor %endif return result; } %endfor #if defined(__cplusplus) }; #endif level-zero-1.20.6/scripts/templates/tracing/000077500000000000000000000000001475521542100210065ustar00rootroot00000000000000level-zero-1.20.6/scripts/templates/tracing/trc_cb_struct.h.mako000066400000000000000000000021411475521542100247430ustar00rootroot00000000000000<% import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name}.h * */ #ifndef ${name}_H #define ${name}_H #if defined(__cplusplus) #pragma once #endif #include "${x}_api.h" #include "layers/zel_tracing_register_cb.h" %for tbl in th.get_zel_pfncbtables(specs, meta, n, tags): /////////////////////////////////////////////////////////////////////////////// /// @brief Table of ${tbl['name']} callback functions pointers typedef struct _${tbl['type']} { %for obj in tbl['functions']: ${th.append_ws(th.make_pfncb_type(n, tags, obj), 63)} ${th.make_pfncb_name(n, tags, obj)}; %endfor } ${tbl['type']}; %endfor /////////////////////////////////////////////////////////////////////////////// /// @brief Container for all callbacks typedef struct _zel_all_core_callbacks_t { %for tbl in th.get_zel_pfncbtables(specs, meta, n, tags): ${th.append_ws(tbl['type'], 35)} ${tbl['name']}; %endfor } zel_all_core_callbacks_t; #endif // ${name}_H level-zero-1.20.6/scripts/templates/tracing/trc_register_cb_libapi.cpp.mako000066400000000000000000000026361475521542100271270ustar00rootroot00000000000000<% import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name}.cpp * */ #include "ze_lib.h" #include "layers/zel_tracing_api.h" #include "layers/zel_tracing_ddi.h" #include "layers/zel_tracing_register_cb.h" #include "${x}_api.h" extern "C" { /// APIs to register callbacks for each core API %for s in specs: %for obj in th.filter_items(s['objects'], 'type', 'function'): ${X}_APIEXPORT ${x}_result_t ${X}_APICALL ${th.make_tracing_func_name(n, tags, obj)}( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ${th.make_pfncb_type(n, tags, obj)} ${th.make_pfncb_name(n, tags, obj)} ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ${th.make_pfncb_type(n, tags, obj)} ${th.make_pfncb_name(n, tags, obj)} ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "${th.make_tracing_func_name(n, tags, obj)}") ); if(func) return func(hTracer, callback_type, ${th.make_pfncb_name(n, tags, obj)}); return ZE_RESULT_ERROR_UNINITIALIZED; } %endfor %endfor #s in specs: } //Extern Clevel-zero-1.20.6/scripts/templates/tracing/trc_setters.cpp.mako000066400000000000000000000022251475521542100250020ustar00rootroot00000000000000<% import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name}.h * */ #include "tracing.h" #include "ze_tracing_layer.h" #include "layers/zel_tracing_api.h" #include "layers/zel_tracing_ddi.h" #include "layers/zel_tracing_register_cb.h" #include "${x}_api.h" extern "C" { /// APIs to register callbacks for each core API %for s in specs: %for obj in th.filter_items(s['objects'], 'type', 'function'): ${X}_DLLEXPORT ${x}_result_t ${X}_APICALL ${th.make_tracing_func_name(n, tags, obj)}( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ${th.make_pfncb_type(n, tags, obj)} ${th.make_pfncb_name(n, tags, obj)} ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.${th.get_callback_table_name(n, tags, obj)}.${th.make_pfncb_name(n, tags, obj)} = ${th.make_pfncb_name(n, tags, obj)}; return result; } %endfor %endfor #s in specs: } //extern Clevel-zero-1.20.6/scripts/templates/tracing/trc_setters.h.mako000066400000000000000000000051101475521542100244430ustar00rootroot00000000000000<% import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name}.h * */ #ifndef ${name}_H #define ${name}_H #if defined(__cplusplus) #pragma once #endif #include "../${x}_api.h" #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of tracer object typedef struct _zel_tracer_handle_t *zel_tracer_handle_t; /// Callback definitions for all API released in LevelZero spec 1.1 or newer /// Callbacks for APIs included in spec 1.0 are contained in ze_api.helper %for tbl in th.get_new_pfncbtables(specs, meta, n, tags): %for obj in tbl['functions']: /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function parameters for ${th.make_func_name(n, tags, obj)} /// @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 _${th.make_pfncb_param_type(n, tags, obj)} { %for line in th.make_param_lines(n, tags, obj, format=["type*", "name"]): ${line}; %endfor } ${th.make_pfncb_param_type(n, tags, obj)}; /////////////////////////////////////////////////////////////////////////////// /// @brief Callback function-pointer for ${th.make_func_name(n, tags, obj)} /// @param[in] params Parameters passed to this instance /// @param[in] result Return value /// @param[in] pTracerUserData Per-Tracer user data /// @param[in,out] ppTracerInstanceUserData Per-Tracer, Per-Instance user data typedef void (${X}_APICALL *${th.make_pfncb_type(n, tags, obj)})( ${th.make_pfncb_param_type(n, tags, obj)}* params, ${x}_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ); %endfor %endfor typedef enum _zel_tracer_reg_t { ZEL_REGISTER_PROLOGUE = 0, ZEL_REGISTER_EPILOGUE = 1 } zel_tracer_reg_t; /// APIs to register callbacks for each core API %for s in specs: %for obj in th.filter_items(s['objects'], 'type', 'function'): ${X}_APIEXPORT ${x}_result_t ${X}_APICALL ${th.make_tracing_func_name(n, tags, obj)}( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ${th.make_pfncb_type(n, tags, obj)} ${th.make_pfncb_name(n, tags, obj)} ); %endfor %endfor #s in specs: ${X}_APIEXPORT ${x}_result_t ${X}_APICALL zelTracerResetAllCallbacks(zel_tracer_handle_t hTracer); #if defined(__cplusplus) } // extern "C" #endif #endif // ${name}_H level-zero-1.20.6/scripts/templates/tracing/trcddi.cpp.mako000066400000000000000000000101561475521542100237140ustar00rootroot00000000000000<%! import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name}.cpp * */ #include #include "${x}_tracing_layer.h" namespace tracing_layer { %for obj in th.extract_objs(specs, r"function"): /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for ${th.make_func_name(n, tags, obj)} %if 'condition' in obj: #if ${th.subt(n, tags, obj['condition'])} %endif __${x}dlllocal ${x}_result_t ${X}_APICALL ${th.make_func_name(n, tags, obj)}( %for line in th.make_param_lines(n, tags, obj): ${line} %endfor ) { auto ${th.make_pfn_name(n, tags, obj)} = context.${n}DdiTable.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}; if( nullptr == ${th.make_pfn_name(n, tags, obj)}) return ${X}_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.${n}DdiTable.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}, ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))}); // capture parameters ${th.make_pfncb_param_type(n, tags, obj)} tracerParams = { &${",\n &".join(th.make_param_lines(n, tags, obj, format=["name"]))} }; tracing_layer::APITracerCallbackDataImp<${th.make_pfncb_type(n, tags, obj)}> apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ${th.make_pfncb_type(n, tags, obj)}, ${th.get_callback_table_name(n, tags, obj)}, ${th.make_pfncb_name(n, tags, obj)}); return tracing_layer::APITracerWrapperImp(context.${n}DdiTable.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.p${",\n *tracerParams.p".join(th.make_param_lines(n, tags, obj, format=["name"]))}); } %if 'condition' in obj: #endif // ${th.subt(n, tags, obj['condition'])} %endif %endfor } // namespace tracing_layer #if defined(__cplusplus) extern "C" { #endif %for tbl in th.get_pfntables(specs, meta, n, tags): /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ${tbl['name']} table /// with current process' addresses /// /// @returns /// - ::${X}_RESULT_SUCCESS /// - ::${X}_RESULT_ERROR_INVALID_NULL_POINTER /// - ::${X}_RESULT_ERROR_UNSUPPORTED_VERSION ${X}_DLLEXPORT ${x}_result_t ${X}_APICALL ${tbl['export']['name']}( %for line in th.make_param_lines(n, tags, tbl['export']): ${line} %endfor ) { auto& dditable = tracing_layer::context.${n}DdiTable.${tbl['name']}; if( nullptr == pDdiTable ) return ${X}_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ${X}_RESULT_ERROR_UNSUPPORTED_VERSION; ${x}_result_t result = ${X}_RESULT_SUCCESS; %for obj in tbl['functions']: %if 'condition' in obj: #if ${th.subt(n, tags, obj['condition'])} %endif dditable.${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = pDdiTable->${th.make_pfn_name(n, tags, obj)}; pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = tracing_layer::${th.make_func_name(n, tags, obj)}; %if 'condition' in obj: #else dditable.${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = nullptr; pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = nullptr; #endif %endif %endfor return result; } %endfor #if defined(__cplusplus) }; #endif level-zero-1.20.6/scripts/templates/validation/000077500000000000000000000000001475521542100215115ustar00rootroot00000000000000level-zero-1.20.6/scripts/templates/validation/entry_points.h.mako000066400000000000000000000016771475521542100253600ustar00rootroot00000000000000<%! import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * ***THIS FILE IS GENERATED. *** * See entry_points.h.mako for modifications * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name} * */ #pragma once #include "${n}_api.h" namespace validation_layer { class ${N}ValidationEntryPoints { public: %for obj in th.extract_objs(specs, r"function"): virtual ${x}_result_t ${th.make_func_name(n, tags, obj)}Prologue( \ %for line in th.make_param_lines(n, tags, obj, format=["type", "name", "delim"]): ${line} \ %endfor ) {return ZE_RESULT_SUCCESS;} virtual ${x}_result_t ${th.make_func_name(n, tags, obj)}Epilogue( \ %for line in th.make_param_lines(n, tags, obj, format=["type", "name", "delim"]): ${line} \ %endfor , ze_result_t result) {return ZE_RESULT_SUCCESS;} %endfor virtual ~${N}ValidationEntryPoints() {} }; }level-zero-1.20.6/scripts/templates/validation/handle_lifetime.cpp.mako000066400000000000000000000070141475521542100262560ustar00rootroot00000000000000<%! import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * ***THIS FILE IS GENERATED. *** * See handle_lifetime.cpp.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name} * */ #include "${x}_validation_layer.h" #include "${x}_handle_lifetime.h" namespace validation_layer { %for obj in th.extract_objs(specs, r"function"): ## don't genrate function if it has no handles as parameters %if th.obj_traits.is_function_with_input_handles(obj): ${x}_result_t ${N}HandleLifetimeValidation::${th.make_func_name(n, tags, obj)}Prologue( %for line in th.make_param_lines(n, tags, obj): ${line} %endfor ) { <% func_name = th.make_func_name(n, tags, obj) %> %if re.match(r"\w+Destroy$", func_name): %for i, item in enumerate(th.get_loader_prologue(n, tags, obj, meta)): if (${item['name']} && context.handleLifetime->isHandleValid( ${item['name']} )){ if (context.handleLifetime->hasDependents( ${item['name']} )){ return ${X}_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( ${item['name']}); context.handleLifetime->removeHandle( ${item['name']} ); } else if (!context.handleLifetime->isHandleValid( ${item['name']} )) { return ${X}_RESULT_ERROR_INVALID_NULL_HANDLE; } %endfor %else: ## Not Destroy %for i, item in enumerate(th.get_loader_prologue(n, tags, obj, meta)): %if not 'range' in item: ## if item is optional, check if it is not null before checking if it is valid %if item['optional']: if (${item['name']} && !context.handleLifetime->isHandleValid( ${item['name']} )){ return ${X}_RESULT_ERROR_INVALID_NULL_HANDLE; } %else: if ( !context.handleLifetime->isHandleValid( ${item['name']} )){ return ${X}_RESULT_ERROR_INVALID_NULL_HANDLE; } %endif ## if item['optional'] %if re.match(r"\w+CommandListAppend\w+$", func_name) and (0 == i) : ## i = 0, first parameter is command list if (!context.handleLifetime->isOpen( ${item['name']} )){ return ${X}_RESULT_ERROR_INVALID_ARGUMENT; } %endif %if re.match(r"\w+CommandListClose$", func_name): context.handleLifetime->close( ${item['name']} ); %endif %if re.match(r"\w+CommandListReset$", func_name): context.handleLifetime->reset( ${item['name']} ); %endif %else: ## if 'range' in item for (size_t i = ${item['range'][0]}; ( nullptr != ${item['name']}) && (i < ${item['range'][1]}); ++i){ if (!context.handleLifetime->isHandleValid( ${item['name']}[i] )){ return ${X}_RESULT_ERROR_INVALID_NULL_HANDLE; } } %if re.match(r"\w+ExecuteCommandLists$", func_name) and (1 == i): for (size_t i = ${item['range'][0]}; ( nullptr != ${item['name']}) && (i < ${item['range'][1]}); ++i){ if (context.handleLifetime->isOpen( ${item['name']}[i] )){ return ${X}_RESULT_ERROR_INVALID_ARGUMENT; } } %endif %endif ## if 'range' in item %endfor ## for i, item in enumerate(th.get_loader_prologue(n, tags, obj, meta)) %endif ## if re.match(r"\w+Destroy$", func_name) return ${X}_RESULT_SUCCESS; } %endif %endfor }level-zero-1.20.6/scripts/templates/validation/handle_lifetime.h.mako000066400000000000000000000015121475521542100257200ustar00rootroot00000000000000<%! import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * ***THIS FILE IS GENERATED. *** * See handle_lifetime.h.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name} * */ #pragma once #include "${n}_entry_points.h" namespace validation_layer { class ${N}HandleLifetimeValidation : public ${N}ValidationEntryPoints { public: %for obj in th.extract_objs(specs, r"function"): %if not th.obj_traits.is_function_with_input_handles(obj): <% continue %> %endif ${x}_result_t ${th.make_func_name(n, tags, obj)}Prologue( \ %for line in th.make_param_lines(n, tags, obj, format=["type", "name", "delim"]): ${line} \ %endfor ) override; %endfor }; } level-zero-1.20.6/scripts/templates/validation/param.cpp.mako000066400000000000000000000046311475521542100242470ustar00rootroot00000000000000<%! import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * ***THIS FILE IS GENERATED. *** * See valddi.cpp.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name} * */ #include "${x}_validation_layer.h" #include "param_validation.h" namespace validation_layer { %if 'ze' == n: class parameterValidationChecker parameterChecker; parameterValidationChecker::parameterValidationChecker() { enableParameterValidation = getenv_tobool( "ZE_ENABLE_PARAMETER_VALIDATION" ); if(enableParameterValidation) { ZEParameterValidation *zeChecker = new ZEParameterValidation; ZESParameterValidation *zesChecker = new ZESParameterValidation; ZETParameterValidation *zetChecker = new ZETParameterValidation; parameterChecker.zeValidation = zeChecker; parameterChecker.zetValidation = zetChecker; parameterChecker.zesValidation = zesChecker; validation_layer::context.getInstance().validationHandlers.push_back(¶meterChecker); } } parameterValidationChecker::~parameterValidationChecker() { if(enableParameterValidation) { delete parameterChecker.zeValidation; delete parameterChecker.zetValidation; delete parameterChecker.zesValidation; } } %endif %for obj in th.extract_objs(specs, r"function"): ${x}_result_t ${N}ParameterValidation::${th.make_func_name(n, tags, obj)}Prologue( %for line in th.make_param_lines(n, tags, obj): ${line} %endfor ) { %for key, values in th.make_param_checks(n, tags, obj, meta=meta).items(): %for val in values: if( ${val} ) return ${key}; %endfor %endfor <% descs = th.get_func_descs(n, tags, obj) %>\ %if len(descs) == 0: return ${X}_RESULT_SUCCESS; %elif len(descs) == 1: return ParameterValidation::validateExtensions(${descs[0]}); %else: auto retVal = ${X}_RESULT_SUCCESS; %for i, desc in enumerate(descs): retVal = ParameterValidation::validateExtensions(${desc}); %if i < len(descs)-1: if(retVal) return retVal; %endif %endfor return retVal; %endif } %endfor }level-zero-1.20.6/scripts/templates/validation/param.h.mako000066400000000000000000000013631475521542100237130ustar00rootroot00000000000000<%! import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * ***THIS FILE IS GENERATED. *** * See param.h.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name} * */ #pragma once #include "${x}_validation_layer.h" #include "${n}_entry_points.h" namespace validation_layer { class ${N}ParameterValidation : public ${N}ValidationEntryPoints { public: %for obj in th.extract_objs(specs, r"function"): ${x}_result_t ${th.make_func_name(n, tags, obj)}Prologue( \ %for line in th.make_param_lines(n, tags, obj, format=["type", "name", "delim"]): ${line} \ %endfor ) override; %endfor }; }level-zero-1.20.6/scripts/templates/validation/valddi.cpp.mako000066400000000000000000000147271475521542100244210ustar00rootroot00000000000000<%! import re from templates import helper as th %><% n=namespace N=n.upper() x=tags['$x'] X=x.upper() %>/* * ***THIS FILE IS GENERATED. *** * See valddi.cpp.mako for modifications * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ${name} * */ #include "${x}_validation_layer.h" namespace validation_layer { static ze_result_t logAndPropagateResult(const char* fname, ze_result_t result) { if (result != ${X}_RESULT_SUCCESS) { context.logger->log_trace("Error (" + loader::to_string(result) + ") in " + std::string(fname)); } return result; } %for obj in th.extract_objs(specs, r"function"): /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for ${th.make_func_name(n, tags, obj)} %if 'condition' in obj: #if ${th.subt(n, tags, obj['condition'])} %endif __${x}dlllocal ${x}_result_t ${X}_APICALL ${th.make_func_name(n, tags, obj)}( %for line in th.make_param_lines(n, tags, obj): ${line} %endfor ) { context.logger->log_trace("${th.make_func_name(n, tags, obj)}(${", ".join(th.make_param_lines(n, tags, obj, format=["name", "local"]))})"); auto ${th.make_pfn_name(n, tags, obj)} = context.${n}DdiTable.${th.get_table_name(n, tags, obj)}.${th.make_pfn_name(n, tags, obj)}; if( nullptr == ${th.make_pfn_name(n, tags, obj)} ) return logAndPropagateResult("${th.make_func_name(n, tags, obj)}", ${X}_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->${n}Validation->${th.make_func_name(n, tags, obj)}Prologue( \ % for line in th.make_param_lines(n, tags, obj, format=['name','delim']): ${line} \ %endfor ); if(result!=${X}_RESULT_SUCCESS) return logAndPropagateResult("${th.make_func_name(n, tags, obj)}", result); } if( context.enableThreadingValidation ){ //Unimplemented } <% func_name = th.make_func_name(n, tags, obj) generate_post_call = re.match(r"\w+Create\w*$|\w+Get$|\w+Get\w*Exp$|\w+GetIpcHandle$|\w+GetSubDevices$", func_name) %> if(context.enableHandleLifetime ){ auto result = context.handleLifetime->${n}HandleLifetime.${th.make_func_name(n, tags, obj)}Prologue( \ % for line in th.make_param_lines(n, tags, obj, format=['name','delim']): ${line} \ %endfor ); if(result!=${X}_RESULT_SUCCESS) return logAndPropagateResult("${th.make_func_name(n, tags, obj)}", result); } auto driver_result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->${n}Validation->${th.make_func_name(n, tags, obj)}Epilogue( \ % for line in th.make_param_lines(n, tags, obj, format=['name','delim']): ${line} \ %endfor ,driver_result); if(result!=${X}_RESULT_SUCCESS) return logAndPropagateResult("${th.make_func_name(n, tags, obj)}", result); } %if generate_post_call: if( driver_result == ${X}_RESULT_SUCCESS && context.enableHandleLifetime ){ ## Add 'Created' handles/objects to dependent maps <% lines = th.make_param_lines(n, tags, obj, format=['name','delim']) %> %for i, item in enumerate(th.get_loader_epilogue(n, tags, obj, meta)): %if 'range' in item: for (size_t i = ${item['range'][0]}; ( nullptr != ${item['name']}) && (i < ${item['range'][1]}); ++i){ if (${item['name']}[i]){ context.handleLifetime->addHandle( ${item['name']}[i] ); %if th.type_traits.is_handle(item['type']): context.handleLifetime->addDependent( ${lines[0]} ${item['name']}[i] ); %endif } } %else: if (${item['name']}){ %if re.match(r"\w+Immediate$", func_name): context.handleLifetime->addHandle( *${item['name']} , false); %else: context.handleLifetime->addHandle( *${item['name']} ); %if th.type_traits.is_handle(item['type']): context.handleLifetime->addDependent( ${lines[0]} *${item['name']} ); %endif %endif } %endif %endfor } %endif return logAndPropagateResult("${th.make_func_name(n, tags, obj)}", driver_result); } %if 'condition' in obj: #endif // ${th.subt(n, tags, obj['condition'])} %endif %endfor } // namespace validation_layer #if defined(__cplusplus) extern "C" { #endif %for tbl in th.get_pfntables(specs, meta, n, tags): /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ${tbl['name']} table /// with current process' addresses /// /// @returns /// - ::${X}_RESULT_SUCCESS /// - ::${X}_RESULT_ERROR_INVALID_NULL_POINTER /// - ::${X}_RESULT_ERROR_UNSUPPORTED_VERSION ${X}_DLLEXPORT ${x}_result_t ${X}_APICALL ${tbl['export']['name']}( %for line in th.make_param_lines(n, tags, tbl['export']): ${line} %endfor ) { auto& dditable = validation_layer::context.${n}DdiTable.${tbl['name']}; if( nullptr == pDdiTable ) return ${X}_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ${X}_RESULT_ERROR_UNSUPPORTED_VERSION; ${x}_result_t result = ${X}_RESULT_SUCCESS; %for obj in tbl['functions']: %if 'condition' in obj: #if ${th.subt(n, tags, obj['condition'])} %endif dditable.${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = pDdiTable->${th.make_pfn_name(n, tags, obj)}; pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = validation_layer::${th.make_func_name(n, tags, obj)}; %if 'condition' in obj: #else dditable.${th.append_ws(th.make_pfn_name(n, tags, obj), 43)} = nullptr; pDdiTable->${th.append_ws(th.make_pfn_name(n, tags, obj), 41)} = nullptr; #endif %endif %endfor return result; } %endfor #if defined(__cplusplus) }; #endif level-zero-1.20.6/scripts/util.py000066400000000000000000000011401475521542100167040ustar00rootroot00000000000000""" Copyright (C) 2019-2021 Intel Corporation SPDX-License-Identifier: MIT """ import re import json from mako.template import Template makoFileList = [] def makoWrite(inpath, outpath, **args): template = Template(filename=inpath) rendered = template.render(**args) rendered = re.sub(r"\r\n", r"\n", rendered) with open(outpath, 'w') as fout: fout.write(rendered) makoFileList.append(outpath) return len(rendered.splitlines()) def makoFileListWrite(outpath): with open(outpath, 'w') as fout: fout.write(json.dumps(makoFileList, indent=4, sort_keys=True)) level-zero-1.20.6/source/000077500000000000000000000000001475521542100151725ustar00rootroot00000000000000level-zero-1.20.6/source/CMakeLists.txt000066400000000000000000000043161475521542100177360ustar00rootroot00000000000000# Copyright (C) 2020 Intel Corporation # SPDX-License-Identifier: MIT add_definitions(-DL0_LOADER_VERSION="${PROJECT_VERSION_MAJOR}") add_definitions(-DL0_VALIDATION_LAYER_SUPPORTED_VERSION="${PROJECT_VERSION_MAJOR}") include_directories(${CMAKE_CURRENT_SOURCE_DIR}/inc) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ZeLoaderVersion.rc.in ${CMAKE_CURRENT_BINARY_DIR}/ZeLoaderVersion.rc @ONLY) include(GNUInstallDirs) add_library(${TARGET_LOADER_NAME} SHARED "" ${CMAKE_CURRENT_BINARY_DIR}/ZeLoaderVersion.rc ) add_subdirectory(lib) add_subdirectory(loader) add_subdirectory(layers) add_subdirectory(drivers) add_subdirectory(utils) set_target_properties(${TARGET_LOADER_NAME} PROPERTIES VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" SOVERSION "${PROJECT_VERSION_MAJOR}" ) target_link_libraries(${TARGET_LOADER_NAME} PRIVATE ${CMAKE_DL_LIBS} level_zero_utils) if (UNIX) set(CMAKE_THREAD_PREFER_PTHREAD TRUE) set(THREADS_PREFER_PTHREAD_FLAG TRUE) find_package(Threads REQUIRED) target_link_libraries (${TARGET_LOADER_NAME} PRIVATE Threads::Threads) endif() if(WIN32) target_link_libraries (${TARGET_LOADER_NAME} PRIVATE cfgmgr32.lib) endif() install(TARGETS ze_loader ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero-devel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT level-zero LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero NAMELINK_COMPONENT level-zero-devel ) file(RELATIVE_PATH pkgconfig_prefix "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" "${CMAKE_INSTALL_PREFIX}") file(RELATIVE_PATH pkgconfig_include_dir "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_FULL_INCLUDEDIR}") file(RELATIVE_PATH pkgconfig_lib_dir "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_FULL_LIBDIR}") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libze_loader.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libze_loader.pc @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/level-zero.pc.in ${CMAKE_CURRENT_BINARY_DIR}/level-zero.pc @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libze_loader.pc" "${CMAKE_CURRENT_BINARY_DIR}/level-zero.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig" COMPONENT level-zero-devel) level-zero-1.20.6/source/ZeLoaderVersion.rc.in000066400000000000000000000023621475521542100212030ustar00rootroot00000000000000#define VER_FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@ #define VER_FILEVERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@\0" #define VER_PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@ #define VER_PRODUCTVERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@\0" #define VER_FILEDESCRIPTION_STR "oneAPI Level Zero Loader for Windows(R) Level Zero Drivers" #define VER_PRODUCT_NAME_STR "oneAPI Level Zero Loader for Windows(R)" #define VER_LEGALCOPYRIGHT_STR "Copyright (C) 2023 Intel Corporation" 1 VERSIONINFO FILEVERSION VER_FILEVERSION PRODUCTVERSION VER_PRODUCTVERSION BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904E4" BEGIN VALUE "FileDescription", VER_FILEDESCRIPTION_STR VALUE "FileVersion", VER_FILEVERSION_STR VALUE "ProductVersion", VER_PRODUCTVERSION_STR VALUE "ProductName", VER_PRODUCT_NAME_STR VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1252 END ENDlevel-zero-1.20.6/source/drivers/000077500000000000000000000000001475521542100166505ustar00rootroot00000000000000level-zero-1.20.6/source/drivers/CMakeLists.txt000066400000000000000000000000261475521542100214060ustar00rootroot00000000000000add_subdirectory(null)level-zero-1.20.6/source/drivers/null/000077500000000000000000000000001475521542100176225ustar00rootroot00000000000000level-zero-1.20.6/source/drivers/null/CMakeLists.txt000066400000000000000000000021461475521542100223650ustar00rootroot00000000000000set(TARGET_NAME ze_null) add_library(${TARGET_NAME} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/ze_null.h ${CMAKE_CURRENT_SOURCE_DIR}/ze_null.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_nullddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zet_nullddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zes_nullddi.cpp ) set_target_properties(${TARGET_NAME} PROPERTIES VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" SOVERSION "${PROJECT_VERSION_MAJOR}" ) target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) if(INSTALL_NULL_DRIVER) install(TARGETS ze_null ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero-devel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT level-zero LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero NAMELINK_COMPONENT level-zero-devel ) endif() if(UNIX) set(GCC_COVERAGE_COMPILE_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden -fno-strict-aliasing") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}") endif()level-zero-1.20.6/source/drivers/null/ze_null.cpp000066400000000000000000000367051475521542100220110ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_null.cpp * */ #include "ze_null.h" namespace driver { ////////////////////////////////////////////////////////////////////////// context_t context; ////////////////////////////////////////////////////////////////////////// context_t::context_t() { zesDdiTable.Driver.pfnGet = []( uint32_t* pCount, ze_driver_handle_t* phDrivers ) { *pCount = 1; if( nullptr != phDrivers ) *reinterpret_cast( phDrivers ) = context.get(); return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Driver.pfnGet = []( uint32_t* pCount, ze_driver_handle_t* phDrivers ) { *pCount = 1; if( nullptr != phDrivers ) *reinterpret_cast( phDrivers ) = context.get(); return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Device.pfnGet = []( ze_driver_handle_t, uint32_t* pCount, ze_device_handle_t* phDevices ) { *pCount = 1; if( nullptr != phDevices ) *reinterpret_cast( phDevices ) = context.get(); return ZE_RESULT_SUCCESS; }; //pfnCreateEventPool ////////////////////////////////////////////////////////////////////////// zeDdiTable.Driver.pfnGetApiVersion = []( ze_driver_handle_t, ze_api_version_t* version ) { *version = context.version; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Driver.pfnGetProperties = []( ze_driver_handle_t, ze_driver_properties_t* pDriverProperties ) { ze_driver_properties_t driverProperties = {}; driverProperties.stype = ZE_STRUCTURE_TYPE_DRIVER_PROPERTIES; //driverProperties.uuid driverProperties.driverVersion = 0; *pDriverProperties = driverProperties; return ZE_RESULT_SUCCESS; }; //pfnGetIPCProperties ////////////////////////////////////////////////////////////////////////// zeDdiTable.Mem.pfnAllocShared = []( ze_context_handle_t, const ze_device_mem_alloc_desc_t*, const ze_host_mem_alloc_desc_t*, size_t size, size_t alignment, ze_device_handle_t, void** pptr) { *pptr = malloc(size); return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Mem.pfnAllocDevice = []( ze_context_handle_t, const ze_device_mem_alloc_desc_t*, size_t size, size_t alignment, ze_device_handle_t, void** pptr) { *pptr = malloc(size); return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Mem.pfnAllocHost = []( ze_context_handle_t, const ze_host_mem_alloc_desc_t*, size_t size, size_t alignment, void** pptr) { *pptr = malloc(size); return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Mem.pfnFree = []( ze_context_handle_t, void* ptr) { free(ptr); return ZE_RESULT_SUCCESS; }; //pfnGetMemProperties //pfnGetMemAddressRange //pfnGetMemIpcHandle //pfnOpenMemIpcHandle //pfnCloseMemIpcHandle ////////////////////////////////////////////////////////////////////////// //pfnGetSubDevices ////////////////////////////////////////////////////////////////////////// zeDdiTable.Device.pfnGetProperties = []( ze_device_handle_t, ze_device_properties_t* pDeviceProperties ) { ze_device_properties_t deviceProperties = {}; deviceProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES; deviceProperties.type = ZE_DEVICE_TYPE_GPU; #if defined(_WIN32) strcpy_s( deviceProperties.name, "Null Device" ); #else strcpy( deviceProperties.name, "Null Device" ); #endif *pDeviceProperties = deviceProperties; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Device.pfnGetComputeProperties = []( ze_device_handle_t, ze_device_compute_properties_t* pComputeProperties ) { ze_device_compute_properties_t computeProperties = {}; computeProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_COMPUTE_PROPERTIES; *pComputeProperties = computeProperties; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Device.pfnGetCommandQueueGroupProperties = []( ze_device_handle_t, uint32_t* pCount, ze_command_queue_group_properties_t* pCommandQueueGroupProperties ) { if( nullptr != pCommandQueueGroupProperties ) { ze_command_queue_group_properties_t commandQueueGroupProperties = {}; commandQueueGroupProperties.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_GROUP_PROPERTIES; commandQueueGroupProperties.flags = ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY | ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE; *pCommandQueueGroupProperties = commandQueueGroupProperties; } *pCount = 1; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Device.pfnGetMemoryProperties = []( ze_device_handle_t, uint32_t* pCount, ze_device_memory_properties_t* pMemProperties ) { ze_device_memory_properties_t memoryProperties = {}; memoryProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_MEMORY_PROPERTIES; *pCount = 1; if( nullptr != pMemProperties ) *pMemProperties = memoryProperties; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Device.pfnGetMemoryAccessProperties = []( ze_device_handle_t, ze_device_memory_access_properties_t* pMemAccessProperties ) { ze_device_memory_access_properties_t memoryAccessProperties = {}; memoryAccessProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_MEMORY_ACCESS_PROPERTIES; *pMemAccessProperties = memoryAccessProperties; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Device.pfnGetCacheProperties = []( ze_device_handle_t, uint32_t* pCount, ze_device_cache_properties_t* pCacheProperties ) { if( nullptr != pCacheProperties ) { ze_device_cache_properties_t cacheProperties = {}; cacheProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_CACHE_PROPERTIES; *pCacheProperties = cacheProperties; } *pCount = 1; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Device.pfnGetImageProperties = []( ze_device_handle_t, ze_device_image_properties_t* pImageProperties ) { ze_device_image_properties_t imageProperties = {}; imageProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_IMAGE_PROPERTIES; *pImageProperties = imageProperties; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zeDdiTable.Driver.pfnGetExtensionProperties = []( ze_driver_handle_t, uint32_t* pCount, ze_driver_extension_properties_t* pExtensionProperties ) { if( nullptr != pExtensionProperties ) { ze_driver_extension_properties_t driverExtensionProperties = {}; #if defined(_WIN32) strcpy_s( driverExtensionProperties.name, ZET_API_TRACING_EXP_NAME ); #else strcpy( driverExtensionProperties.name, ZET_API_TRACING_EXP_NAME ); #endif driverExtensionProperties.version = ZET_API_TRACING_EXP_VERSION_1_0; *pExtensionProperties = driverExtensionProperties; } *pCount = 1; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zetDdiTable.MetricGroup.pfnGet = []( zet_device_handle_t, uint32_t* pCount, zet_metric_group_handle_t* phMetricGroups ) { *pCount = 1; if( nullptr != phMetricGroups ) *reinterpret_cast( phMetricGroups ) = context.get(); return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zetDdiTable.MetricGroup.pfnGetProperties = []( zet_metric_group_handle_t, zet_metric_group_properties_t* pProperties ) { zet_metric_group_properties_t metricGroupProperties = {}; metricGroupProperties.stype = ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES; metricGroupProperties.metricCount = 1; metricGroupProperties.samplingType = ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED | ZET_METRIC_GROUP_SAMPLING_TYPE_FLAG_TIME_BASED; #if defined(_WIN32) strcpy_s( metricGroupProperties.name, "Null Metric Group" ); #else strcpy( metricGroupProperties.name, "Null Metric Group" ); #endif *pProperties = metricGroupProperties; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zetDdiTable.MetricGroup.pfnCalculateMetricValues = []( zet_metric_group_handle_t, zet_metric_group_calculation_type_t, size_t, const uint8_t*, uint32_t* pMetricValueCount, zet_typed_value_t* pMetricValues ) { *pMetricValueCount = 1; if( pMetricValues ) *pMetricValues = {}; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zetDdiTable.Metric.pfnGet = []( zet_metric_group_handle_t, uint32_t* pCount, zet_metric_handle_t* phMetrics ) { *pCount = 1; if( nullptr != phMetrics ) *reinterpret_cast( phMetrics ) = context.get(); return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zetDdiTable.Metric.pfnGetProperties = []( zet_metric_handle_t, zet_metric_properties_t* pProperties ) { zet_metric_properties_t metricProperties = {}; metricProperties.stype = ZET_STRUCTURE_TYPE_METRIC_PROPERTIES; metricProperties.metricType = ZET_METRIC_TYPE_DURATION; metricProperties.resultType = ZET_VALUE_TYPE_UINT32; #if defined(_WIN32) strcpy_s( metricProperties.name, "Null Metric" ); strcpy_s( metricProperties.resultUnits, "ns" ); #else strcpy( metricProperties.name, "Null Metric" ); strcpy( metricProperties.resultUnits, "ns" ); #endif *pProperties = metricProperties; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zetDdiTable.MetricQuery.pfnGetData = []( zet_metric_query_handle_t, size_t* pRawDataSize, uint8_t* pRawData ) { *pRawDataSize = 1; if( pRawData ) *pRawData = 0; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// zetDdiTable.MetricStreamer.pfnReadData = []( zet_metric_streamer_handle_t, uint32_t, size_t* pRawDataSize, uint8_t* pRawData ) { *pRawDataSize = 1; if( pRawData ) *pRawData = 0; return ZE_RESULT_SUCCESS; }; } } // namespace driver namespace instrumented { ////////////////////////////////////////////////////////////////////////// context_t context; ////////////////////////////////////////////////////////////////////////// context_t::context_t() { ////////////////////////////////////////////////////////////////////////// enableTracing = getenv_tobool( "ZET_ENABLE_API_TRACING_EXP" ); if( enableTracing ) { tracerData.emplace_back(); // reserve index 0 ////////////////////////////////////////////////////////////////////////// driver::context.zetDdiTable.TracerExp.pfnCreate = []( zet_context_handle_t, const zet_tracer_exp_desc_t* desc, zet_tracer_exp_handle_t* phTracer ) { context.tracerData.emplace_back(); auto index = context.tracerData.size() - 1; context.tracerData[ index ].userData = desc->pUserData; *phTracer = reinterpret_cast( index ); return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// driver::context.zetDdiTable.TracerExp.pfnSetPrologues = []( zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t* pCoreCbs) { auto index = reinterpret_cast( hTracer ); context.tracerData[ index ].zePrologueCbs = *pCoreCbs; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// driver::context.zetDdiTable.TracerExp.pfnSetEpilogues = []( zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t* pCoreCbs) { auto index = reinterpret_cast( hTracer ); context.tracerData[ index ].zeEpilogueCbs = *pCoreCbs; return ZE_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// driver::context.zetDdiTable.TracerExp.pfnSetEnabled = []( zet_tracer_exp_handle_t hTracer, ze_bool_t enable ) { auto index = reinterpret_cast( hTracer ); context.tracerData[ index ].enabled = enable; return ZE_RESULT_SUCCESS; }; } } } // namespace instrumented level-zero-1.20.6/source/drivers/null/ze_null.h000066400000000000000000000027321475521542100214470ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_null.h * */ #pragma once #include #include #include "ze_ddi.h" #include "zet_ddi.h" #include "zes_ddi.h" #include "ze_util.h" namespace driver { /////////////////////////////////////////////////////////////////////////////// class __zedlllocal context_t { public: ze_api_version_t version = ZE_API_VERSION_CURRENT; ze_dditable_t zeDdiTable = {}; zet_dditable_t zetDdiTable = {}; zes_dditable_t zesDdiTable = {}; context_t(); ~context_t() = default; void* get( void ) { static uint64_t count = 0x80800000; return reinterpret_cast( ++count ); } }; extern context_t context; } // namespace driver namespace instrumented { ////////////////////////////////////////////////////////////////////////// struct tracer_data_t { ze_bool_t enabled = false; void* userData = nullptr; ze_callbacks_t zePrologueCbs = {}; ze_callbacks_t zeEpilogueCbs = {}; }; /////////////////////////////////////////////////////////////////////////////// class __zedlllocal context_t { public: ze_bool_t enableTracing = false; std::vector< tracer_data_t > tracerData; context_t(); ~context_t() = default; }; extern context_t context; } // namespace instrumented level-zero-1.20.6/source/drivers/null/ze_nullddi.cpp000066400000000000000000010426031475521542100224650ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_nullddi.cpp * */ #include "ze_null.h" #include namespace driver { /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeInit __zedlllocal ze_result_t ZE_APICALL zeInit( ze_init_flags_t flags ///< [in] initialization flags. ///< must be 0 (default) or a combination of ::ze_init_flag_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnInit = context.zeDdiTable.Global.pfnInit; if( nullptr != pfnInit ) { result = pfnInit( flags ); } else { // generic implementation auto driver_type = getenv_string( "ZEL_TEST_NULL_DRIVER_TYPE" ); if (std::strcmp(driver_type.c_str(), "GPU") == 0) { if (!(flags & ZE_INIT_FLAG_GPU_ONLY)) { return ZE_RESULT_ERROR_UNINITIALIZED; } } if (std::strcmp(driver_type.c_str(), "NPU") == 0) { if (!(flags & ZE_INIT_FLAG_VPU_ONLY)) { return ZE_RESULT_ERROR_UNINITIALIZED; } } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGet __zedlllocal ze_result_t ZE_APICALL zeDriverGet( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGet = context.zeDdiTable.Driver.pfnGet; if( nullptr != pfnGet ) { result = pfnGet( pCount, phDrivers ); } else { // generic implementation for( size_t i = 0; ( nullptr != phDrivers ) && ( i < *pCount ); ++i ) phDrivers[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeInitDrivers __zedlllocal ze_result_t ZE_APICALL zeInitDrivers( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers, ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ze_init_driver_type_desc_t* desc ///< [in] descriptor containing the driver type initialization details ///< including ::ze_init_driver_type_flag_t combinations. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnInitDrivers = context.zeDdiTable.Global.pfnInitDrivers; if( nullptr != pfnInitDrivers ) { result = pfnInitDrivers( pCount, phDrivers, desc ); } else { // generic implementation auto driver_type = getenv_string( "ZEL_TEST_NULL_DRIVER_TYPE" ); if (std::strcmp(driver_type.c_str(), "GPU") == 0) { if (!(desc->flags & ZE_INIT_DRIVER_TYPE_FLAG_GPU)) { return ZE_RESULT_ERROR_UNINITIALIZED; } } if (std::strcmp(driver_type.c_str(), "NPU") == 0) { if (!(desc->flags & ZE_INIT_DRIVER_TYPE_FLAG_NPU)) { return ZE_RESULT_ERROR_UNINITIALIZED; } } if (phDrivers == nullptr) { *pCount = 1; } for( size_t i = 0; ( nullptr != phDrivers ) && ( i < *pCount ); ++i ) phDrivers[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetApiVersion __zedlllocal ze_result_t ZE_APICALL zeDriverGetApiVersion( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_api_version_t* version ///< [out] api version ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetApiVersion = context.zeDdiTable.Driver.pfnGetApiVersion; if( nullptr != pfnGetApiVersion ) { result = pfnGetApiVersion( hDriver, version ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetProperties __zedlllocal ze_result_t ZE_APICALL zeDriverGetProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_properties_t* pDriverProperties ///< [in,out] query result for driver properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zeDdiTable.Driver.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hDriver, pDriverProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetIpcProperties __zedlllocal ze_result_t ZE_APICALL zeDriverGetIpcProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_ipc_properties_t* pIpcProperties ///< [in,out] query result for IPC properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetIpcProperties = context.zeDdiTable.Driver.pfnGetIpcProperties; if( nullptr != pfnGetIpcProperties ) { result = pfnGetIpcProperties( hDriver, pIpcProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetExtensionProperties __zedlllocal ze_result_t ZE_APICALL zeDriverGetExtensionProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. ze_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetExtensionProperties = context.zeDdiTable.Driver.pfnGetExtensionProperties; if( nullptr != pfnGetExtensionProperties ) { result = pfnGetExtensionProperties( hDriver, pCount, pExtensionProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetExtensionFunctionAddress __zedlllocal ze_result_t ZE_APICALL zeDriverGetExtensionFunctionAddress( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetExtensionFunctionAddress = context.zeDdiTable.Driver.pfnGetExtensionFunctionAddress; if( nullptr != pfnGetExtensionFunctionAddress ) { result = pfnGetExtensionFunctionAddress( hDriver, name, ppFunctionAddress ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetLastErrorDescription __zedlllocal ze_result_t ZE_APICALL zeDriverGetLastErrorDescription( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char** ppString ///< [in,out] pointer to a null-terminated array of characters describing ///< cause of error. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetLastErrorDescription = context.zeDdiTable.Driver.pfnGetLastErrorDescription; if( nullptr != pfnGetLastErrorDescription ) { result = pfnGetLastErrorDescription( hDriver, ppString ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGet __zedlllocal ze_result_t ZE_APICALL zeDeviceGet( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of devices. ///< if count is zero, then the driver shall update the value with the ///< total number of devices available. ///< if count is greater than the number of devices available, then the ///< driver shall update the value with the correct number of devices available. ze_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of devices. ///< if count is less than the number of devices available, then driver ///< shall only retrieve that number of devices. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGet = context.zeDdiTable.Device.pfnGet; if( nullptr != pfnGet ) { result = pfnGet( hDriver, pCount, phDevices ); } else { // generic implementation for( size_t i = 0; ( nullptr != phDevices ) && ( i < *pCount ); ++i ) phDevices[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetRootDevice __zedlllocal ze_result_t ZE_APICALL zeDeviceGetRootDevice( ze_device_handle_t hDevice, ///< [in] handle of the device object ze_device_handle_t* phRootDevice ///< [in,out] parent root device. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetRootDevice = context.zeDdiTable.Device.pfnGetRootDevice; if( nullptr != pfnGetRootDevice ) { result = pfnGetRootDevice( hDevice, phRootDevice ); } else { // generic implementation *phRootDevice = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetSubDevices __zedlllocal ze_result_t ZE_APICALL zeDeviceGetSubDevices( ze_device_handle_t hDevice, ///< [in] handle of the device object uint32_t* pCount, ///< [in,out] pointer to the number of sub-devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-devices available. ///< if count is greater than the number of sub-devices available, then the ///< driver shall update the value with the correct number of sub-devices available. ze_device_handle_t* phSubdevices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-devices. ///< if count is less than the number of sub-devices available, then driver ///< shall only retrieve that number of sub-devices. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetSubDevices = context.zeDdiTable.Device.pfnGetSubDevices; if( nullptr != pfnGetSubDevices ) { result = pfnGetSubDevices( hDevice, pCount, phSubdevices ); } else { // generic implementation for( size_t i = 0; ( nullptr != phSubdevices ) && ( i < *pCount ); ++i ) phSubdevices[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_properties_t* pDeviceProperties ///< [in,out] query result for device properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zeDdiTable.Device.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hDevice, pDeviceProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetComputeProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetComputeProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_compute_properties_t* pComputeProperties ///< [in,out] query result for compute properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetComputeProperties = context.zeDdiTable.Device.pfnGetComputeProperties; if( nullptr != pfnGetComputeProperties ) { result = pfnGetComputeProperties( hDevice, pComputeProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetModuleProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetModuleProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_module_properties_t* pModuleProperties///< [in,out] query result for module properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetModuleProperties = context.zeDdiTable.Device.pfnGetModuleProperties; if( nullptr != pfnGetModuleProperties ) { result = pfnGetModuleProperties( hDevice, pModuleProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetCommandQueueGroupProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetCommandQueueGroupProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of command queue group properties. ///< if count is zero, then the driver shall update the value with the ///< total number of command queue group properties available. ///< if count is greater than the number of command queue group properties ///< available, then the driver shall update the value with the correct ///< number of command queue group properties available. ze_command_queue_group_properties_t* pCommandQueueGroupProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< command queue group properties. ///< if count is less than the number of command queue group properties ///< available, then driver shall only retrieve that number of command ///< queue group properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetCommandQueueGroupProperties = context.zeDdiTable.Device.pfnGetCommandQueueGroupProperties; if( nullptr != pfnGetCommandQueueGroupProperties ) { result = pfnGetCommandQueueGroupProperties( hDevice, pCount, pCommandQueueGroupProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetMemoryProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetMemoryProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of memory properties. ///< if count is zero, then the driver shall update the value with the ///< total number of memory properties available. ///< if count is greater than the number of memory properties available, ///< then the driver shall update the value with the correct number of ///< memory properties available. ze_device_memory_properties_t* pMemProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< memory properties. ///< if count is less than the number of memory properties available, then ///< driver shall only retrieve that number of memory properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetMemoryProperties = context.zeDdiTable.Device.pfnGetMemoryProperties; if( nullptr != pfnGetMemoryProperties ) { result = pfnGetMemoryProperties( hDevice, pCount, pMemProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetMemoryAccessProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetMemoryAccessProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_memory_access_properties_t* pMemAccessProperties ///< [in,out] query result for memory access properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetMemoryAccessProperties = context.zeDdiTable.Device.pfnGetMemoryAccessProperties; if( nullptr != pfnGetMemoryAccessProperties ) { result = pfnGetMemoryAccessProperties( hDevice, pMemAccessProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetCacheProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetCacheProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of cache properties. ///< if count is zero, then the driver shall update the value with the ///< total number of cache properties available. ///< if count is greater than the number of cache properties available, ///< then the driver shall update the value with the correct number of ///< cache properties available. ze_device_cache_properties_t* pCacheProperties ///< [in,out][optional][range(0, *pCount)] array of query results for cache properties. ///< if count is less than the number of cache properties available, then ///< driver shall only retrieve that number of cache properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetCacheProperties = context.zeDdiTable.Device.pfnGetCacheProperties; if( nullptr != pfnGetCacheProperties ) { result = pfnGetCacheProperties( hDevice, pCount, pCacheProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetImageProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetImageProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_image_properties_t* pImageProperties ///< [in,out] query result for image properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetImageProperties = context.zeDdiTable.Device.pfnGetImageProperties; if( nullptr != pfnGetImageProperties ) { result = pfnGetImageProperties( hDevice, pImageProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetExternalMemoryProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetExternalMemoryProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_external_memory_properties_t* pExternalMemoryProperties ///< [in,out] query result for external memory properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetExternalMemoryProperties = context.zeDdiTable.Device.pfnGetExternalMemoryProperties; if( nullptr != pfnGetExternalMemoryProperties ) { result = pfnGetExternalMemoryProperties( hDevice, pExternalMemoryProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetP2PProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetP2PProperties( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_device_p2p_properties_t* pP2PProperties ///< [in,out] Peer-to-Peer properties between source and peer device ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetP2PProperties = context.zeDdiTable.Device.pfnGetP2PProperties; if( nullptr != pfnGetP2PProperties ) { result = pfnGetP2PProperties( hDevice, hPeerDevice, pP2PProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceCanAccessPeer __zedlllocal ze_result_t ZE_APICALL zeDeviceCanAccessPeer( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_bool_t* value ///< [out] returned access capability ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCanAccessPeer = context.zeDdiTable.Device.pfnCanAccessPeer; if( nullptr != pfnCanAccessPeer ) { result = pfnCanAccessPeer( hDevice, hPeerDevice, value ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetStatus __zedlllocal ze_result_t ZE_APICALL zeDeviceGetStatus( ze_device_handle_t hDevice ///< [in] handle of the device ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetStatus = context.zeDdiTable.Device.pfnGetStatus; if( nullptr != pfnGetStatus ) { result = pfnGetStatus( hDevice ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetGlobalTimestamps __zedlllocal ze_result_t ZE_APICALL zeDeviceGetGlobalTimestamps( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the ///< Host's global timestamp value. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetGlobalTimestamps = context.zeDdiTable.Device.pfnGetGlobalTimestamps; if( nullptr != pfnGetGlobalTimestamps ) { result = pfnGetGlobalTimestamps( hDevice, hostTimestamp, deviceTimestamp ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreate __zedlllocal ze_result_t ZE_APICALL zeContextCreate( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zeDdiTable.Context.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hDriver, desc, phContext ); } else { // generic implementation *phContext = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreateEx __zedlllocal ze_result_t ZE_APICALL zeContextCreateEx( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< context has visibility. ///< if nullptr, then all devices and any sub-devices supported by the ///< driver instance are ///< visible to the context. ///< otherwise, the context only has visibility to the devices and any ///< sub-devices of the ///< devices in this array. ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreateEx = context.zeDdiTable.Context.pfnCreateEx; if( nullptr != pfnCreateEx ) { result = pfnCreateEx( hDriver, desc, numDevices, phDevices, phContext ); } else { // generic implementation *phContext = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextDestroy __zedlllocal ze_result_t ZE_APICALL zeContextDestroy( ze_context_handle_t hContext ///< [in][release] handle of context object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zeDdiTable.Context.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hContext ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextGetStatus __zedlllocal ze_result_t ZE_APICALL zeContextGetStatus( ze_context_handle_t hContext ///< [in] handle of context object ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetStatus = context.zeDdiTable.Context.pfnGetStatus; if( nullptr != pfnGetStatus ) { result = pfnGetStatus( hContext ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueCreate __zedlllocal ze_result_t ZE_APICALL zeCommandQueueCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* desc, ///< [in] pointer to command queue descriptor ze_command_queue_handle_t* phCommandQueue ///< [out] pointer to handle of command queue object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zeDdiTable.CommandQueue.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hContext, hDevice, desc, phCommandQueue ); } else { // generic implementation *phCommandQueue = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueDestroy __zedlllocal ze_result_t ZE_APICALL zeCommandQueueDestroy( ze_command_queue_handle_t hCommandQueue ///< [in][release] handle of command queue object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zeDdiTable.CommandQueue.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hCommandQueue ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueExecuteCommandLists __zedlllocal ze_result_t ZE_APICALL zeCommandQueueExecuteCommandLists( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t numCommandLists, ///< [in] number of command lists to execute ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] list of handles of the command lists ///< to execute ze_fence_handle_t hFence ///< [in][optional] handle of the fence to signal on completion ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnExecuteCommandLists = context.zeDdiTable.CommandQueue.pfnExecuteCommandLists; if( nullptr != pfnExecuteCommandLists ) { result = pfnExecuteCommandLists( hCommandQueue, numCommandLists, phCommandLists, hFence ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueSynchronize __zedlllocal ze_result_t ZE_APICALL zeCommandQueueSynchronize( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the command queue; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSynchronize = context.zeDdiTable.CommandQueue.pfnSynchronize; if( nullptr != pfnSynchronize ) { result = pfnSynchronize( hCommandQueue, timeout ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueGetOrdinal __zedlllocal ze_result_t ZE_APICALL zeCommandQueueGetOrdinal( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pOrdinal ///< [out] command queue group ordinal ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetOrdinal = context.zeDdiTable.CommandQueue.pfnGetOrdinal; if( nullptr != pfnGetOrdinal ) { result = pfnGetOrdinal( hCommandQueue, pOrdinal ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueGetIndex __zedlllocal ze_result_t ZE_APICALL zeCommandQueueGetIndex( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pIndex ///< [out] command queue index within the group ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetIndex = context.zeDdiTable.CommandQueue.pfnGetIndex; if( nullptr != pfnGetIndex ) { result = pfnGetIndex( hCommandQueue, pIndex ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListCreate __zedlllocal ze_result_t ZE_APICALL zeCommandListCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_list_desc_t* desc, ///< [in] pointer to command list descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zeDdiTable.CommandList.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hContext, hDevice, desc, phCommandList ); } else { // generic implementation *phCommandList = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListCreateImmediate __zedlllocal ze_result_t ZE_APICALL zeCommandListCreateImmediate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* altdesc, ///< [in] pointer to command queue descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreateImmediate = context.zeDdiTable.CommandList.pfnCreateImmediate; if( nullptr != pfnCreateImmediate ) { result = pfnCreateImmediate( hContext, hDevice, altdesc, phCommandList ); } else { // generic implementation *phCommandList = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListDestroy __zedlllocal ze_result_t ZE_APICALL zeCommandListDestroy( ze_command_list_handle_t hCommandList ///< [in][release] handle of command list object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zeDdiTable.CommandList.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hCommandList ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListClose __zedlllocal ze_result_t ZE_APICALL zeCommandListClose( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to close ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnClose = context.zeDdiTable.CommandList.pfnClose; if( nullptr != pfnClose ) { result = pfnClose( hCommandList ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListReset __zedlllocal ze_result_t ZE_APICALL zeCommandListReset( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to reset ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReset = context.zeDdiTable.CommandList.pfnReset; if( nullptr != pfnReset ) { result = pfnReset( hCommandList ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendWriteGlobalTimestamp __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendWriteGlobalTimestamp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t* dstptr, ///< [in,out] pointer to memory where timestamp value will be written; must ///< be 8byte-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendWriteGlobalTimestamp = context.zeDdiTable.CommandList.pfnAppendWriteGlobalTimestamp; if( nullptr != pfnAppendWriteGlobalTimestamp ) { result = pfnAppendWriteGlobalTimestamp( hCommandList, dstptr, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListHostSynchronize __zedlllocal ze_result_t ZE_APICALL zeCommandListHostSynchronize( ze_command_list_handle_t hCommandList, ///< [in] handle of the immediate command list uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the immediate command list; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnHostSynchronize = context.zeDdiTable.CommandList.pfnHostSynchronize; if( nullptr != pfnHostSynchronize ) { result = pfnHostSynchronize( hCommandList, timeout ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetDeviceHandle __zedlllocal ze_result_t ZE_APICALL zeCommandListGetDeviceHandle( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_device_handle_t* phDevice ///< [out] handle of the device on which the command list was created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetDeviceHandle = context.zeDdiTable.CommandList.pfnGetDeviceHandle; if( nullptr != pfnGetDeviceHandle ) { result = pfnGetDeviceHandle( hCommandList, phDevice ); } else { // generic implementation *phDevice = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetContextHandle __zedlllocal ze_result_t ZE_APICALL zeCommandListGetContextHandle( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_context_handle_t* phContext ///< [out] handle of the context on which the command list was created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetContextHandle = context.zeDdiTable.CommandList.pfnGetContextHandle; if( nullptr != pfnGetContextHandle ) { result = pfnGetContextHandle( hCommandList, phContext ); } else { // generic implementation *phContext = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetOrdinal __zedlllocal ze_result_t ZE_APICALL zeCommandListGetOrdinal( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t* pOrdinal ///< [out] command queue group ordinal to which command list is submitted ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetOrdinal = context.zeDdiTable.CommandList.pfnGetOrdinal; if( nullptr != pfnGetOrdinal ) { result = pfnGetOrdinal( hCommandList, pOrdinal ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListImmediateGetIndex __zedlllocal ze_result_t ZE_APICALL zeCommandListImmediateGetIndex( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t* pIndex ///< [out] command queue index within the group to which the immediate ///< command list is submitted ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnImmediateGetIndex = context.zeDdiTable.CommandList.pfnImmediateGetIndex; if( nullptr != pfnImmediateGetIndex ) { result = pfnImmediateGetIndex( hCommandListImmediate, pIndex ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListIsImmediate __zedlllocal ze_result_t ZE_APICALL zeCommandListIsImmediate( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_bool_t* pIsImmediate ///< [out] Boolean indicating whether the command list is an immediate ///< command list (true) or not (false) ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnIsImmediate = context.zeDdiTable.CommandList.pfnIsImmediate; if( nullptr != pfnIsImmediate ) { result = pfnIsImmediate( hCommandList, pIsImmediate ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendBarrier __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendBarrier( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendBarrier = context.zeDdiTable.CommandList.pfnAppendBarrier; if( nullptr != pfnAppendBarrier ) { result = pfnAppendBarrier( hCommandList, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryRangesBarrier __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryRangesBarrier( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numRanges, ///< [in] number of memory ranges const size_t* pRangeSizes, ///< [in][range(0, numRanges)] array of sizes of memory range const void** pRanges, ///< [in][range(0, numRanges)] array of memory ranges ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendMemoryRangesBarrier = context.zeDdiTable.CommandList.pfnAppendMemoryRangesBarrier; if( nullptr != pfnAppendMemoryRangesBarrier ) { result = pfnAppendMemoryRangesBarrier( hCommandList, numRanges, pRangeSizes, pRanges, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextSystemBarrier __zedlllocal ze_result_t ZE_APICALL zeContextSystemBarrier( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice ///< [in] handle of the device ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSystemBarrier = context.zeDdiTable.Context.pfnSystemBarrier; if( nullptr != pfnSystemBarrier ) { result = pfnSystemBarrier( hContext, hDevice ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopy __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopy( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendMemoryCopy = context.zeDdiTable.CommandList.pfnAppendMemoryCopy; if( nullptr != pfnAppendMemoryCopy ) { result = pfnAppendMemoryCopy( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryFill __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryFill( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* ptr, ///< [in] pointer to memory to initialize const void* pattern, ///< [in] pointer to value to initialize memory to size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to size_t size, ///< [in] size in bytes to initialize ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendMemoryFill = context.zeDdiTable.CommandList.pfnAppendMemoryFill; if( nullptr != pfnAppendMemoryFill ) { result = pfnAppendMemoryFill( hCommandList, ptr, pattern, pattern_size, size, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyRegion __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const ze_copy_region_t* dstRegion, ///< [in] pointer to destination region to copy to uint32_t dstPitch, ///< [in] destination pitch in bytes uint32_t dstSlicePitch, ///< [in] destination slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. const void* srcptr, ///< [in] pointer to source memory to copy from const ze_copy_region_t* srcRegion, ///< [in] pointer to source region to copy from uint32_t srcPitch, ///< [in] source pitch in bytes uint32_t srcSlicePitch, ///< [in] source slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendMemoryCopyRegion = context.zeDdiTable.CommandList.pfnAppendMemoryCopyRegion; if( nullptr != pfnAppendMemoryCopyRegion ) { result = pfnAppendMemoryCopyRegion( hCommandList, dstptr, dstRegion, dstPitch, dstSlicePitch, srcptr, srcRegion, srcPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyFromContext __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyFromContext( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_context_handle_t hContextSrc, ///< [in] handle of source context object const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendMemoryCopyFromContext = context.zeDdiTable.CommandList.pfnAppendMemoryCopyFromContext; if( nullptr != pfnAppendMemoryCopyFromContext ) { result = pfnAppendMemoryCopyFromContext( hCommandList, dstptr, hContextSrc, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopy __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopy( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendImageCopy = context.zeDdiTable.CommandList.pfnAppendImageCopy; if( nullptr != pfnAppendImageCopy ) { result = pfnAppendImageCopy( hCommandList, hDstImage, hSrcImage, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyRegion __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendImageCopyRegion = context.zeDdiTable.CommandList.pfnAppendImageCopyRegion; if( nullptr != pfnAppendImageCopyRegion ) { result = pfnAppendImageCopyRegion( hCommandList, hDstImage, hSrcImage, pDstRegion, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyToMemory __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemory( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendImageCopyToMemory = context.zeDdiTable.CommandList.pfnAppendImageCopyToMemory; if( nullptr != pfnAppendImageCopyToMemory ) { result = pfnAppendImageCopyToMemory( hCommandList, dstptr, hSrcImage, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyFromMemory __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyFromMemory( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendImageCopyFromMemory = context.zeDdiTable.CommandList.pfnAppendImageCopyFromMemory; if( nullptr != pfnAppendImageCopyFromMemory ) { result = pfnAppendImageCopyFromMemory( hCommandList, hDstImage, srcptr, pDstRegion, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryPrefetch __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryPrefetch( ze_command_list_handle_t hCommandList, ///< [in] handle of command list const void* ptr, ///< [in] pointer to start of the memory range to prefetch size_t size ///< [in] size in bytes of the memory range to prefetch ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendMemoryPrefetch = context.zeDdiTable.CommandList.pfnAppendMemoryPrefetch; if( nullptr != pfnAppendMemoryPrefetch ) { result = pfnAppendMemoryPrefetch( hCommandList, ptr, size ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemAdvise __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemAdvise( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_advice_t advice ///< [in] Memory advice for the memory range ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendMemAdvise = context.zeDdiTable.CommandList.pfnAppendMemAdvise; if( nullptr != pfnAppendMemAdvise ) { result = pfnAppendMemAdvise( hCommandList, hDevice, ptr, size, advice ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolCreate __zedlllocal ze_result_t ZE_APICALL zeEventPoolCreate( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_event_pool_desc_t* desc, ///< [in] pointer to event pool descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< have visibility to the event pool. ///< if nullptr, then event pool is visible to all devices supported by the ///< driver instance. ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zeDdiTable.EventPool.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hContext, desc, numDevices, phDevices, phEventPool ); } else { // generic implementation *phEventPool = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolDestroy __zedlllocal ze_result_t ZE_APICALL zeEventPoolDestroy( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zeDdiTable.EventPool.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hEventPool ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventCreate __zedlllocal ze_result_t ZE_APICALL zeEventCreate( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool const ze_event_desc_t* desc, ///< [in] pointer to event descriptor ze_event_handle_t* phEvent ///< [out] pointer to handle of event object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zeDdiTable.Event.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hEventPool, desc, phEvent ); } else { // generic implementation *phEvent = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventDestroy __zedlllocal ze_result_t ZE_APICALL zeEventDestroy( ze_event_handle_t hEvent ///< [in][release] handle of event object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zeDdiTable.Event.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hEvent ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolGetIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolGetIpcHandle( ze_event_pool_handle_t hEventPool, ///< [in] handle of event pool object ze_ipc_event_pool_handle_t* phIpc ///< [out] Returned IPC event handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetIpcHandle = context.zeDdiTable.EventPool.pfnGetIpcHandle; if( nullptr != pfnGetIpcHandle ) { result = pfnGetIpcHandle( hEventPool, phIpc ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolPutIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolPutIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object associated with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc ///< [in] IPC event pool handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnPutIpcHandle = context.zeDdiTable.EventPool.pfnPutIpcHandle; if( nullptr != pfnPutIpcHandle ) { result = pfnPutIpcHandle( hContext, hIpc ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolOpenIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolOpenIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object to associate with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc, ///< [in] IPC event pool handle ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOpenIpcHandle = context.zeDdiTable.EventPool.pfnOpenIpcHandle; if( nullptr != pfnOpenIpcHandle ) { result = pfnOpenIpcHandle( hContext, hIpc, phEventPool ); } else { // generic implementation *phEventPool = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolCloseIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolCloseIpcHandle( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCloseIpcHandle = context.zeDdiTable.EventPool.pfnCloseIpcHandle; if( nullptr != pfnCloseIpcHandle ) { result = pfnCloseIpcHandle( hEventPool ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendSignalEvent __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendSignalEvent( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendSignalEvent = context.zeDdiTable.CommandList.pfnAppendSignalEvent; if( nullptr != pfnAppendSignalEvent ) { result = pfnAppendSignalEvent( hCommandList, hEvent ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendWaitOnEvents __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendWaitOnEvents( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] number of events to wait on before continuing ze_event_handle_t* phEvents ///< [in][range(0, numEvents)] handles of the events to wait on before ///< continuing ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendWaitOnEvents = context.zeDdiTable.CommandList.pfnAppendWaitOnEvents; if( nullptr != pfnAppendWaitOnEvents ) { result = pfnAppendWaitOnEvents( hCommandList, numEvents, phEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventHostSignal __zedlllocal ze_result_t ZE_APICALL zeEventHostSignal( ze_event_handle_t hEvent ///< [in] handle of the event ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnHostSignal = context.zeDdiTable.Event.pfnHostSignal; if( nullptr != pfnHostSignal ) { result = pfnHostSignal( hEvent ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventHostSynchronize __zedlllocal ze_result_t ZE_APICALL zeEventHostSynchronize( ze_event_handle_t hEvent, ///< [in] handle of the event uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeEventQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnHostSynchronize = context.zeDdiTable.Event.pfnHostSynchronize; if( nullptr != pfnHostSynchronize ) { result = pfnHostSynchronize( hEvent, timeout ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryStatus __zedlllocal ze_result_t ZE_APICALL zeEventQueryStatus( ze_event_handle_t hEvent ///< [in] handle of the event ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnQueryStatus = context.zeDdiTable.Event.pfnQueryStatus; if( nullptr != pfnQueryStatus ) { result = pfnQueryStatus( hEvent ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendEventReset __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendEventReset( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendEventReset = context.zeDdiTable.CommandList.pfnAppendEventReset; if( nullptr != pfnAppendEventReset ) { result = pfnAppendEventReset( hCommandList, hEvent ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventHostReset __zedlllocal ze_result_t ZE_APICALL zeEventHostReset( ze_event_handle_t hEvent ///< [in] handle of the event ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnHostReset = context.zeDdiTable.Event.pfnHostReset; if( nullptr != pfnHostReset ) { result = pfnHostReset( hEvent ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryKernelTimestamp __zedlllocal ze_result_t ZE_APICALL zeEventQueryKernelTimestamp( ze_event_handle_t hEvent, ///< [in] handle of the event ze_kernel_timestamp_result_t* dstptr ///< [in,out] pointer to memory for where timestamp result will be written. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnQueryKernelTimestamp = context.zeDdiTable.Event.pfnQueryKernelTimestamp; if( nullptr != pfnQueryKernelTimestamp ) { result = pfnQueryKernelTimestamp( hEvent, dstptr ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendQueryKernelTimestamps __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendQueryKernelTimestamps( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] the number of timestamp events to query ze_event_handle_t* phEvents, ///< [in][range(0, numEvents)] handles of timestamp events to query void* dstptr, ///< [in,out] pointer to memory where ::ze_kernel_timestamp_result_t will ///< be written; must be size-aligned. const size_t* pOffsets, ///< [in][optional][range(0, numEvents)] offset, in bytes, to write ///< results; address must be 4byte-aligned and offsets must be ///< size-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendQueryKernelTimestamps = context.zeDdiTable.CommandList.pfnAppendQueryKernelTimestamps; if( nullptr != pfnAppendQueryKernelTimestamps ) { result = pfnAppendQueryKernelTimestamps( hCommandList, numEvents, phEvents, dstptr, pOffsets, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventGetEventPool __zedlllocal ze_result_t ZE_APICALL zeEventGetEventPool( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_pool_handle_t* phEventPool ///< [out] handle of the event pool for the event ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetEventPool = context.zeDdiTable.Event.pfnGetEventPool; if( nullptr != pfnGetEventPool ) { result = pfnGetEventPool( hEvent, phEventPool ); } else { // generic implementation *phEventPool = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventGetSignalScope __zedlllocal ze_result_t ZE_APICALL zeEventGetSignalScope( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pSignalScope ///< [out] signal event scope. This is the scope of relevant cache ///< hierarchies that are flushed on a signal action before the event is ///< triggered. May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetSignalScope = context.zeDdiTable.Event.pfnGetSignalScope; if( nullptr != pfnGetSignalScope ) { result = pfnGetSignalScope( hEvent, pSignalScope ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventGetWaitScope __zedlllocal ze_result_t ZE_APICALL zeEventGetWaitScope( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pWaitScope ///< [out] wait event scope. This is the scope of relevant cache ///< hierarchies invalidated on a wait action after the event is complete. ///< May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetWaitScope = context.zeDdiTable.Event.pfnGetWaitScope; if( nullptr != pfnGetWaitScope ) { result = pfnGetWaitScope( hEvent, pWaitScope ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolGetContextHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolGetContextHandle( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_context_handle_t* phContext ///< [out] handle of the context on which the event pool was created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetContextHandle = context.zeDdiTable.EventPool.pfnGetContextHandle; if( nullptr != pfnGetContextHandle ) { result = pfnGetContextHandle( hEventPool, phContext ); } else { // generic implementation *phContext = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolGetFlags __zedlllocal ze_result_t ZE_APICALL zeEventPoolGetFlags( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_event_pool_flags_t* pFlags ///< [out] creation flags used to create the event pool; may be 0 or a ///< valid combination of ::ze_event_pool_flag_t ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetFlags = context.zeDdiTable.EventPool.pfnGetFlags; if( nullptr != pfnGetFlags ) { result = pfnGetFlags( hEventPool, pFlags ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceCreate __zedlllocal ze_result_t ZE_APICALL zeFenceCreate( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of command queue const ze_fence_desc_t* desc, ///< [in] pointer to fence descriptor ze_fence_handle_t* phFence ///< [out] pointer to handle of fence object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zeDdiTable.Fence.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hCommandQueue, desc, phFence ); } else { // generic implementation *phFence = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceDestroy __zedlllocal ze_result_t ZE_APICALL zeFenceDestroy( ze_fence_handle_t hFence ///< [in][release] handle of fence object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zeDdiTable.Fence.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hFence ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceHostSynchronize __zedlllocal ze_result_t ZE_APICALL zeFenceHostSynchronize( ze_fence_handle_t hFence, ///< [in] handle of the fence uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeFenceQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnHostSynchronize = context.zeDdiTable.Fence.pfnHostSynchronize; if( nullptr != pfnHostSynchronize ) { result = pfnHostSynchronize( hFence, timeout ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceQueryStatus __zedlllocal ze_result_t ZE_APICALL zeFenceQueryStatus( ze_fence_handle_t hFence ///< [in] handle of the fence ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnQueryStatus = context.zeDdiTable.Fence.pfnQueryStatus; if( nullptr != pfnQueryStatus ) { result = pfnQueryStatus( hFence ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceReset __zedlllocal ze_result_t ZE_APICALL zeFenceReset( ze_fence_handle_t hFence ///< [in] handle of the fence ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReset = context.zeDdiTable.Fence.pfnReset; if( nullptr != pfnReset ) { result = pfnReset( hFence ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetProperties __zedlllocal ze_result_t ZE_APICALL zeImageGetProperties( ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_properties_t* pImageProperties ///< [out] pointer to image properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zeDdiTable.Image.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hDevice, desc, pImageProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageCreate __zedlllocal ze_result_t ZE_APICALL zeImageCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t* phImage ///< [out] pointer to handle of image object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zeDdiTable.Image.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hContext, hDevice, desc, phImage ); } else { // generic implementation *phImage = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageDestroy __zedlllocal ze_result_t ZE_APICALL zeImageDestroy( ze_image_handle_t hImage ///< [in][release] handle of image object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zeDdiTable.Image.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hImage ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemAllocShared __zedlllocal ze_result_t ZE_APICALL zeMemAllocShared( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in][optional] device handle to associate with void** pptr ///< [out] pointer to shared allocation ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAllocShared = context.zeDdiTable.Mem.pfnAllocShared; if( nullptr != pfnAllocShared ) { result = pfnAllocShared( hContext, device_desc, host_desc, size, alignment, hDevice, pptr ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemAllocDevice __zedlllocal ze_result_t ZE_APICALL zeMemAllocDevice( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in] handle of the device void** pptr ///< [out] pointer to device allocation ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAllocDevice = context.zeDdiTable.Mem.pfnAllocDevice; if( nullptr != pfnAllocDevice ) { result = pfnAllocDevice( hContext, device_desc, size, alignment, hDevice, pptr ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemAllocHost __zedlllocal ze_result_t ZE_APICALL zeMemAllocHost( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two void** pptr ///< [out] pointer to host allocation ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAllocHost = context.zeDdiTable.Mem.pfnAllocHost; if( nullptr != pfnAllocHost ) { result = pfnAllocHost( hContext, host_desc, size, alignment, pptr ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemFree __zedlllocal ze_result_t ZE_APICALL zeMemFree( ze_context_handle_t hContext, ///< [in] handle of the context object void* ptr ///< [in][release] pointer to memory to free ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnFree = context.zeDdiTable.Mem.pfnFree; if( nullptr != pfnFree ) { result = pfnFree( hContext, ptr ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetAllocProperties __zedlllocal ze_result_t ZE_APICALL zeMemGetAllocProperties( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query ze_memory_allocation_properties_t* pMemAllocProperties, ///< [in,out] query result for memory allocation properties ze_device_handle_t* phDevice ///< [out][optional] device associated with this allocation ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetAllocProperties = context.zeDdiTable.Mem.pfnGetAllocProperties; if( nullptr != pfnGetAllocProperties ) { result = pfnGetAllocProperties( hContext, ptr, pMemAllocProperties, phDevice ); } else { // generic implementation if( nullptr != phDevice ) *phDevice = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetAddressRange __zedlllocal ze_result_t ZE_APICALL zeMemGetAddressRange( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query void** pBase, ///< [in,out][optional] base address of the allocation size_t* pSize ///< [in,out][optional] size of the allocation ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetAddressRange = context.zeDdiTable.Mem.pfnGetAddressRange; if( nullptr != pfnGetAddressRange ) { result = pfnGetAddressRange( hContext, ptr, pBase, pSize ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemGetIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to the device memory allocation ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetIpcHandle = context.zeDdiTable.Mem.pfnGetIpcHandle; if( nullptr != pfnGetIpcHandle ) { result = pfnGetIpcHandle( hContext, ptr, pIpcHandle ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetIpcHandleFromFileDescriptorExp __zedlllocal ze_result_t ZE_APICALL zeMemGetIpcHandleFromFileDescriptorExp( ze_context_handle_t hContext, ///< [in] handle of the context object uint64_t handle, ///< [in] file descriptor ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetIpcHandleFromFileDescriptorExp = context.zeDdiTable.MemExp.pfnGetIpcHandleFromFileDescriptorExp; if( nullptr != pfnGetIpcHandleFromFileDescriptorExp ) { result = pfnGetIpcHandleFromFileDescriptorExp( hContext, handle, pIpcHandle ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetFileDescriptorFromIpcHandleExp __zedlllocal ze_result_t ZE_APICALL zeMemGetFileDescriptorFromIpcHandleExp( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t ipcHandle, ///< [in] IPC memory handle uint64_t* pHandle ///< [out] Returned file descriptor ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetFileDescriptorFromIpcHandleExp = context.zeDdiTable.MemExp.pfnGetFileDescriptorFromIpcHandleExp; if( nullptr != pfnGetFileDescriptorFromIpcHandleExp ) { result = pfnGetFileDescriptorFromIpcHandleExp( hContext, ipcHandle, pHandle ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemPutIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemPutIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t handle ///< [in] IPC memory handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnPutIpcHandle = context.zeDdiTable.Mem.pfnPutIpcHandle; if( nullptr != pfnPutIpcHandle ) { result = pfnPutIpcHandle( hContext, handle ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemOpenIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemOpenIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device to associate with the IPC memory handle ze_ipc_mem_handle_t handle, ///< [in] IPC memory handle ze_ipc_memory_flags_t flags, ///< [in] flags controlling the operation. ///< must be 0 (default) or a valid combination of ::ze_ipc_memory_flag_t. void** pptr ///< [out] pointer to device allocation in this process ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOpenIpcHandle = context.zeDdiTable.Mem.pfnOpenIpcHandle; if( nullptr != pfnOpenIpcHandle ) { result = pfnOpenIpcHandle( hContext, hDevice, handle, flags, pptr ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemCloseIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemCloseIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr ///< [in][release] pointer to device allocation in this process ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCloseIpcHandle = context.zeDdiTable.Mem.pfnCloseIpcHandle; if( nullptr != pfnCloseIpcHandle ) { result = pfnCloseIpcHandle( hContext, ptr ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemSetAtomicAccessAttributeExp __zedlllocal ze_result_t ZE_APICALL zeMemSetAtomicAccessAttributeExp( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t attr ///< [in] Atomic access attributes to set for the specified range. ///< Must be 0 (default) or a valid combination of ::ze_memory_atomic_attr_exp_flag_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetAtomicAccessAttributeExp = context.zeDdiTable.MemExp.pfnSetAtomicAccessAttributeExp; if( nullptr != pfnSetAtomicAccessAttributeExp ) { result = pfnSetAtomicAccessAttributeExp( hContext, hDevice, ptr, size, attr ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetAtomicAccessAttributeExp __zedlllocal ze_result_t ZE_APICALL zeMemGetAtomicAccessAttributeExp( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t* pAttr ///< [out] Atomic access attributes for the specified range ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetAtomicAccessAttributeExp = context.zeDdiTable.MemExp.pfnGetAtomicAccessAttributeExp; if( nullptr != pfnGetAtomicAccessAttributeExp ) { result = pfnGetAtomicAccessAttributeExp( hContext, hDevice, ptr, size, pAttr ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleCreate __zedlllocal ze_result_t ZE_APICALL zeModuleCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_module_desc_t* desc, ///< [in] pointer to module descriptor ze_module_handle_t* phModule, ///< [out] pointer to handle of module object created ze_module_build_log_handle_t* phBuildLog ///< [out][optional] pointer to handle of module's build log. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zeDdiTable.Module.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hContext, hDevice, desc, phModule, phBuildLog ); } else { // generic implementation *phModule = reinterpret_cast( context.get() ); if( nullptr != phBuildLog ) *phBuildLog = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleDestroy __zedlllocal ze_result_t ZE_APICALL zeModuleDestroy( ze_module_handle_t hModule ///< [in][release] handle of the module ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zeDdiTable.Module.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hModule ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleDynamicLink __zedlllocal ze_result_t ZE_APICALL zeModuleDynamicLink( uint32_t numModules, ///< [in] number of modules to be linked pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to ///< dynamically link together. ze_module_build_log_handle_t* phLinkLog ///< [out][optional] pointer to handle of dynamic link log. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDynamicLink = context.zeDdiTable.Module.pfnDynamicLink; if( nullptr != pfnDynamicLink ) { result = pfnDynamicLink( numModules, phModules, phLinkLog ); } else { // generic implementation if( nullptr != phLinkLog ) *phLinkLog = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleBuildLogDestroy __zedlllocal ze_result_t ZE_APICALL zeModuleBuildLogDestroy( ze_module_build_log_handle_t hModuleBuildLog ///< [in][release] handle of the module build log object. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zeDdiTable.ModuleBuildLog.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hModuleBuildLog ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleBuildLogGetString __zedlllocal ze_result_t ZE_APICALL zeModuleBuildLogGetString( ze_module_build_log_handle_t hModuleBuildLog, ///< [in] handle of the module build log object. size_t* pSize, ///< [in,out] size of build log string. char* pBuildLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetString = context.zeDdiTable.ModuleBuildLog.pfnGetString; if( nullptr != pfnGetString ) { result = pfnGetString( hModuleBuildLog, pSize, pBuildLog ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetNativeBinary __zedlllocal ze_result_t ZE_APICALL zeModuleGetNativeBinary( ze_module_handle_t hModule, ///< [in] handle of the module size_t* pSize, ///< [in,out] size of native binary in bytes. uint8_t* pModuleNativeBinary ///< [in,out][optional] byte pointer to native binary ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetNativeBinary = context.zeDdiTable.Module.pfnGetNativeBinary; if( nullptr != pfnGetNativeBinary ) { result = pfnGetNativeBinary( hModule, pSize, pModuleNativeBinary ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetGlobalPointer __zedlllocal ze_result_t ZE_APICALL zeModuleGetGlobalPointer( ze_module_handle_t hModule, ///< [in] handle of the module const char* pGlobalName, ///< [in] name of global variable in module size_t* pSize, ///< [in,out][optional] size of global variable void** pptr ///< [in,out][optional] device visible pointer ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetGlobalPointer = context.zeDdiTable.Module.pfnGetGlobalPointer; if( nullptr != pfnGetGlobalPointer ) { result = pfnGetGlobalPointer( hModule, pGlobalName, pSize, pptr ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetKernelNames __zedlllocal ze_result_t ZE_APICALL zeModuleGetKernelNames( ze_module_handle_t hModule, ///< [in] handle of the module uint32_t* pCount, ///< [in,out] pointer to the number of names. ///< if count is zero, then the driver shall update the value with the ///< total number of names available. ///< if count is greater than the number of names available, then the ///< driver shall update the value with the correct number of names available. const char** pNames ///< [in,out][optional][range(0, *pCount)] array of names of functions. ///< if count is less than the number of names available, then driver shall ///< only retrieve that number of names. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetKernelNames = context.zeDdiTable.Module.pfnGetKernelNames; if( nullptr != pfnGetKernelNames ) { result = pfnGetKernelNames( hModule, pCount, pNames ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetProperties __zedlllocal ze_result_t ZE_APICALL zeModuleGetProperties( ze_module_handle_t hModule, ///< [in] handle of the module ze_module_properties_t* pModuleProperties ///< [in,out] query result for module properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zeDdiTable.Module.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hModule, pModuleProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelCreate __zedlllocal ze_result_t ZE_APICALL zeKernelCreate( ze_module_handle_t hModule, ///< [in] handle of the module const ze_kernel_desc_t* desc, ///< [in] pointer to kernel descriptor ze_kernel_handle_t* phKernel ///< [out] handle of the Function object ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zeDdiTable.Kernel.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hModule, desc, phKernel ); } else { // generic implementation *phKernel = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelDestroy __zedlllocal ze_result_t ZE_APICALL zeKernelDestroy( ze_kernel_handle_t hKernel ///< [in][release] handle of the kernel object ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zeDdiTable.Kernel.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hKernel ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetFunctionPointer __zedlllocal ze_result_t ZE_APICALL zeModuleGetFunctionPointer( ze_module_handle_t hModule, ///< [in] handle of the module const char* pFunctionName, ///< [in] Name of function to retrieve function pointer for. void** pfnFunction ///< [out] pointer to function. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetFunctionPointer = context.zeDdiTable.Module.pfnGetFunctionPointer; if( nullptr != pfnGetFunctionPointer ) { result = pfnGetFunctionPointer( hModule, pFunctionName, pfnFunction ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetGroupSize __zedlllocal ze_result_t ZE_APICALL zeKernelSetGroupSize( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t groupSizeX, ///< [in] group size for X dimension to use for this kernel uint32_t groupSizeY, ///< [in] group size for Y dimension to use for this kernel uint32_t groupSizeZ ///< [in] group size for Z dimension to use for this kernel ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetGroupSize = context.zeDdiTable.Kernel.pfnSetGroupSize; if( nullptr != pfnSetGroupSize ) { result = pfnSetGroupSize( hKernel, groupSizeX, groupSizeY, groupSizeZ ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSuggestGroupSize __zedlllocal ze_result_t ZE_APICALL zeKernelSuggestGroupSize( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t globalSizeX, ///< [in] global width for X dimension uint32_t globalSizeY, ///< [in] global width for Y dimension uint32_t globalSizeZ, ///< [in] global width for Z dimension uint32_t* groupSizeX, ///< [out] recommended size of group for X dimension uint32_t* groupSizeY, ///< [out] recommended size of group for Y dimension uint32_t* groupSizeZ ///< [out] recommended size of group for Z dimension ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSuggestGroupSize = context.zeDdiTable.Kernel.pfnSuggestGroupSize; if( nullptr != pfnSuggestGroupSize ) { result = pfnSuggestGroupSize( hKernel, globalSizeX, globalSizeY, globalSizeZ, groupSizeX, groupSizeY, groupSizeZ ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSuggestMaxCooperativeGroupCount __zedlllocal ze_result_t ZE_APICALL zeKernelSuggestMaxCooperativeGroupCount( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* totalGroupCount ///< [out] recommended total group count. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSuggestMaxCooperativeGroupCount = context.zeDdiTable.Kernel.pfnSuggestMaxCooperativeGroupCount; if( nullptr != pfnSuggestMaxCooperativeGroupCount ) { result = pfnSuggestMaxCooperativeGroupCount( hKernel, totalGroupCount ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetArgumentValue __zedlllocal ze_result_t ZE_APICALL zeKernelSetArgumentValue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t argIndex, ///< [in] argument index in range [0, num args - 1] size_t argSize, ///< [in] size of argument type const void* pArgValue ///< [in][optional] argument value represented as matching arg type. If ///< null then argument value is considered null. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetArgumentValue = context.zeDdiTable.Kernel.pfnSetArgumentValue; if( nullptr != pfnSetArgumentValue ) { result = pfnSetArgumentValue( hKernel, argIndex, argSize, pArgValue ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetIndirectAccess __zedlllocal ze_result_t ZE_APICALL zeKernelSetIndirectAccess( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t flags ///< [in] kernel indirect access flags ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetIndirectAccess = context.zeDdiTable.Kernel.pfnSetIndirectAccess; if( nullptr != pfnSetIndirectAccess ) { result = pfnSetIndirectAccess( hKernel, flags ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetIndirectAccess __zedlllocal ze_result_t ZE_APICALL zeKernelGetIndirectAccess( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t* pFlags ///< [out] query result for kernel indirect access flags. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetIndirectAccess = context.zeDdiTable.Kernel.pfnGetIndirectAccess; if( nullptr != pfnGetIndirectAccess ) { result = pfnGetIndirectAccess( hKernel, pFlags ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetSourceAttributes __zedlllocal ze_result_t ZE_APICALL zeKernelGetSourceAttributes( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* pSize, ///< [in,out] pointer to size of string in bytes, including ///< null-terminating character. char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including ///< a null-terminating character, is returned in pSize. ///< Otherwise, pString must point to valid application memory that is ///< greater than or equal to *pSize bytes in length, and on return the ///< pointed-to string will contain a space-separated list of kernel source attributes. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetSourceAttributes = context.zeDdiTable.Kernel.pfnGetSourceAttributes; if( nullptr != pfnGetSourceAttributes ) { result = pfnGetSourceAttributes( hKernel, pSize, pString ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetCacheConfig __zedlllocal ze_result_t ZE_APICALL zeKernelSetCacheConfig( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_cache_config_flags_t flags ///< [in] cache configuration. ///< must be 0 (default configuration) or a valid combination of ::ze_cache_config_flag_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetCacheConfig = context.zeDdiTable.Kernel.pfnSetCacheConfig; if( nullptr != pfnSetCacheConfig ) { result = pfnSetCacheConfig( hKernel, flags ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetProperties __zedlllocal ze_result_t ZE_APICALL zeKernelGetProperties( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_properties_t* pKernelProperties ///< [in,out] query result for kernel properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zeDdiTable.Kernel.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hKernel, pKernelProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetName __zedlllocal ze_result_t ZE_APICALL zeKernelGetName( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object size_t* pSize, ///< [in,out] size of kernel name string, including null terminator, in ///< bytes. char* pName ///< [in,out][optional] char pointer to kernel name. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetName = context.zeDdiTable.Kernel.pfnGetName; if( nullptr != pfnGetName ) { result = pfnGetName( hKernel, pSize, pName ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchKernel __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchKernel( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendLaunchKernel = context.zeDdiTable.CommandList.pfnAppendLaunchKernel; if( nullptr != pfnAppendLaunchKernel ) { result = pfnAppendLaunchKernel( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchCooperativeKernel __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchCooperativeKernel( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendLaunchCooperativeKernel = context.zeDdiTable.CommandList.pfnAppendLaunchCooperativeKernel; if( nullptr != pfnAppendLaunchCooperativeKernel ) { result = pfnAppendLaunchCooperativeKernel( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchKernelIndirect __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchKernelIndirect( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in] pointer to device buffer that will contain thread group launch ///< arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendLaunchKernelIndirect = context.zeDdiTable.CommandList.pfnAppendLaunchKernelIndirect; if( nullptr != pfnAppendLaunchKernelIndirect ) { result = pfnAppendLaunchKernelIndirect( hCommandList, hKernel, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchMultipleKernelsIndirect __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchMultipleKernelsIndirect( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] maximum number of kernels to launch ze_kernel_handle_t* phKernels, ///< [in][range(0, numKernels)] handles of the kernel objects const uint32_t* pCountBuffer, ///< [in] pointer to device memory location that will contain the actual ///< number of kernels to launch; value must be less than or equal to ///< numKernels const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in][range(0, numKernels)] pointer to device buffer that will contain ///< a contiguous array of thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendLaunchMultipleKernelsIndirect = context.zeDdiTable.CommandList.pfnAppendLaunchMultipleKernelsIndirect; if( nullptr != pfnAppendLaunchMultipleKernelsIndirect ) { result = pfnAppendLaunchMultipleKernelsIndirect( hCommandList, numKernels, phKernels, pCountBuffer, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextMakeMemoryResident __zedlllocal ze_result_t ZE_APICALL zeContextMakeMemoryResident( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to make resident size_t size ///< [in] size in bytes to make resident ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnMakeMemoryResident = context.zeDdiTable.Context.pfnMakeMemoryResident; if( nullptr != pfnMakeMemoryResident ) { result = pfnMakeMemoryResident( hContext, hDevice, ptr, size ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextEvictMemory __zedlllocal ze_result_t ZE_APICALL zeContextEvictMemory( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to evict size_t size ///< [in] size in bytes to evict ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEvictMemory = context.zeDdiTable.Context.pfnEvictMemory; if( nullptr != pfnEvictMemory ) { result = pfnEvictMemory( hContext, hDevice, ptr, size ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextMakeImageResident __zedlllocal ze_result_t ZE_APICALL zeContextMakeImageResident( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make resident ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnMakeImageResident = context.zeDdiTable.Context.pfnMakeImageResident; if( nullptr != pfnMakeImageResident ) { result = pfnMakeImageResident( hContext, hDevice, hImage ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextEvictImage __zedlllocal ze_result_t ZE_APICALL zeContextEvictImage( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make evict ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEvictImage = context.zeDdiTable.Context.pfnEvictImage; if( nullptr != pfnEvictImage ) { result = pfnEvictImage( hContext, hDevice, hImage ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeSamplerCreate __zedlllocal ze_result_t ZE_APICALL zeSamplerCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_sampler_desc_t* desc, ///< [in] pointer to sampler descriptor ze_sampler_handle_t* phSampler ///< [out] handle of the sampler ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zeDdiTable.Sampler.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hContext, hDevice, desc, phSampler ); } else { // generic implementation *phSampler = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeSamplerDestroy __zedlllocal ze_result_t ZE_APICALL zeSamplerDestroy( ze_sampler_handle_t hSampler ///< [in][release] handle of the sampler ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zeDdiTable.Sampler.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hSampler ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemReserve __zedlllocal ze_result_t ZE_APICALL zeVirtualMemReserve( ze_context_handle_t hContext, ///< [in] handle of the context object const void* pStart, ///< [in][optional] pointer to start of region to reserve. If nullptr then ///< implementation will choose a start address. size_t size, ///< [in] size in bytes to reserve; must be page aligned. void** pptr ///< [out] pointer to virtual reservation. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReserve = context.zeDdiTable.VirtualMem.pfnReserve; if( nullptr != pfnReserve ) { result = pfnReserve( hContext, pStart, size, pptr ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemFree __zedlllocal ze_result_t ZE_APICALL zeVirtualMemFree( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to free. size_t size ///< [in] size in bytes to free; must be page aligned. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnFree = context.zeDdiTable.VirtualMem.pfnFree; if( nullptr != pfnFree ) { result = pfnFree( hContext, ptr, size ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemQueryPageSize __zedlllocal ze_result_t ZE_APICALL zeVirtualMemQueryPageSize( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] unaligned allocation size in bytes size_t* pagesize ///< [out] pointer to page size to use for start address and size ///< alignments. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnQueryPageSize = context.zeDdiTable.VirtualMem.pfnQueryPageSize; if( nullptr != pfnQueryPageSize ) { result = pfnQueryPageSize( hContext, hDevice, size, pagesize ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zePhysicalMemCreate __zedlllocal ze_result_t ZE_APICALL zePhysicalMemCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zeDdiTable.PhysicalMem.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hContext, hDevice, desc, phPhysicalMemory ); } else { // generic implementation *phPhysicalMemory = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zePhysicalMemDestroy __zedlllocal ze_result_t ZE_APICALL zePhysicalMemDestroy( ze_context_handle_t hContext, ///< [in] handle of the context object ze_physical_mem_handle_t hPhysicalMemory ///< [in][release] handle of physical memory object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zeDdiTable.PhysicalMem.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hContext, hPhysicalMemory ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemMap __zedlllocal ze_result_t ZE_APICALL zeVirtualMemMap( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address range to map. size_t size, ///< [in] size in bytes of virtual address range to map; must be page ///< aligned. ze_physical_mem_handle_t hPhysicalMemory, ///< [in] handle to physical memory object. size_t offset, ///< [in] offset into physical memory allocation object; must be page ///< aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnMap = context.zeDdiTable.VirtualMem.pfnMap; if( nullptr != pfnMap ) { result = pfnMap( hContext, ptr, size, hPhysicalMemory, offset, access ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemUnmap __zedlllocal ze_result_t ZE_APICALL zeVirtualMemUnmap( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to unmap. size_t size ///< [in] size in bytes to unmap; must be page aligned. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnUnmap = context.zeDdiTable.VirtualMem.pfnUnmap; if( nullptr != pfnUnmap ) { result = pfnUnmap( hContext, ptr, size ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemSetAccessAttribute __zedlllocal ze_result_t ZE_APICALL zeVirtualMemSetAccessAttribute( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of reserved virtual address region. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetAccessAttribute = context.zeDdiTable.VirtualMem.pfnSetAccessAttribute; if( nullptr != pfnSetAccessAttribute ) { result = pfnSetAccessAttribute( hContext, ptr, size, access ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemGetAccessAttribute __zedlllocal ze_result_t ZE_APICALL zeVirtualMemGetAccessAttribute( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address region for query. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t* access, ///< [out] query result for page access attribute. size_t* outSize ///< [out] query result for size of virtual address range, starting at ptr, ///< that shares same access attribute. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetAccessAttribute = context.zeDdiTable.VirtualMem.pfnGetAccessAttribute; if( nullptr != pfnGetAccessAttribute ) { result = pfnGetAccessAttribute( hContext, ptr, size, access, outSize ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetGlobalOffsetExp __zedlllocal ze_result_t ZE_APICALL zeKernelSetGlobalOffsetExp( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t offsetX, ///< [in] global offset for X dimension to use for this kernel uint32_t offsetY, ///< [in] global offset for Y dimension to use for this kernel uint32_t offsetZ ///< [in] global offset for Z dimension to use for this kernel ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetGlobalOffsetExp = context.zeDdiTable.KernelExp.pfnSetGlobalOffsetExp; if( nullptr != pfnSetGlobalOffsetExp ) { result = pfnSetGlobalOffsetExp( hKernel, offsetX, offsetY, offsetZ ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetBinaryExp __zedlllocal ze_result_t ZE_APICALL zeKernelGetBinaryExp( ze_kernel_handle_t hKernel, ///< [in] Kernel handle. size_t* pSize, ///< [in,out] pointer to variable with size of GEN ISA binary. uint8_t* pKernelBinary ///< [in,out] pointer to storage area for GEN ISA binary function. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetBinaryExp = context.zeDdiTable.KernelExp.pfnGetBinaryExp; if( nullptr != pfnGetBinaryExp ) { result = pfnGetBinaryExp( hKernel, pSize, pKernelBinary ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceImportExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeDeviceImportExternalSemaphoreExt( ze_device_handle_t hDevice, ///< [in] The device handle. const ze_external_semaphore_ext_desc_t* desc, ///< [in] The pointer to external semaphore descriptor. ze_external_semaphore_ext_handle_t* phSemaphore ///< [out] The handle of the external semaphore imported. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnImportExternalSemaphoreExt = context.zeDdiTable.Device.pfnImportExternalSemaphoreExt; if( nullptr != pfnImportExternalSemaphoreExt ) { result = pfnImportExternalSemaphoreExt( hDevice, desc, phSemaphore ); } else { // generic implementation *phSemaphore = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceReleaseExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeDeviceReleaseExternalSemaphoreExt( ze_external_semaphore_ext_handle_t hSemaphore ///< [in] The handle of the external semaphore. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReleaseExternalSemaphoreExt = context.zeDdiTable.Device.pfnReleaseExternalSemaphoreExt; if( nullptr != pfnReleaseExternalSemaphoreExt ) { result = pfnReleaseExternalSemaphoreExt( hSemaphore ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendSignalExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendSignalExternalSemaphoreExt( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in][range(0, numSemaphores)] The vector of external semaphore handles ///< to be appended into command list. ze_external_semaphore_signal_params_ext_t* signalParams,///< [in] Signal parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendSignalExternalSemaphoreExt = context.zeDdiTable.CommandList.pfnAppendSignalExternalSemaphoreExt; if( nullptr != pfnAppendSignalExternalSemaphoreExt ) { result = pfnAppendSignalExternalSemaphoreExt( hCommandList, numSemaphores, phSemaphores, signalParams, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendWaitExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendWaitExternalSemaphoreExt( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in] [range(0,numSemaphores)] The vector of external semaphore handles ///< to append into command list. ze_external_semaphore_wait_params_ext_t* waitParams,///< [in] Wait parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendWaitExternalSemaphoreExt = context.zeDdiTable.CommandList.pfnAppendWaitExternalSemaphoreExt; if( nullptr != pfnAppendWaitExternalSemaphoreExt ) { result = pfnAppendWaitExternalSemaphoreExt( hCommandList, numSemaphores, phSemaphores, waitParams, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceReserveCacheExt __zedlllocal ze_result_t ZE_APICALL zeDeviceReserveCacheExt( ze_device_handle_t hDevice, ///< [in] handle of the device object size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the ///< driver shall default to last level of cache and attempt to reserve in ///< that cache. size_t cacheReservationSize ///< [in] value for reserving size, in bytes. If zero, then the driver ///< shall remove prior reservation ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReserveCacheExt = context.zeDdiTable.Device.pfnReserveCacheExt; if( nullptr != pfnReserveCacheExt ) { result = pfnReserveCacheExt( hDevice, cacheLevel, cacheReservationSize ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceSetCacheAdviceExt __zedlllocal ze_result_t ZE_APICALL zeDeviceSetCacheAdviceExt( ze_device_handle_t hDevice, ///< [in] handle of the device object void* ptr, ///< [in] memory pointer to query size_t regionSize, ///< [in] region size, in pages ze_cache_ext_region_t cacheRegion ///< [in] reservation region ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetCacheAdviceExt = context.zeDdiTable.Device.pfnSetCacheAdviceExt; if( nullptr != pfnSetCacheAdviceExt ) { result = pfnSetCacheAdviceExt( hDevice, ptr, regionSize, cacheRegion ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryTimestampsExp __zedlllocal ze_result_t ZE_APICALL zeEventQueryTimestampsExp( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of timestamp results. ///< if count is zero, then the driver shall update the value with the ///< total number of timestamps available. ///< if count is greater than the number of timestamps available, then the ///< driver shall update the value with the correct number of timestamps available. ze_kernel_timestamp_result_t* pTimestamps ///< [in,out][optional][range(0, *pCount)] array of timestamp results. ///< if count is less than the number of timestamps available, then driver ///< shall only retrieve that number of timestamps. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnQueryTimestampsExp = context.zeDdiTable.EventExp.pfnQueryTimestampsExp; if( nullptr != pfnQueryTimestampsExp ) { result = pfnQueryTimestampsExp( hEvent, hDevice, pCount, pTimestamps ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetMemoryPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeImageGetMemoryPropertiesExp( ze_image_handle_t hImage, ///< [in] handle of image object ze_image_memory_properties_exp_t* pMemoryProperties ///< [in,out] query result for image memory properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetMemoryPropertiesExp = context.zeDdiTable.ImageExp.pfnGetMemoryPropertiesExp; if( nullptr != pfnGetMemoryPropertiesExp ) { result = pfnGetMemoryPropertiesExp( hImage, pMemoryProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageViewCreateExt __zedlllocal ze_result_t ZE_APICALL zeImageViewCreateExt( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnViewCreateExt = context.zeDdiTable.Image.pfnViewCreateExt; if( nullptr != pfnViewCreateExt ) { result = pfnViewCreateExt( hContext, hDevice, desc, hImage, phImageView ); } else { // generic implementation *phImageView = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageViewCreateExp __zedlllocal ze_result_t ZE_APICALL zeImageViewCreateExp( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnViewCreateExp = context.zeDdiTable.ImageExp.pfnViewCreateExp; if( nullptr != pfnViewCreateExp ) { result = pfnViewCreateExp( hContext, hDevice, desc, hImage, phImageView ); } else { // generic implementation *phImageView = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSchedulingHintExp __zedlllocal ze_result_t ZE_APICALL zeKernelSchedulingHintExp( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_scheduling_hint_exp_desc_t* pHint ///< [in] pointer to kernel scheduling hint descriptor ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSchedulingHintExp = context.zeDdiTable.KernelExp.pfnSchedulingHintExp; if( nullptr != pfnSchedulingHintExp ) { result = pfnSchedulingHintExp( hKernel, pHint ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDevicePciGetPropertiesExt __zedlllocal ze_result_t ZE_APICALL zeDevicePciGetPropertiesExt( ze_device_handle_t hDevice, ///< [in] handle of the device object. ze_pci_ext_properties_t* pPciProperties ///< [in,out] returns the PCI properties of the device. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnPciGetPropertiesExt = context.zeDdiTable.Device.pfnPciGetPropertiesExt; if( nullptr != pfnPciGetPropertiesExt ) { result = pfnPciGetPropertiesExt( hDevice, pPciProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyToMemoryExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemoryExt( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor uint32_t destRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being written uint32_t destSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being written ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendImageCopyToMemoryExt = context.zeDdiTable.CommandList.pfnAppendImageCopyToMemoryExt; if( nullptr != pfnAppendImageCopyToMemoryExt ) { result = pfnAppendImageCopyToMemoryExt( hCommandList, dstptr, hSrcImage, pSrcRegion, destRowPitch, destSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyFromMemoryExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyFromMemoryExt( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor uint32_t srcRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being read uint32_t srcSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being read ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendImageCopyFromMemoryExt = context.zeDdiTable.CommandList.pfnAppendImageCopyFromMemoryExt; if( nullptr != pfnAppendImageCopyFromMemoryExt ) { result = pfnAppendImageCopyFromMemoryExt( hCommandList, hDstImage, srcptr, pDstRegion, srcRowPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetAllocPropertiesExt __zedlllocal ze_result_t ZE_APICALL zeImageGetAllocPropertiesExt( ze_context_handle_t hContext, ///< [in] handle of the context object ze_image_handle_t hImage, ///< [in] handle of image object to query ze_image_allocation_ext_properties_t* pImageAllocProperties ///< [in,out] query result for image allocation properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetAllocPropertiesExt = context.zeDdiTable.Image.pfnGetAllocPropertiesExt; if( nullptr != pfnGetAllocPropertiesExt ) { result = pfnGetAllocPropertiesExt( hContext, hImage, pImageAllocProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleInspectLinkageExt __zedlllocal ze_result_t ZE_APICALL zeModuleInspectLinkageExt( ze_linkage_inspection_ext_desc_t* pInspectDesc, ///< [in] pointer to linkage inspection descriptor structure. uint32_t numModules, ///< [in] number of modules to be inspected pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to be ///< inspected for import dependencies. ze_module_build_log_handle_t* phLog ///< [out] pointer to handle of linkage inspection log. Log object will ///< contain separate lists of imports, un-resolvable imports, and exports. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnInspectLinkageExt = context.zeDdiTable.Module.pfnInspectLinkageExt; if( nullptr != pfnInspectLinkageExt ) { result = pfnInspectLinkageExt( pInspectDesc, numModules, phModules, phLog ); } else { // generic implementation *phLog = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemFreeExt __zedlllocal ze_result_t ZE_APICALL zeMemFreeExt( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_memory_free_ext_desc_t* pMemFreeDesc, ///< [in] pointer to memory free descriptor void* ptr ///< [in][release] pointer to memory to free ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnFreeExt = context.zeDdiTable.Mem.pfnFreeExt; if( nullptr != pfnFreeExt ) { result = pfnFreeExt( hContext, pMemFreeDesc, ptr ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetExp( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric vertices available. ///< if count is greater than the number of fabric vertices available, then ///< the driver shall update the value with the correct number of fabric ///< vertices available. ze_fabric_vertex_handle_t* phVertices ///< [in,out][optional][range(0, *pCount)] array of handle of fabric vertices. ///< if count is less than the number of fabric vertices available, then ///< driver shall only retrieve that number of fabric vertices. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetExp = context.zeDdiTable.FabricVertexExp.pfnGetExp; if( nullptr != pfnGetExp ) { result = pfnGetExp( hDriver, pCount, phVertices ); } else { // generic implementation for( size_t i = 0; ( nullptr != phVertices ) && ( i < *pCount ); ++i ) phVertices[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetSubVerticesExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetSubVerticesExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex object uint32_t* pCount, ///< [in,out] pointer to the number of sub-vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-vertices available. ///< if count is greater than the number of sub-vertices available, then ///< the driver shall update the value with the correct number of ///< sub-vertices available. ze_fabric_vertex_handle_t* phSubvertices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-vertices. ///< if count is less than the number of sub-vertices available, then ///< driver shall only retrieve that number of sub-vertices. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetSubVerticesExp = context.zeDdiTable.FabricVertexExp.pfnGetSubVerticesExp; if( nullptr != pfnGetSubVerticesExp ) { result = pfnGetSubVerticesExp( hVertex, pCount, phSubvertices ); } else { // generic implementation for( size_t i = 0; ( nullptr != phSubvertices ) && ( i < *pCount ); ++i ) phSubvertices[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetPropertiesExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_fabric_vertex_exp_properties_t* pVertexProperties///< [in,out] query result for fabric vertex properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetPropertiesExp = context.zeDdiTable.FabricVertexExp.pfnGetPropertiesExp; if( nullptr != pfnGetPropertiesExp ) { result = pfnGetPropertiesExp( hVertex, pVertexProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetDeviceExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetDeviceExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_device_handle_t* phDevice ///< [out] device handle corresponding to fabric vertex ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetDeviceExp = context.zeDdiTable.FabricVertexExp.pfnGetDeviceExp; if( nullptr != pfnGetDeviceExp ) { result = pfnGetDeviceExp( hVertex, phDevice ); } else { // generic implementation *phDevice = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetFabricVertexExp __zedlllocal ze_result_t ZE_APICALL zeDeviceGetFabricVertexExp( ze_device_handle_t hDevice, ///< [in] handle of the device ze_fabric_vertex_handle_t* phVertex ///< [out] fabric vertex handle corresponding to device ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetFabricVertexExp = context.zeDdiTable.DeviceExp.pfnGetFabricVertexExp; if( nullptr != pfnGetFabricVertexExp ) { result = pfnGetFabricVertexExp( hDevice, phVertex ); } else { // generic implementation *phVertex = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricEdgeGetExp __zedlllocal ze_result_t ZE_APICALL zeFabricEdgeGetExp( ze_fabric_vertex_handle_t hVertexA, ///< [in] handle of first fabric vertex instance ze_fabric_vertex_handle_t hVertexB, ///< [in] handle of second fabric vertex instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric edges. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric edges available. ///< if count is greater than the number of fabric edges available, then ///< the driver shall update the value with the correct number of fabric ///< edges available. ze_fabric_edge_handle_t* phEdges ///< [in,out][optional][range(0, *pCount)] array of handle of fabric edges. ///< if count is less than the number of fabric edges available, then ///< driver shall only retrieve that number of fabric edges. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetExp = context.zeDdiTable.FabricEdgeExp.pfnGetExp; if( nullptr != pfnGetExp ) { result = pfnGetExp( hVertexA, hVertexB, pCount, phEdges ); } else { // generic implementation for( size_t i = 0; ( nullptr != phEdges ) && ( i < *pCount ); ++i ) phEdges[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricEdgeGetVerticesExp __zedlllocal ze_result_t ZE_APICALL zeFabricEdgeGetVerticesExp( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge instance ze_fabric_vertex_handle_t* phVertexA, ///< [out] fabric vertex connected to one end of the given fabric edge. ze_fabric_vertex_handle_t* phVertexB ///< [out] fabric vertex connected to other end of the given fabric edge. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetVerticesExp = context.zeDdiTable.FabricEdgeExp.pfnGetVerticesExp; if( nullptr != pfnGetVerticesExp ) { result = pfnGetVerticesExp( hEdge, phVertexA, phVertexB ); } else { // generic implementation *phVertexA = reinterpret_cast( context.get() ); *phVertexB = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricEdgeGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeFabricEdgeGetPropertiesExp( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge ze_fabric_edge_exp_properties_t* pEdgeProperties///< [in,out] query result for fabric edge properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetPropertiesExp = context.zeDdiTable.FabricEdgeExp.pfnGetPropertiesExp; if( nullptr != pfnGetPropertiesExp ) { result = pfnGetPropertiesExp( hEdge, pEdgeProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryKernelTimestampsExt __zedlllocal ze_result_t ZE_APICALL zeEventQueryKernelTimestampsExt( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of event packets available. ///< - This value is implementation specific. ///< - if `*pCount` is zero, then the driver shall update the value with ///< the total number of event packets available. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver shall update the value with the correct value. ///< - Buffer(s) for query results must be sized by the application to ///< accommodate a minimum of `*pCount` elements. ze_event_query_kernel_timestamps_results_ext_properties_t* pResults ///< [in,out][optional][range(0, *pCount)] pointer to event query ///< properties structure(s). ///< - This parameter may be null when `*pCount` is zero. ///< - if `*pCount` is less than the number of event packets available, ///< the driver may only update `*pCount` elements, starting at element zero. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver may only update the valid elements. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnQueryKernelTimestampsExt = context.zeDdiTable.Event.pfnQueryKernelTimestampsExt; if( nullptr != pfnQueryKernelTimestampsExt ) { result = pfnQueryKernelTimestampsExt( hEvent, hDevice, pCount, pResults ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderCreateExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderCreateExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object const ze_rtas_builder_exp_desc_t* pDescriptor, ///< [in] pointer to builder descriptor ze_rtas_builder_exp_handle_t* phBuilder ///< [out] handle of builder object ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreateExp = context.zeDdiTable.RTASBuilderExp.pfnCreateExp; if( nullptr != pfnCreateExp ) { result = pfnCreateExp( hDriver, pDescriptor, phBuilder ); } else { // generic implementation *phBuilder = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderGetBuildPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderGetBuildPropertiesExp( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor ze_rtas_builder_exp_properties_t* pProperties ///< [in,out] query result for builder properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetBuildPropertiesExp = context.zeDdiTable.RTASBuilderExp.pfnGetBuildPropertiesExp; if( nullptr != pfnGetBuildPropertiesExp ) { result = pfnGetBuildPropertiesExp( hBuilder, pBuildOpDescriptor, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverRTASFormatCompatibilityCheckExp __zedlllocal ze_result_t ZE_APICALL zeDriverRTASFormatCompatibilityCheckExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_format_exp_t rtasFormatA, ///< [in] operand A ze_rtas_format_exp_t rtasFormatB ///< [in] operand B ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnRTASFormatCompatibilityCheckExp = context.zeDdiTable.DriverExp.pfnRTASFormatCompatibilityCheckExp; if( nullptr != pfnRTASFormatCompatibilityCheckExp ) { result = pfnRTASFormatCompatibilityCheckExp( hDriver, rtasFormatA, rtasFormatB ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderBuildExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderBuildExp( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used ///< during acceleration structure construction size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes void* pRtasBuffer, ///< [in] pointer to destination buffer size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks ze_rtas_aabb_exp_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration ///< structure bounds size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in ///< bytes ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnBuildExp = context.zeDdiTable.RTASBuilderExp.pfnBuildExp; if( nullptr != pfnBuildExp ) { result = pfnBuildExp( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderDestroyExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderDestroyExp( ze_rtas_builder_exp_handle_t hBuilder ///< [in][release] handle of builder object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroyExp = context.zeDdiTable.RTASBuilderExp.pfnDestroyExp; if( nullptr != pfnDestroyExp ) { result = pfnDestroyExp( hBuilder ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationCreateExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationCreateExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_parallel_operation_exp_handle_t* phParallelOperation///< [out] handle of parallel operation object ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreateExp = context.zeDdiTable.RTASParallelOperationExp.pfnCreateExp; if( nullptr != pfnCreateExp ) { result = pfnCreateExp( hDriver, phParallelOperation ); } else { // generic implementation *phParallelOperation = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationGetPropertiesExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in] handle of parallel operation object ze_rtas_parallel_operation_exp_properties_t* pProperties///< [in,out] query result for parallel operation properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetPropertiesExp = context.zeDdiTable.RTASParallelOperationExp.pfnGetPropertiesExp; if( nullptr != pfnGetPropertiesExp ) { result = pfnGetPropertiesExp( hParallelOperation, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationJoinExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationJoinExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in] handle of parallel operation object ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnJoinExp = context.zeDdiTable.RTASParallelOperationExp.pfnJoinExp; if( nullptr != pfnJoinExp ) { result = pfnJoinExp( hParallelOperation ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationDestroyExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationDestroyExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroyExp = context.zeDdiTable.RTASParallelOperationExp.pfnDestroyExp; if( nullptr != pfnDestroyExp ) { result = pfnDestroyExp( hParallelOperation ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetPitchFor2dImage __zedlllocal ze_result_t ZE_APICALL zeMemGetPitchFor2dImage( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device size_t imageWidth, ///< [in] imageWidth size_t imageHeight, ///< [in] imageHeight unsigned int elementSizeInBytes, ///< [in] Element size in bytes size_t * rowPitch ///< [out] rowPitch ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetPitchFor2dImage = context.zeDdiTable.Mem.pfnGetPitchFor2dImage; if( nullptr != pfnGetPitchFor2dImage ) { result = pfnGetPitchFor2dImage( hContext, hDevice, imageWidth, imageHeight, elementSizeInBytes, rowPitch ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetDeviceOffsetExp __zedlllocal ze_result_t ZE_APICALL zeImageGetDeviceOffsetExp( ze_image_handle_t hImage, ///< [in] handle of the image uint64_t* pDeviceOffset ///< [out] bindless device offset for image ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetDeviceOffsetExp = context.zeDdiTable.ImageExp.pfnGetDeviceOffsetExp; if( nullptr != pfnGetDeviceOffsetExp ) { result = pfnGetDeviceOffsetExp( hImage, pDeviceOffset ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListCreateCloneExp __zedlllocal ze_result_t ZE_APICALL zeCommandListCreateCloneExp( ze_command_list_handle_t hCommandList, ///< [in] handle to source command list (the command list to clone) ze_command_list_handle_t* phClonedCommandList ///< [out] pointer to handle of the cloned command list ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreateCloneExp = context.zeDdiTable.CommandListExp.pfnCreateCloneExp; if( nullptr != pfnCreateCloneExp ) { result = pfnCreateCloneExp( hCommandList, phClonedCommandList ); } else { // generic implementation *phClonedCommandList = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListImmediateAppendCommandListsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListImmediateAppendCommandListsExp( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t numCommandLists, ///< [in] number of command lists ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion ///< - if not null, this event is signaled after the completion of all ///< appended command lists uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended ///< command lists; must be 0 if nullptr == phWaitEvents ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing appended command lists. ///< - if not null, all wait events must be satisfied prior to the start ///< of any appended command list(s) ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnImmediateAppendCommandListsExp = context.zeDdiTable.CommandListExp.pfnImmediateAppendCommandListsExp; if( nullptr != pfnImmediateAppendCommandListsExp ) { result = pfnImmediateAppendCommandListsExp( hCommandListImmediate, numCommandLists, phCommandLists, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdExp __zedlllocal ze_result_t ZE_APICALL zeCommandListGetNextCommandIdExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in] pointer to mutable command identifier descriptor uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetNextCommandIdExp = context.zeDdiTable.CommandListExp.pfnGetNextCommandIdExp; if( nullptr != pfnGetNextCommandIdExp ) { result = pfnGetNextCommandIdExp( hCommandList, desc, pCommandId ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdWithKernelsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListGetNextCommandIdWithKernelsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in][out] pointer to mutable command identifier descriptor uint32_t numKernels, ///< [in][optional] number of entries on phKernels list ze_kernel_handle_t* phKernels, ///< [in][optional][range(0, numKernels)] list of kernels that user can ///< switch between using ::zeCommandListUpdateMutableCommandKernelsExp ///< call uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetNextCommandIdWithKernelsExp = context.zeDdiTable.CommandListExp.pfnGetNextCommandIdWithKernelsExp; if( nullptr != pfnGetNextCommandIdWithKernelsExp ) { result = pfnGetNextCommandIdWithKernelsExp( hCommandList, desc, numKernels, phKernels, pCommandId ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_commands_exp_desc_t* desc ///< [in] pointer to mutable commands descriptor; multiple descriptors may ///< be chained via `pNext` member ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnUpdateMutableCommandsExp = context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandsExp; if( nullptr != pfnUpdateMutableCommandsExp ) { result = pfnUpdateMutableCommandsExp( hCommandList, desc ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandSignalEventExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandSignalEventExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier ze_event_handle_t hSignalEvent ///< [in][optional] handle of the event to signal on completion ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnUpdateMutableCommandSignalEventExp = context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandSignalEventExp; if( nullptr != pfnUpdateMutableCommandSignalEventExp ) { result = pfnUpdateMutableCommandSignalEventExp( hCommandList, commandId, hSignalEvent ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandWaitEventsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandWaitEventsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier uint32_t numWaitEvents, ///< [in][optional] the number of wait events ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnUpdateMutableCommandWaitEventsExp = context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandWaitEventsExp; if( nullptr != pfnUpdateMutableCommandWaitEventsExp ) { result = pfnUpdateMutableCommandWaitEventsExp( hCommandList, commandId, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandKernelsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandKernelsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] the number of kernels to update uint64_t* pCommandId, ///< [in][range(0, numKernels)] command identifier ze_kernel_handle_t* phKernels ///< [in][range(0, numKernels)] handle of the kernel for a command ///< identifier to switch to ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnUpdateMutableCommandKernelsExp = context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandKernelsExp; if( nullptr != pfnUpdateMutableCommandKernelsExp ) { result = pfnUpdateMutableCommandKernelsExp( hCommandList, numKernels, pCommandId, phKernels ); } else { // generic implementation } return result; } } // namespace driver #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Global table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetGlobalProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_global_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnInit = driver::zeInit; auto missing_api = getenv_string( "ZEL_TEST_MISSING_API" ); if (std::strcmp(missing_api.c_str(), "zeInitDrivers") == 0) { pDdiTable->pfnInitDrivers = nullptr; } else { pDdiTable->pfnInitDrivers = driver::zeInitDrivers; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASBuilderExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetRTASBuilderExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_rtas_builder_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreateExp = driver::zeRTASBuilderCreateExp; pDdiTable->pfnGetBuildPropertiesExp = driver::zeRTASBuilderGetBuildPropertiesExp; pDdiTable->pfnBuildExp = driver::zeRTASBuilderBuildExp; pDdiTable->pfnDestroyExp = driver::zeRTASBuilderDestroyExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASParallelOperationExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetRTASParallelOperationExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_rtas_parallel_operation_exp_dditable_t* pDdiTable///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreateExp = driver::zeRTASParallelOperationCreateExp; pDdiTable->pfnGetPropertiesExp = driver::zeRTASParallelOperationGetPropertiesExp; pDdiTable->pfnJoinExp = driver::zeRTASParallelOperationJoinExp; pDdiTable->pfnDestroyExp = driver::zeRTASParallelOperationDestroyExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Driver table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDriverProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_driver_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGet = driver::zeDriverGet; pDdiTable->pfnGetApiVersion = driver::zeDriverGetApiVersion; pDdiTable->pfnGetProperties = driver::zeDriverGetProperties; pDdiTable->pfnGetIpcProperties = driver::zeDriverGetIpcProperties; pDdiTable->pfnGetExtensionProperties = driver::zeDriverGetExtensionProperties; pDdiTable->pfnGetExtensionFunctionAddress = driver::zeDriverGetExtensionFunctionAddress; pDdiTable->pfnGetLastErrorDescription = driver::zeDriverGetLastErrorDescription; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DriverExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDriverExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_driver_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnRTASFormatCompatibilityCheckExp = driver::zeDriverRTASFormatCompatibilityCheckExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGet = driver::zeDeviceGet; pDdiTable->pfnGetSubDevices = driver::zeDeviceGetSubDevices; pDdiTable->pfnGetProperties = driver::zeDeviceGetProperties; pDdiTable->pfnGetComputeProperties = driver::zeDeviceGetComputeProperties; pDdiTable->pfnGetModuleProperties = driver::zeDeviceGetModuleProperties; pDdiTable->pfnGetCommandQueueGroupProperties = driver::zeDeviceGetCommandQueueGroupProperties; pDdiTable->pfnGetMemoryProperties = driver::zeDeviceGetMemoryProperties; pDdiTable->pfnGetMemoryAccessProperties = driver::zeDeviceGetMemoryAccessProperties; pDdiTable->pfnGetCacheProperties = driver::zeDeviceGetCacheProperties; pDdiTable->pfnGetImageProperties = driver::zeDeviceGetImageProperties; pDdiTable->pfnGetExternalMemoryProperties = driver::zeDeviceGetExternalMemoryProperties; pDdiTable->pfnGetP2PProperties = driver::zeDeviceGetP2PProperties; pDdiTable->pfnCanAccessPeer = driver::zeDeviceCanAccessPeer; pDdiTable->pfnGetStatus = driver::zeDeviceGetStatus; pDdiTable->pfnGetGlobalTimestamps = driver::zeDeviceGetGlobalTimestamps; pDdiTable->pfnImportExternalSemaphoreExt = driver::zeDeviceImportExternalSemaphoreExt; pDdiTable->pfnReleaseExternalSemaphoreExt = driver::zeDeviceReleaseExternalSemaphoreExt; pDdiTable->pfnReserveCacheExt = driver::zeDeviceReserveCacheExt; pDdiTable->pfnSetCacheAdviceExt = driver::zeDeviceSetCacheAdviceExt; pDdiTable->pfnPciGetPropertiesExt = driver::zeDevicePciGetPropertiesExt; pDdiTable->pfnGetRootDevice = driver::zeDeviceGetRootDevice; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetFabricVertexExp = driver::zeDeviceGetFabricVertexExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Context table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetContextProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_context_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zeContextCreate; pDdiTable->pfnDestroy = driver::zeContextDestroy; pDdiTable->pfnGetStatus = driver::zeContextGetStatus; pDdiTable->pfnSystemBarrier = driver::zeContextSystemBarrier; pDdiTable->pfnMakeMemoryResident = driver::zeContextMakeMemoryResident; pDdiTable->pfnEvictMemory = driver::zeContextEvictMemory; pDdiTable->pfnMakeImageResident = driver::zeContextMakeImageResident; pDdiTable->pfnEvictImage = driver::zeContextEvictImage; pDdiTable->pfnCreateEx = driver::zeContextCreateEx; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandQueue table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandQueueProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_queue_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zeCommandQueueCreate; pDdiTable->pfnDestroy = driver::zeCommandQueueDestroy; pDdiTable->pfnExecuteCommandLists = driver::zeCommandQueueExecuteCommandLists; pDdiTable->pfnSynchronize = driver::zeCommandQueueSynchronize; pDdiTable->pfnGetOrdinal = driver::zeCommandQueueGetOrdinal; pDdiTable->pfnGetIndex = driver::zeCommandQueueGetIndex; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandList table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandListProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_list_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zeCommandListCreate; pDdiTable->pfnCreateImmediate = driver::zeCommandListCreateImmediate; pDdiTable->pfnDestroy = driver::zeCommandListDestroy; pDdiTable->pfnClose = driver::zeCommandListClose; pDdiTable->pfnReset = driver::zeCommandListReset; pDdiTable->pfnAppendWriteGlobalTimestamp = driver::zeCommandListAppendWriteGlobalTimestamp; pDdiTable->pfnAppendBarrier = driver::zeCommandListAppendBarrier; pDdiTable->pfnAppendMemoryRangesBarrier = driver::zeCommandListAppendMemoryRangesBarrier; pDdiTable->pfnAppendMemoryCopy = driver::zeCommandListAppendMemoryCopy; pDdiTable->pfnAppendMemoryFill = driver::zeCommandListAppendMemoryFill; pDdiTable->pfnAppendMemoryCopyRegion = driver::zeCommandListAppendMemoryCopyRegion; pDdiTable->pfnAppendMemoryCopyFromContext = driver::zeCommandListAppendMemoryCopyFromContext; pDdiTable->pfnAppendImageCopy = driver::zeCommandListAppendImageCopy; pDdiTable->pfnAppendImageCopyRegion = driver::zeCommandListAppendImageCopyRegion; pDdiTable->pfnAppendImageCopyToMemory = driver::zeCommandListAppendImageCopyToMemory; pDdiTable->pfnAppendImageCopyFromMemory = driver::zeCommandListAppendImageCopyFromMemory; pDdiTable->pfnAppendMemoryPrefetch = driver::zeCommandListAppendMemoryPrefetch; pDdiTable->pfnAppendMemAdvise = driver::zeCommandListAppendMemAdvise; pDdiTable->pfnAppendSignalEvent = driver::zeCommandListAppendSignalEvent; pDdiTable->pfnAppendWaitOnEvents = driver::zeCommandListAppendWaitOnEvents; pDdiTable->pfnAppendEventReset = driver::zeCommandListAppendEventReset; pDdiTable->pfnAppendQueryKernelTimestamps = driver::zeCommandListAppendQueryKernelTimestamps; pDdiTable->pfnAppendLaunchKernel = driver::zeCommandListAppendLaunchKernel; pDdiTable->pfnAppendLaunchCooperativeKernel = driver::zeCommandListAppendLaunchCooperativeKernel; pDdiTable->pfnAppendLaunchKernelIndirect = driver::zeCommandListAppendLaunchKernelIndirect; pDdiTable->pfnAppendLaunchMultipleKernelsIndirect = driver::zeCommandListAppendLaunchMultipleKernelsIndirect; pDdiTable->pfnAppendSignalExternalSemaphoreExt = driver::zeCommandListAppendSignalExternalSemaphoreExt; pDdiTable->pfnAppendWaitExternalSemaphoreExt = driver::zeCommandListAppendWaitExternalSemaphoreExt; pDdiTable->pfnAppendImageCopyToMemoryExt = driver::zeCommandListAppendImageCopyToMemoryExt; pDdiTable->pfnAppendImageCopyFromMemoryExt = driver::zeCommandListAppendImageCopyFromMemoryExt; pDdiTable->pfnHostSynchronize = driver::zeCommandListHostSynchronize; pDdiTable->pfnGetDeviceHandle = driver::zeCommandListGetDeviceHandle; pDdiTable->pfnGetContextHandle = driver::zeCommandListGetContextHandle; pDdiTable->pfnGetOrdinal = driver::zeCommandListGetOrdinal; pDdiTable->pfnImmediateGetIndex = driver::zeCommandListImmediateGetIndex; pDdiTable->pfnIsImmediate = driver::zeCommandListIsImmediate; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandListExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandListExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_list_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetNextCommandIdWithKernelsExp = driver::zeCommandListGetNextCommandIdWithKernelsExp; pDdiTable->pfnUpdateMutableCommandKernelsExp = driver::zeCommandListUpdateMutableCommandKernelsExp; pDdiTable->pfnCreateCloneExp = driver::zeCommandListCreateCloneExp; pDdiTable->pfnImmediateAppendCommandListsExp = driver::zeCommandListImmediateAppendCommandListsExp; pDdiTable->pfnGetNextCommandIdExp = driver::zeCommandListGetNextCommandIdExp; pDdiTable->pfnUpdateMutableCommandsExp = driver::zeCommandListUpdateMutableCommandsExp; pDdiTable->pfnUpdateMutableCommandSignalEventExp = driver::zeCommandListUpdateMutableCommandSignalEventExp; pDdiTable->pfnUpdateMutableCommandWaitEventsExp = driver::zeCommandListUpdateMutableCommandWaitEventsExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Event table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zeEventCreate; pDdiTable->pfnDestroy = driver::zeEventDestroy; pDdiTable->pfnHostSignal = driver::zeEventHostSignal; pDdiTable->pfnHostSynchronize = driver::zeEventHostSynchronize; pDdiTable->pfnQueryStatus = driver::zeEventQueryStatus; pDdiTable->pfnHostReset = driver::zeEventHostReset; pDdiTable->pfnQueryKernelTimestamp = driver::zeEventQueryKernelTimestamp; pDdiTable->pfnQueryKernelTimestampsExt = driver::zeEventQueryKernelTimestampsExt; pDdiTable->pfnGetEventPool = driver::zeEventGetEventPool; pDdiTable->pfnGetSignalScope = driver::zeEventGetSignalScope; pDdiTable->pfnGetWaitScope = driver::zeEventGetWaitScope; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's EventExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnQueryTimestampsExp = driver::zeEventQueryTimestampsExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's EventPool table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventPoolProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_pool_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zeEventPoolCreate; pDdiTable->pfnDestroy = driver::zeEventPoolDestroy; pDdiTable->pfnGetIpcHandle = driver::zeEventPoolGetIpcHandle; pDdiTable->pfnOpenIpcHandle = driver::zeEventPoolOpenIpcHandle; pDdiTable->pfnCloseIpcHandle = driver::zeEventPoolCloseIpcHandle; pDdiTable->pfnPutIpcHandle = driver::zeEventPoolPutIpcHandle; pDdiTable->pfnGetContextHandle = driver::zeEventPoolGetContextHandle; pDdiTable->pfnGetFlags = driver::zeEventPoolGetFlags; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Fence table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFenceProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fence_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zeFenceCreate; pDdiTable->pfnDestroy = driver::zeFenceDestroy; pDdiTable->pfnHostSynchronize = driver::zeFenceHostSynchronize; pDdiTable->pfnQueryStatus = driver::zeFenceQueryStatus; pDdiTable->pfnReset = driver::zeFenceReset; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Image table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetImageProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_image_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zeImageGetProperties; pDdiTable->pfnCreate = driver::zeImageCreate; pDdiTable->pfnDestroy = driver::zeImageDestroy; pDdiTable->pfnGetAllocPropertiesExt = driver::zeImageGetAllocPropertiesExt; pDdiTable->pfnViewCreateExt = driver::zeImageViewCreateExt; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ImageExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetImageExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_image_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetMemoryPropertiesExp = driver::zeImageGetMemoryPropertiesExp; pDdiTable->pfnViewCreateExp = driver::zeImageViewCreateExp; pDdiTable->pfnGetDeviceOffsetExp = driver::zeImageGetDeviceOffsetExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Kernel table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetKernelProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_kernel_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zeKernelCreate; pDdiTable->pfnDestroy = driver::zeKernelDestroy; pDdiTable->pfnSetCacheConfig = driver::zeKernelSetCacheConfig; pDdiTable->pfnSetGroupSize = driver::zeKernelSetGroupSize; pDdiTable->pfnSuggestGroupSize = driver::zeKernelSuggestGroupSize; pDdiTable->pfnSuggestMaxCooperativeGroupCount = driver::zeKernelSuggestMaxCooperativeGroupCount; pDdiTable->pfnSetArgumentValue = driver::zeKernelSetArgumentValue; pDdiTable->pfnSetIndirectAccess = driver::zeKernelSetIndirectAccess; pDdiTable->pfnGetIndirectAccess = driver::zeKernelGetIndirectAccess; pDdiTable->pfnGetSourceAttributes = driver::zeKernelGetSourceAttributes; pDdiTable->pfnGetProperties = driver::zeKernelGetProperties; pDdiTable->pfnGetName = driver::zeKernelGetName; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's KernelExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetKernelExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_kernel_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnSetGlobalOffsetExp = driver::zeKernelSetGlobalOffsetExp; pDdiTable->pfnGetBinaryExp = driver::zeKernelGetBinaryExp; pDdiTable->pfnSchedulingHintExp = driver::zeKernelSchedulingHintExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Mem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnAllocShared = driver::zeMemAllocShared; pDdiTable->pfnAllocDevice = driver::zeMemAllocDevice; pDdiTable->pfnAllocHost = driver::zeMemAllocHost; pDdiTable->pfnFree = driver::zeMemFree; pDdiTable->pfnGetAllocProperties = driver::zeMemGetAllocProperties; pDdiTable->pfnGetAddressRange = driver::zeMemGetAddressRange; pDdiTable->pfnGetIpcHandle = driver::zeMemGetIpcHandle; pDdiTable->pfnOpenIpcHandle = driver::zeMemOpenIpcHandle; pDdiTable->pfnCloseIpcHandle = driver::zeMemCloseIpcHandle; pDdiTable->pfnFreeExt = driver::zeMemFreeExt; pDdiTable->pfnPutIpcHandle = driver::zeMemPutIpcHandle; pDdiTable->pfnGetPitchFor2dImage = driver::zeMemGetPitchFor2dImage; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MemExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetMemExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_mem_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetIpcHandleFromFileDescriptorExp = driver::zeMemGetIpcHandleFromFileDescriptorExp; pDdiTable->pfnGetFileDescriptorFromIpcHandleExp = driver::zeMemGetFileDescriptorFromIpcHandleExp; pDdiTable->pfnSetAtomicAccessAttributeExp = driver::zeMemSetAtomicAccessAttributeExp; pDdiTable->pfnGetAtomicAccessAttributeExp = driver::zeMemGetAtomicAccessAttributeExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Module table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetModuleProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_module_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zeModuleCreate; pDdiTable->pfnDestroy = driver::zeModuleDestroy; pDdiTable->pfnDynamicLink = driver::zeModuleDynamicLink; pDdiTable->pfnGetNativeBinary = driver::zeModuleGetNativeBinary; pDdiTable->pfnGetGlobalPointer = driver::zeModuleGetGlobalPointer; pDdiTable->pfnGetKernelNames = driver::zeModuleGetKernelNames; pDdiTable->pfnGetProperties = driver::zeModuleGetProperties; pDdiTable->pfnGetFunctionPointer = driver::zeModuleGetFunctionPointer; pDdiTable->pfnInspectLinkageExt = driver::zeModuleInspectLinkageExt; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ModuleBuildLog table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetModuleBuildLogProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_module_build_log_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnDestroy = driver::zeModuleBuildLogDestroy; pDdiTable->pfnGetString = driver::zeModuleBuildLogGetString; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's PhysicalMem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetPhysicalMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_physical_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zePhysicalMemCreate; pDdiTable->pfnDestroy = driver::zePhysicalMemDestroy; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Sampler table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetSamplerProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_sampler_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zeSamplerCreate; pDdiTable->pfnDestroy = driver::zeSamplerDestroy; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's VirtualMem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetVirtualMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_virtual_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnReserve = driver::zeVirtualMemReserve; pDdiTable->pfnFree = driver::zeVirtualMemFree; pDdiTable->pfnQueryPageSize = driver::zeVirtualMemQueryPageSize; pDdiTable->pfnMap = driver::zeVirtualMemMap; pDdiTable->pfnUnmap = driver::zeVirtualMemUnmap; pDdiTable->pfnSetAccessAttribute = driver::zeVirtualMemSetAccessAttribute; pDdiTable->pfnGetAccessAttribute = driver::zeVirtualMemGetAccessAttribute; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricEdgeExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFabricEdgeExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fabric_edge_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetExp = driver::zeFabricEdgeGetExp; pDdiTable->pfnGetVerticesExp = driver::zeFabricEdgeGetVerticesExp; pDdiTable->pfnGetPropertiesExp = driver::zeFabricEdgeGetPropertiesExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricVertexExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFabricVertexExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fabric_vertex_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetExp = driver::zeFabricVertexGetExp; pDdiTable->pfnGetSubVerticesExp = driver::zeFabricVertexGetSubVerticesExp; pDdiTable->pfnGetPropertiesExp = driver::zeFabricVertexGetPropertiesExp; pDdiTable->pfnGetDeviceExp = driver::zeFabricVertexGetDeviceExp; return result; } #if defined(__cplusplus) }; #endif level-zero-1.20.6/source/drivers/null/zes_nullddi.cpp000066400000000000000000006726311475521542100226610ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_nullddi.cpp * */ #include "ze_null.h" #include namespace driver { /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesInit __zedlllocal ze_result_t ZE_APICALL zesInit( zes_init_flags_t flags ///< [in] initialization flags. ///< currently unused, must be 0 (default). ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnInit = context.zesDdiTable.Global.pfnInit; if( nullptr != pfnInit ) { result = pfnInit( flags ); } else { // generic implementation auto driver_type = getenv_string( "ZEL_TEST_NULL_DRIVER_TYPE" ); if (std::strcmp(driver_type.c_str(), "GPU") == 0) { if (!(flags & ZE_INIT_FLAG_GPU_ONLY)) { return ZE_RESULT_ERROR_UNINITIALIZED; } } if (std::strcmp(driver_type.c_str(), "NPU") == 0) { if (!(flags & ZE_INIT_FLAG_VPU_ONLY)) { return ZE_RESULT_ERROR_UNINITIALIZED; } } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverGet __zedlllocal ze_result_t ZE_APICALL zesDriverGet( uint32_t* pCount, ///< [in,out] pointer to the number of sysman driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of sysman drivers available. ///< if count is greater than the number of sysman drivers available, then ///< the loader shall update the value with the correct number of sysman ///< drivers available. zes_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of sysman driver instance handles. ///< if count is less than the number of sysman drivers available, then the ///< loader shall only retrieve that number of sysman drivers. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGet = context.zesDdiTable.Driver.pfnGet; if( nullptr != pfnGet ) { result = pfnGet( pCount, phDrivers ); } else { // generic implementation for( size_t i = 0; ( nullptr != phDrivers ) && ( i < *pCount ); ++i ) phDrivers[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverGetExtensionProperties __zedlllocal ze_result_t ZE_APICALL zesDriverGetExtensionProperties( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. zes_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetExtensionProperties = context.zesDdiTable.Driver.pfnGetExtensionProperties; if( nullptr != pfnGetExtensionProperties ) { result = pfnGetExtensionProperties( hDriver, pCount, pExtensionProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverGetExtensionFunctionAddress __zedlllocal ze_result_t ZE_APICALL zesDriverGetExtensionFunctionAddress( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetExtensionFunctionAddress = context.zesDdiTable.Driver.pfnGetExtensionFunctionAddress; if( nullptr != pfnGetExtensionFunctionAddress ) { result = pfnGetExtensionFunctionAddress( hDriver, name, ppFunctionAddress ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGet __zedlllocal ze_result_t ZE_APICALL zesDeviceGet( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance uint32_t* pCount, ///< [in,out] pointer to the number of sysman devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sysman devices available. ///< if count is greater than the number of sysman devices available, then ///< the driver shall update the value with the correct number of sysman ///< devices available. zes_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of sysman devices. ///< if count is less than the number of sysman devices available, then ///< driver shall only retrieve that number of sysman devices. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGet = context.zesDdiTable.Device.pfnGet; if( nullptr != pfnGet ) { result = pfnGet( hDriver, pCount, phDevices ); } else { // generic implementation for( size_t i = 0; ( nullptr != phDevices ) && ( i < *pCount ); ++i ) phDevices[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetProperties __zedlllocal ze_result_t ZE_APICALL zesDeviceGetProperties( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_properties_t* pProperties ///< [in,out] Structure that will contain information about the device. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Device.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hDevice, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetState __zedlllocal ze_result_t ZE_APICALL zesDeviceGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_state_t* pState ///< [in,out] Structure that will contain information about the device. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetState = context.zesDdiTable.Device.pfnGetState; if( nullptr != pfnGetState ) { result = pfnGetState( hDevice, pState ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceReset __zedlllocal ze_result_t ZE_APICALL zesDeviceReset( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device ze_bool_t force ///< [in] If set to true, all applications that are currently using the ///< device will be forcibly killed. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReset = context.zesDdiTable.Device.pfnReset; if( nullptr != pfnReset ) { result = pfnReset( hDevice, force ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceResetExt __zedlllocal ze_result_t ZE_APICALL zesDeviceResetExt( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device zes_reset_properties_t* pProperties ///< [in] Device reset properties to apply ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnResetExt = context.zesDdiTable.Device.pfnResetExt; if( nullptr != pfnResetExt ) { result = pfnResetExt( hDevice, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceProcessesGetState __zedlllocal ze_result_t ZE_APICALL zesDeviceProcessesGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device uint32_t* pCount, ///< [in,out] pointer to the number of processes. ///< if count is zero, then the driver shall update the value with the ///< total number of processes currently attached to the device. ///< if count is greater than the number of processes currently attached to ///< the device, then the driver shall update the value with the correct ///< number of processes. zes_process_state_t* pProcesses ///< [in,out][optional][range(0, *pCount)] array of process information. ///< if count is less than the number of processes currently attached to ///< the device, then the driver shall only retrieve information about that ///< number of processes. In this case, the return code will ::ZE_RESULT_ERROR_INVALID_SIZE. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnProcessesGetState = context.zesDdiTable.Device.pfnProcessesGetState; if( nullptr != pfnProcessesGetState ) { result = pfnProcessesGetState( hDevice, pCount, pProcesses ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDevicePciGetProperties __zedlllocal ze_result_t ZE_APICALL zesDevicePciGetProperties( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_properties_t* pProperties ///< [in,out] Will contain the PCI properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnPciGetProperties = context.zesDdiTable.Device.pfnPciGetProperties; if( nullptr != pfnPciGetProperties ) { result = pfnPciGetProperties( hDevice, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDevicePciGetState __zedlllocal ze_result_t ZE_APICALL zesDevicePciGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_state_t* pState ///< [in,out] Will contain the PCI properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnPciGetState = context.zesDdiTable.Device.pfnPciGetState; if( nullptr != pfnPciGetState ) { result = pfnPciGetState( hDevice, pState ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDevicePciGetBars __zedlllocal ze_result_t ZE_APICALL zesDevicePciGetBars( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of PCI bars. ///< if count is zero, then the driver shall update the value with the ///< total number of PCI bars that are setup. ///< if count is greater than the number of PCI bars that are setup, then ///< the driver shall update the value with the correct number of PCI bars. zes_pci_bar_properties_t* pProperties ///< [in,out][optional][range(0, *pCount)] array of information about setup ///< PCI bars. ///< if count is less than the number of PCI bars that are setup, then the ///< driver shall only retrieve information about that number of PCI bars. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnPciGetBars = context.zesDdiTable.Device.pfnPciGetBars; if( nullptr != pfnPciGetBars ) { result = pfnPciGetBars( hDevice, pCount, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDevicePciGetStats __zedlllocal ze_result_t ZE_APICALL zesDevicePciGetStats( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_stats_t* pStats ///< [in,out] Will contain a snapshot of the latest stats. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnPciGetStats = context.zesDdiTable.Device.pfnPciGetStats; if( nullptr != pfnPciGetStats ) { result = pfnPciGetStats( hDevice, pStats ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceSetOverclockWaiver __zedlllocal ze_result_t ZE_APICALL zesDeviceSetOverclockWaiver( zes_device_handle_t hDevice ///< [in] Sysman handle of the device. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetOverclockWaiver = context.zesDdiTable.Device.pfnSetOverclockWaiver; if( nullptr != pfnSetOverclockWaiver ) { result = pfnSetOverclockWaiver( hDevice ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetOverclockDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceGetOverclockDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pOverclockDomains ///< [in,out] Returns the overclock domains that are supported (a bit for ///< each of enum ::zes_overclock_domain_t). If no bits are set, the device ///< doesn't support overclocking. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetOverclockDomains = context.zesDdiTable.Device.pfnGetOverclockDomains; if( nullptr != pfnGetOverclockDomains ) { result = pfnGetOverclockDomains( hDevice, pOverclockDomains ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetOverclockControls __zedlllocal ze_result_t ZE_APICALL zesDeviceGetOverclockControls( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_domain_t domainType, ///< [in] Domain type. uint32_t* pAvailableControls ///< [in,out] Returns the overclock controls that are supported for the ///< specified overclock domain (a bit for each of enum ///< ::zes_overclock_control_t). ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetOverclockControls = context.zesDdiTable.Device.pfnGetOverclockControls; if( nullptr != pfnGetOverclockControls ) { result = pfnGetOverclockControls( hDevice, domainType, pAvailableControls ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceResetOverclockSettings __zedlllocal ze_result_t ZE_APICALL zesDeviceResetOverclockSettings( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. ze_bool_t onShippedState ///< [in] True will reset to shipped state; false will reset to ///< manufacturing state ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnResetOverclockSettings = context.zesDdiTable.Device.pfnResetOverclockSettings; if( nullptr != pfnResetOverclockSettings ) { result = pfnResetOverclockSettings( hDevice, onShippedState ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceReadOverclockState __zedlllocal ze_result_t ZE_APICALL zesDeviceReadOverclockState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_mode_t* pOverclockMode, ///< [out] One of overclock mode. ze_bool_t* pWaiverSetting, ///< [out] Waiver setting: 0 = Waiver not set, 1 = waiver has been set. ze_bool_t* pOverclockState, ///< [out] Current settings 0 =manufacturing state, 1= shipped state).. zes_pending_action_t* pPendingAction, ///< [out] This enum is returned when the driver attempts to set an ///< overclock control or reset overclock settings. ze_bool_t* pPendingReset ///< [out] Pending reset 0 =manufacturing state, 1= shipped state).. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReadOverclockState = context.zesDdiTable.Device.pfnReadOverclockState; if( nullptr != pfnReadOverclockState ) { result = pfnReadOverclockState( hDevice, pOverclockMode, pWaiverSetting, pOverclockState, pPendingAction, pPendingReset ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumOverclockDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumOverclockDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_overclock_handle_t* phDomainHandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumOverclockDomains = context.zesDdiTable.Device.pfnEnumOverclockDomains; if( nullptr != pfnEnumOverclockDomains ) { result = pfnEnumOverclockDomains( hDevice, pCount, phDomainHandle ); } else { // generic implementation for( size_t i = 0; ( nullptr != phDomainHandle ) && ( i < *pCount ); ++i ) phDomainHandle[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetDomainProperties __zedlllocal ze_result_t ZE_APICALL zesOverclockGetDomainProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_properties_t* pDomainProperties ///< [in,out] The overclock properties for the specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetDomainProperties = context.zesDdiTable.Overclock.pfnGetDomainProperties; if( nullptr != pfnGetDomainProperties ) { result = pfnGetDomainProperties( hDomainHandle, pDomainProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetDomainVFProperties __zedlllocal ze_result_t ZE_APICALL zesOverclockGetDomainVFProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_property_t* pVFProperties ///< [in,out] The VF min,max,step for a specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetDomainVFProperties = context.zesDdiTable.Overclock.pfnGetDomainVFProperties; if( nullptr != pfnGetDomainVFProperties ) { result = pfnGetDomainVFProperties( hDomainHandle, pVFProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetDomainControlProperties __zedlllocal ze_result_t ZE_APICALL zesOverclockGetDomainControlProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Handle for the component. zes_control_property_t* pControlProperties ///< [in,out] overclock control values. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetDomainControlProperties = context.zesDdiTable.Overclock.pfnGetDomainControlProperties; if( nullptr != pfnGetDomainControlProperties ) { result = pfnGetDomainControlProperties( hDomainHandle, DomainControl, pControlProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetControlCurrentValue __zedlllocal ze_result_t ZE_APICALL zesOverclockGetControlCurrentValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [in,out] Getting overclock control value for the specified control. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetControlCurrentValue = context.zesDdiTable.Overclock.pfnGetControlCurrentValue; if( nullptr != pfnGetControlCurrentValue ) { result = pfnGetControlCurrentValue( hDomainHandle, DomainControl, pValue ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetControlPendingValue __zedlllocal ze_result_t ZE_APICALL zesOverclockGetControlPendingValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [out] Returns the pending value for a given control. The units and ///< format of the value depend on the control type. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetControlPendingValue = context.zesDdiTable.Overclock.pfnGetControlPendingValue; if( nullptr != pfnGetControlPendingValue ) { result = pfnGetControlPendingValue( hDomainHandle, DomainControl, pValue ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockSetControlUserValue __zedlllocal ze_result_t ZE_APICALL zesOverclockSetControlUserValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. double pValue, ///< [in] The new value of the control. The units and format of the value ///< depend on the control type. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetControlUserValue = context.zesDdiTable.Overclock.pfnSetControlUserValue; if( nullptr != pfnSetControlUserValue ) { result = pfnSetControlUserValue( hDomainHandle, DomainControl, pValue, pPendingAction ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetControlState __zedlllocal ze_result_t ZE_APICALL zesOverclockGetControlState( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. zes_control_state_t* pControlState, ///< [out] Current overclock control state. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetControlState = context.zesDdiTable.Overclock.pfnGetControlState; if( nullptr != pfnGetControlState ) { result = pfnGetControlState( hDomainHandle, DomainControl, pControlState, pPendingAction ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetVFPointValues __zedlllocal ze_result_t ZE_APICALL zesOverclockGetVFPointValues( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. zes_vf_array_type_t VFArrayType, ///< [in] User,Default or Live VF array to read from uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t* PointValue ///< [out] Returns the frequency in 1kHz units or voltage in millivolt ///< units from the custom V-F curve at the specified zero-based index ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetVFPointValues = context.zesDdiTable.Overclock.pfnGetVFPointValues; if( nullptr != pfnGetVFPointValues ) { result = pfnGetVFPointValues( hDomainHandle, VFType, VFArrayType, PointIndex, PointValue ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockSetVFPointValues __zedlllocal ze_result_t ZE_APICALL zesOverclockSetVFPointValues( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t PointValue ///< [in] Writes frequency in 1kHz units or voltage in millivolt units to ///< custom V-F curve at the specified zero-based index ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetVFPointValues = context.zesDdiTable.Overclock.pfnSetVFPointValues; if( nullptr != pfnSetVFPointValues ) { result = pfnSetVFPointValues( hDomainHandle, VFType, PointIndex, PointValue ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumDiagnosticTestSuites __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumDiagnosticTestSuites( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_diag_handle_t* phDiagnostics ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumDiagnosticTestSuites = context.zesDdiTable.Device.pfnEnumDiagnosticTestSuites; if( nullptr != pfnEnumDiagnosticTestSuites ) { result = pfnEnumDiagnosticTestSuites( hDevice, pCount, phDiagnostics ); } else { // generic implementation for( size_t i = 0; ( nullptr != phDiagnostics ) && ( i < *pCount ); ++i ) phDiagnostics[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDiagnosticsGetProperties __zedlllocal ze_result_t ZE_APICALL zesDiagnosticsGetProperties( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. zes_diag_properties_t* pProperties ///< [in,out] Structure describing the properties of a diagnostics test ///< suite ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Diagnostics.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hDiagnostics, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDiagnosticsGetTests __zedlllocal ze_result_t ZE_APICALL zesDiagnosticsGetTests( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of tests. ///< if count is zero, then the driver shall update the value with the ///< total number of tests that are available. ///< if count is greater than the number of tests that are available, then ///< the driver shall update the value with the correct number of tests. zes_diag_test_t* pTests ///< [in,out][optional][range(0, *pCount)] array of information about ///< individual tests sorted by increasing value of the `index` member of ::zes_diag_test_t. ///< if count is less than the number of tests that are available, then the ///< driver shall only retrieve that number of tests. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetTests = context.zesDdiTable.Diagnostics.pfnGetTests; if( nullptr != pfnGetTests ) { result = pfnGetTests( hDiagnostics, pCount, pTests ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDiagnosticsRunTests __zedlllocal ze_result_t ZE_APICALL zesDiagnosticsRunTests( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t startIndex, ///< [in] The index of the first test to run. Set to ///< ::ZES_DIAG_FIRST_TEST_INDEX to start from the beginning. uint32_t endIndex, ///< [in] The index of the last test to run. Set to ///< ::ZES_DIAG_LAST_TEST_INDEX to complete all tests after the start test. zes_diag_result_t* pResult ///< [in,out] The result of the diagnostics ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnRunTests = context.zesDdiTable.Diagnostics.pfnRunTests; if( nullptr != pfnRunTests ) { result = pfnRunTests( hDiagnostics, startIndex, endIndex, pResult ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEccAvailable __zedlllocal ze_result_t ZE_APICALL zesDeviceEccAvailable( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pAvailable ///< [out] ECC functionality is available (true)/unavailable (false). ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEccAvailable = context.zesDdiTable.Device.pfnEccAvailable; if( nullptr != pfnEccAvailable ) { result = pfnEccAvailable( hDevice, pAvailable ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEccConfigurable __zedlllocal ze_result_t ZE_APICALL zesDeviceEccConfigurable( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pConfigurable ///< [out] ECC can be enabled/disabled (true)/enabled/disabled (false). ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEccConfigurable = context.zesDdiTable.Device.pfnEccConfigurable; if( nullptr != pfnEccConfigurable ) { result = pfnEccConfigurable( hDevice, pConfigurable ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetEccState __zedlllocal ze_result_t ZE_APICALL zesDeviceGetEccState( zes_device_handle_t hDevice, ///< [in] Handle for the component. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetEccState = context.zesDdiTable.Device.pfnGetEccState; if( nullptr != pfnGetEccState ) { result = pfnGetEccState( hDevice, pState ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceSetEccState __zedlllocal ze_result_t ZE_APICALL zesDeviceSetEccState( zes_device_handle_t hDevice, ///< [in] Handle for the component. const zes_device_ecc_desc_t* newState, ///< [in] Pointer to desired ECC state. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetEccState = context.zesDdiTable.Device.pfnSetEccState; if( nullptr != pfnSetEccState ) { result = pfnSetEccState( hDevice, newState, pState ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumEngineGroups __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumEngineGroups( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_engine_handle_t* phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumEngineGroups = context.zesDdiTable.Device.pfnEnumEngineGroups; if( nullptr != pfnEnumEngineGroups ) { result = pfnEnumEngineGroups( hDevice, pCount, phEngine ); } else { // generic implementation for( size_t i = 0; ( nullptr != phEngine ) && ( i < *pCount ); ++i ) phEngine[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetProperties __zedlllocal ze_result_t ZE_APICALL zesEngineGetProperties( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_properties_t* pProperties ///< [in,out] The properties for the specified engine group. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Engine.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hEngine, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetActivity __zedlllocal ze_result_t ZE_APICALL zesEngineGetActivity( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_stats_t* pStats ///< [in,out] Will contain a snapshot of the engine group activity ///< counters. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetActivity = context.zesDdiTable.Engine.pfnGetActivity; if( nullptr != pfnGetActivity ) { result = pfnGetActivity( hEngine, pStats ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEventRegister __zedlllocal ze_result_t ZE_APICALL zesDeviceEventRegister( zes_device_handle_t hDevice, ///< [in] The device handle. zes_event_type_flags_t events ///< [in] List of events to listen to. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEventRegister = context.zesDdiTable.Device.pfnEventRegister; if( nullptr != pfnEventRegister ) { result = pfnEventRegister( hDevice, events ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverEventListen __zedlllocal ze_result_t ZE_APICALL zesDriverEventListen( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT32_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEventListen = context.zesDdiTable.Driver.pfnEventListen; if( nullptr != pfnEventListen ) { result = pfnEventListen( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverEventListenEx __zedlllocal ze_result_t ZE_APICALL zesDriverEventListenEx( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT64_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEventListenEx = context.zesDdiTable.Driver.pfnEventListenEx; if( nullptr != pfnEventListenEx ) { result = pfnEventListenEx( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumFabricPorts __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumFabricPorts( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fabric_port_handle_t* phPort ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumFabricPorts = context.zesDdiTable.Device.pfnEnumFabricPorts; if( nullptr != pfnEnumFabricPorts ) { result = pfnEnumFabricPorts( hDevice, pCount, phPort ); } else { // generic implementation for( size_t i = 0; ( nullptr != phPort ) && ( i < *pCount ); ++i ) phPort[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetProperties __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetProperties( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_properties_t* pProperties ///< [in,out] Will contain properties of the Fabric Port. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.FabricPort.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hPort, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetLinkType __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetLinkType( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_link_type_t* pLinkType ///< [in,out] Will contain details about the link attached to the Fabric ///< port. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetLinkType = context.zesDdiTable.FabricPort.pfnGetLinkType; if( nullptr != pfnGetLinkType ) { result = pfnGetLinkType( hPort, pLinkType ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetConfig __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetConfig( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_config_t* pConfig ///< [in,out] Will contain configuration of the Fabric Port. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetConfig = context.zesDdiTable.FabricPort.pfnGetConfig; if( nullptr != pfnGetConfig ) { result = pfnGetConfig( hPort, pConfig ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortSetConfig __zedlllocal ze_result_t ZE_APICALL zesFabricPortSetConfig( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. const zes_fabric_port_config_t* pConfig ///< [in] Contains new configuration of the Fabric Port. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetConfig = context.zesDdiTable.FabricPort.pfnSetConfig; if( nullptr != pfnSetConfig ) { result = pfnSetConfig( hPort, pConfig ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetState __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetState( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_state_t* pState ///< [in,out] Will contain the current state of the Fabric Port ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetState = context.zesDdiTable.FabricPort.pfnGetState; if( nullptr != pfnGetState ) { result = pfnGetState( hPort, pState ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetThroughput __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetThroughput( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_throughput_t* pThroughput ///< [in,out] Will contain the Fabric port throughput counters. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetThroughput = context.zesDdiTable.FabricPort.pfnGetThroughput; if( nullptr != pfnGetThroughput ) { result = pfnGetThroughput( hPort, pThroughput ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetFabricErrorCounters __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetFabricErrorCounters( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_error_counters_t* pErrors ///< [in,out] Will contain the Fabric port Error counters. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetFabricErrorCounters = context.zesDdiTable.FabricPort.pfnGetFabricErrorCounters; if( nullptr != pfnGetFabricErrorCounters ) { result = pfnGetFabricErrorCounters( hPort, pErrors ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetMultiPortThroughput __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetMultiPortThroughput( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t numPorts, ///< [in] Number of ports enumerated in function ::zesDeviceEnumFabricPorts zes_fabric_port_handle_t* phPort, ///< [in][range(0, numPorts)] array of fabric port handles provided by user ///< to gather throughput values. zes_fabric_port_throughput_t** pThroughput ///< [out][range(0, numPorts)] array of fabric port throughput counters ///< from multiple ports of type ::zes_fabric_port_throughput_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetMultiPortThroughput = context.zesDdiTable.FabricPort.pfnGetMultiPortThroughput; if( nullptr != pfnGetMultiPortThroughput ) { result = pfnGetMultiPortThroughput( hDevice, numPorts, phPort, pThroughput ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumFans __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumFans( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fan_handle_t* phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumFans = context.zesDdiTable.Device.pfnEnumFans; if( nullptr != pfnEnumFans ) { result = pfnEnumFans( hDevice, pCount, phFan ); } else { // generic implementation for( size_t i = 0; ( nullptr != phFan ) && ( i < *pCount ); ++i ) phFan[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanGetProperties __zedlllocal ze_result_t ZE_APICALL zesFanGetProperties( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_properties_t* pProperties ///< [in,out] Will contain the properties of the fan. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Fan.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hFan, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanGetConfig __zedlllocal ze_result_t ZE_APICALL zesFanGetConfig( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_config_t* pConfig ///< [in,out] Will contain the current configuration of the fan. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetConfig = context.zesDdiTable.Fan.pfnGetConfig; if( nullptr != pfnGetConfig ) { result = pfnGetConfig( hFan, pConfig ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanSetDefaultMode __zedlllocal ze_result_t ZE_APICALL zesFanSetDefaultMode( zes_fan_handle_t hFan ///< [in] Handle for the component. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetDefaultMode = context.zesDdiTable.Fan.pfnSetDefaultMode; if( nullptr != pfnSetDefaultMode ) { result = pfnSetDefaultMode( hFan ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanSetFixedSpeedMode __zedlllocal ze_result_t ZE_APICALL zesFanSetFixedSpeedMode( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_t* speed ///< [in] The fixed fan speed setting ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetFixedSpeedMode = context.zesDdiTable.Fan.pfnSetFixedSpeedMode; if( nullptr != pfnSetFixedSpeedMode ) { result = pfnSetFixedSpeedMode( hFan, speed ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanSetSpeedTableMode __zedlllocal ze_result_t ZE_APICALL zesFanSetSpeedTableMode( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_table_t* speedTable ///< [in] A table containing temperature/speed pairs. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetSpeedTableMode = context.zesDdiTable.Fan.pfnSetSpeedTableMode; if( nullptr != pfnSetSpeedTableMode ) { result = pfnSetSpeedTableMode( hFan, speedTable ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanGetState __zedlllocal ze_result_t ZE_APICALL zesFanGetState( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned. int32_t* pSpeed ///< [in,out] Will contain the current speed of the fan in the units ///< requested. A value of -1 indicates that the fan speed cannot be ///< measured. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetState = context.zesDdiTable.Fan.pfnGetState; if( nullptr != pfnGetState ) { result = pfnGetState( hFan, units, pSpeed ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumFirmwares __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumFirmwares( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_firmware_handle_t* phFirmware ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumFirmwares = context.zesDdiTable.Device.pfnEnumFirmwares; if( nullptr != pfnEnumFirmwares ) { result = pfnEnumFirmwares( hDevice, pCount, phFirmware ); } else { // generic implementation for( size_t i = 0; ( nullptr != phFirmware ) && ( i < *pCount ); ++i ) phFirmware[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetProperties __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetProperties( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. zes_firmware_properties_t* pProperties ///< [in,out] Pointer to an array that will hold the properties of the ///< firmware ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Firmware.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hFirmware, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareFlash __zedlllocal ze_result_t ZE_APICALL zesFirmwareFlash( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. void* pImage, ///< [in] Image of the new firmware to flash. uint32_t size ///< [in] Size of the flash image. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnFlash = context.zesDdiTable.Firmware.pfnFlash; if( nullptr != pfnFlash ) { result = pfnFlash( hFirmware, pImage, size ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetFlashProgress __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetFlashProgress( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. uint32_t* pCompletionPercent ///< [in,out] Pointer to the Completion Percentage of Firmware Update ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetFlashProgress = context.zesDdiTable.Firmware.pfnGetFlashProgress; if( nullptr != pfnGetFlashProgress ) { result = pfnGetFlashProgress( hFirmware, pCompletionPercent ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetConsoleLogs __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetConsoleLogs( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. size_t* pSize, ///< [in,out] size of firmware log char* pFirmwareLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetConsoleLogs = context.zesDdiTable.Firmware.pfnGetConsoleLogs; if( nullptr != pfnGetConsoleLogs ) { result = pfnGetConsoleLogs( hFirmware, pSize, pFirmwareLog ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumFrequencyDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumFrequencyDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_freq_handle_t* phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumFrequencyDomains = context.zesDdiTable.Device.pfnEnumFrequencyDomains; if( nullptr != pfnEnumFrequencyDomains ) { result = pfnEnumFrequencyDomains( hDevice, pCount, phFrequency ); } else { // generic implementation for( size_t i = 0; ( nullptr != phFrequency ) && ( i < *pCount ); ++i ) phFrequency[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetProperties __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetProperties( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_properties_t* pProperties ///< [in,out] The frequency properties for the specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Frequency.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hFrequency, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetAvailableClocks __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetAvailableClocks( zes_freq_handle_t hFrequency, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of frequencies. ///< if count is zero, then the driver shall update the value with the ///< total number of frequencies that are available. ///< if count is greater than the number of frequencies that are available, ///< then the driver shall update the value with the correct number of frequencies. double* phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of ///< MHz and sorted from slowest to fastest. ///< if count is less than the number of frequencies that are available, ///< then the driver shall only retrieve that number of frequencies. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetAvailableClocks = context.zesDdiTable.Frequency.pfnGetAvailableClocks; if( nullptr != pfnGetAvailableClocks ) { result = pfnGetAvailableClocks( hFrequency, pCount, phFrequency ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetRange __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetRange( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_range_t* pLimits ///< [in,out] The range between which the hardware can operate for the ///< specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetRange = context.zesDdiTable.Frequency.pfnGetRange; if( nullptr != pfnGetRange ) { result = pfnGetRange( hFrequency, pLimits ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencySetRange __zedlllocal ze_result_t ZE_APICALL zesFrequencySetRange( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. const zes_freq_range_t* pLimits ///< [in] The limits between which the hardware can operate for the ///< specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetRange = context.zesDdiTable.Frequency.pfnSetRange; if( nullptr != pfnSetRange ) { result = pfnSetRange( hFrequency, pLimits ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetState __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetState( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_state_t* pState ///< [in,out] Frequency state for the specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetState = context.zesDdiTable.Frequency.pfnGetState; if( nullptr != pfnGetState ) { result = pfnGetState( hFrequency, pState ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetThrottleTime __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetThrottleTime( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_throttle_time_t* pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the ///< specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetThrottleTime = context.zesDdiTable.Frequency.pfnGetThrottleTime; if( nullptr != pfnGetThrottleTime ) { result = pfnGetThrottleTime( hFrequency, pThrottleTime ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetCapabilities __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetCapabilities( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_capabilities_t* pOcCapabilities ///< [in,out] Pointer to the capabilities structure. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOcGetCapabilities = context.zesDdiTable.Frequency.pfnOcGetCapabilities; if( nullptr != pfnOcGetCapabilities ) { result = pfnOcGetCapabilities( hFrequency, pOcCapabilities ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetFrequencyTarget __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetFrequencyTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentOcFrequency ///< [out] Overclocking Frequency in MHz, if extended moded is supported, ///< will returned in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOcGetFrequencyTarget = context.zesDdiTable.Frequency.pfnOcGetFrequencyTarget; if( nullptr != pfnOcGetFrequencyTarget ) { result = pfnOcGetFrequencyTarget( hFrequency, pCurrentOcFrequency ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetFrequencyTarget __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetFrequencyTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentOcFrequency ///< [in] Overclocking Frequency in MHz, if extended moded is supported, it ///< could be set in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOcSetFrequencyTarget = context.zesDdiTable.Frequency.pfnOcSetFrequencyTarget; if( nullptr != pfnOcSetFrequencyTarget ) { result = pfnOcSetFrequencyTarget( hFrequency, CurrentOcFrequency ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetVoltageTarget __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetVoltageTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentVoltageTarget, ///< [out] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double* pCurrentVoltageOffset ///< [out] This voltage offset is applied to all points on the ///< voltage/frequency curve, including the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOcGetVoltageTarget = context.zesDdiTable.Frequency.pfnOcGetVoltageTarget; if( nullptr != pfnOcGetVoltageTarget ) { result = pfnOcGetVoltageTarget( hFrequency, pCurrentVoltageTarget, pCurrentVoltageOffset ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetVoltageTarget __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetVoltageTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentVoltageTarget, ///< [in] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double CurrentVoltageOffset ///< [in] This voltage offset is applied to all points on the ///< voltage/frequency curve, include the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOcSetVoltageTarget = context.zesDdiTable.Frequency.pfnOcSetVoltageTarget; if( nullptr != pfnOcSetVoltageTarget ) { result = pfnOcSetVoltageTarget( hFrequency, CurrentVoltageTarget, CurrentVoltageOffset ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetMode __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetMode( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t CurrentOcMode ///< [in] Current Overclocking Mode ::zes_oc_mode_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOcSetMode = context.zesDdiTable.Frequency.pfnOcSetMode; if( nullptr != pfnOcSetMode ) { result = pfnOcSetMode( hFrequency, CurrentOcMode ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetMode __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetMode( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t* pCurrentOcMode ///< [out] Current Overclocking Mode ::zes_oc_mode_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOcGetMode = context.zesDdiTable.Frequency.pfnOcGetMode; if( nullptr != pfnOcGetMode ) { result = pfnOcGetMode( hFrequency, pCurrentOcMode ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetIccMax __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetIccMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcIccMax ///< [in,out] Will contain the maximum current limit in Amperes on ///< successful return. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOcGetIccMax = context.zesDdiTable.Frequency.pfnOcGetIccMax; if( nullptr != pfnOcGetIccMax ) { result = pfnOcGetIccMax( hFrequency, pOcIccMax ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetIccMax __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetIccMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocIccMax ///< [in] The new maximum current limit in Amperes. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOcSetIccMax = context.zesDdiTable.Frequency.pfnOcSetIccMax; if( nullptr != pfnOcSetIccMax ) { result = pfnOcSetIccMax( hFrequency, ocIccMax ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetTjMax __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetTjMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcTjMax ///< [in,out] Will contain the maximum temperature limit in degrees Celsius ///< on successful return. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOcGetTjMax = context.zesDdiTable.Frequency.pfnOcGetTjMax; if( nullptr != pfnOcGetTjMax ) { result = pfnOcGetTjMax( hFrequency, pOcTjMax ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetTjMax __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetTjMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocTjMax ///< [in] The new maximum temperature limit in degrees Celsius. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOcSetTjMax = context.zesDdiTable.Frequency.pfnOcSetTjMax; if( nullptr != pfnOcSetTjMax ) { result = pfnOcSetTjMax( hFrequency, ocTjMax ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumLeds __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumLeds( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_led_handle_t* phLed ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumLeds = context.zesDdiTable.Device.pfnEnumLeds; if( nullptr != pfnEnumLeds ) { result = pfnEnumLeds( hDevice, pCount, phLed ); } else { // generic implementation for( size_t i = 0; ( nullptr != phLed ) && ( i < *pCount ); ++i ) phLed[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesLedGetProperties __zedlllocal ze_result_t ZE_APICALL zesLedGetProperties( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_properties_t* pProperties ///< [in,out] Will contain the properties of the LED. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Led.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hLed, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesLedGetState __zedlllocal ze_result_t ZE_APICALL zesLedGetState( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_state_t* pState ///< [in,out] Will contain the current state of the LED. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetState = context.zesDdiTable.Led.pfnGetState; if( nullptr != pfnGetState ) { result = pfnGetState( hLed, pState ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesLedSetState __zedlllocal ze_result_t ZE_APICALL zesLedSetState( zes_led_handle_t hLed, ///< [in] Handle for the component. ze_bool_t enable ///< [in] Set to TRUE to turn the LED on, FALSE to turn off. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetState = context.zesDdiTable.Led.pfnSetState; if( nullptr != pfnSetState ) { result = pfnSetState( hLed, enable ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesLedSetColor __zedlllocal ze_result_t ZE_APICALL zesLedSetColor( zes_led_handle_t hLed, ///< [in] Handle for the component. const zes_led_color_t* pColor ///< [in] New color of the LED. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetColor = context.zesDdiTable.Led.pfnSetColor; if( nullptr != pfnSetColor ) { result = pfnSetColor( hLed, pColor ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumMemoryModules __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumMemoryModules( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_mem_handle_t* phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumMemoryModules = context.zesDdiTable.Device.pfnEnumMemoryModules; if( nullptr != pfnEnumMemoryModules ) { result = pfnEnumMemoryModules( hDevice, pCount, phMemory ); } else { // generic implementation for( size_t i = 0; ( nullptr != phMemory ) && ( i < *pCount ); ++i ) phMemory[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesMemoryGetProperties __zedlllocal ze_result_t ZE_APICALL zesMemoryGetProperties( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_properties_t* pProperties ///< [in,out] Will contain memory properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Memory.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hMemory, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesMemoryGetState __zedlllocal ze_result_t ZE_APICALL zesMemoryGetState( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_state_t* pState ///< [in,out] Will contain the current health and allocated memory. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetState = context.zesDdiTable.Memory.pfnGetState; if( nullptr != pfnGetState ) { result = pfnGetState( hMemory, pState ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesMemoryGetBandwidth __zedlllocal ze_result_t ZE_APICALL zesMemoryGetBandwidth( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_bandwidth_t* pBandwidth ///< [in,out] Will contain the total number of bytes read from and written ///< to memory, as well as the current maximum bandwidth. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetBandwidth = context.zesDdiTable.Memory.pfnGetBandwidth; if( nullptr != pfnGetBandwidth ) { result = pfnGetBandwidth( hMemory, pBandwidth ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPerformanceFactorDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumPerformanceFactorDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_perf_handle_t* phPerf ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumPerformanceFactorDomains = context.zesDdiTable.Device.pfnEnumPerformanceFactorDomains; if( nullptr != pfnEnumPerformanceFactorDomains ) { result = pfnEnumPerformanceFactorDomains( hDevice, pCount, phPerf ); } else { // generic implementation for( size_t i = 0; ( nullptr != phPerf ) && ( i < *pCount ); ++i ) phPerf[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPerformanceFactorGetProperties __zedlllocal ze_result_t ZE_APICALL zesPerformanceFactorGetProperties( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. zes_perf_properties_t* pProperties ///< [in,out] Will contain information about the specified Performance ///< Factor domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.PerformanceFactor.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hPerf, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPerformanceFactorGetConfig __zedlllocal ze_result_t ZE_APICALL zesPerformanceFactorGetConfig( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double* pFactor ///< [in,out] Will contain the actual Performance Factor being used by the ///< hardware (may not be the same as the requested Performance Factor). ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetConfig = context.zesDdiTable.PerformanceFactor.pfnGetConfig; if( nullptr != pfnGetConfig ) { result = pfnGetConfig( hPerf, pFactor ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPerformanceFactorSetConfig __zedlllocal ze_result_t ZE_APICALL zesPerformanceFactorSetConfig( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double factor ///< [in] The new Performance Factor. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetConfig = context.zesDdiTable.PerformanceFactor.pfnSetConfig; if( nullptr != pfnSetConfig ) { result = pfnSetConfig( hPerf, factor ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPowerDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumPowerDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_pwr_handle_t* phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumPowerDomains = context.zesDdiTable.Device.pfnEnumPowerDomains; if( nullptr != pfnEnumPowerDomains ) { result = pfnEnumPowerDomains( hDevice, pCount, phPower ); } else { // generic implementation for( size_t i = 0; ( nullptr != phPower ) && ( i < *pCount ); ++i ) phPower[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetCardPowerDomain __zedlllocal ze_result_t ZE_APICALL zesDeviceGetCardPowerDomain( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pwr_handle_t* phPower ///< [in,out] power domain handle for the entire PCIe card. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetCardPowerDomain = context.zesDdiTable.Device.pfnGetCardPowerDomain; if( nullptr != pfnGetCardPowerDomain ) { result = pfnGetCardPowerDomain( hDevice, phPower ); } else { // generic implementation *phPower = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetProperties __zedlllocal ze_result_t ZE_APICALL zesPowerGetProperties( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_properties_t* pProperties ///< [in,out] Structure that will contain property data. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Power.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hPower, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetEnergyCounter __zedlllocal ze_result_t ZE_APICALL zesPowerGetEnergyCounter( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_energy_counter_t* pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and ///< timestamp when the last counter value was measured. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetEnergyCounter = context.zesDdiTable.Power.pfnGetEnergyCounter; if( nullptr != pfnGetEnergyCounter ) { result = pfnGetEnergyCounter( hPower, pEnergy ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetLimits __zedlllocal ze_result_t ZE_APICALL zesPowerGetLimits( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_sustained_limit_t* pSustained, ///< [in,out][optional] The sustained power limit. If this is null, the ///< current sustained power limits will not be returned. zes_power_burst_limit_t* pBurst, ///< [in,out][optional] The burst power limit. If this is null, the current ///< peak power limits will not be returned. zes_power_peak_limit_t* pPeak ///< [in,out][optional] The peak power limit. If this is null, the peak ///< power limits will not be returned. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetLimits = context.zesDdiTable.Power.pfnGetLimits; if( nullptr != pfnGetLimits ) { result = pfnGetLimits( hPower, pSustained, pBurst, pPeak ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerSetLimits __zedlllocal ze_result_t ZE_APICALL zesPowerSetLimits( zes_pwr_handle_t hPower, ///< [in] Handle for the component. const zes_power_sustained_limit_t* pSustained, ///< [in][optional] The sustained power limit. If this is null, no changes ///< will be made to the sustained power limits. const zes_power_burst_limit_t* pBurst, ///< [in][optional] The burst power limit. If this is null, no changes will ///< be made to the burst power limits. const zes_power_peak_limit_t* pPeak ///< [in][optional] The peak power limit. If this is null, no changes will ///< be made to the peak power limits. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetLimits = context.zesDdiTable.Power.pfnSetLimits; if( nullptr != pfnSetLimits ) { result = pfnSetLimits( hPower, pSustained, pBurst, pPeak ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetEnergyThreshold __zedlllocal ze_result_t ZE_APICALL zesPowerGetEnergyThreshold( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_energy_threshold_t* pThreshold ///< [in,out] Returns information about the energy threshold setting - ///< enabled/energy threshold/process ID. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetEnergyThreshold = context.zesDdiTable.Power.pfnGetEnergyThreshold; if( nullptr != pfnGetEnergyThreshold ) { result = pfnGetEnergyThreshold( hPower, pThreshold ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerSetEnergyThreshold __zedlllocal ze_result_t ZE_APICALL zesPowerSetEnergyThreshold( zes_pwr_handle_t hPower, ///< [in] Handle for the component. double threshold ///< [in] The energy threshold to be set in joules. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetEnergyThreshold = context.zesDdiTable.Power.pfnSetEnergyThreshold; if( nullptr != pfnSetEnergyThreshold ) { result = pfnSetEnergyThreshold( hPower, threshold ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPsus __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumPsus( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_psu_handle_t* phPsu ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumPsus = context.zesDdiTable.Device.pfnEnumPsus; if( nullptr != pfnEnumPsus ) { result = pfnEnumPsus( hDevice, pCount, phPsu ); } else { // generic implementation for( size_t i = 0; ( nullptr != phPsu ) && ( i < *pCount ); ++i ) phPsu[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPsuGetProperties __zedlllocal ze_result_t ZE_APICALL zesPsuGetProperties( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_properties_t* pProperties ///< [in,out] Will contain the properties of the power supply. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Psu.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hPsu, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPsuGetState __zedlllocal ze_result_t ZE_APICALL zesPsuGetState( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_state_t* pState ///< [in,out] Will contain the current state of the power supply. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetState = context.zesDdiTable.Psu.pfnGetState; if( nullptr != pfnGetState ) { result = pfnGetState( hPsu, pState ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumRasErrorSets __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumRasErrorSets( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_ras_handle_t* phRas ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumRasErrorSets = context.zesDdiTable.Device.pfnEnumRasErrorSets; if( nullptr != pfnEnumRasErrorSets ) { result = pfnEnumRasErrorSets( hDevice, pCount, phRas ); } else { // generic implementation for( size_t i = 0; ( nullptr != phRas ) && ( i < *pCount ); ++i ) phRas[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasGetProperties __zedlllocal ze_result_t ZE_APICALL zesRasGetProperties( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_properties_t* pProperties ///< [in,out] Structure describing RAS properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Ras.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hRas, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasGetConfig __zedlllocal ze_result_t ZE_APICALL zesRasGetConfig( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_config_t* pConfig ///< [in,out] Will be populed with the current RAS configuration - ///< thresholds used to trigger events ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetConfig = context.zesDdiTable.Ras.pfnGetConfig; if( nullptr != pfnGetConfig ) { result = pfnGetConfig( hRas, pConfig ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasSetConfig __zedlllocal ze_result_t ZE_APICALL zesRasSetConfig( zes_ras_handle_t hRas, ///< [in] Handle for the component. const zes_ras_config_t* pConfig ///< [in] Change the RAS configuration - thresholds used to trigger events ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetConfig = context.zesDdiTable.Ras.pfnSetConfig; if( nullptr != pfnSetConfig ) { result = pfnSetConfig( hRas, pConfig ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasGetState __zedlllocal ze_result_t ZE_APICALL zesRasGetState( zes_ras_handle_t hRas, ///< [in] Handle for the component. ze_bool_t clear, ///< [in] Set to 1 to clear the counters of this type zes_ras_state_t* pState ///< [in,out] Breakdown of where errors have occurred ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetState = context.zesDdiTable.Ras.pfnGetState; if( nullptr != pfnGetState ) { result = pfnGetState( hRas, clear, pState ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumSchedulers __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumSchedulers( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_sched_handle_t* phScheduler ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumSchedulers = context.zesDdiTable.Device.pfnEnumSchedulers; if( nullptr != pfnEnumSchedulers ) { result = pfnEnumSchedulers( hDevice, pCount, phScheduler ); } else { // generic implementation for( size_t i = 0; ( nullptr != phScheduler ) && ( i < *pCount ); ++i ) phScheduler[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerGetProperties __zedlllocal ze_result_t ZE_APICALL zesSchedulerGetProperties( zes_sched_handle_t hScheduler, ///< [in] Handle for the component. zes_sched_properties_t* pProperties ///< [in,out] Structure that will contain property data. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Scheduler.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hScheduler, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerGetCurrentMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerGetCurrentMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_mode_t* pMode ///< [in,out] Will contain the current scheduler mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetCurrentMode = context.zesDdiTable.Scheduler.pfnGetCurrentMode; if( nullptr != pfnGetCurrentMode ) { result = pfnGetCurrentMode( hScheduler, pMode ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerGetTimeoutModeProperties __zedlllocal ze_result_t ZE_APICALL zesSchedulerGetTimeoutModeProperties( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeout_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetTimeoutModeProperties = context.zesDdiTable.Scheduler.pfnGetTimeoutModeProperties; if( nullptr != pfnGetTimeoutModeProperties ) { result = pfnGetTimeoutModeProperties( hScheduler, getDefaults, pConfig ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerGetTimesliceModeProperties __zedlllocal ze_result_t ZE_APICALL zesSchedulerGetTimesliceModeProperties( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeslice_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetTimesliceModeProperties = context.zesDdiTable.Scheduler.pfnGetTimesliceModeProperties; if( nullptr != pfnGetTimesliceModeProperties ) { result = pfnGetTimesliceModeProperties( hScheduler, getDefaults, pConfig ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerSetTimeoutMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerSetTimeoutMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeout_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetTimeoutMode = context.zesDdiTable.Scheduler.pfnSetTimeoutMode; if( nullptr != pfnSetTimeoutMode ) { result = pfnSetTimeoutMode( hScheduler, pProperties, pNeedReload ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerSetTimesliceMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerSetTimesliceMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeslice_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetTimesliceMode = context.zesDdiTable.Scheduler.pfnSetTimesliceMode; if( nullptr != pfnSetTimesliceMode ) { result = pfnSetTimesliceMode( hScheduler, pProperties, pNeedReload ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerSetExclusiveMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerSetExclusiveMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetExclusiveMode = context.zesDdiTable.Scheduler.pfnSetExclusiveMode; if( nullptr != pfnSetExclusiveMode ) { result = pfnSetExclusiveMode( hScheduler, pNeedReload ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerSetComputeUnitDebugMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerSetComputeUnitDebugMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetComputeUnitDebugMode = context.zesDdiTable.Scheduler.pfnSetComputeUnitDebugMode; if( nullptr != pfnSetComputeUnitDebugMode ) { result = pfnSetComputeUnitDebugMode( hScheduler, pNeedReload ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumStandbyDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumStandbyDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_standby_handle_t* phStandby ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumStandbyDomains = context.zesDdiTable.Device.pfnEnumStandbyDomains; if( nullptr != pfnEnumStandbyDomains ) { result = pfnEnumStandbyDomains( hDevice, pCount, phStandby ); } else { // generic implementation for( size_t i = 0; ( nullptr != phStandby ) && ( i < *pCount ); ++i ) phStandby[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesStandbyGetProperties __zedlllocal ze_result_t ZE_APICALL zesStandbyGetProperties( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_properties_t* pProperties ///< [in,out] Will contain the standby hardware properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Standby.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hStandby, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesStandbyGetMode __zedlllocal ze_result_t ZE_APICALL zesStandbyGetMode( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t* pMode ///< [in,out] Will contain the current standby mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetMode = context.zesDdiTable.Standby.pfnGetMode; if( nullptr != pfnGetMode ) { result = pfnGetMode( hStandby, pMode ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesStandbySetMode __zedlllocal ze_result_t ZE_APICALL zesStandbySetMode( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t mode ///< [in] New standby mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetMode = context.zesDdiTable.Standby.pfnSetMode; if( nullptr != pfnSetMode ) { result = pfnSetMode( hStandby, mode ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumTemperatureSensors __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumTemperatureSensors( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_temp_handle_t* phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumTemperatureSensors = context.zesDdiTable.Device.pfnEnumTemperatureSensors; if( nullptr != pfnEnumTemperatureSensors ) { result = pfnEnumTemperatureSensors( hDevice, pCount, phTemperature ); } else { // generic implementation for( size_t i = 0; ( nullptr != phTemperature ) && ( i < *pCount ); ++i ) phTemperature[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesTemperatureGetProperties __zedlllocal ze_result_t ZE_APICALL zesTemperatureGetProperties( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_properties_t* pProperties ///< [in,out] Will contain the temperature sensor properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zesDdiTable.Temperature.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hTemperature, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesTemperatureGetConfig __zedlllocal ze_result_t ZE_APICALL zesTemperatureGetConfig( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_config_t* pConfig ///< [in,out] Returns current configuration. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetConfig = context.zesDdiTable.Temperature.pfnGetConfig; if( nullptr != pfnGetConfig ) { result = pfnGetConfig( hTemperature, pConfig ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesTemperatureSetConfig __zedlllocal ze_result_t ZE_APICALL zesTemperatureSetConfig( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. const zes_temp_config_t* pConfig ///< [in] New configuration. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetConfig = context.zesDdiTable.Temperature.pfnSetConfig; if( nullptr != pfnSetConfig ) { result = pfnSetConfig( hTemperature, pConfig ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesTemperatureGetState __zedlllocal ze_result_t ZE_APICALL zesTemperatureGetState( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. double* pTemperature ///< [in,out] Will contain the temperature read from the specified sensor ///< in degrees Celsius. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetState = context.zesDdiTable.Temperature.pfnGetState; if( nullptr != pfnGetState ) { result = pfnGetState( hTemperature, pTemperature ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetLimitsExt __zedlllocal ze_result_t ZE_APICALL zesPowerGetLimitsExt( zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. uint32_t* pCount, ///< [in,out] Pointer to the number of power limit descriptors. If count is ///< zero, then the driver shall update the value with the total number of ///< components of this type that are available. If count is greater than ///< the number of components of this type that are available, then the ///< driver shall update the value with the correct number of components. zes_power_limit_ext_desc_t* pSustained ///< [in,out][optional][range(0, *pCount)] Array of query results for power ///< limit descriptors. If count is less than the number of components of ///< this type that are available, then the driver shall only retrieve that ///< number of components. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetLimitsExt = context.zesDdiTable.Power.pfnGetLimitsExt; if( nullptr != pfnGetLimitsExt ) { result = pfnGetLimitsExt( hPower, pCount, pSustained ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerSetLimitsExt __zedlllocal ze_result_t ZE_APICALL zesPowerSetLimitsExt( zes_pwr_handle_t hPower, ///< [in] Handle for the component. uint32_t* pCount, ///< [in] Pointer to the number of power limit descriptors. zes_power_limit_ext_desc_t* pSustained ///< [in][optional][range(0, *pCount)] Array of power limit descriptors. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetLimitsExt = context.zesDdiTable.Power.pfnSetLimitsExt; if( nullptr != pfnSetLimitsExt ) { result = pfnSetLimitsExt( hPower, pCount, pSustained ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetActivityExt __zedlllocal ze_result_t ZE_APICALL zesEngineGetActivityExt( zes_engine_handle_t hEngine, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_engine_stats_t* pStats ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector with engine stat for ///< PF at index 0 of the vector followed by user provided pCount-1 number ///< of VF engine stats. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetActivityExt = context.zesDdiTable.Engine.pfnGetActivityExt; if( nullptr != pfnGetActivityExt ) { result = pfnGetActivityExt( hEngine, pCount, pStats ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasGetStateExp __zedlllocal ze_result_t ZE_APICALL zesRasGetStateExp( zes_ras_handle_t hRas, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of RAS state structures that can be retrieved. ///< if count is zero, then the driver shall update the value with the ///< total number of error categories for which state can be retrieved. ///< if count is greater than the number of RAS states available, then the ///< driver shall update the value with the correct number of RAS states available. zes_ras_state_exp_t* pState ///< [in,out][optional][range(0, *pCount)] array of query results for RAS ///< error states for different categories. ///< if count is less than the number of RAS states available, then driver ///< shall only retrieve that number of RAS states. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetStateExp = context.zesDdiTable.RasExp.pfnGetStateExp; if( nullptr != pfnGetStateExp ) { result = pfnGetStateExp( hRas, pCount, pState ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasClearStateExp __zedlllocal ze_result_t ZE_APICALL zesRasClearStateExp( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_error_category_exp_t category ///< [in] category for which error counter is to be cleared. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnClearStateExp = context.zesDdiTable.RasExp.pfnClearStateExp; if( nullptr != pfnClearStateExp ) { result = pfnClearStateExp( hRas, category ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetSecurityVersionExp __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetSecurityVersionExp( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. char* pVersion ///< [in,out] NULL terminated string value. The string "unknown" will be ///< returned if this property cannot be determined. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetSecurityVersionExp = context.zesDdiTable.FirmwareExp.pfnGetSecurityVersionExp; if( nullptr != pfnGetSecurityVersionExp ) { result = pfnGetSecurityVersionExp( hFirmware, pVersion ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareSetSecurityVersionExp __zedlllocal ze_result_t ZE_APICALL zesFirmwareSetSecurityVersionExp( zes_firmware_handle_t hFirmware ///< [in] Handle for the component. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetSecurityVersionExp = context.zesDdiTable.FirmwareExp.pfnSetSecurityVersionExp; if( nullptr != pfnSetSecurityVersionExp ) { result = pfnSetSecurityVersionExp( hFirmware ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetSubDevicePropertiesExp __zedlllocal ze_result_t ZE_APICALL zesDeviceGetSubDevicePropertiesExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of sub devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub devices currently attached to the device. ///< if count is greater than the number of sub devices currently attached ///< to the device, then the driver shall update the value with the correct ///< number of sub devices. zes_subdevice_exp_properties_t* pSubdeviceProps ///< [in,out][optional][range(0, *pCount)] array of sub device property structures. ///< if count is less than the number of sysman sub devices available, then ///< the driver shall only retrieve that number of sub device property structures. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetSubDevicePropertiesExp = context.zesDdiTable.DeviceExp.pfnGetSubDevicePropertiesExp; if( nullptr != pfnGetSubDevicePropertiesExp ) { result = pfnGetSubDevicePropertiesExp( hDevice, pCount, pSubdeviceProps ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverGetDeviceByUuidExp __zedlllocal ze_result_t ZE_APICALL zesDriverGetDeviceByUuidExp( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance zes_uuid_t uuid, ///< [in] universal unique identifier. zes_device_handle_t* phDevice, ///< [out] Sysman handle of the device. ze_bool_t* onSubdevice, ///< [out] True if the UUID belongs to the sub-device; false means that ///< UUID belongs to the root device. uint32_t* subdeviceId ///< [out] If onSubdevice is true, this gives the ID of the sub-device ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetDeviceByUuidExp = context.zesDdiTable.DriverExp.pfnGetDeviceByUuidExp; if( nullptr != pfnGetDeviceByUuidExp ) { result = pfnGetDeviceByUuidExp( hDriver, uuid, phDevice, onSubdevice, subdeviceId ); } else { // generic implementation *phDevice = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumActiveVFExp __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumActiveVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumActiveVFExp = context.zesDdiTable.DeviceExp.pfnEnumActiveVFExp; if( nullptr != pfnEnumActiveVFExp ) { result = pfnEnumActiveVFExp( hDevice, pCount, phVFhandle ); } else { // generic implementation for( size_t i = 0; ( nullptr != phVFhandle ) && ( i < *pCount ); ++i ) phVFhandle[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFPropertiesExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFPropertiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetVFPropertiesExp = context.zesDdiTable.VFManagementExp.pfnGetVFPropertiesExp; if( nullptr != pfnGetVFPropertiesExp ) { result = pfnGetVFPropertiesExp( hVFhandle, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFMemoryUtilizationExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFMemoryUtilizationExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetVFMemoryUtilizationExp = context.zesDdiTable.VFManagementExp.pfnGetVFMemoryUtilizationExp; if( nullptr != pfnGetVFMemoryUtilizationExp ) { result = pfnGetVFMemoryUtilizationExp( hVFhandle, pCount, pMemUtil ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFEngineUtilizationExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFEngineUtilizationExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetVFEngineUtilizationExp = context.zesDdiTable.VFManagementExp.pfnGetVFEngineUtilizationExp; if( nullptr != pfnGetVFEngineUtilizationExp ) { result = pfnGetVFEngineUtilizationExp( hVFhandle, pCount, pEngineUtil ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementSetVFTelemetryModeExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementSetVFTelemetryModeExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. ze_bool_t enable ///< [in] Enable utilization telemetry. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetVFTelemetryModeExp = context.zesDdiTable.VFManagementExp.pfnSetVFTelemetryModeExp; if( nullptr != pfnSetVFTelemetryModeExp ) { result = pfnSetVFTelemetryModeExp( hVFhandle, flags, enable ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementSetVFTelemetrySamplingIntervalExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementSetVFTelemetrySamplingIntervalExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. uint64_t samplingInterval ///< [in] Sampling interval value. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetVFTelemetrySamplingIntervalExp = context.zesDdiTable.VFManagementExp.pfnSetVFTelemetrySamplingIntervalExp; if( nullptr != pfnSetVFTelemetrySamplingIntervalExp ) { result = pfnSetVFTelemetrySamplingIntervalExp( hVFhandle, flag, samplingInterval ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumEnabledVFExp __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumEnabledVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnumEnabledVFExp = context.zesDdiTable.DeviceExp.pfnEnumEnabledVFExp; if( nullptr != pfnEnumEnabledVFExp ) { result = pfnEnumEnabledVFExp( hDevice, pCount, phVFhandle ); } else { // generic implementation for( size_t i = 0; ( nullptr != phVFhandle ) && ( i < *pCount ); ++i ) phVFhandle[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFCapabilitiesExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFCapabilitiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetVFCapabilitiesExp = context.zesDdiTable.VFManagementExp.pfnGetVFCapabilitiesExp; if( nullptr != pfnGetVFCapabilitiesExp ) { result = pfnGetVFCapabilitiesExp( hVFhandle, pCapability ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFMemoryUtilizationExp2 __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFMemoryUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetVFMemoryUtilizationExp2 = context.zesDdiTable.VFManagementExp.pfnGetVFMemoryUtilizationExp2; if( nullptr != pfnGetVFMemoryUtilizationExp2 ) { result = pfnGetVFMemoryUtilizationExp2( hVFhandle, pCount, pMemUtil ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFEngineUtilizationExp2 __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFEngineUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetVFEngineUtilizationExp2 = context.zesDdiTable.VFManagementExp.pfnGetVFEngineUtilizationExp2; if( nullptr != pfnGetVFEngineUtilizationExp2 ) { result = pfnGetVFEngineUtilizationExp2( hVFhandle, pCount, pEngineUtil ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFCapabilitiesExp2 __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFCapabilitiesExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp2_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetVFCapabilitiesExp2 = context.zesDdiTable.VFManagementExp.pfnGetVFCapabilitiesExp2; if( nullptr != pfnGetVFCapabilitiesExp2 ) { result = pfnGetVFCapabilitiesExp2( hVFhandle, pCapability ); } else { // generic implementation } return result; } } // namespace driver #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Global table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetGlobalProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_global_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnInit = driver::zesInit; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesDeviceGetProperties; pDdiTable->pfnGetState = driver::zesDeviceGetState; pDdiTable->pfnReset = driver::zesDeviceReset; pDdiTable->pfnProcessesGetState = driver::zesDeviceProcessesGetState; pDdiTable->pfnPciGetProperties = driver::zesDevicePciGetProperties; pDdiTable->pfnPciGetState = driver::zesDevicePciGetState; pDdiTable->pfnPciGetBars = driver::zesDevicePciGetBars; pDdiTable->pfnPciGetStats = driver::zesDevicePciGetStats; pDdiTable->pfnEnumDiagnosticTestSuites = driver::zesDeviceEnumDiagnosticTestSuites; pDdiTable->pfnEnumEngineGroups = driver::zesDeviceEnumEngineGroups; pDdiTable->pfnEventRegister = driver::zesDeviceEventRegister; pDdiTable->pfnEnumFabricPorts = driver::zesDeviceEnumFabricPorts; pDdiTable->pfnEnumFans = driver::zesDeviceEnumFans; pDdiTable->pfnEnumFirmwares = driver::zesDeviceEnumFirmwares; pDdiTable->pfnEnumFrequencyDomains = driver::zesDeviceEnumFrequencyDomains; pDdiTable->pfnEnumLeds = driver::zesDeviceEnumLeds; pDdiTable->pfnEnumMemoryModules = driver::zesDeviceEnumMemoryModules; pDdiTable->pfnEnumPerformanceFactorDomains = driver::zesDeviceEnumPerformanceFactorDomains; pDdiTable->pfnEnumPowerDomains = driver::zesDeviceEnumPowerDomains; pDdiTable->pfnGetCardPowerDomain = driver::zesDeviceGetCardPowerDomain; pDdiTable->pfnEnumPsus = driver::zesDeviceEnumPsus; pDdiTable->pfnEnumRasErrorSets = driver::zesDeviceEnumRasErrorSets; pDdiTable->pfnEnumSchedulers = driver::zesDeviceEnumSchedulers; pDdiTable->pfnEnumStandbyDomains = driver::zesDeviceEnumStandbyDomains; pDdiTable->pfnEnumTemperatureSensors = driver::zesDeviceEnumTemperatureSensors; pDdiTable->pfnEccAvailable = driver::zesDeviceEccAvailable; pDdiTable->pfnEccConfigurable = driver::zesDeviceEccConfigurable; pDdiTable->pfnGetEccState = driver::zesDeviceGetEccState; pDdiTable->pfnSetEccState = driver::zesDeviceSetEccState; pDdiTable->pfnGet = driver::zesDeviceGet; pDdiTable->pfnSetOverclockWaiver = driver::zesDeviceSetOverclockWaiver; pDdiTable->pfnGetOverclockDomains = driver::zesDeviceGetOverclockDomains; pDdiTable->pfnGetOverclockControls = driver::zesDeviceGetOverclockControls; pDdiTable->pfnResetOverclockSettings = driver::zesDeviceResetOverclockSettings; pDdiTable->pfnReadOverclockState = driver::zesDeviceReadOverclockState; pDdiTable->pfnEnumOverclockDomains = driver::zesDeviceEnumOverclockDomains; pDdiTable->pfnResetExt = driver::zesDeviceResetExt; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnEnumEnabledVFExp = driver::zesDeviceEnumEnabledVFExp; pDdiTable->pfnGetSubDevicePropertiesExp = driver::zesDeviceGetSubDevicePropertiesExp; pDdiTable->pfnEnumActiveVFExp = driver::zesDeviceEnumActiveVFExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Driver table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDriverProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_driver_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnEventListen = driver::zesDriverEventListen; pDdiTable->pfnEventListenEx = driver::zesDriverEventListenEx; pDdiTable->pfnGet = driver::zesDriverGet; pDdiTable->pfnGetExtensionProperties = driver::zesDriverGetExtensionProperties; pDdiTable->pfnGetExtensionFunctionAddress = driver::zesDriverGetExtensionFunctionAddress; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DriverExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDriverExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_driver_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetDeviceByUuidExp = driver::zesDriverGetDeviceByUuidExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Diagnostics table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDiagnosticsProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_diagnostics_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesDiagnosticsGetProperties; pDdiTable->pfnGetTests = driver::zesDiagnosticsGetTests; pDdiTable->pfnRunTests = driver::zesDiagnosticsRunTests; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Engine table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetEngineProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_engine_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesEngineGetProperties; pDdiTable->pfnGetActivity = driver::zesEngineGetActivity; pDdiTable->pfnGetActivityExt = driver::zesEngineGetActivityExt; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricPort table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFabricPortProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_fabric_port_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesFabricPortGetProperties; pDdiTable->pfnGetLinkType = driver::zesFabricPortGetLinkType; pDdiTable->pfnGetConfig = driver::zesFabricPortGetConfig; pDdiTable->pfnSetConfig = driver::zesFabricPortSetConfig; pDdiTable->pfnGetState = driver::zesFabricPortGetState; pDdiTable->pfnGetThroughput = driver::zesFabricPortGetThroughput; pDdiTable->pfnGetFabricErrorCounters = driver::zesFabricPortGetFabricErrorCounters; pDdiTable->pfnGetMultiPortThroughput = driver::zesFabricPortGetMultiPortThroughput; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Fan table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFanProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_fan_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesFanGetProperties; pDdiTable->pfnGetConfig = driver::zesFanGetConfig; pDdiTable->pfnSetDefaultMode = driver::zesFanSetDefaultMode; pDdiTable->pfnSetFixedSpeedMode = driver::zesFanSetFixedSpeedMode; pDdiTable->pfnSetSpeedTableMode = driver::zesFanSetSpeedTableMode; pDdiTable->pfnGetState = driver::zesFanGetState; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Firmware table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFirmwareProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_firmware_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesFirmwareGetProperties; pDdiTable->pfnFlash = driver::zesFirmwareFlash; pDdiTable->pfnGetFlashProgress = driver::zesFirmwareGetFlashProgress; pDdiTable->pfnGetConsoleLogs = driver::zesFirmwareGetConsoleLogs; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FirmwareExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFirmwareExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_firmware_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetSecurityVersionExp = driver::zesFirmwareGetSecurityVersionExp; pDdiTable->pfnSetSecurityVersionExp = driver::zesFirmwareSetSecurityVersionExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Frequency table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFrequencyProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_frequency_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesFrequencyGetProperties; pDdiTable->pfnGetAvailableClocks = driver::zesFrequencyGetAvailableClocks; pDdiTable->pfnGetRange = driver::zesFrequencyGetRange; pDdiTable->pfnSetRange = driver::zesFrequencySetRange; pDdiTable->pfnGetState = driver::zesFrequencyGetState; pDdiTable->pfnGetThrottleTime = driver::zesFrequencyGetThrottleTime; pDdiTable->pfnOcGetCapabilities = driver::zesFrequencyOcGetCapabilities; pDdiTable->pfnOcGetFrequencyTarget = driver::zesFrequencyOcGetFrequencyTarget; pDdiTable->pfnOcSetFrequencyTarget = driver::zesFrequencyOcSetFrequencyTarget; pDdiTable->pfnOcGetVoltageTarget = driver::zesFrequencyOcGetVoltageTarget; pDdiTable->pfnOcSetVoltageTarget = driver::zesFrequencyOcSetVoltageTarget; pDdiTable->pfnOcSetMode = driver::zesFrequencyOcSetMode; pDdiTable->pfnOcGetMode = driver::zesFrequencyOcGetMode; pDdiTable->pfnOcGetIccMax = driver::zesFrequencyOcGetIccMax; pDdiTable->pfnOcSetIccMax = driver::zesFrequencyOcSetIccMax; pDdiTable->pfnOcGetTjMax = driver::zesFrequencyOcGetTjMax; pDdiTable->pfnOcSetTjMax = driver::zesFrequencyOcSetTjMax; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Led table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetLedProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_led_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesLedGetProperties; pDdiTable->pfnGetState = driver::zesLedGetState; pDdiTable->pfnSetState = driver::zesLedSetState; pDdiTable->pfnSetColor = driver::zesLedSetColor; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Memory table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetMemoryProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_memory_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesMemoryGetProperties; pDdiTable->pfnGetState = driver::zesMemoryGetState; pDdiTable->pfnGetBandwidth = driver::zesMemoryGetBandwidth; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Overclock table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetOverclockProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_overclock_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetDomainProperties = driver::zesOverclockGetDomainProperties; pDdiTable->pfnGetDomainVFProperties = driver::zesOverclockGetDomainVFProperties; pDdiTable->pfnGetDomainControlProperties = driver::zesOverclockGetDomainControlProperties; pDdiTable->pfnGetControlCurrentValue = driver::zesOverclockGetControlCurrentValue; pDdiTable->pfnGetControlPendingValue = driver::zesOverclockGetControlPendingValue; pDdiTable->pfnSetControlUserValue = driver::zesOverclockSetControlUserValue; pDdiTable->pfnGetControlState = driver::zesOverclockGetControlState; pDdiTable->pfnGetVFPointValues = driver::zesOverclockGetVFPointValues; pDdiTable->pfnSetVFPointValues = driver::zesOverclockSetVFPointValues; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's PerformanceFactor table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetPerformanceFactorProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_performance_factor_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesPerformanceFactorGetProperties; pDdiTable->pfnGetConfig = driver::zesPerformanceFactorGetConfig; pDdiTable->pfnSetConfig = driver::zesPerformanceFactorSetConfig; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Power table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetPowerProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_power_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesPowerGetProperties; pDdiTable->pfnGetEnergyCounter = driver::zesPowerGetEnergyCounter; pDdiTable->pfnGetLimits = driver::zesPowerGetLimits; pDdiTable->pfnSetLimits = driver::zesPowerSetLimits; pDdiTable->pfnGetEnergyThreshold = driver::zesPowerGetEnergyThreshold; pDdiTable->pfnSetEnergyThreshold = driver::zesPowerSetEnergyThreshold; pDdiTable->pfnGetLimitsExt = driver::zesPowerGetLimitsExt; pDdiTable->pfnSetLimitsExt = driver::zesPowerSetLimitsExt; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Psu table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetPsuProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_psu_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesPsuGetProperties; pDdiTable->pfnGetState = driver::zesPsuGetState; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Ras table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetRasProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_ras_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesRasGetProperties; pDdiTable->pfnGetConfig = driver::zesRasGetConfig; pDdiTable->pfnSetConfig = driver::zesRasSetConfig; pDdiTable->pfnGetState = driver::zesRasGetState; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RasExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetRasExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_ras_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetStateExp = driver::zesRasGetStateExp; pDdiTable->pfnClearStateExp = driver::zesRasClearStateExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Scheduler table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetSchedulerProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_scheduler_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesSchedulerGetProperties; pDdiTable->pfnGetCurrentMode = driver::zesSchedulerGetCurrentMode; pDdiTable->pfnGetTimeoutModeProperties = driver::zesSchedulerGetTimeoutModeProperties; pDdiTable->pfnGetTimesliceModeProperties = driver::zesSchedulerGetTimesliceModeProperties; pDdiTable->pfnSetTimeoutMode = driver::zesSchedulerSetTimeoutMode; pDdiTable->pfnSetTimesliceMode = driver::zesSchedulerSetTimesliceMode; pDdiTable->pfnSetExclusiveMode = driver::zesSchedulerSetExclusiveMode; pDdiTable->pfnSetComputeUnitDebugMode = driver::zesSchedulerSetComputeUnitDebugMode; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Standby table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetStandbyProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_standby_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesStandbyGetProperties; pDdiTable->pfnGetMode = driver::zesStandbyGetMode; pDdiTable->pfnSetMode = driver::zesStandbySetMode; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Temperature table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetTemperatureProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_temperature_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProperties = driver::zesTemperatureGetProperties; pDdiTable->pfnGetConfig = driver::zesTemperatureGetConfig; pDdiTable->pfnSetConfig = driver::zesTemperatureSetConfig; pDdiTable->pfnGetState = driver::zesTemperatureGetState; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's VFManagementExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetVFManagementExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_vf_management_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetVFCapabilitiesExp = driver::zesVFManagementGetVFCapabilitiesExp; pDdiTable->pfnGetVFMemoryUtilizationExp2 = driver::zesVFManagementGetVFMemoryUtilizationExp2; pDdiTable->pfnGetVFEngineUtilizationExp2 = driver::zesVFManagementGetVFEngineUtilizationExp2; pDdiTable->pfnGetVFCapabilitiesExp2 = driver::zesVFManagementGetVFCapabilitiesExp2; pDdiTable->pfnGetVFPropertiesExp = driver::zesVFManagementGetVFPropertiesExp; pDdiTable->pfnGetVFMemoryUtilizationExp = driver::zesVFManagementGetVFMemoryUtilizationExp; pDdiTable->pfnGetVFEngineUtilizationExp = driver::zesVFManagementGetVFEngineUtilizationExp; pDdiTable->pfnSetVFTelemetryModeExp = driver::zesVFManagementSetVFTelemetryModeExp; pDdiTable->pfnSetVFTelemetrySamplingIntervalExp = driver::zesVFManagementSetVFTelemetrySamplingIntervalExp; return result; } #if defined(__cplusplus) }; #endif level-zero-1.20.6/source/drivers/null/zet_nullddi.cpp000066400000000000000000003553341475521542100226600ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_nullddi.cpp * */ #include "ze_null.h" #include namespace driver { /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetModuleGetDebugInfo __zedlllocal ze_result_t ZE_APICALL zetModuleGetDebugInfo( zet_module_handle_t hModule, ///< [in] handle of the module zet_module_debug_info_format_t format, ///< [in] debug info format requested size_t* pSize, ///< [in,out] size of debug info in bytes uint8_t* pDebugInfo ///< [in,out][optional] byte pointer to debug info ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetDebugInfo = context.zetDdiTable.Module.pfnGetDebugInfo; if( nullptr != pfnGetDebugInfo ) { result = pfnGetDebugInfo( hModule, format, pSize, pDebugInfo ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDeviceGetDebugProperties __zedlllocal ze_result_t ZE_APICALL zetDeviceGetDebugProperties( zet_device_handle_t hDevice, ///< [in] device handle zet_device_debug_properties_t* pDebugProperties ///< [in,out] query result for debug properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetDebugProperties = context.zetDdiTable.Device.pfnGetDebugProperties; if( nullptr != pfnGetDebugProperties ) { result = pfnGetDebugProperties( hDevice, pDebugProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugAttach __zedlllocal ze_result_t ZE_APICALL zetDebugAttach( zet_device_handle_t hDevice, ///< [in] device handle const zet_debug_config_t* config, ///< [in] the debug configuration zet_debug_session_handle_t* phDebug ///< [out] debug session handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAttach = context.zetDdiTable.Debug.pfnAttach; if( nullptr != pfnAttach ) { result = pfnAttach( hDevice, config, phDebug ); } else { // generic implementation *phDebug = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugDetach __zedlllocal ze_result_t ZE_APICALL zetDebugDetach( zet_debug_session_handle_t hDebug ///< [in][release] debug session handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDetach = context.zetDdiTable.Debug.pfnDetach; if( nullptr != pfnDetach ) { result = pfnDetach( hDebug ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugReadEvent __zedlllocal ze_result_t ZE_APICALL zetDebugReadEvent( zet_debug_session_handle_t hDebug, ///< [in] debug session handle uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the event; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. zet_debug_event_t* event ///< [in,out] a pointer to a ::zet_debug_event_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReadEvent = context.zetDdiTable.Debug.pfnReadEvent; if( nullptr != pfnReadEvent ) { result = pfnReadEvent( hDebug, timeout, event ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugAcknowledgeEvent __zedlllocal ze_result_t ZE_APICALL zetDebugAcknowledgeEvent( zet_debug_session_handle_t hDebug, ///< [in] debug session handle const zet_debug_event_t* event ///< [in] a pointer to a ::zet_debug_event_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAcknowledgeEvent = context.zetDdiTable.Debug.pfnAcknowledgeEvent; if( nullptr != pfnAcknowledgeEvent ) { result = pfnAcknowledgeEvent( hDebug, event ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugInterrupt __zedlllocal ze_result_t ZE_APICALL zetDebugInterrupt( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to interrupt ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnInterrupt = context.zetDdiTable.Debug.pfnInterrupt; if( nullptr != pfnInterrupt ) { result = pfnInterrupt( hDebug, thread ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugResume __zedlllocal ze_result_t ZE_APICALL zetDebugResume( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to resume ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnResume = context.zetDdiTable.Debug.pfnResume; if( nullptr != pfnResume ) { result = pfnResume( hDebug, thread ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugReadMemory __zedlllocal ze_result_t ZE_APICALL zetDebugReadMemory( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to read void* buffer ///< [in,out] a buffer to hold a copy of the memory ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReadMemory = context.zetDdiTable.Debug.pfnReadMemory; if( nullptr != pfnReadMemory ) { result = pfnReadMemory( hDebug, thread, desc, size, buffer ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugWriteMemory __zedlllocal ze_result_t ZE_APICALL zetDebugWriteMemory( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to write const void* buffer ///< [in] a buffer holding the pattern to write ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnWriteMemory = context.zetDdiTable.Debug.pfnWriteMemory; if( nullptr != pfnWriteMemory ) { result = pfnWriteMemory( hDebug, thread, desc, size, buffer ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugGetRegisterSetProperties __zedlllocal ze_result_t ZE_APICALL zetDebugGetRegisterSetProperties( zet_device_handle_t hDevice, ///< [in] device handle uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetRegisterSetProperties = context.zetDdiTable.Debug.pfnGetRegisterSetProperties; if( nullptr != pfnGetRegisterSetProperties ) { result = pfnGetRegisterSetProperties( hDevice, pCount, pRegisterSetProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugGetThreadRegisterSetProperties __zedlllocal ze_result_t ZE_APICALL zetDebugGetThreadRegisterSetProperties( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier specifying a single stopped thread uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetThreadRegisterSetProperties = context.zetDdiTable.Debug.pfnGetThreadRegisterSetProperties; if( nullptr != pfnGetThreadRegisterSetProperties ) { result = pfnGetThreadRegisterSetProperties( hDebug, thread, pCount, pRegisterSetProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugReadRegisters __zedlllocal ze_result_t ZE_APICALL zetDebugReadRegisters( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or ///< equal to the `count` member of ::zet_debug_register_group_properties_t ///< for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReadRegisters = context.zetDdiTable.Debug.pfnReadRegisters; if( nullptr != pfnReadRegisters ) { result = pfnReadRegisters( hDebug, thread, type, start, count, pRegisterValues ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugWriteRegisters __zedlllocal ze_result_t ZE_APICALL zetDebugWriteRegisters( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than ///< or equal to the `count` member of ///< ::zet_debug_register_group_properties_t for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnWriteRegisters = context.zetDdiTable.Debug.pfnWriteRegisters; if( nullptr != pfnWriteRegisters ) { result = pfnWriteRegisters( hDebug, thread, type, start, count, pRegisterValues ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupGet __zedlllocal ze_result_t ZE_APICALL zetMetricGroupGet( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric groups. ///< if count is zero, then the driver shall update the value with the ///< total number of metric groups available. ///< if count is greater than the number of metric groups available, then ///< the driver shall update the value with the correct number of metric ///< groups available. zet_metric_group_handle_t* phMetricGroups ///< [in,out][optional][range(0, *pCount)] array of handle of metric groups. ///< if count is less than the number of metric groups available, then ///< driver shall only retrieve that number of metric groups. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGet = context.zetDdiTable.MetricGroup.pfnGet; if( nullptr != pfnGet ) { result = pfnGet( hDevice, pCount, phMetricGroups ); } else { // generic implementation for( size_t i = 0; ( nullptr != phMetricGroups ) && ( i < *pCount ); ++i ) phMetricGroups[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupGetProperties __zedlllocal ze_result_t ZE_APICALL zetMetricGroupGetProperties( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_properties_t* pProperties ///< [in,out] metric group properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zetDdiTable.MetricGroup.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hMetricGroup, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCalculateMetricValues __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCalculateMetricValues( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pMetricValueCount, ///< [in,out] pointer to number of metric values calculated. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pMetricValueCount)] buffer of calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCalculateMetricValues = context.zetDdiTable.MetricGroup.pfnCalculateMetricValues; if( nullptr != pfnCalculateMetricValues ) { result = pfnCalculateMetricValues( hMetricGroup, type, rawDataSize, pRawData, pMetricValueCount, pMetricValues ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGet __zedlllocal ze_result_t ZE_APICALL zetMetricGet( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group uint32_t* pCount, ///< [in,out] pointer to the number of metrics. ///< if count is zero, then the driver shall update the value with the ///< total number of metrics available. ///< if count is greater than the number of metrics available, then the ///< driver shall update the value with the correct number of metrics available. zet_metric_handle_t* phMetrics ///< [in,out][optional][range(0, *pCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metrics. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGet = context.zetDdiTable.Metric.pfnGet; if( nullptr != pfnGet ) { result = pfnGet( hMetricGroup, pCount, phMetrics ); } else { // generic implementation for( size_t i = 0; ( nullptr != phMetrics ) && ( i < *pCount ); ++i ) phMetrics[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGetProperties __zedlllocal ze_result_t ZE_APICALL zetMetricGetProperties( zet_metric_handle_t hMetric, ///< [in] handle of the metric zet_metric_properties_t* pProperties ///< [in,out] metric properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProperties = context.zetDdiTable.Metric.pfnGetProperties; if( nullptr != pfnGetProperties ) { result = pfnGetProperties( hMetric, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetContextActivateMetricGroups __zedlllocal ze_result_t ZE_APICALL zetContextActivateMetricGroups( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t count, ///< [in] metric group count to activate; must be 0 if `nullptr == ///< phMetricGroups` zet_metric_group_handle_t* phMetricGroups ///< [in][optional][range(0, count)] handles of the metric groups to activate. ///< nullptr deactivates all previously used metric groups. ///< all metrics groups must come from a different domains. ///< metric query and metric stream must use activated metric groups. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnActivateMetricGroups = context.zetDdiTable.Context.pfnActivateMetricGroups; if( nullptr != pfnActivateMetricGroups ) { result = pfnActivateMetricGroups( hContext, hDevice, count, phMetricGroups ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricStreamerOpen __zedlllocal ze_result_t ZE_APICALL zetMetricStreamerOpen( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_streamer_desc_t* desc, ///< [in,out] metric streamer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification zet_metric_streamer_handle_t* phMetricStreamer ///< [out] handle of metric streamer ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnOpen = context.zetDdiTable.MetricStreamer.pfnOpen; if( nullptr != pfnOpen ) { result = pfnOpen( hContext, hDevice, hMetricGroup, desc, hNotificationEvent, phMetricStreamer ); } else { // generic implementation *phMetricStreamer = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetCommandListAppendMetricStreamerMarker __zedlllocal ze_result_t ZE_APICALL zetCommandListAppendMetricStreamerMarker( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t value ///< [in] streamer marker value ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendMetricStreamerMarker = context.zetDdiTable.CommandList.pfnAppendMetricStreamerMarker; if( nullptr != pfnAppendMetricStreamerMarker ) { result = pfnAppendMetricStreamerMarker( hCommandList, hMetricStreamer, value ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricStreamerClose __zedlllocal ze_result_t ZE_APICALL zetMetricStreamerClose( zet_metric_streamer_handle_t hMetricStreamer ///< [in][release] handle of the metric streamer ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnClose = context.zetDdiTable.MetricStreamer.pfnClose; if( nullptr != pfnClose ) { result = pfnClose( hMetricStreamer ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricStreamerReadData __zedlllocal ze_result_t ZE_APICALL zetMetricStreamerReadData( zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReadData = context.zetDdiTable.MetricStreamer.pfnReadData; if( nullptr != pfnReadData ) { result = pfnReadData( hMetricStreamer, maxReportCount, pRawDataSize, pRawData ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryPoolCreate __zedlllocal ze_result_t ZE_APICALL zetMetricQueryPoolCreate( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] metric group associated with the query object. const zet_metric_query_pool_desc_t* desc, ///< [in] metric query pool descriptor zet_metric_query_pool_handle_t* phMetricQueryPool ///< [out] handle of metric query pool ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zetDdiTable.MetricQueryPool.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hContext, hDevice, hMetricGroup, desc, phMetricQueryPool ); } else { // generic implementation *phMetricQueryPool = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryPoolDestroy __zedlllocal ze_result_t ZE_APICALL zetMetricQueryPoolDestroy( zet_metric_query_pool_handle_t hMetricQueryPool ///< [in][release] handle of the metric query pool ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zetDdiTable.MetricQueryPool.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hMetricQueryPool ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryCreate __zedlllocal ze_result_t ZE_APICALL zetMetricQueryCreate( zet_metric_query_pool_handle_t hMetricQueryPool,///< [in] handle of the metric query pool uint32_t index, ///< [in] index of the query within the pool zet_metric_query_handle_t* phMetricQuery ///< [out] handle of metric query ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zetDdiTable.MetricQuery.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hMetricQueryPool, index, phMetricQuery ); } else { // generic implementation *phMetricQuery = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryDestroy __zedlllocal ze_result_t ZE_APICALL zetMetricQueryDestroy( zet_metric_query_handle_t hMetricQuery ///< [in][release] handle of metric query ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zetDdiTable.MetricQuery.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hMetricQuery ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryReset __zedlllocal ze_result_t ZE_APICALL zetMetricQueryReset( zet_metric_query_handle_t hMetricQuery ///< [in] handle of metric query ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReset = context.zetDdiTable.MetricQuery.pfnReset; if( nullptr != pfnReset ) { result = pfnReset( hMetricQuery ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetCommandListAppendMetricQueryBegin __zedlllocal ze_result_t ZE_APICALL zetCommandListAppendMetricQueryBegin( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery ///< [in] handle of the metric query ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendMetricQueryBegin = context.zetDdiTable.CommandList.pfnAppendMetricQueryBegin; if( nullptr != pfnAppendMetricQueryBegin ) { result = pfnAppendMetricQueryBegin( hCommandList, hMetricQuery ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetCommandListAppendMetricQueryEnd __zedlllocal ze_result_t ZE_APICALL zetCommandListAppendMetricQueryEnd( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in] must be zero ze_event_handle_t* phWaitEvents ///< [in][mbz] must be nullptr ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendMetricQueryEnd = context.zetDdiTable.CommandList.pfnAppendMetricQueryEnd; if( nullptr != pfnAppendMetricQueryEnd ) { result = pfnAppendMetricQueryEnd( hCommandList, hMetricQuery, hSignalEvent, numWaitEvents, phWaitEvents ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetCommandListAppendMetricMemoryBarrier __zedlllocal ze_result_t ZE_APICALL zetCommandListAppendMetricMemoryBarrier( zet_command_list_handle_t hCommandList ///< [in] handle of the command list ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAppendMetricMemoryBarrier = context.zetDdiTable.CommandList.pfnAppendMetricMemoryBarrier; if( nullptr != pfnAppendMetricMemoryBarrier ) { result = pfnAppendMetricMemoryBarrier( hCommandList ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryGetData __zedlllocal ze_result_t ZE_APICALL zetMetricQueryGetData( zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing query ///< reports in raw format ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetData = context.zetDdiTable.MetricQuery.pfnGetData; if( nullptr != pfnGetData ) { result = pfnGetData( hMetricQuery, pRawDataSize, pRawData ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetKernelGetProfileInfo __zedlllocal ze_result_t ZE_APICALL zetKernelGetProfileInfo( zet_kernel_handle_t hKernel, ///< [in] handle to kernel zet_profile_properties_t* pProfileProperties ///< [out] pointer to profile properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetProfileInfo = context.zetDdiTable.Kernel.pfnGetProfileInfo; if( nullptr != pfnGetProfileInfo ) { result = pfnGetProfileInfo( hKernel, pProfileProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpCreate __zedlllocal ze_result_t ZE_APICALL zetTracerExpCreate( zet_context_handle_t hContext, ///< [in] handle of the context object const zet_tracer_exp_desc_t* desc, ///< [in] pointer to tracer descriptor zet_tracer_exp_handle_t* phTracer ///< [out] pointer to handle of tracer object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreate = context.zetDdiTable.TracerExp.pfnCreate; if( nullptr != pfnCreate ) { result = pfnCreate( hContext, desc, phTracer ); } else { // generic implementation *phTracer = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpDestroy __zedlllocal ze_result_t ZE_APICALL zetTracerExpDestroy( zet_tracer_exp_handle_t hTracer ///< [in][release] handle of tracer object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroy = context.zetDdiTable.TracerExp.pfnDestroy; if( nullptr != pfnDestroy ) { result = pfnDestroy( hTracer ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpSetPrologues __zedlllocal ze_result_t ZE_APICALL zetTracerExpSetPrologues( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetPrologues = context.zetDdiTable.TracerExp.pfnSetPrologues; if( nullptr != pfnSetPrologues ) { result = pfnSetPrologues( hTracer, pCoreCbs ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpSetEpilogues __zedlllocal ze_result_t ZE_APICALL zetTracerExpSetEpilogues( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetEpilogues = context.zetDdiTable.TracerExp.pfnSetEpilogues; if( nullptr != pfnSetEpilogues ) { result = pfnSetEpilogues( hTracer, pCoreCbs ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpSetEnabled __zedlllocal ze_result_t ZE_APICALL zetTracerExpSetEnabled( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer ze_bool_t enable ///< [in] enable the tracer if true; disable if false ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnSetEnabled = context.zetDdiTable.TracerExp.pfnSetEnabled; if( nullptr != pfnSetEnabled ) { result = pfnSetEnabled( hTracer, enable ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDeviceGetConcurrentMetricGroupsExp __zedlllocal ze_result_t ZE_APICALL zetDeviceGetConcurrentMetricGroupsExp( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t * phMetricGroups, ///< [in,out] metrics groups to be re-arranged to be sets of concurrent ///< groups uint32_t * pMetricGroupsCountPerConcurrentGroup,///< [in,out][optional][*pConcurrentGroupCount] count of metric groups per ///< concurrent group. uint32_t * pConcurrentGroupCount ///< [out] number of concurrent groups. ///< The value of this parameter could be used to determine the number of ///< replays necessary. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetConcurrentMetricGroupsExp = context.zetDdiTable.DeviceExp.pfnGetConcurrentMetricGroupsExp; if( nullptr != pfnGetConcurrentMetricGroupsExp ) { result = pfnGetConcurrentMetricGroupsExp( hDevice, metricGroupCount, phMetricGroups, pMetricGroupsCountPerConcurrentGroup, pConcurrentGroupCount ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerCreateExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerCreateExp( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t* phMetricGroups, ///< [in][range(0, metricGroupCount )] handles of the metric groups to ///< trace zet_metric_tracer_exp_desc_t* desc, ///< [in,out] metric tracer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification. Note: ///< If buffer is not drained when the event it flagged, there is a risk of ///< HW event buffer being overrun zet_metric_tracer_exp_handle_t* phMetricTracer ///< [out] handle of the metric tracer ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreateExp = context.zetDdiTable.MetricTracerExp.pfnCreateExp; if( nullptr != pfnCreateExp ) { result = pfnCreateExp( hContext, hDevice, metricGroupCount, phMetricGroups, desc, hNotificationEvent, phMetricTracer ); } else { // generic implementation *phMetricTracer = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerDestroyExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerDestroyExp( zet_metric_tracer_exp_handle_t hMetricTracer ///< [in] handle of the metric tracer ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroyExp = context.zetDdiTable.MetricTracerExp.pfnDestroyExp; if( nullptr != pfnDestroyExp ) { result = pfnDestroyExp( hMetricTracer ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerEnableExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerEnableExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_NOT_READY will be returned ///< when the tracer is inactive. ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnEnableExp = context.zetDdiTable.MetricTracerExp.pfnEnableExp; if( nullptr != pfnEnableExp ) { result = pfnEnableExp( hMetricTracer, synchronous ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerDisableExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerDisableExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active or when it is inactive but still has data. ///< ::ZE_RESULT_NOT_READY will be returned when the tracer is inactive and ///< has no more data to be retrieved. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDisableExp = context.zetDdiTable.MetricTracerExp.pfnDisableExp; if( nullptr != pfnDisableExp ) { result = pfnDisableExp( hMetricTracer, synchronous ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerReadDataExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerReadDataExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all data available. ///< if size is non-zero, then driver will only retrieve that amount of ///< data. ///< if size is larger than size needed for all data, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnReadDataExp = context.zetDdiTable.MetricTracerExp.pfnReadDataExp; if( nullptr != pfnReadDataExp ) { result = pfnReadDataExp( hMetricTracer, pRawDataSize, pRawData ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricDecoderCreateExp __zedlllocal ze_result_t ZE_APICALL zetMetricDecoderCreateExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer zet_metric_decoder_exp_handle_t* phMetricDecoder///< [out] handle of the metric decoder object ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreateExp = context.zetDdiTable.MetricDecoderExp.pfnCreateExp; if( nullptr != pfnCreateExp ) { result = pfnCreateExp( hMetricTracer, phMetricDecoder ); } else { // generic implementation *phMetricDecoder = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricDecoderDestroyExp __zedlllocal ze_result_t ZE_APICALL zetMetricDecoderDestroyExp( zet_metric_decoder_exp_handle_t phMetricDecoder ///< [in] handle of the metric decoder object ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroyExp = context.zetDdiTable.MetricDecoderExp.pfnDestroyExp; if( nullptr != pfnDestroyExp ) { result = pfnDestroyExp( phMetricDecoder ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricDecoderGetDecodableMetricsExp __zedlllocal ze_result_t ZE_APICALL zetMetricDecoderGetDecodableMetricsExp( zet_metric_decoder_exp_handle_t hMetricDecoder, ///< [in] handle of the metric decoder object uint32_t* pCount, ///< [in,out] pointer to number of decodable metric in the hMetricDecoder ///< handle. If count is zero, then the driver shall ///< update the value with the total number of decodable metrics available ///< in the decoder. if count is greater than zero ///< but less than the total number of decodable metrics available in the ///< decoder, then only that number will be returned. ///< if count is greater than the number of decodable metrics available in ///< the decoder, then the driver shall update the ///< value with the actual number of decodable metrics available. zet_metric_handle_t* phMetrics ///< [in,out] [range(0, *pCount)] array of handles of decodable metrics in ///< the hMetricDecoder handle provided. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetDecodableMetricsExp = context.zetDdiTable.MetricDecoderExp.pfnGetDecodableMetricsExp; if( nullptr != pfnGetDecodableMetricsExp ) { result = pfnGetDecodableMetricsExp( hMetricDecoder, pCount, phMetrics ); } else { // generic implementation for( size_t i = 0; ( nullptr != phMetrics ) && ( i < *pCount ); ++i ) phMetrics[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerDecodeExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerDecodeExp( zet_metric_decoder_exp_handle_t phMetricDecoder,///< [in] handle of the metric decoder object size_t* pRawDataSize, ///< [in,out] size in bytes of raw data buffer. If pMetricEntriesCount is ///< greater than zero but less than total number of ///< decodable metrics available in the raw data buffer, then driver shall ///< update this value with actual number of raw ///< data bytes processed. uint8_t* pRawData, ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format uint32_t metricsCount, ///< [in] number of decodable metrics in the tracer for which the ///< hMetricDecoder handle was provided. See ///< ::zetMetricDecoderGetDecodableMetricsExp(). If metricCount is greater ///< than zero but less than the number decodable ///< metrics available in the raw data buffer, then driver shall only ///< decode those. zet_metric_handle_t* phMetrics, ///< [in] [range(0, metricsCount)] array of handles of decodable metrics in ///< the decoder for which the hMetricDecoder handle was ///< provided. Metrics handles are expected to be for decodable metrics, ///< see ::zetMetricDecoderGetDecodableMetricsExp() uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. If count is zero, then the ///< driver shall update the value with the total ///< number of metric sets to be decoded. If count is greater than the ///< number available in the raw data buffer, then the ///< driver shall update the value with the actual number of metric sets to ///< be decoded. There is a 1:1 relation between ///< the number of sets and sub-devices returned in the decoded entries. uint32_t* pMetricEntriesCountPerSet, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric entries ///< counts per metric set, one value per set. uint32_t* pMetricEntriesCount, ///< [in,out] pointer to the total number of metric entries decoded, for ///< all metric sets. If count is zero, then the ///< driver shall update the value with the total number of metric entries ///< to be decoded. If count is greater than zero ///< but less than the total number of metric entries available in the raw ///< data, then user provided number will be decoded. ///< If count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with ///< the actual number of decodable metric entries decoded. If set to null, ///< then driver will only update the value of ///< pSetCount. zet_metric_entry_exp_t* pMetricEntries ///< [in,out][optional][range(0, *pMetricEntriesCount)] buffer containing ///< decoded metric entries ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDecodeExp = context.zetDdiTable.MetricTracerExp.pfnDecodeExp; if( nullptr != pfnDecodeExp ) { result = pfnDecodeExp( phMetricDecoder, pRawDataSize, pRawData, metricsCount, phMetrics, pSetCount, pMetricEntriesCountPerSet, pMetricEntriesCount, pMetricEntries ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCalculateMultipleMetricValuesExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCalculateMultipleMetricValuesExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCalculateMultipleMetricValuesExp = context.zetDdiTable.MetricGroupExp.pfnCalculateMultipleMetricValuesExp; if( nullptr != pfnCalculateMultipleMetricValuesExp ) { result = pfnCalculateMultipleMetricValuesExp( hMetricGroup, type, rawDataSize, pRawData, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupGetGlobalTimestampsExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupGetGlobalTimestampsExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group ze_bool_t synchronizedWithHost, ///< [in] Returns the timestamps synchronized to the host or the device. uint64_t* globalTimestamp, ///< [out] Device timestamp. uint64_t* metricTimestamp ///< [out] Metric timestamp. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetGlobalTimestampsExp = context.zetDdiTable.MetricGroupExp.pfnGetGlobalTimestampsExp; if( nullptr != pfnGetGlobalTimestampsExp ) { result = pfnGetGlobalTimestampsExp( hMetricGroup, synchronizedWithHost, globalTimestamp, metricTimestamp ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupGetExportDataExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupGetExportDataExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group const uint8_t* pRawData, ///< [in] buffer of raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer size_t* pExportDataSize, ///< [in,out] size in bytes of export data buffer ///< if size is zero, then the driver shall update the value with the ///< number of bytes necessary to store the exported data. ///< if size is greater than required, then the driver shall update the ///< value with the actual number of bytes necessary to store the exported data. uint8_t * pExportData ///< [in,out][optional][range(0, *pExportDataSize)] buffer of exported data. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetExportDataExp = context.zetDdiTable.MetricGroupExp.pfnGetExportDataExp; if( nullptr != pfnGetExportDataExp ) { result = pfnGetExportDataExp( hMetricGroup, pRawData, rawDataSize, pExportDataSize, pExportData ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCalculateMetricExportDataExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCalculateMetricExportDataExp( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t exportDataSize, ///< [in] size in bytes of exported data buffer const uint8_t* pExportData, ///< [in][range(0, exportDataSize)] buffer of exported data to calculate zet_metric_calculate_exp_desc_t* pCalculateDescriptor, ///< [in] descriptor specifying calculation specific parameters uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCalculateMetricExportDataExp = context.zetDdiTable.MetricGroupExp.pfnCalculateMetricExportDataExp; if( nullptr != pfnCalculateMetricExportDataExp ) { result = pfnCalculateMetricExportDataExp( hDriver, type, exportDataSize, pExportData, pCalculateDescriptor, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricProgrammableGetExp __zedlllocal ze_result_t ZE_APICALL zetMetricProgrammableGetExp( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric programmable handles. ///< if count is zero, then the driver shall update the value with the ///< total number of metric programmable handles available. ///< if count is greater than the number of metric programmable handles ///< available, then the driver shall update the value with the correct ///< number of metric programmable handles available. zet_metric_programmable_exp_handle_t* phMetricProgrammables ///< [in,out][optional][range(0, *pCount)] array of handle of metric programmables. ///< if count is less than the number of metric programmables available, ///< then driver shall only retrieve that number of metric programmables. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetExp = context.zetDdiTable.MetricProgrammableExp.pfnGetExp; if( nullptr != pfnGetExp ) { result = pfnGetExp( hDevice, pCount, phMetricProgrammables ); } else { // generic implementation for( size_t i = 0; ( nullptr != phMetricProgrammables ) && ( i < *pCount ); ++i ) phMetricProgrammables[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricProgrammableGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zetMetricProgrammableGetPropertiesExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_exp_properties_t* pProperties ///< [in,out] properties of the metric programmable ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetPropertiesExp = context.zetDdiTable.MetricProgrammableExp.pfnGetPropertiesExp; if( nullptr != pfnGetPropertiesExp ) { result = pfnGetPropertiesExp( hMetricProgrammable, pProperties ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricProgrammableGetParamInfoExp __zedlllocal ze_result_t ZE_APICALL zetMetricProgrammableGetParamInfoExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t* pParameterCount, ///< [in,out] count of the parameters to retrieve parameter info. ///< if value pParameterCount is greater than count of parameters ///< available, then pParameterCount will be updated with count of ///< parameters available. ///< The count of parameters available can be queried using ::zetMetricProgrammableGetPropertiesExp. zet_metric_programmable_param_info_exp_t* pParameterInfo///< [in,out][range(1, *pParameterCount)] array of parameter info. ///< if parameterCount is less than the number of parameters available, ///< then driver shall only retrieve that number of parameter info. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetParamInfoExp = context.zetDdiTable.MetricProgrammableExp.pfnGetParamInfoExp; if( nullptr != pfnGetParamInfoExp ) { result = pfnGetParamInfoExp( hMetricProgrammable, pParameterCount, pParameterInfo ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricProgrammableGetParamValueInfoExp __zedlllocal ze_result_t ZE_APICALL zetMetricProgrammableGetParamValueInfoExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterOrdinal, ///< [in] ordinal of the parameter in the metric programmable uint32_t* pValueInfoCount, ///< [in,out] count of parameter value information to retrieve. ///< if value at pValueInfoCount is greater than count of value info ///< available, then pValueInfoCount will be updated with count of value ///< info available. ///< The count of parameter value info available can be queried using ::zetMetricProgrammableGetParamInfoExp. zet_metric_programmable_param_value_info_exp_t* pValueInfo ///< [in,out][range(1, *pValueInfoCount)] array of parameter value info. ///< if pValueInfoCount is less than the number of value info available, ///< then driver shall only retrieve that number of value info. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnGetParamValueInfoExp = context.zetDdiTable.MetricProgrammableExp.pfnGetParamValueInfoExp; if( nullptr != pfnGetParamValueInfoExp ) { result = pfnGetParamValueInfoExp( hMetricProgrammable, parameterOrdinal, pValueInfoCount, pValueInfo ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricCreateFromProgrammableExp2 __zedlllocal ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp2( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreateFromProgrammableExp2 = context.zetDdiTable.MetricExp.pfnCreateFromProgrammableExp2; if( nullptr != pfnCreateFromProgrammableExp2 ) { result = pfnCreateFromProgrammableExp2( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); } else { // generic implementation for( size_t i = 0; ( nullptr != phMetricHandles ) && ( i < *pMetricHandleCount ); ++i ) phMetricHandles[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricCreateFromProgrammableExp __zedlllocal ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. uint32_t parameterCount, ///< [in] Count of parameters to set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreateFromProgrammableExp = context.zetDdiTable.MetricExp.pfnCreateFromProgrammableExp; if( nullptr != pfnCreateFromProgrammableExp ) { result = pfnCreateFromProgrammableExp( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); } else { // generic implementation for( size_t i = 0; ( nullptr != phMetricHandles ) && ( i < *pMetricHandleCount ); ++i ) phMetricHandles[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDeviceCreateMetricGroupsFromMetricsExp __zedlllocal ze_result_t ZE_APICALL zetDeviceCreateMetricGroupsFromMetricsExp( zet_device_handle_t hDevice, ///< [in] handle of the device. uint32_t metricCount, ///< [in] number of metric handles. zet_metric_handle_t * phMetrics, ///< [in] metric handles to be added to the metric groups. const char * pMetricGroupNamePrefix, ///< [in] prefix to the name created for the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP. const char * pDescription, ///< [in] pointer to description of the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. uint32_t * pMetricGroupCount, ///< [in,out] pointer to the number of metric group handles to be created. ///< if pMetricGroupCount is zero, then the driver shall update the value ///< with the maximum possible number of metric group handles that could be created. ///< if pMetricGroupCount is greater than the number of metric group ///< handles that could be created, then the driver shall update the value ///< with the correct number of metric group handles generated. ///< if pMetricGroupCount is lesser than the number of metric group handles ///< that could be created, then ::ZE_RESULT_ERROR_INVALID_ARGUMENT is returned. zet_metric_group_handle_t* phMetricGroup ///< [in,out][optional][range(0, *pMetricGroupCount)] array of handle of ///< metric group handles. ///< Created Metric group handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreateMetricGroupsFromMetricsExp = context.zetDdiTable.DeviceExp.pfnCreateMetricGroupsFromMetricsExp; if( nullptr != pfnCreateMetricGroupsFromMetricsExp ) { result = pfnCreateMetricGroupsFromMetricsExp( hDevice, metricCount, phMetrics, pMetricGroupNamePrefix, pDescription, pMetricGroupCount, phMetricGroup ); } else { // generic implementation for( size_t i = 0; ( nullptr != phMetricGroup ) && ( i < *pMetricGroupCount ); ++i ) phMetricGroup[ i ] = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCreateExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCreateExp( zet_device_handle_t hDevice, ///< [in] handle of the device const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. const char* pDescription, ///< [in] pointer to metric group description. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. zet_metric_group_sampling_type_flags_t samplingType,///< [in] Sampling type for the metric group. zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCreateExp = context.zetDdiTable.MetricGroupExp.pfnCreateExp; if( nullptr != pfnCreateExp ) { result = pfnCreateExp( hDevice, pName, pDescription, samplingType, phMetricGroup ); } else { // generic implementation *phMetricGroup = reinterpret_cast( context.get() ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupAddMetricExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupAddMetricExp( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric, ///< [in] Metric to be added to the group. size_t * pErrorStringSize, ///< [in,out][optional] Size of the error string to query, if an error was ///< reported during adding the metric handle. ///< if *pErrorStringSize is zero, then the driver shall update the value ///< with the size of the error string in bytes. char* pErrorString ///< [in,out][optional][range(0, *pErrorStringSize)] Error string. ///< if *pErrorStringSize is less than the length of the error string ///< available, then driver shall only retrieve that length of error string. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnAddMetricExp = context.zetDdiTable.MetricGroupExp.pfnAddMetricExp; if( nullptr != pfnAddMetricExp ) { result = pfnAddMetricExp( hMetricGroup, hMetric, pErrorStringSize, pErrorString ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupRemoveMetricExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupRemoveMetricExp( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric ///< [in] Metric handle to be removed from the metric group. ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnRemoveMetricExp = context.zetDdiTable.MetricGroupExp.pfnRemoveMetricExp; if( nullptr != pfnRemoveMetricExp ) { result = pfnRemoveMetricExp( hMetricGroup, hMetric ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCloseExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCloseExp( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnCloseExp = context.zetDdiTable.MetricGroupExp.pfnCloseExp; if( nullptr != pfnCloseExp ) { result = pfnCloseExp( hMetricGroup ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupDestroyExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupDestroyExp( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroyExp = context.zetDdiTable.MetricGroupExp.pfnDestroyExp; if( nullptr != pfnDestroyExp ) { result = pfnDestroyExp( hMetricGroup ); } else { // generic implementation } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricDestroyExp __zedlllocal ze_result_t ZE_APICALL zetMetricDestroyExp( zet_metric_handle_t hMetric ///< [in] Handle of the metric to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path auto pfnDestroyExp = context.zetDdiTable.MetricExp.pfnDestroyExp; if( nullptr != pfnDestroyExp ) { result = pfnDestroyExp( hMetric ); } else { // generic implementation } return result; } } // namespace driver #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricDecoderExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricDecoderExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_decoder_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreateExp = driver::zetMetricDecoderCreateExp; pDdiTable->pfnDestroyExp = driver::zetMetricDecoderDestroyExp; pDdiTable->pfnGetDecodableMetricsExp = driver::zetMetricDecoderGetDecodableMetricsExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricProgrammableExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricProgrammableExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_programmable_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetExp = driver::zetMetricProgrammableGetExp; pDdiTable->pfnGetPropertiesExp = driver::zetMetricProgrammableGetPropertiesExp; pDdiTable->pfnGetParamInfoExp = driver::zetMetricProgrammableGetParamInfoExp; pDdiTable->pfnGetParamValueInfoExp = driver::zetMetricProgrammableGetParamValueInfoExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricTracerExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricTracerExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_tracer_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreateExp = driver::zetMetricTracerCreateExp; pDdiTable->pfnDestroyExp = driver::zetMetricTracerDestroyExp; pDdiTable->pfnEnableExp = driver::zetMetricTracerEnableExp; pDdiTable->pfnDisableExp = driver::zetMetricTracerDisableExp; pDdiTable->pfnReadDataExp = driver::zetMetricTracerReadDataExp; pDdiTable->pfnDecodeExp = driver::zetMetricTracerDecodeExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetDebugProperties = driver::zetDeviceGetDebugProperties; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetConcurrentMetricGroupsExp = driver::zetDeviceGetConcurrentMetricGroupsExp; pDdiTable->pfnCreateMetricGroupsFromMetricsExp = driver::zetDeviceCreateMetricGroupsFromMetricsExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Context table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetContextProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_context_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnActivateMetricGroups = driver::zetContextActivateMetricGroups; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandList table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetCommandListProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_command_list_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnAppendMetricStreamerMarker = driver::zetCommandListAppendMetricStreamerMarker; pDdiTable->pfnAppendMetricQueryBegin = driver::zetCommandListAppendMetricQueryBegin; pDdiTable->pfnAppendMetricQueryEnd = driver::zetCommandListAppendMetricQueryEnd; pDdiTable->pfnAppendMetricMemoryBarrier = driver::zetCommandListAppendMetricMemoryBarrier; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Kernel table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetKernelProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_kernel_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetProfileInfo = driver::zetKernelGetProfileInfo; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Module table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetModuleProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_module_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGetDebugInfo = driver::zetModuleGetDebugInfo; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Debug table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDebugProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_debug_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnAttach = driver::zetDebugAttach; pDdiTable->pfnDetach = driver::zetDebugDetach; pDdiTable->pfnReadEvent = driver::zetDebugReadEvent; pDdiTable->pfnAcknowledgeEvent = driver::zetDebugAcknowledgeEvent; pDdiTable->pfnInterrupt = driver::zetDebugInterrupt; pDdiTable->pfnResume = driver::zetDebugResume; pDdiTable->pfnReadMemory = driver::zetDebugReadMemory; pDdiTable->pfnWriteMemory = driver::zetDebugWriteMemory; pDdiTable->pfnGetRegisterSetProperties = driver::zetDebugGetRegisterSetProperties; pDdiTable->pfnReadRegisters = driver::zetDebugReadRegisters; pDdiTable->pfnWriteRegisters = driver::zetDebugWriteRegisters; pDdiTable->pfnGetThreadRegisterSetProperties = driver::zetDebugGetThreadRegisterSetProperties; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Metric table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGet = driver::zetMetricGet; pDdiTable->pfnGetProperties = driver::zetMetricGetProperties; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreateFromProgrammableExp2 = driver::zetMetricCreateFromProgrammableExp2; pDdiTable->pfnCreateFromProgrammableExp = driver::zetMetricCreateFromProgrammableExp; pDdiTable->pfnDestroyExp = driver::zetMetricDestroyExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricGroup table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricGroupProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_group_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnGet = driver::zetMetricGroupGet; pDdiTable->pfnGetProperties = driver::zetMetricGroupGetProperties; pDdiTable->pfnCalculateMetricValues = driver::zetMetricGroupCalculateMetricValues; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricGroupExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricGroupExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_group_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCalculateMultipleMetricValuesExp = driver::zetMetricGroupCalculateMultipleMetricValuesExp; pDdiTable->pfnGetGlobalTimestampsExp = driver::zetMetricGroupGetGlobalTimestampsExp; pDdiTable->pfnGetExportDataExp = driver::zetMetricGroupGetExportDataExp; pDdiTable->pfnCalculateMetricExportDataExp = driver::zetMetricGroupCalculateMetricExportDataExp; pDdiTable->pfnCreateExp = driver::zetMetricGroupCreateExp; pDdiTable->pfnAddMetricExp = driver::zetMetricGroupAddMetricExp; pDdiTable->pfnRemoveMetricExp = driver::zetMetricGroupRemoveMetricExp; pDdiTable->pfnCloseExp = driver::zetMetricGroupCloseExp; pDdiTable->pfnDestroyExp = driver::zetMetricGroupDestroyExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricQuery table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricQueryProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_query_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zetMetricQueryCreate; pDdiTable->pfnDestroy = driver::zetMetricQueryDestroy; pDdiTable->pfnReset = driver::zetMetricQueryReset; pDdiTable->pfnGetData = driver::zetMetricQueryGetData; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricQueryPool table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricQueryPoolProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_query_pool_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zetMetricQueryPoolCreate; pDdiTable->pfnDestroy = driver::zetMetricQueryPoolDestroy; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricStreamer table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricStreamerProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_streamer_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnOpen = driver::zetMetricStreamerOpen; pDdiTable->pfnClose = driver::zetMetricStreamerClose; pDdiTable->pfnReadData = driver::zetMetricStreamerReadData; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's TracerExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetTracerExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_tracer_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( driver::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = driver::zetTracerExpCreate; pDdiTable->pfnDestroy = driver::zetTracerExpDestroy; pDdiTable->pfnSetPrologues = driver::zetTracerExpSetPrologues; pDdiTable->pfnSetEpilogues = driver::zetTracerExpSetEpilogues; pDdiTable->pfnSetEnabled = driver::zetTracerExpSetEnabled; return result; } #if defined(__cplusplus) }; #endif level-zero-1.20.6/source/inc/000077500000000000000000000000001475521542100157435ustar00rootroot00000000000000level-zero-1.20.6/source/inc/ze_singleton.h000066400000000000000000000045641475521542100206250ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include #include #include ////////////////////////////////////////////////////////////////////////// /// a abstract factory for creation of singleton objects template class singleton_factory_t { protected: using singleton_t = _singleton_t; using key_t = typename std::conditional::value, size_t, _key_t>::type; using ptr_t = std::unique_ptr < singleton_t >; using map_t = std::unordered_map < key_t, ptr_t >; std::mutex mut; ///< lock for thread-safety map_t map; ///< single instance of singleton for each unique key ////////////////////////////////////////////////////////////////////////// /// extract the key from parameter list and if necessary, convert type template key_t getKey( _key_t _key, Ts&&... _params ) { return reinterpret_cast( _key ); } public: ////////////////////////////////////////////////////////////////////////// /// default ctor/dtor singleton_factory_t() = default; ~singleton_factory_t() = default; ////////////////////////////////////////////////////////////////////////// /// gets a pointer to a unique instance of singleton /// if no instance exists, then creates a new instance /// the params are forwarded to the ctor of the singleton /// the first parameter must be the unique identifier of the instance template _singleton_t* getInstance( Ts&&... _params ) { auto key = getKey( std::forward( _params )... ); if(key == 0) // No zero keys allowed in map return static_cast<_singleton_t*>(0); std::lock_guard lk( mut ); auto iter = map.find( key ); if( map.end() == iter ) { auto ptr = std::make_unique( std::forward( _params )... ); iter = map.emplace( key, std::move( ptr ) ).first; } return iter->second.get(); } ////////////////////////////////////////////////////////////////////////// /// once the key is no longer valid, release the singleton void release( _key_t _key ) { std::lock_guard lk( mut ); map.erase( getKey( _key ) ); } }; level-zero-1.20.6/source/inc/ze_util.h000066400000000000000000000116221475521542100175710ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #if defined(__cplusplus) #pragma once #endif #include #include #include /////////////////////////////////////////////////////////////////////////////// #if defined(_WIN32) # include inline void getLastErrorString(std::string &errorValue) { DWORD errorID = GetLastError(); if (errorID) { LPSTR tempErrorMessage = nullptr; FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, errorID, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&tempErrorMessage, 0, NULL); errorValue.assign(tempErrorMessage); LocalFree(tempErrorMessage); } } # define MAKE_LIBRARY_NAME(NAME, VERSION) NAME".dll" # define MAKE_LAYER_NAME(NAME) NAME".dll" # define LOAD_DRIVER_LIBRARY(NAME) LoadLibraryExA(NAME, nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32) # define GET_LIBRARY_ERROR(ERROR_STRING) getLastErrorString(ERROR_STRING) # define FREE_DRIVER_LIBRARY(LIB) FreeLibrary(LIB) # define FREE_DRIVER_LIBRARY_FAILURE_CHECK(RESULT) (RESULT) == 0 ? true : false # define GET_FUNCTION_PTR(LIB, FUNC_NAME) reinterpret_cast(GetProcAddress(LIB, FUNC_NAME)) # define string_copy_s strncpy_s #else # include # include # define HMODULE void* # define MAKE_LIBRARY_NAME(NAME, VERSION) "lib" NAME ".so." VERSION # define MAKE_LAYER_NAME(NAME) "lib" NAME ".so." L0_VALIDATION_LAYER_SUPPORTED_VERSION # define LOAD_DRIVER_LIBRARY(NAME) dlopen(NAME, RTLD_LAZY|RTLD_LOCAL) # define GET_LIBRARY_ERROR(ERROR_STRING) ERROR_STRING.assign(dlerror()) # define FREE_DRIVER_LIBRARY(LIB) dlclose(LIB) # define FREE_DRIVER_LIBRARY_FAILURE_CHECK(RESULT) (RESULT) != 0 ? true : false # define GET_FUNCTION_PTR(LIB, FUNC_NAME) dlsym(LIB, FUNC_NAME) # define string_copy_s strncpy #endif inline std::string create_library_path(const char *name, const char *path){ std::string library_path; if (path && (strcmp("", path) != 0)) { library_path.assign(path); #ifdef _WIN32 library_path.append("\\"); #else library_path.append("/"); #endif library_path.append(name); } else { library_path.assign(name); } return library_path; } #ifdef _WIN32 inline std::string readLevelZeroLoaderLibraryPath() { std::string LoaderRegKeyPath = ""; HKEY regKey = {}; DWORD regValueType = {}; DWORD pathSize = {}; std::string loaderMajorVersionString = std::to_string(LOADER_VERSION_MAJOR); std::string loaderRegistryKeyPath = "Software\\Intel\\oneAPI\\LevelZero\\"; loaderRegistryKeyPath.append(loaderMajorVersionString); static constexpr char levelZeroLoaderPathKey[] = "LevelZeroLoaderPath"; LSTATUS regOpenStatus = RegOpenKeyA(HKEY_LOCAL_MACHINE, loaderRegistryKeyPath.c_str(), ®Key); if (ERROR_SUCCESS != regOpenStatus) { return LoaderRegKeyPath; } LSTATUS regOpStatus = RegQueryValueExA(regKey, levelZeroLoaderPathKey, NULL, ®ValueType, NULL, &pathSize); if ((ERROR_SUCCESS == regOpStatus) && (REG_SZ == regValueType)) { LoaderRegKeyPath.resize(pathSize); regOpStatus = RegQueryValueExA(regKey, levelZeroLoaderPathKey, NULL, ®ValueType, (LPBYTE) & *LoaderRegKeyPath.begin(), &pathSize); if (ERROR_SUCCESS != regOpStatus) { LoaderRegKeyPath.clear(); LoaderRegKeyPath.assign(""); } } return LoaderRegKeyPath; } #endif ////////////////////////////////////////////////////////////////////////// #if !defined(_WIN32) && (__GNUC__ >= 4) #define __zedlllocal __attribute__ ((visibility ("hidden"))) #else #define __zedlllocal #endif /////////////////////////////////////////////////////////////////////////////// #if ZE_ENABLE_OCL_INTEROP typedef struct _cl_mem* cl_mem; typedef struct _cl_command_queue* cl_command_queue; typedef struct _cl_context* cl_context; typedef struct _cl_program* cl_program; #endif /////////////////////////////////////////////////////////////////////////////// inline bool getenv_tobool( const char* name ) { const char* env = nullptr; #if defined(_WIN32) char buffer[8]; auto rc = GetEnvironmentVariable(name, buffer, 8); if (0 != rc && rc <= 8) { env = buffer; } #else env = getenv(name); #endif if( ( nullptr == env ) || ( 0 == strcmp( "0", env ) ) ) return false; return ( 0 == strcmp( "1", env ) ); } inline std::string getenv_string ( const char* name){ const char* env = nullptr; #if defined(_WIN32) char buffer[1024]; auto rc = GetEnvironmentVariable(name, buffer, 1024); if (0 != rc && rc <= 1024) { env = buffer; } #else env = getenv(name); #endif if ((nullptr == env)) return ""; return std::string(env); }level-zero-1.20.6/source/layers/000077500000000000000000000000001475521542100164715ustar00rootroot00000000000000level-zero-1.20.6/source/layers/CMakeLists.txt000066400000000000000000000001741475521542100212330ustar00rootroot00000000000000# Copyright (C) 2020 Intel Corporation # SPDX-License-Identifier: MIT add_subdirectory(validation) add_subdirectory(tracing)level-zero-1.20.6/source/layers/tracing/000077500000000000000000000000001475521542100201205ustar00rootroot00000000000000level-zero-1.20.6/source/layers/tracing/CMakeLists.txt000066400000000000000000000034651475521542100226700ustar00rootroot00000000000000# Copyright (C) 2020 Intel Corporation # SPDX-License-Identifier: MIT set(TARGET_NAME ze_tracing_layer) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ZeTracingLayerVersion.rc.in ${CMAKE_CURRENT_BINARY_DIR}/ZeTracingLayerVersion.rc @ONLY) add_library(${TARGET_NAME} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/ze_tracing_layer.h ${CMAKE_CURRENT_SOURCE_DIR}/tracing.h ${CMAKE_CURRENT_SOURCE_DIR}/tracing_imp.h ${CMAKE_CURRENT_SOURCE_DIR}/ze_tracing_layer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_trcddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/tracing_imp.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_tracing.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_tracing_cb_structs.h ${CMAKE_CURRENT_SOURCE_DIR}/ze_tracing_register_cb.cpp ${CMAKE_CURRENT_BINARY_DIR}/ZeTracingLayerVersion.rc ) if(WIN32) target_sources(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/windows/tracing_init.cpp ) else() target_sources(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/linux/tracing_init.cpp ) endif() target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) if(UNIX) set(GCC_COVERAGE_COMPILE_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}") endif() set_target_properties(${TARGET_NAME} PROPERTIES VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" SOVERSION "${PROJECT_VERSION_MAJOR}" ) install(TARGETS ze_tracing_layer ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero-devel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT level-zero LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero NAMELINK_COMPONENT level-zero-devel ) level-zero-1.20.6/source/layers/tracing/README.md000066400000000000000000000246501475521542100214060ustar00rootroot00000000000000# API Tracing, Loader Implementation ## Introduction API tracing provides a way for tools to receive notifications of **L0 API** calls made by an application. These notifications are provided via callback functions that provide direct access to the input and output parameters which can be viewed and modified. Tools may also use these notifications as triggers to block and inject new API calls into the command stream, such as __metrics__. Tracing provides for a tool to create one or more __tracers__. A __tracer__ is identified by a __tracer handle__, and has associated with it a set of __prologue__ functions for each **L0 API** function that can be invoked at the beginning of these function calls, and a matching set of __epilogue__ functions that can be invoked at the end of L0 API calls. In summary, this tracing implementation provides functions to create one or more __tracers__, acquiring a __tracer handle__ for each, then registering a set of __prologue__ and __epilogue__ functions for each __tracer handle__, enabling and disabling a __tracer__, and for destroying a __tracer__. ## Enabling Tracing in the Loader Tracing is implemented as a layer in the loader. This tracing layer must be enabled by setting the environment variable **ZE_ENABLE_TRACING_LAYER** to 1. This environment variable must be defined in the application process's context before that process calls _zeInit()_. ## Tracing API The API for using this tracing implementation is this header file below. Please examine that header file for tracing API details. `include/level_zero/layers/zel_tracing_api.h` __zelTracerCreate__ returns a __tracer handle__ representing that __tracer__. A __tracer__ represents a set of __prologue__ callbacks and __epilogue__ callbacks. See **Creation, Registration, Enabling, Disabling and Destruction** below. ## Callback Structures The per-**L0-API** function structures used to pass arguments into callback handlers (`..params_t`) are defined in the `ze_api.h`. Only **L0 API** functions declared in `ze_api.h` can be traced. `include/level_zero/ze_api.h` ## Prologue/Epilogue Structures The structure used to declare sets of __prologue__ and __epilogue__ callbacks (`zel_core_callbacks_t`) is defined in `zel_tracing_api.h`. This currently references the `ze_core_callbacks_t` declaration in `ze_api.h`. Please use the `zel_core_callbacks_t` definition. `include/level_zero/layers/zel_tracing_api.h` ## Creation Users of tracing must first create one or more __tracers__, using __zelTracerCreate__. ## Registration Users of tracing may independently register for enter and exit callbacks for individual **L0 API** calls. These callbacks are associated with a __tracer handle__ returned from the __zelTracerCreate__. The set of __tracers__ applies across all drivers and devices. There are now TWO classes of interfaces for registering callbacks: ### Registration functions that take a `zet_core_callbacks_t` argument For this class of registration functions, the `zet_core_callbacks_t` argument is a structure of pointers to callback handler functions. A __nullptr__ value for one of these entries means no callback handler is defined for the corresponding **L0 API** function. This `zet_core_callbacks_t` structure is not extensible in a way that could support binary compatibility as new APIs are added to the **L0 specification**. As a consequence, these registration functions are deprecated and will be removed in the future. The definition of the `zet_core_callbacks_t` structure is frozen as of the **L0 API 1.0** specification. Any new **L0 API** functions added since version 1.0 will not be traceable using these registration functions. - __zelTracerSetPrologues__ is used to specify all the enter callbacks for a __tracer handle__. - __zelTracerSetEpilogues__ is used to specify all the exit callbacks for a __tracer handle__. These functions can be called only when the tracer specified by __tracer handle__ is in the disabled state. See **Enabling, Disabling and Destruction** below. ### A set of unique registration function for each API function A new set of registration functions has been added, one for each **L0 API** function. These registration functions have the general form: -__zelTracerXRegisterCallback(zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnXCb_t callback_handler_function)__ The `zel_tracer_reg_t` value can be either `ZEL_REGISTER_PROLOGUE` or `ZEL_REGISTER_EPILOGUE`, specifying whether a prologue or an epilogue handler is being registered. These new registration functions are defined in the header file `include/level_zero/layers/tracing/zel_tracing_register_cb.h`. This header file also includes prototypes for callback handler functions and `Xcb_t` structure declarations for **L0 API** functions that have been added since specification version 1.0. When the older __zelTracerSetPrologues__ and __zelTracerSetEpilogues__ functions are removed, the `zet_core_callbacks_t` structure will also be removed, and all __ze_pfnXCb_t__ and `XCb_t` declarations that are in `ze_api.h` will be relocated into this header file. If the __callback_handler_function__ pointer is NULL, then no callback handler will be registered for that API function. These register callback functions can be called only when the __hTracer__ argument references a tracer that is in the disabled state. ## Reset All Callbacks __zelTracerResetAllCallbacks(zel_tracer_handle_t hTracer)__ can be used to set ALL prologue and epilogue callback handlers to NULL. ## Callback Handlers Callback handlers are functions that are implemented by the application, and registered through either the set epilogue/set prologue functions, or the RegisterCallback APIs. The `ze_api.h` header file or the `zel_tracing_register_cb.h` header file contain prototype declarations for these functions. Generally, these functions take the following parameters: - __params__ : a structure capturing pointers to the input and output parameters of the current instance. - __result__ : the current value of the return value. - __pTracerUserData__ : a per-tracer per-API pointer to user's data that is passed into the callback handler functions. - __ppTracerInstanceUserData__ : a per-tracer, per-instance, per-thread storage location; typically used for passing data from the prologue to the epilogue. See example below. ## __ZeInit__ is traceable for all calls subsequent from the creation and enabling of the tracer itself. ## Enabling, Disabling and Destruction The __tracer__ is created in a disabled state and must be explicitly enabled by calling __zelTracerSetEnabled__. The implementation guarantees that __prologue__ and __epilogue__ handlers for a given **L0 API** function will always be executed in pairs; i.e. - if the __prologue__ function was called and there is a corresponding __epilogue__ function, then the __epilogue__ is guaranteed to be called, even if another thread disabled the __tracer__ between execution - if the __prologue__ function was not called then the __epilogue__ function is guaranteed not to be called, even if another thread enabled the tracer between execution The __tracer__ must be disabled by the application before the __tracer__ is destroyed. If multiple threads are in-flight, then callbacks that are in progress for that __tracer__ will continue to execute even after the __tracer__ is disabled; the implementation will stall and wait for any outstanding threads executing a __tracer__ __prologue__ or __epilogue__ functions to complete those during __zelTracerDestroy__ of that __tracer__. The following pseudo-code demonstrates a basic usage of API tracing: ``` #include "level_zero/ze_api.h" #include "level_zero/layers/zel_tracing_api.h" typedef struct _my_tracer_data_t { uint32_t instance; } my_tracer_data_t; typedef struct _my_instance_data_t { clock_t start; } my_instance_data_t; void OnEnterCommandListAppendLaunchKernel( ze_command_list_append_launch_kernel_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ) { my_instance_data_t* instance_data = malloc( sizeof(my_instance_data_t) ); *ppTracerInstanceUserData = instance_data; instance_data->start = clock(); } void OnExitCommandListAppendLaunchKernel( ze_command_list_append_launch_kernel_params_t* params, ze_result_t result, void* pTracerUserData, void** ppTracerInstanceUserData ) { clock_t end = clock(); my_tracer_data_t* tracer_data = (my_tracer_data_t*)pTracerUserData; my_instance_data_t* instance_data = *(my_instance_data_t**)ppTracerInstanceUserData; float time = 1000.f * ( end - instance_data->start ) / CLOCKS_PER_SEC; printf("zeCommandListAppendLaunchKernel #%d takes %.4f msn", tracer_data->instance++, time); free(instance_data); } // An example using deprecated setepilogue/setprologue functions void TracingExample1( ... ) { my_tracer_data_t tracer_data = {}; zel_tracer_desc_t tracer_desc; tracer_desc.stype = ZEL_STRUCTURE_TYPE_TRACER_DESC; tracer_desc.pUserData = &tracer_data; zel_tracer_handle_t hTracer; zelTracerCreate(hDevice, &tracer_desc, &hTracer); // Set all callbacks zel_core_callbacks_t prologCbs = {}; zel_core_callbacks_t epilogCbs = {}; prologCbs.CommandList.pfnAppendLaunchKernelCb = OnEnterCommandListAppendLaunchKernel; epilogCbs.CommandList.pfnAppendLaunchKernelCb = OnExitCommandListAppendLaunchKernel; zelTracerSetPrologues(hTracer, &prologCbs); zelTracerSetEpilogues(hTracer, &epilogCbs); zelTracerSetEnabled(hTracer, true); zeCommandListAppendLaunchKernel(hCommandList, hFunction, &launchArgs, nullptr, 0, nullptr); zelTracerSetEnabled(hTracer, false); zelTracerDestroy(hTracer); } // an example using RegisterCallback functions void TracingExample2( ... ) { my_tracer_data_t tracer_data = {}; zel_tracer_desc_t tracer_desc; tracer_desc.stype = ZEL_STRUCTURE_TYPE_TRACER_DESC; tracer_desc.pUserData = &tracer_data; zel_tracer_handle_t hTracer; zelTracerCreate(hDevice, &tracer_desc, &hTracer); zelTracerCommandListAppendLaunchKernelRegisterCallback(hTracer, ZEL_REGISTER_PROLOGUE, OnEnterCommandListAppendLaunchKernel); zelTracerCommandListAppendLaunchKernelRegisterCallback(hTracer, ZEL_REGISTER_EPILOGUE, OnExitCommandListAppendLaunchKernel); zelTracerSetEnabled(hTracer, true); zeCommandListAppendLaunchKernel(hCommandList, hFunction, &launchArgs, nullptr, 0, nullptr); zelTracerSetEnabled(hTracer, false); zelTracerDestroy(hTracer); } ``` level-zero-1.20.6/source/layers/tracing/ZeTracingLayerVersion.rc.in000066400000000000000000000024101475521542100253010ustar00rootroot00000000000000#define VER_FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@ #define VER_FILEVERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@\0" #define VER_PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@ #define VER_PRODUCTVERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@\0" #define VER_FILEDESCRIPTION_STR "oneAPI Level Zero API Tracing Layer for Windows(R) Level Zero Drivers" #define VER_PRODUCT_NAME_STR "oneAPI Level Zero API Tracing Layer for Windows(R)" #define VER_LEGALCOPYRIGHT_STR "Copyright (C) 2020 Intel Corporation" 1 VERSIONINFO FILEVERSION VER_FILEVERSION PRODUCTVERSION VER_PRODUCTVERSION BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904E4" BEGIN VALUE "FileDescription", VER_FILEDESCRIPTION_STR VALUE "FileVersion", VER_FILEVERSION_STR VALUE "ProductVersion", VER_PRODUCTVERSION_STR VALUE "ProductName", VER_PRODUCT_NAME_STR VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1252 END ENDlevel-zero-1.20.6/source/layers/tracing/linux/000077500000000000000000000000001475521542100212575ustar00rootroot00000000000000level-zero-1.20.6/source/layers/tracing/linux/tracing_init.cpp000066400000000000000000000006321475521542100244360ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "../tracing_imp.h" namespace tracing_layer { void __attribute__((constructor)) createAPITracerContextImp() { pGlobalAPITracerContextImp = new struct APITracerContextImp; } void __attribute__((destructor)) deleteAPITracerContextImp() { delete pGlobalAPITracerContextImp; } } level-zero-1.20.6/source/layers/tracing/tracing.h000066400000000000000000000025111475521542100217170ustar00rootroot00000000000000/* * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include "ze_api.h" #include "layers/zel_tracing_api.h" #include "layers/zel_tracing_register_cb.h" #include "ze_tracing_cb_structs.h" struct _zel_tracer_handle_t {}; #define TRACING_COMP_NAME "tracing layer" namespace tracing_layer { struct APITracer : _zel_tracer_handle_t { static APITracer *create(); virtual ~APITracer() = default; static APITracer *fromHandle(zel_tracer_handle_t handle) { return static_cast(handle); } inline zel_tracer_handle_t toHandle() { return this; } virtual ze_result_t destroyTracer(zel_tracer_handle_t phTracer) = 0; virtual ze_result_t setPrologues(zel_core_callbacks_t *pCoreCbs) = 0; virtual ze_result_t setEpilogues(zel_core_callbacks_t *pCoreCbs) = 0; virtual zel_all_core_callbacks_t& getProEpilogues(zel_tracer_reg_t callback_type, ze_result_t& result) = 0; virtual ze_result_t resetAllCallbacks() = 0; virtual ze_result_t enableTracer(ze_bool_t enable) = 0; }; ze_result_t createAPITracer(const zel_tracer_desc_t *desc, zel_tracer_handle_t *phTracer); struct APITracerContext { virtual ~APITracerContext() = default; virtual void *getActiveTracersList() = 0; virtual void releaseActivetracersList() = 0; }; } // namespace tracing_layer level-zero-1.20.6/source/layers/tracing/tracing_imp.cpp000066400000000000000000000473771475521542100231420ustar00rootroot00000000000000/* * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "tracing_imp.h" namespace tracing_layer { thread_local ze_bool_t tracingInProgress = 0; struct APITracerContextImp *pGlobalAPITracerContextImp; APITracer *APITracer::create() { APITracerImp *tracer = new APITracerImp; tracer->tracingState = disabledState; tracer->tracerFunctions = {}; UNRECOVERABLE_IF(tracer == nullptr); return tracer; } ze_result_t createAPITracer(const zel_tracer_desc_t *desc, zel_tracer_handle_t *phTracer) { if (!pGlobalAPITracerContextImp->isTracingEnabled()) { return ZE_RESULT_ERROR_UNINITIALIZED; } APITracerImp *tracer = static_cast(APITracer::create()); tracer->tracerFunctions.pUserData = desc->pUserData; *phTracer = tracer->toHandle(); return ZE_RESULT_SUCCESS; } // This destructor will be called only during at-exit processing, // Hence, this function is executing in a single threaded environment, // and requires no mutex. APITracerContextImp::~APITracerContextImp() { std::list::iterator itr = threadTracerDataList.begin(); while (itr != threadTracerDataList.end()) { (*itr)->clearThreadTracerDataOnList(); itr = threadTracerDataList.erase(itr); } } ze_result_t APITracerImp::destroyTracer(zel_tracer_handle_t phTracer) { APITracerImp *tracer = static_cast(phTracer); ze_result_t result = pGlobalAPITracerContextImp->finalizeDisableImpTracingWait(tracer); if (result == ZE_RESULT_SUCCESS) { delete tracing_layer::APITracer::fromHandle(phTracer); } return result; } ze_result_t APITracerImp::setPrologues(zel_core_callbacks_t *pCoreCbs) { if (this->tracingState != disabledState) { return ZE_RESULT_ERROR_INVALID_ARGUMENT; } copyCoreCbsToAllCbs(this->tracerFunctions.corePrologues, *pCoreCbs); return ZE_RESULT_SUCCESS; } ze_result_t APITracerImp::setEpilogues(zel_core_callbacks_t *pCoreCbs) { if (this->tracingState != disabledState) { return ZE_RESULT_ERROR_INVALID_ARGUMENT; } copyCoreCbsToAllCbs(this->tracerFunctions.coreEpilogues, *pCoreCbs); return ZE_RESULT_SUCCESS; } zel_all_core_callbacks_t& APITracerImp::getProEpilogues(zel_tracer_reg_t callback_type, ze_result_t& result) { result = ZE_RESULT_SUCCESS; if (this->tracingState != disabledState) result = ZE_RESULT_ERROR_INVALID_ARGUMENT; if (callback_type == ZEL_REGISTER_PROLOGUE) return this->tracerFunctions.corePrologues; else return this->tracerFunctions.coreEpilogues; } ze_result_t APITracerImp::resetAllCallbacks() { if (this->tracingState != disabledState) { return ZE_RESULT_ERROR_INVALID_ARGUMENT; } this->tracerFunctions.corePrologues = {}; this->tracerFunctions.coreEpilogues = {}; return ZE_RESULT_SUCCESS; } ze_result_t APITracerImp::enableTracer(ze_bool_t enable) { return pGlobalAPITracerContextImp->enableTracingImp(this, enable); } void APITracerImp::copyCoreCbsToAllCbs(zel_all_core_callbacks_t& allCbs, zel_core_callbacks_t& cbs) { allCbs.Global.pfnInitCb = cbs.Global.pfnInitCb; allCbs.Driver.pfnGetCb = cbs.Driver.pfnGetCb; allCbs.Driver.pfnGetApiVersionCb = cbs.Driver.pfnGetApiVersionCb; allCbs.Driver.pfnGetPropertiesCb = cbs.Driver.pfnGetPropertiesCb; allCbs.Driver.pfnGetIpcPropertiesCb = cbs.Driver.pfnGetIpcPropertiesCb; allCbs.Driver.pfnGetExtensionPropertiesCb = cbs.Driver.pfnGetExtensionPropertiesCb; allCbs.Device.pfnGetCb = cbs.Device.pfnGetCb; allCbs.Device.pfnGetSubDevicesCb = cbs.Device.pfnGetSubDevicesCb; allCbs.Device.pfnGetPropertiesCb = cbs.Device.pfnGetPropertiesCb; allCbs.Device.pfnGetComputePropertiesCb = cbs.Device.pfnGetComputePropertiesCb; allCbs.Device.pfnGetModulePropertiesCb = cbs.Device.pfnGetModulePropertiesCb; allCbs.Device.pfnGetCommandQueueGroupPropertiesCb = cbs.Device.pfnGetCommandQueueGroupPropertiesCb; allCbs.Device.pfnGetMemoryPropertiesCb = cbs.Device.pfnGetMemoryPropertiesCb; allCbs.Device.pfnGetMemoryAccessPropertiesCb = cbs.Device.pfnGetMemoryAccessPropertiesCb; allCbs.Device.pfnGetCachePropertiesCb = cbs.Device.pfnGetCachePropertiesCb; allCbs.Device.pfnGetImagePropertiesCb = cbs.Device.pfnGetImagePropertiesCb; allCbs.Device.pfnGetExternalMemoryPropertiesCb = cbs.Device.pfnGetExternalMemoryPropertiesCb; allCbs.Device.pfnGetP2PPropertiesCb = cbs.Device.pfnGetP2PPropertiesCb; allCbs.Device.pfnCanAccessPeerCb = cbs.Device.pfnCanAccessPeerCb; allCbs.Device.pfnGetStatusCb = cbs.Device.pfnGetStatusCb; allCbs.Context.pfnCreateCb = cbs.Context.pfnCreateCb; allCbs.Context.pfnDestroyCb = cbs.Context.pfnDestroyCb; allCbs.Context.pfnGetStatusCb = cbs.Context.pfnGetStatusCb; allCbs.Context.pfnSystemBarrierCb = cbs.Context.pfnSystemBarrierCb; allCbs.Context.pfnMakeMemoryResidentCb = cbs.Context.pfnMakeMemoryResidentCb; allCbs.Context.pfnEvictMemoryCb = cbs.Context.pfnEvictMemoryCb; allCbs.Context.pfnMakeImageResidentCb = cbs.Context.pfnMakeImageResidentCb; allCbs.Context.pfnEvictImageCb = cbs.Context.pfnEvictImageCb; allCbs.CommandQueue.pfnCreateCb = cbs.CommandQueue.pfnCreateCb; allCbs.CommandQueue.pfnDestroyCb = cbs.CommandQueue.pfnDestroyCb; allCbs.CommandQueue.pfnExecuteCommandListsCb = cbs.CommandQueue.pfnExecuteCommandListsCb; allCbs.CommandQueue.pfnSynchronizeCb = cbs.CommandQueue.pfnSynchronizeCb; allCbs.CommandList.pfnCreateCb = cbs.CommandList.pfnCreateCb; allCbs.CommandList.pfnCreateImmediateCb = cbs.CommandList.pfnCreateImmediateCb; allCbs.CommandList.pfnDestroyCb = cbs.CommandList.pfnDestroyCb; allCbs.CommandList.pfnCloseCb = cbs.CommandList.pfnCloseCb; allCbs.CommandList.pfnResetCb = cbs.CommandList.pfnResetCb; allCbs.CommandList.pfnAppendWriteGlobalTimestampCb = cbs.CommandList.pfnAppendWriteGlobalTimestampCb; allCbs.CommandList.pfnAppendBarrierCb = cbs.CommandList.pfnAppendBarrierCb; allCbs.CommandList.pfnAppendMemoryRangesBarrierCb = cbs.CommandList.pfnAppendMemoryRangesBarrierCb; allCbs.CommandList.pfnAppendMemoryCopyCb = cbs.CommandList.pfnAppendMemoryCopyCb; allCbs.CommandList.pfnAppendMemoryFillCb = cbs.CommandList.pfnAppendMemoryFillCb; allCbs.CommandList.pfnAppendMemoryCopyRegionCb = cbs.CommandList.pfnAppendMemoryCopyRegionCb; allCbs.CommandList.pfnAppendMemoryCopyFromContextCb = cbs.CommandList.pfnAppendMemoryCopyFromContextCb; allCbs.CommandList.pfnAppendImageCopyCb = cbs.CommandList.pfnAppendImageCopyCb; allCbs.CommandList.pfnAppendImageCopyRegionCb = cbs.CommandList.pfnAppendImageCopyRegionCb; allCbs.CommandList.pfnAppendImageCopyToMemoryCb = cbs.CommandList.pfnAppendImageCopyToMemoryCb; allCbs.CommandList.pfnAppendImageCopyFromMemoryCb = cbs.CommandList.pfnAppendImageCopyFromMemoryCb; allCbs.CommandList.pfnAppendMemoryPrefetchCb = cbs.CommandList.pfnAppendMemoryPrefetchCb; allCbs.CommandList.pfnAppendMemAdviseCb = cbs.CommandList.pfnAppendMemAdviseCb; allCbs.CommandList.pfnAppendSignalEventCb = cbs.CommandList.pfnAppendSignalEventCb; allCbs.CommandList.pfnAppendWaitOnEventsCb = cbs.CommandList.pfnAppendWaitOnEventsCb; allCbs.CommandList.pfnAppendEventResetCb = cbs.CommandList.pfnAppendEventResetCb; allCbs.CommandList.pfnAppendQueryKernelTimestampsCb = cbs.CommandList.pfnAppendQueryKernelTimestampsCb; allCbs.CommandList.pfnAppendLaunchKernelCb = cbs.CommandList.pfnAppendLaunchKernelCb; allCbs.CommandList.pfnAppendLaunchCooperativeKernelCb = cbs.CommandList.pfnAppendLaunchCooperativeKernelCb; allCbs.CommandList.pfnAppendLaunchKernelIndirectCb = cbs.CommandList.pfnAppendLaunchKernelIndirectCb; allCbs.CommandList.pfnAppendLaunchMultipleKernelsIndirectCb = cbs.CommandList.pfnAppendLaunchMultipleKernelsIndirectCb; allCbs.Fence.pfnCreateCb = cbs.Fence.pfnCreateCb; allCbs.Fence.pfnDestroyCb = cbs.Fence.pfnDestroyCb; allCbs.Fence.pfnHostSynchronizeCb = cbs.Fence.pfnHostSynchronizeCb; allCbs.Fence.pfnQueryStatusCb = cbs.Fence.pfnQueryStatusCb; allCbs.Fence.pfnResetCb = cbs.Fence.pfnResetCb; allCbs.EventPool.pfnCreateCb = cbs.EventPool.pfnCreateCb; allCbs.EventPool.pfnDestroyCb = cbs.EventPool.pfnDestroyCb; allCbs.EventPool.pfnGetIpcHandleCb = cbs.EventPool.pfnGetIpcHandleCb; allCbs.EventPool.pfnOpenIpcHandleCb = cbs.EventPool.pfnOpenIpcHandleCb; allCbs.EventPool.pfnCloseIpcHandleCb = cbs.EventPool.pfnCloseIpcHandleCb; allCbs.Event.pfnCreateCb = cbs.Event.pfnCreateCb; allCbs.Event.pfnDestroyCb = cbs.Event.pfnDestroyCb; allCbs.Event.pfnHostSignalCb = cbs.Event.pfnHostSignalCb; allCbs.Event.pfnHostSynchronizeCb = cbs.Event.pfnHostSynchronizeCb; allCbs.Event.pfnQueryStatusCb = cbs.Event.pfnQueryStatusCb; allCbs.Event.pfnHostResetCb = cbs.Event.pfnHostResetCb; allCbs.Event.pfnQueryKernelTimestampCb = cbs.Event.pfnQueryKernelTimestampCb; allCbs.Image.pfnGetPropertiesCb = cbs.Image.pfnGetPropertiesCb; allCbs.Image.pfnCreateCb = cbs.Image.pfnCreateCb; allCbs.Image.pfnDestroyCb = cbs.Image.pfnDestroyCb; allCbs.Module.pfnCreateCb = cbs.Module.pfnCreateCb; allCbs.Module.pfnDestroyCb = cbs.Module.pfnDestroyCb; allCbs.Module.pfnDynamicLinkCb = cbs.Module.pfnDynamicLinkCb; allCbs.Module.pfnGetNativeBinaryCb = cbs.Module.pfnGetNativeBinaryCb; allCbs.Module.pfnGetGlobalPointerCb = cbs.Module.pfnGetGlobalPointerCb; allCbs.Module.pfnGetKernelNamesCb = cbs.Module.pfnGetKernelNamesCb; allCbs.Module.pfnGetPropertiesCb = cbs.Module.pfnGetPropertiesCb; allCbs.Module.pfnGetFunctionPointerCb = cbs.Module.pfnGetFunctionPointerCb; allCbs.ModuleBuildLog.pfnDestroyCb = cbs.ModuleBuildLog.pfnDestroyCb; allCbs.ModuleBuildLog.pfnGetStringCb = cbs.ModuleBuildLog.pfnGetStringCb; allCbs.Kernel.pfnCreateCb = cbs.Kernel.pfnCreateCb; allCbs.Kernel.pfnDestroyCb = cbs.Kernel.pfnDestroyCb; allCbs.Kernel.pfnSetCacheConfigCb = cbs.Kernel.pfnSetCacheConfigCb; allCbs.Kernel.pfnSetGroupSizeCb = cbs.Kernel.pfnSetGroupSizeCb; allCbs.Kernel.pfnSuggestGroupSizeCb = cbs.Kernel.pfnSuggestGroupSizeCb; allCbs.Kernel.pfnSuggestMaxCooperativeGroupCountCb = cbs.Kernel.pfnSuggestMaxCooperativeGroupCountCb; allCbs.Kernel.pfnSetArgumentValueCb = cbs.Kernel.pfnSetArgumentValueCb; allCbs.Kernel.pfnSetIndirectAccessCb = cbs.Kernel.pfnSetIndirectAccessCb; allCbs.Kernel.pfnGetIndirectAccessCb = cbs.Kernel.pfnGetIndirectAccessCb; allCbs.Kernel.pfnGetSourceAttributesCb = cbs.Kernel.pfnGetSourceAttributesCb; allCbs.Kernel.pfnGetPropertiesCb = cbs.Kernel.pfnGetPropertiesCb; allCbs.Kernel.pfnGetNameCb = cbs.Kernel.pfnGetNameCb; allCbs.Sampler.pfnCreateCb = cbs.Sampler.pfnCreateCb; allCbs.Sampler.pfnDestroyCb = cbs.Sampler.pfnDestroyCb; allCbs.PhysicalMem.pfnCreateCb = cbs.PhysicalMem.pfnCreateCb; allCbs.PhysicalMem.pfnDestroyCb = cbs.PhysicalMem.pfnDestroyCb; allCbs.Mem.pfnAllocSharedCb = cbs.Mem.pfnAllocSharedCb; allCbs.Mem.pfnAllocDeviceCb = cbs.Mem.pfnAllocDeviceCb; allCbs.Mem.pfnAllocHostCb = cbs.Mem.pfnAllocHostCb; allCbs.Mem.pfnFreeCb = cbs.Mem.pfnFreeCb; allCbs.Mem.pfnGetAllocPropertiesCb = cbs.Mem.pfnGetAllocPropertiesCb; allCbs.Mem.pfnGetAddressRangeCb = cbs.Mem.pfnGetAddressRangeCb; allCbs.Mem.pfnGetIpcHandleCb = cbs.Mem.pfnGetIpcHandleCb; allCbs.Mem.pfnOpenIpcHandleCb = cbs.Mem.pfnOpenIpcHandleCb; allCbs.Mem.pfnCloseIpcHandleCb = cbs.Mem.pfnCloseIpcHandleCb; allCbs.VirtualMem.pfnReserveCb = cbs.VirtualMem.pfnReserveCb; allCbs.VirtualMem.pfnFreeCb = cbs.VirtualMem.pfnFreeCb; allCbs.VirtualMem.pfnQueryPageSizeCb = cbs.VirtualMem.pfnQueryPageSizeCb; allCbs.VirtualMem.pfnMapCb = cbs.VirtualMem.pfnMapCb; allCbs.VirtualMem.pfnUnmapCb = cbs.VirtualMem.pfnUnmapCb; allCbs.VirtualMem.pfnSetAccessAttributeCb = cbs.VirtualMem.pfnSetAccessAttributeCb; allCbs.VirtualMem.pfnGetAccessAttributeCb = cbs.VirtualMem.pfnGetAccessAttributeCb; } void APITracerContextImp::addThreadTracerDataToList( ThreadPrivateTracerData *threadDataP) { std::lock_guard lock(threadTracerDataListMutex); threadTracerDataList.push_back(threadDataP); } void APITracerContextImp::removeThreadTracerDataFromList( ThreadPrivateTracerData *threadDataP) { std::lock_guard lock(threadTracerDataListMutex); if (threadTracerDataList.empty()) return; threadTracerDataList.remove(threadDataP); } thread_local ThreadPrivateTracerData myThreadPrivateTracerData; ThreadPrivateTracerData::ThreadPrivateTracerData() { isInitialized = false; onList = false; tracerArrayPointer.store(nullptr, std::memory_order_relaxed); } ThreadPrivateTracerData::~ThreadPrivateTracerData() { if (onList) { pGlobalAPITracerContextImp->removeThreadTracerDataFromList(this); onList = false; } tracerArrayPointer.store(nullptr, std::memory_order_relaxed); } void ThreadPrivateTracerData::removeThreadTracerDataFromList(void) { if (onList) { pGlobalAPITracerContextImp->removeThreadTracerDataFromList(this); onList = false; } tracerArrayPointer.store(nullptr, std::memory_order_relaxed); } bool ThreadPrivateTracerData::testAndSetThreadTracerDataInitializedAndOnList( void) { if (!isInitialized) { isInitialized = true; onList = true; pGlobalAPITracerContextImp->addThreadTracerDataToList( &myThreadPrivateTracerData); } return onList; } // bool APITracerContextImp::isTracingEnabled() { return // driver_ddiTable.enableTracing; } bool APITracerContextImp::isTracingEnabled() { return true; } // // Walk the list of per-thread private data structures, testing // whether any of them reference this array. // // Return 1 if a reference is found. Otherwise return 0. // ze_bool_t APITracerContextImp::testForTracerArrayReferences(tracer_array_t *tracerArray) { std::lock_guard lock(threadTracerDataListMutex); std::list::iterator itr; for (itr = threadTracerDataList.begin(); itr != threadTracerDataList.end(); itr++) { if ((*itr)->tracerArrayPointer.load(std::memory_order_relaxed) == tracerArray) return 1; } return 0; } // // Walk the retiring_tracer_array_list, checking each member of the list for // references by per thread tracer array pointer. Delete and free // each tracer array that has no per-thread references. // // Return the number of entries on the retiring tracer array list. // size_t APITracerContextImp::testAndFreeRetiredTracers() { std::list::iterator itr = this->retiringTracerArrayList.begin(); while (itr != this->retiringTracerArrayList.end()) { tracer_array_t *retiringTracerArray = *itr; itr++; if (testForTracerArrayReferences(retiringTracerArray)) continue; this->retiringTracerArrayList.remove(retiringTracerArray); delete[] retiringTracerArray->tracerArrayEntries; delete retiringTracerArray; } return this->retiringTracerArrayList.size(); } size_t APITracerContextImp::updateTracerArrays() { tracer_array_t *newTracerArray; size_t newTracerArrayCount = this->enabledTracerImpList.size(); if (newTracerArrayCount != 0) { newTracerArray = new tracer_array_t; newTracerArray->tracerArrayCount = newTracerArrayCount; newTracerArray->tracerArrayEntries = new tracer_array_entry_t[newTracerArrayCount]; // // iterate over the list of enabled tracers, copying their entries into the // new tracer array // size_t i = 0; std::list::iterator itr; for (itr = enabledTracerImpList.begin(); itr != enabledTracerImpList.end(); itr++) { newTracerArray->tracerArrayEntries[i] = (*itr)->tracerFunctions; i++; } } else { newTracerArray = &emptyTracerArray; } // // active_tracer_array.load can use memory_order_relaxed here because // there is logically no transfer of other memory context between // threads in this case. // tracer_array_t *active_tracer_array_shadow = activeTracerArray.load(std::memory_order_relaxed); if (active_tracer_array_shadow != &emptyTracerArray) { retiringTracerArrayList.push_back(active_tracer_array_shadow); } // // This active_tracer_array.store must use memory_order_release. // This store DOES signal a logical transfer of tracer state information // from this thread to the tracing threads. // activeTracerArray.store(newTracerArray, std::memory_order_release); return testAndFreeRetiredTracers(); } ze_result_t APITracerContextImp::enableTracingImp(struct APITracerImp *tracerImp, ze_bool_t enable) { std::lock_guard lock(traceTableMutex); ze_result_t result; switch (tracerImp->tracingState) { case disabledState: if (enable) { enabledTracerImpList.push_back(tracerImp); tracerImp->tracingState = enabledState; updateTracerArrays(); } result = ZE_RESULT_SUCCESS; break; case enabledState: if (!enable) { enabledTracerImpList.remove(tracerImp); tracerImp->tracingState = disabledWaitingState; if (updateTracerArrays() == 0) tracerImp->tracingState = disabledState; } result = ZE_RESULT_SUCCESS; break; case disabledWaitingState: result = ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; break; default: result = ZE_RESULT_ERROR_UNINITIALIZED; UNRECOVERABLE_IF(true); break; } return result; } // This is called by the destroy tracer method. // // This routine will return ZE_RESULT_SUCCESS // state if either it has never been enabled, // or if it has been enabled and then disabled. // // On ZE_RESULT_SUCESS, the destroy tracer method // can free the tracer's memory. // // ZE_RESULT_ERROR_UNINITIALIZED is returned // if the tracer has been enabled but not // disabled. The destroy tracer method // should NOT free this tracer's memory. // ze_result_t APITracerContextImp::finalizeDisableImpTracingWait( struct APITracerImp *tracerImp) { std::lock_guard lock(traceTableMutex); ze_result_t result; switch (tracerImp->tracingState) { case disabledState: result = ZE_RESULT_SUCCESS; break; case enabledState: result = ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; break; case disabledWaitingState: while (testAndFreeRetiredTracers() != 0) { std::this_thread::sleep_for(std::chrono::milliseconds(1)); } tracerImp->tracingState = disabledState; result = ZE_RESULT_SUCCESS; break; default: result = ZE_RESULT_ERROR_UNINITIALIZED; UNRECOVERABLE_IF(true); break; } return result; } void *APITracerContextImp::getActiveTracersList() { tracer_array_t *stableTracerArray = nullptr; if (!myThreadPrivateTracerData .testAndSetThreadTracerDataInitializedAndOnList()) { return nullptr; } do { stableTracerArray = pGlobalAPITracerContextImp->activeTracerArray.load( std::memory_order_acquire); myThreadPrivateTracerData.tracerArrayPointer.store( stableTracerArray, std::memory_order_relaxed); } while (stableTracerArray != pGlobalAPITracerContextImp->activeTracerArray.load( std::memory_order_relaxed)); return (void *)stableTracerArray; } void APITracerContextImp::releaseActivetracersList() { if (myThreadPrivateTracerData .testAndSetThreadTracerDataInitializedAndOnList()) myThreadPrivateTracerData.tracerArrayPointer.store( nullptr, std::memory_order_relaxed); } } // namespace tracing_layer level-zero-1.20.6/source/layers/tracing/tracing_imp.h000066400000000000000000000223471475521542100225750ustar00rootroot00000000000000/* * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include "tracing.h" #include "ze_api.h" #include "ze_tracing_cb_structs.h" #include #include #include #include #include #include #include #define UNRECOVERABLE_IF(expression) \ \ if (expression) { \ std::cout << "Abort was called at " << __LINE__ \ << " line in file: " << __FILE__ << std::endl; \ std::abort(); \ } namespace tracing_layer { extern thread_local ze_bool_t tracingInProgress; extern struct APITracerContextImp *pGlobalAPITracerContextImp; typedef struct tracer_array_entry { zel_all_core_callbacks_t corePrologues; zel_all_core_callbacks_t coreEpilogues; void *pUserData; } tracer_array_entry_t; typedef struct tracerArray { size_t tracerArrayCount; tracer_array_entry_t *tracerArrayEntries; } tracer_array_t; typedef enum tracingState { disabledState, // tracing has never been enabled enabledState, // tracing is enabled. disabledWaitingState, // tracing has been disabled, but not waited for } tracingState_t; struct APITracerImp : APITracer { ze_result_t destroyTracer(zel_tracer_handle_t phTracer) override; ze_result_t setPrologues(zel_core_callbacks_t *pCoreCbs) override; ze_result_t setEpilogues(zel_core_callbacks_t *pCoreCbs) override; zel_all_core_callbacks_t& getProEpilogues(zel_tracer_reg_t callback_type, ze_result_t& result) override; ze_result_t resetAllCallbacks() override; ze_result_t enableTracer(ze_bool_t enable) override; tracer_array_entry_t tracerFunctions; tracingState_t tracingState; private: void copyCoreCbsToAllCbs(zel_all_core_callbacks_t& allCbs, zel_core_callbacks_t& Cbs); }; class ThreadPrivateTracerData { public: void clearThreadTracerDataOnList(void) { onList = false; } void removeThreadTracerDataFromList(void); bool testAndSetThreadTracerDataInitializedAndOnList(void); bool onList; bool isInitialized; ThreadPrivateTracerData(); ~ThreadPrivateTracerData(); std::atomic tracerArrayPointer; private: ThreadPrivateTracerData(const ThreadPrivateTracerData &); ThreadPrivateTracerData &operator=(const ThreadPrivateTracerData &); }; struct APITracerContextImp : APITracerContext { public: APITracerContextImp() { activeTracerArray.store(&emptyTracerArray, std::memory_order_relaxed); }; ~APITracerContextImp() override; static void apiTracingEnable(ze_init_flag_t flag); void *getActiveTracersList() override; void releaseActivetracersList() override; ze_result_t enableTracingImp(struct APITracerImp *newTracer, ze_bool_t enable); ze_result_t finalizeDisableImpTracingWait(struct APITracerImp *oldTracer); bool isTracingEnabled(); void addThreadTracerDataToList(ThreadPrivateTracerData *threadDataP); void removeThreadTracerDataFromList(ThreadPrivateTracerData *threadDataP); private: std::mutex traceTableMutex; tracer_array_t emptyTracerArray = {0, NULL}; std::atomic activeTracerArray; // // a list of tracer arrays that were once active, but // have been replaced by a new active array. These // once-active tracer arrays may continue for some time // to have references to them among the per-thread // tracer array pointers. // std::list retiringTracerArrayList; std::list enabledTracerImpList; ze_bool_t testForTracerArrayReferences(tracer_array_t *tracerArray); size_t testAndFreeRetiredTracers(); size_t updateTracerArrays(); std::list threadTracerDataList; std::mutex threadTracerDataListMutex; }; extern thread_local ThreadPrivateTracerData myThreadPrivateTracerData; template class APITracerCallbackStateImp { public: T current_api_callback; void *pUserData; }; template class APITracerCallbackDataImp { public: T apiOrdinal = nullptr; std::vector> prologCallbacks; std::vector> epilogCallbacks; }; #define ZE_HANDLE_TRACER_RECURSION(ze_api_ptr, ...) \ do { \ if (tracing_layer::tracingInProgress) { \ return ze_api_ptr(__VA_ARGS__); \ } \ tracing_layer::tracingInProgress = 1; \ } while (0) #define ZE_GEN_TRACER_ARRAY_ENTRY(callbackPtr, tracerArray, tracerArrayIndex, \ callbackType, callbackCategory, \ callbackFunction) \ do { \ callbackPtr = tracerArray->tracerArrayEntries[tracerArrayIndex] \ .callbackType.callbackCategory.callbackFunction; \ } while (0) #define ZE_GEN_PER_API_CALLBACK_STATE(perApiCallbackData, tracerType, \ callbackCategory, callbackFunctionType) \ tracing_layer::tracer_array_t *currentTracerArray; \ currentTracerArray = \ (tracing_layer::tracer_array_t *) \ tracing_layer::pGlobalAPITracerContextImp->getActiveTracersList(); \ if (currentTracerArray) { \ for (size_t i = 0; i < currentTracerArray->tracerArrayCount; i++) { \ tracerType prologueCallbackPtr; \ tracerType epilogue_callback_ptr; \ ZE_GEN_TRACER_ARRAY_ENTRY(prologueCallbackPtr, currentTracerArray, i, \ corePrologues, callbackCategory, \ callbackFunctionType); \ ZE_GEN_TRACER_ARRAY_ENTRY(epilogue_callback_ptr, currentTracerArray, i, \ coreEpilogues, callbackCategory, \ callbackFunctionType); \ \ tracing_layer::APITracerCallbackStateImp prologCallback; \ prologCallback.current_api_callback = prologueCallbackPtr; \ prologCallback.pUserData = \ currentTracerArray->tracerArrayEntries[i].pUserData; \ perApiCallbackData.prologCallbacks.push_back(prologCallback); \ \ tracing_layer::APITracerCallbackStateImp epilogCallback; \ epilogCallback.current_api_callback = epilogue_callback_ptr; \ epilogCallback.pUserData = \ currentTracerArray->tracerArrayEntries[i].pUserData; \ perApiCallbackData.epilogCallbacks.push_back(epilogCallback); \ } \ } template ze_result_t APITracerWrapperImp(TFunction_pointer zeApiPtr, TParams paramsStruct, TTracer apiOrdinal, TTracerPrologCallbacks prologCallbacks, TTracerEpilogCallbacks epilogCallbacks, Args &&... args) { ze_result_t ret = ZE_RESULT_SUCCESS; std::vector> *callbacks_prologs = &prologCallbacks; std::vector ppTracerInstanceUserData; ppTracerInstanceUserData.resize(callbacks_prologs->size()); for (size_t i = 0; i < callbacks_prologs->size(); i++) { if (callbacks_prologs->at(i).current_api_callback != nullptr) callbacks_prologs->at(i).current_api_callback( paramsStruct, ret, callbacks_prologs->at(i).pUserData, &ppTracerInstanceUserData[i]); } ret = zeApiPtr(args...); std::vector> *callbacksEpilogs = &epilogCallbacks; for (size_t i = 0; i < callbacksEpilogs->size(); i++) { if (callbacksEpilogs->at(i).current_api_callback != nullptr) callbacksEpilogs->at(i).current_api_callback( paramsStruct, ret, callbacksEpilogs->at(i).pUserData, &ppTracerInstanceUserData[i]); } tracing_layer::tracingInProgress = 0; tracing_layer::pGlobalAPITracerContextImp->releaseActivetracersList(); return ret; } } // namespace tracing_layer level-zero-1.20.6/source/layers/tracing/windows/000077500000000000000000000000001475521542100216125ustar00rootroot00000000000000level-zero-1.20.6/source/layers/tracing/windows/tracing_init.cpp000066400000000000000000000007741475521542100250000ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "../tracing_imp.h" #include namespace tracing_layer { extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_DETACH) { delete pGlobalAPITracerContextImp; } else if (fdwReason == DLL_PROCESS_ATTACH) { pGlobalAPITracerContextImp = new APITracerContextImp; } return TRUE; } } // namespace tracing_layer level-zero-1.20.6/source/layers/tracing/ze_tracing.cpp000066400000000000000000000061611475521542100227550ustar00rootroot00000000000000/* * Copyright (C) 2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "tracing.h" #include "ze_tracing_layer.h" #include "layers/zel_tracing_api.h" #include "layers/zel_tracing_ddi.h" #include "loader/ze_loader.h" namespace tracing { ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCreate( const zel_tracer_desc_t *desc, zel_tracer_handle_t *phTracer) { return tracing_layer::createAPITracer(desc, phTracer); } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDestroy( zel_tracer_handle_t hTracer) { return tracing_layer::APITracer::fromHandle(hTracer)->destroyTracer(hTracer); } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerSetPrologues( zel_tracer_handle_t hTracer, zel_core_callbacks_t *pCoreCbs) { return tracing_layer::APITracer::fromHandle(hTracer)->setPrologues(pCoreCbs); } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerSetEpilogues( zel_tracer_handle_t hTracer, zel_core_callbacks_t *pCoreCbs) { return tracing_layer::APITracer::fromHandle(hTracer)->setEpilogues(pCoreCbs); } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerSetEnabled( zel_tracer_handle_t hTracer, ze_bool_t enable) { return tracing_layer::APITracer::fromHandle(hTracer)->enableTracer(enable); } } #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's TracerExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zelGetTracerApiProcAddrTable( ze_api_version_t version, ///< [in] API version requested zel_tracer_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( tracing_layer::context.version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; pDdiTable->pfnCreate = tracing::zelTracerCreate; pDdiTable->pfnDestroy = tracing::zelTracerDestroy; pDdiTable->pfnSetPrologues = tracing::zelTracerSetPrologues; pDdiTable->pfnSetEpilogues = tracing::zelTracerSetEpilogues; pDdiTable->pfnSetEnabled = tracing::zelTracerSetEnabled; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelLoaderGetVersion(zel_component_version_t *version) { if(version == nullptr) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; string_copy_s(version->component_name, TRACING_COMP_NAME, ZEL_COMPONENT_STRING_SIZE); version->spec_version = ZE_API_VERSION_CURRENT; version->component_lib_version.major = LOADER_VERSION_MAJOR; version->component_lib_version.minor = LOADER_VERSION_MINOR; version->component_lib_version.patch = LOADER_VERSION_PATCH; return ZE_RESULT_SUCCESS; } #if defined(__cplusplus) }; #endif level-zero-1.20.6/source/layers/tracing/ze_tracing_cb_structs.h000066400000000000000000000555171475521542100246660ustar00rootroot00000000000000/* * * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_tracing_cb_structs.h * */ #ifndef ze_tracing_cb_structs_H #define ze_tracing_cb_structs_H #if defined(__cplusplus) #pragma once #endif #include "ze_api.h" #include "layers/zel_tracing_register_cb.h" /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Global callback functions pointers typedef struct _zel_global_callbacks_t { ze_pfnInitCb_t pfnInitCb; ze_pfnInitDriversCb_t pfnInitDriversCb; } zel_global_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of RTASBuilder callback functions pointers typedef struct _zel_rtas_builder_callbacks_t { ze_pfnRTASBuilderCreateExpCb_t pfnCreateExpCb; ze_pfnRTASBuilderGetBuildPropertiesExpCb_t pfnGetBuildPropertiesExpCb; ze_pfnRTASBuilderBuildExpCb_t pfnBuildExpCb; ze_pfnRTASBuilderDestroyExpCb_t pfnDestroyExpCb; } zel_rtas_builder_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of RTASParallelOperation callback functions pointers typedef struct _zel_rtas_parallel_operation_callbacks_t { ze_pfnRTASParallelOperationCreateExpCb_t pfnCreateExpCb; ze_pfnRTASParallelOperationGetPropertiesExpCb_t pfnGetPropertiesExpCb; ze_pfnRTASParallelOperationJoinExpCb_t pfnJoinExpCb; ze_pfnRTASParallelOperationDestroyExpCb_t pfnDestroyExpCb; } zel_rtas_parallel_operation_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Driver callback functions pointers typedef struct _zel_driver_callbacks_t { ze_pfnDriverGetCb_t pfnGetCb; ze_pfnDriverGetApiVersionCb_t pfnGetApiVersionCb; ze_pfnDriverGetPropertiesCb_t pfnGetPropertiesCb; ze_pfnDriverGetIpcPropertiesCb_t pfnGetIpcPropertiesCb; ze_pfnDriverGetExtensionPropertiesCb_t pfnGetExtensionPropertiesCb; ze_pfnDriverGetExtensionFunctionAddressCb_t pfnGetExtensionFunctionAddressCb; ze_pfnDriverGetLastErrorDescriptionCb_t pfnGetLastErrorDescriptionCb; ze_pfnDriverRTASFormatCompatibilityCheckExpCb_t pfnRTASFormatCompatibilityCheckExpCb; } zel_driver_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Device callback functions pointers typedef struct _zel_device_callbacks_t { ze_pfnDeviceGetCb_t pfnGetCb; ze_pfnDeviceGetSubDevicesCb_t pfnGetSubDevicesCb; ze_pfnDeviceGetPropertiesCb_t pfnGetPropertiesCb; ze_pfnDeviceGetComputePropertiesCb_t pfnGetComputePropertiesCb; ze_pfnDeviceGetModulePropertiesCb_t pfnGetModulePropertiesCb; ze_pfnDeviceGetCommandQueueGroupPropertiesCb_t pfnGetCommandQueueGroupPropertiesCb; ze_pfnDeviceGetMemoryPropertiesCb_t pfnGetMemoryPropertiesCb; ze_pfnDeviceGetMemoryAccessPropertiesCb_t pfnGetMemoryAccessPropertiesCb; ze_pfnDeviceGetCachePropertiesCb_t pfnGetCachePropertiesCb; ze_pfnDeviceGetImagePropertiesCb_t pfnGetImagePropertiesCb; ze_pfnDeviceGetExternalMemoryPropertiesCb_t pfnGetExternalMemoryPropertiesCb; ze_pfnDeviceGetP2PPropertiesCb_t pfnGetP2PPropertiesCb; ze_pfnDeviceCanAccessPeerCb_t pfnCanAccessPeerCb; ze_pfnDeviceGetStatusCb_t pfnGetStatusCb; ze_pfnDeviceGetGlobalTimestampsCb_t pfnGetGlobalTimestampsCb; ze_pfnDeviceImportExternalSemaphoreExtCb_t pfnImportExternalSemaphoreExtCb; ze_pfnDeviceReleaseExternalSemaphoreExtCb_t pfnReleaseExternalSemaphoreExtCb; ze_pfnDeviceReserveCacheExtCb_t pfnReserveCacheExtCb; ze_pfnDeviceSetCacheAdviceExtCb_t pfnSetCacheAdviceExtCb; ze_pfnDevicePciGetPropertiesExtCb_t pfnPciGetPropertiesExtCb; ze_pfnDeviceGetFabricVertexExpCb_t pfnGetFabricVertexExpCb; ze_pfnDeviceGetRootDeviceCb_t pfnGetRootDeviceCb; } zel_device_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Context callback functions pointers typedef struct _zel_context_callbacks_t { ze_pfnContextCreateCb_t pfnCreateCb; ze_pfnContextDestroyCb_t pfnDestroyCb; ze_pfnContextGetStatusCb_t pfnGetStatusCb; ze_pfnContextSystemBarrierCb_t pfnSystemBarrierCb; ze_pfnContextMakeMemoryResidentCb_t pfnMakeMemoryResidentCb; ze_pfnContextEvictMemoryCb_t pfnEvictMemoryCb; ze_pfnContextMakeImageResidentCb_t pfnMakeImageResidentCb; ze_pfnContextEvictImageCb_t pfnEvictImageCb; ze_pfnContextCreateExCb_t pfnCreateExCb; } zel_context_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of CommandQueue callback functions pointers typedef struct _zel_command_queue_callbacks_t { ze_pfnCommandQueueCreateCb_t pfnCreateCb; ze_pfnCommandQueueDestroyCb_t pfnDestroyCb; ze_pfnCommandQueueExecuteCommandListsCb_t pfnExecuteCommandListsCb; ze_pfnCommandQueueSynchronizeCb_t pfnSynchronizeCb; ze_pfnCommandQueueGetOrdinalCb_t pfnGetOrdinalCb; ze_pfnCommandQueueGetIndexCb_t pfnGetIndexCb; } zel_command_queue_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of CommandList callback functions pointers typedef struct _zel_command_list_callbacks_t { ze_pfnCommandListCreateCb_t pfnCreateCb; ze_pfnCommandListCreateImmediateCb_t pfnCreateImmediateCb; ze_pfnCommandListDestroyCb_t pfnDestroyCb; ze_pfnCommandListCloseCb_t pfnCloseCb; ze_pfnCommandListResetCb_t pfnResetCb; ze_pfnCommandListAppendWriteGlobalTimestampCb_t pfnAppendWriteGlobalTimestampCb; ze_pfnCommandListAppendBarrierCb_t pfnAppendBarrierCb; ze_pfnCommandListAppendMemoryRangesBarrierCb_t pfnAppendMemoryRangesBarrierCb; ze_pfnCommandListAppendMemoryCopyCb_t pfnAppendMemoryCopyCb; ze_pfnCommandListAppendMemoryFillCb_t pfnAppendMemoryFillCb; ze_pfnCommandListAppendMemoryCopyRegionCb_t pfnAppendMemoryCopyRegionCb; ze_pfnCommandListAppendMemoryCopyFromContextCb_t pfnAppendMemoryCopyFromContextCb; ze_pfnCommandListAppendImageCopyCb_t pfnAppendImageCopyCb; ze_pfnCommandListAppendImageCopyRegionCb_t pfnAppendImageCopyRegionCb; ze_pfnCommandListAppendImageCopyToMemoryCb_t pfnAppendImageCopyToMemoryCb; ze_pfnCommandListAppendImageCopyFromMemoryCb_t pfnAppendImageCopyFromMemoryCb; ze_pfnCommandListAppendMemoryPrefetchCb_t pfnAppendMemoryPrefetchCb; ze_pfnCommandListAppendMemAdviseCb_t pfnAppendMemAdviseCb; ze_pfnCommandListAppendSignalEventCb_t pfnAppendSignalEventCb; ze_pfnCommandListAppendWaitOnEventsCb_t pfnAppendWaitOnEventsCb; ze_pfnCommandListAppendEventResetCb_t pfnAppendEventResetCb; ze_pfnCommandListAppendQueryKernelTimestampsCb_t pfnAppendQueryKernelTimestampsCb; ze_pfnCommandListAppendLaunchKernelCb_t pfnAppendLaunchKernelCb; ze_pfnCommandListAppendLaunchCooperativeKernelCb_t pfnAppendLaunchCooperativeKernelCb; ze_pfnCommandListAppendLaunchKernelIndirectCb_t pfnAppendLaunchKernelIndirectCb; ze_pfnCommandListAppendLaunchMultipleKernelsIndirectCb_t pfnAppendLaunchMultipleKernelsIndirectCb; ze_pfnCommandListGetNextCommandIdWithKernelsExpCb_t pfnGetNextCommandIdWithKernelsExpCb; ze_pfnCommandListUpdateMutableCommandKernelsExpCb_t pfnUpdateMutableCommandKernelsExpCb; ze_pfnCommandListAppendSignalExternalSemaphoreExtCb_t pfnAppendSignalExternalSemaphoreExtCb; ze_pfnCommandListAppendWaitExternalSemaphoreExtCb_t pfnAppendWaitExternalSemaphoreExtCb; ze_pfnCommandListAppendImageCopyToMemoryExtCb_t pfnAppendImageCopyToMemoryExtCb; ze_pfnCommandListAppendImageCopyFromMemoryExtCb_t pfnAppendImageCopyFromMemoryExtCb; ze_pfnCommandListHostSynchronizeCb_t pfnHostSynchronizeCb; ze_pfnCommandListCreateCloneExpCb_t pfnCreateCloneExpCb; ze_pfnCommandListGetDeviceHandleCb_t pfnGetDeviceHandleCb; ze_pfnCommandListGetContextHandleCb_t pfnGetContextHandleCb; ze_pfnCommandListGetOrdinalCb_t pfnGetOrdinalCb; ze_pfnCommandListImmediateGetIndexCb_t pfnImmediateGetIndexCb; ze_pfnCommandListIsImmediateCb_t pfnIsImmediateCb; ze_pfnCommandListImmediateAppendCommandListsExpCb_t pfnImmediateAppendCommandListsExpCb; ze_pfnCommandListGetNextCommandIdExpCb_t pfnGetNextCommandIdExpCb; ze_pfnCommandListUpdateMutableCommandsExpCb_t pfnUpdateMutableCommandsExpCb; ze_pfnCommandListUpdateMutableCommandSignalEventExpCb_t pfnUpdateMutableCommandSignalEventExpCb; ze_pfnCommandListUpdateMutableCommandWaitEventsExpCb_t pfnUpdateMutableCommandWaitEventsExpCb; } zel_command_list_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Event callback functions pointers typedef struct _zel_event_callbacks_t { ze_pfnEventCreateCb_t pfnCreateCb; ze_pfnEventDestroyCb_t pfnDestroyCb; ze_pfnEventHostSignalCb_t pfnHostSignalCb; ze_pfnEventHostSynchronizeCb_t pfnHostSynchronizeCb; ze_pfnEventQueryStatusCb_t pfnQueryStatusCb; ze_pfnEventHostResetCb_t pfnHostResetCb; ze_pfnEventQueryKernelTimestampCb_t pfnQueryKernelTimestampCb; ze_pfnEventQueryTimestampsExpCb_t pfnQueryTimestampsExpCb; ze_pfnEventQueryKernelTimestampsExtCb_t pfnQueryKernelTimestampsExtCb; ze_pfnEventGetEventPoolCb_t pfnGetEventPoolCb; ze_pfnEventGetSignalScopeCb_t pfnGetSignalScopeCb; ze_pfnEventGetWaitScopeCb_t pfnGetWaitScopeCb; } zel_event_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of EventPool callback functions pointers typedef struct _zel_event_pool_callbacks_t { ze_pfnEventPoolCreateCb_t pfnCreateCb; ze_pfnEventPoolDestroyCb_t pfnDestroyCb; ze_pfnEventPoolGetIpcHandleCb_t pfnGetIpcHandleCb; ze_pfnEventPoolOpenIpcHandleCb_t pfnOpenIpcHandleCb; ze_pfnEventPoolCloseIpcHandleCb_t pfnCloseIpcHandleCb; ze_pfnEventPoolPutIpcHandleCb_t pfnPutIpcHandleCb; ze_pfnEventPoolGetContextHandleCb_t pfnGetContextHandleCb; ze_pfnEventPoolGetFlagsCb_t pfnGetFlagsCb; } zel_event_pool_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Fence callback functions pointers typedef struct _zel_fence_callbacks_t { ze_pfnFenceCreateCb_t pfnCreateCb; ze_pfnFenceDestroyCb_t pfnDestroyCb; ze_pfnFenceHostSynchronizeCb_t pfnHostSynchronizeCb; ze_pfnFenceQueryStatusCb_t pfnQueryStatusCb; ze_pfnFenceResetCb_t pfnResetCb; } zel_fence_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Image callback functions pointers typedef struct _zel_image_callbacks_t { ze_pfnImageGetPropertiesCb_t pfnGetPropertiesCb; ze_pfnImageCreateCb_t pfnCreateCb; ze_pfnImageDestroyCb_t pfnDestroyCb; ze_pfnImageGetMemoryPropertiesExpCb_t pfnGetMemoryPropertiesExpCb; ze_pfnImageViewCreateExpCb_t pfnViewCreateExpCb; ze_pfnImageGetAllocPropertiesExtCb_t pfnGetAllocPropertiesExtCb; ze_pfnImageViewCreateExtCb_t pfnViewCreateExtCb; ze_pfnImageGetDeviceOffsetExpCb_t pfnGetDeviceOffsetExpCb; } zel_image_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Kernel callback functions pointers typedef struct _zel_kernel_callbacks_t { ze_pfnKernelCreateCb_t pfnCreateCb; ze_pfnKernelDestroyCb_t pfnDestroyCb; ze_pfnKernelSetCacheConfigCb_t pfnSetCacheConfigCb; ze_pfnKernelSetGroupSizeCb_t pfnSetGroupSizeCb; ze_pfnKernelSuggestGroupSizeCb_t pfnSuggestGroupSizeCb; ze_pfnKernelSuggestMaxCooperativeGroupCountCb_t pfnSuggestMaxCooperativeGroupCountCb; ze_pfnKernelSetArgumentValueCb_t pfnSetArgumentValueCb; ze_pfnKernelSetIndirectAccessCb_t pfnSetIndirectAccessCb; ze_pfnKernelGetIndirectAccessCb_t pfnGetIndirectAccessCb; ze_pfnKernelGetSourceAttributesCb_t pfnGetSourceAttributesCb; ze_pfnKernelGetPropertiesCb_t pfnGetPropertiesCb; ze_pfnKernelGetNameCb_t pfnGetNameCb; ze_pfnKernelSetGlobalOffsetExpCb_t pfnSetGlobalOffsetExpCb; ze_pfnKernelGetBinaryExpCb_t pfnGetBinaryExpCb; ze_pfnKernelSchedulingHintExpCb_t pfnSchedulingHintExpCb; } zel_kernel_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Mem callback functions pointers typedef struct _zel_mem_callbacks_t { ze_pfnMemAllocSharedCb_t pfnAllocSharedCb; ze_pfnMemAllocDeviceCb_t pfnAllocDeviceCb; ze_pfnMemAllocHostCb_t pfnAllocHostCb; ze_pfnMemFreeCb_t pfnFreeCb; ze_pfnMemGetAllocPropertiesCb_t pfnGetAllocPropertiesCb; ze_pfnMemGetAddressRangeCb_t pfnGetAddressRangeCb; ze_pfnMemGetIpcHandleCb_t pfnGetIpcHandleCb; ze_pfnMemOpenIpcHandleCb_t pfnOpenIpcHandleCb; ze_pfnMemCloseIpcHandleCb_t pfnCloseIpcHandleCb; ze_pfnMemFreeExtCb_t pfnFreeExtCb; ze_pfnMemGetIpcHandleFromFileDescriptorExpCb_t pfnGetIpcHandleFromFileDescriptorExpCb; ze_pfnMemGetFileDescriptorFromIpcHandleExpCb_t pfnGetFileDescriptorFromIpcHandleExpCb; ze_pfnMemPutIpcHandleCb_t pfnPutIpcHandleCb; ze_pfnMemSetAtomicAccessAttributeExpCb_t pfnSetAtomicAccessAttributeExpCb; ze_pfnMemGetAtomicAccessAttributeExpCb_t pfnGetAtomicAccessAttributeExpCb; ze_pfnMemGetPitchFor2dImageCb_t pfnGetPitchFor2dImageCb; } zel_mem_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Module callback functions pointers typedef struct _zel_module_callbacks_t { ze_pfnModuleCreateCb_t pfnCreateCb; ze_pfnModuleDestroyCb_t pfnDestroyCb; ze_pfnModuleDynamicLinkCb_t pfnDynamicLinkCb; ze_pfnModuleGetNativeBinaryCb_t pfnGetNativeBinaryCb; ze_pfnModuleGetGlobalPointerCb_t pfnGetGlobalPointerCb; ze_pfnModuleGetKernelNamesCb_t pfnGetKernelNamesCb; ze_pfnModuleGetPropertiesCb_t pfnGetPropertiesCb; ze_pfnModuleGetFunctionPointerCb_t pfnGetFunctionPointerCb; ze_pfnModuleInspectLinkageExtCb_t pfnInspectLinkageExtCb; } zel_module_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of ModuleBuildLog callback functions pointers typedef struct _zel_module_build_log_callbacks_t { ze_pfnModuleBuildLogDestroyCb_t pfnDestroyCb; ze_pfnModuleBuildLogGetStringCb_t pfnGetStringCb; } zel_module_build_log_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of PhysicalMem callback functions pointers typedef struct _zel_physical_mem_callbacks_t { ze_pfnPhysicalMemCreateCb_t pfnCreateCb; ze_pfnPhysicalMemDestroyCb_t pfnDestroyCb; } zel_physical_mem_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of Sampler callback functions pointers typedef struct _zel_sampler_callbacks_t { ze_pfnSamplerCreateCb_t pfnCreateCb; ze_pfnSamplerDestroyCb_t pfnDestroyCb; } zel_sampler_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of VirtualMem callback functions pointers typedef struct _zel_virtual_mem_callbacks_t { ze_pfnVirtualMemReserveCb_t pfnReserveCb; ze_pfnVirtualMemFreeCb_t pfnFreeCb; ze_pfnVirtualMemQueryPageSizeCb_t pfnQueryPageSizeCb; ze_pfnVirtualMemMapCb_t pfnMapCb; ze_pfnVirtualMemUnmapCb_t pfnUnmapCb; ze_pfnVirtualMemSetAccessAttributeCb_t pfnSetAccessAttributeCb; ze_pfnVirtualMemGetAccessAttributeCb_t pfnGetAccessAttributeCb; } zel_virtual_mem_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of FabricEdge callback functions pointers typedef struct _zel_fabric_edge_callbacks_t { ze_pfnFabricEdgeGetExpCb_t pfnGetExpCb; ze_pfnFabricEdgeGetVerticesExpCb_t pfnGetVerticesExpCb; ze_pfnFabricEdgeGetPropertiesExpCb_t pfnGetPropertiesExpCb; } zel_fabric_edge_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Table of FabricVertex callback functions pointers typedef struct _zel_fabric_vertex_callbacks_t { ze_pfnFabricVertexGetExpCb_t pfnGetExpCb; ze_pfnFabricVertexGetSubVerticesExpCb_t pfnGetSubVerticesExpCb; ze_pfnFabricVertexGetPropertiesExpCb_t pfnGetPropertiesExpCb; ze_pfnFabricVertexGetDeviceExpCb_t pfnGetDeviceExpCb; } zel_fabric_vertex_callbacks_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Container for all callbacks typedef struct _zel_all_core_callbacks_t { zel_global_callbacks_t Global; zel_rtas_builder_callbacks_t RTASBuilder; zel_rtas_parallel_operation_callbacks_t RTASParallelOperation; zel_driver_callbacks_t Driver; zel_device_callbacks_t Device; zel_context_callbacks_t Context; zel_command_queue_callbacks_t CommandQueue; zel_command_list_callbacks_t CommandList; zel_event_callbacks_t Event; zel_event_pool_callbacks_t EventPool; zel_fence_callbacks_t Fence; zel_image_callbacks_t Image; zel_kernel_callbacks_t Kernel; zel_mem_callbacks_t Mem; zel_module_callbacks_t Module; zel_module_build_log_callbacks_t ModuleBuildLog; zel_physical_mem_callbacks_t PhysicalMem; zel_sampler_callbacks_t Sampler; zel_virtual_mem_callbacks_t VirtualMem; zel_fabric_edge_callbacks_t FabricEdge; zel_fabric_vertex_callbacks_t FabricVertex; } zel_all_core_callbacks_t; #endif // ze_tracing_cb_structs_H level-zero-1.20.6/source/layers/tracing/ze_tracing_layer.cpp000066400000000000000000000007241475521542100241500ustar00rootroot00000000000000/* * Copyright (C) 2020 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_layer.cpp * */ #include "ze_tracing_layer.h" namespace tracing_layer { context_t context; /////////////////////////////////////////////////////////////////////////////// context_t::context_t() { } /////////////////////////////////////////////////////////////////////////////// context_t::~context_t() { } } // namespace tracing_layer level-zero-1.20.6/source/layers/tracing/ze_tracing_layer.h000066400000000000000000000010661475521542100236150ustar00rootroot00000000000000/* * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_layer.h * */ #pragma once #include "ze_ddi.h" #include "ze_util.h" #include "tracing_imp.h" namespace tracing_layer { /////////////////////////////////////////////////////////////////////////////// class __zedlllocal context_t { public: ze_api_version_t version = ZE_API_VERSION_CURRENT; ze_dditable_t zeDdiTable = {}; context_t(); ~context_t(); }; extern context_t context; } // namespace tracing_layer level-zero-1.20.6/source/layers/tracing/ze_tracing_register_cb.cpp000066400000000000000000002637601475521542100253370ustar00rootroot00000000000000/* * * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_tracing_register_cb.h * */ #include "tracing.h" #include "ze_tracing_layer.h" #include "layers/zel_tracing_api.h" #include "layers/zel_tracing_ddi.h" #include "layers/zel_tracing_register_cb.h" #include "ze_api.h" extern "C" { /// APIs to register callbacks for each core API ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerInitRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnInitCb_t pfnInitCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Global.pfnInitCb = pfnInitCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDriverGetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetCb_t pfnGetCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Driver.pfnGetCb = pfnGetCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerInitDriversRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnInitDriversCb_t pfnInitDriversCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Global.pfnInitDriversCb = pfnInitDriversCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDriverGetApiVersionRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetApiVersionCb_t pfnGetApiVersionCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Driver.pfnGetApiVersionCb = pfnGetApiVersionCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDriverGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetPropertiesCb_t pfnGetPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Driver.pfnGetPropertiesCb = pfnGetPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDriverGetIpcPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetIpcPropertiesCb_t pfnGetIpcPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Driver.pfnGetIpcPropertiesCb = pfnGetIpcPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDriverGetExtensionPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetExtensionPropertiesCb_t pfnGetExtensionPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Driver.pfnGetExtensionPropertiesCb = pfnGetExtensionPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDriverGetExtensionFunctionAddressRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetExtensionFunctionAddressCb_t pfnGetExtensionFunctionAddressCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Driver.pfnGetExtensionFunctionAddressCb = pfnGetExtensionFunctionAddressCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDriverGetLastErrorDescriptionRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetLastErrorDescriptionCb_t pfnGetLastErrorDescriptionCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Driver.pfnGetLastErrorDescriptionCb = pfnGetLastErrorDescriptionCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetCb_t pfnGetCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetCb = pfnGetCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetRootDeviceRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetRootDeviceCb_t pfnGetRootDeviceCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetRootDeviceCb = pfnGetRootDeviceCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetSubDevicesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetSubDevicesCb_t pfnGetSubDevicesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetSubDevicesCb = pfnGetSubDevicesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetPropertiesCb_t pfnGetPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetPropertiesCb = pfnGetPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetComputePropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetComputePropertiesCb_t pfnGetComputePropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetComputePropertiesCb = pfnGetComputePropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetModulePropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetModulePropertiesCb_t pfnGetModulePropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetModulePropertiesCb = pfnGetModulePropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetCommandQueueGroupPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetCommandQueueGroupPropertiesCb_t pfnGetCommandQueueGroupPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetCommandQueueGroupPropertiesCb = pfnGetCommandQueueGroupPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetMemoryPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetMemoryPropertiesCb_t pfnGetMemoryPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetMemoryPropertiesCb = pfnGetMemoryPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetMemoryAccessPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetMemoryAccessPropertiesCb_t pfnGetMemoryAccessPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetMemoryAccessPropertiesCb = pfnGetMemoryAccessPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetCachePropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetCachePropertiesCb_t pfnGetCachePropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetCachePropertiesCb = pfnGetCachePropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetImagePropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetImagePropertiesCb_t pfnGetImagePropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetImagePropertiesCb = pfnGetImagePropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetExternalMemoryPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetExternalMemoryPropertiesCb_t pfnGetExternalMemoryPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetExternalMemoryPropertiesCb = pfnGetExternalMemoryPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetP2PPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetP2PPropertiesCb_t pfnGetP2PPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetP2PPropertiesCb = pfnGetP2PPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceCanAccessPeerRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceCanAccessPeerCb_t pfnCanAccessPeerCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnCanAccessPeerCb = pfnCanAccessPeerCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetStatusRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetStatusCb_t pfnGetStatusCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetStatusCb = pfnGetStatusCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetGlobalTimestampsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetGlobalTimestampsCb_t pfnGetGlobalTimestampsCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetGlobalTimestampsCb = pfnGetGlobalTimestampsCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerContextCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextCreateCb_t pfnCreateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Context.pfnCreateCb = pfnCreateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerContextCreateExRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextCreateExCb_t pfnCreateExCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Context.pfnCreateExCb = pfnCreateExCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerContextDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextDestroyCb_t pfnDestroyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Context.pfnDestroyCb = pfnDestroyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerContextGetStatusRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextGetStatusCb_t pfnGetStatusCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Context.pfnGetStatusCb = pfnGetStatusCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueCreateCb_t pfnCreateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandQueue.pfnCreateCb = pfnCreateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueDestroyCb_t pfnDestroyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandQueue.pfnDestroyCb = pfnDestroyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueExecuteCommandListsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueExecuteCommandListsCb_t pfnExecuteCommandListsCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandQueue.pfnExecuteCommandListsCb = pfnExecuteCommandListsCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueSynchronizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueSynchronizeCb_t pfnSynchronizeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandQueue.pfnSynchronizeCb = pfnSynchronizeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueGetOrdinalRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueGetOrdinalCb_t pfnGetOrdinalCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandQueue.pfnGetOrdinalCb = pfnGetOrdinalCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueGetIndexRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueGetIndexCb_t pfnGetIndexCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandQueue.pfnGetIndexCb = pfnGetIndexCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCreateCb_t pfnCreateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnCreateCb = pfnCreateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListCreateImmediateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCreateImmediateCb_t pfnCreateImmediateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnCreateImmediateCb = pfnCreateImmediateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListDestroyCb_t pfnDestroyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnDestroyCb = pfnDestroyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListCloseRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCloseCb_t pfnCloseCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnCloseCb = pfnCloseCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListResetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListResetCb_t pfnResetCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnResetCb = pfnResetCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendWriteGlobalTimestampRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendWriteGlobalTimestampCb_t pfnAppendWriteGlobalTimestampCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendWriteGlobalTimestampCb = pfnAppendWriteGlobalTimestampCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListHostSynchronizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListHostSynchronizeCb_t pfnHostSynchronizeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnHostSynchronizeCb = pfnHostSynchronizeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetDeviceHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetDeviceHandleCb_t pfnGetDeviceHandleCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnGetDeviceHandleCb = pfnGetDeviceHandleCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetContextHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetContextHandleCb_t pfnGetContextHandleCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnGetContextHandleCb = pfnGetContextHandleCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetOrdinalRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetOrdinalCb_t pfnGetOrdinalCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnGetOrdinalCb = pfnGetOrdinalCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListImmediateGetIndexRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListImmediateGetIndexCb_t pfnImmediateGetIndexCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnImmediateGetIndexCb = pfnImmediateGetIndexCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListIsImmediateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListIsImmediateCb_t pfnIsImmediateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnIsImmediateCb = pfnIsImmediateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendBarrierRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendBarrierCb_t pfnAppendBarrierCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendBarrierCb = pfnAppendBarrierCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryRangesBarrierRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryRangesBarrierCb_t pfnAppendMemoryRangesBarrierCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendMemoryRangesBarrierCb = pfnAppendMemoryRangesBarrierCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerContextSystemBarrierRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextSystemBarrierCb_t pfnSystemBarrierCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Context.pfnSystemBarrierCb = pfnSystemBarrierCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryCopyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryCopyCb_t pfnAppendMemoryCopyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendMemoryCopyCb = pfnAppendMemoryCopyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryFillRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryFillCb_t pfnAppendMemoryFillCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendMemoryFillCb = pfnAppendMemoryFillCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryCopyRegionRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryCopyRegionCb_t pfnAppendMemoryCopyRegionCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendMemoryCopyRegionCb = pfnAppendMemoryCopyRegionCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryCopyFromContextRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryCopyFromContextCb_t pfnAppendMemoryCopyFromContextCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendMemoryCopyFromContextCb = pfnAppendMemoryCopyFromContextCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyCb_t pfnAppendImageCopyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendImageCopyCb = pfnAppendImageCopyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyRegionRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyRegionCb_t pfnAppendImageCopyRegionCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendImageCopyRegionCb = pfnAppendImageCopyRegionCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyToMemoryRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyToMemoryCb_t pfnAppendImageCopyToMemoryCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendImageCopyToMemoryCb = pfnAppendImageCopyToMemoryCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyFromMemoryRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyFromMemoryCb_t pfnAppendImageCopyFromMemoryCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendImageCopyFromMemoryCb = pfnAppendImageCopyFromMemoryCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryPrefetchRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryPrefetchCb_t pfnAppendMemoryPrefetchCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendMemoryPrefetchCb = pfnAppendMemoryPrefetchCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemAdviseRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemAdviseCb_t pfnAppendMemAdviseCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendMemAdviseCb = pfnAppendMemAdviseCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventPoolCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolCreateCb_t pfnCreateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.EventPool.pfnCreateCb = pfnCreateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventPoolDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolDestroyCb_t pfnDestroyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.EventPool.pfnDestroyCb = pfnDestroyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventCreateCb_t pfnCreateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Event.pfnCreateCb = pfnCreateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventDestroyCb_t pfnDestroyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Event.pfnDestroyCb = pfnDestroyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventPoolGetIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolGetIpcHandleCb_t pfnGetIpcHandleCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.EventPool.pfnGetIpcHandleCb = pfnGetIpcHandleCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventPoolPutIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolPutIpcHandleCb_t pfnPutIpcHandleCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.EventPool.pfnPutIpcHandleCb = pfnPutIpcHandleCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventPoolOpenIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolOpenIpcHandleCb_t pfnOpenIpcHandleCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.EventPool.pfnOpenIpcHandleCb = pfnOpenIpcHandleCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventPoolCloseIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolCloseIpcHandleCb_t pfnCloseIpcHandleCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.EventPool.pfnCloseIpcHandleCb = pfnCloseIpcHandleCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendSignalEventRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendSignalEventCb_t pfnAppendSignalEventCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendSignalEventCb = pfnAppendSignalEventCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendWaitOnEventsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendWaitOnEventsCb_t pfnAppendWaitOnEventsCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendWaitOnEventsCb = pfnAppendWaitOnEventsCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventHostSignalRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventHostSignalCb_t pfnHostSignalCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Event.pfnHostSignalCb = pfnHostSignalCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventHostSynchronizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventHostSynchronizeCb_t pfnHostSynchronizeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Event.pfnHostSynchronizeCb = pfnHostSynchronizeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventQueryStatusRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryStatusCb_t pfnQueryStatusCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Event.pfnQueryStatusCb = pfnQueryStatusCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendEventResetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendEventResetCb_t pfnAppendEventResetCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendEventResetCb = pfnAppendEventResetCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventHostResetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventHostResetCb_t pfnHostResetCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Event.pfnHostResetCb = pfnHostResetCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventQueryKernelTimestampRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryKernelTimestampCb_t pfnQueryKernelTimestampCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Event.pfnQueryKernelTimestampCb = pfnQueryKernelTimestampCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendQueryKernelTimestampsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendQueryKernelTimestampsCb_t pfnAppendQueryKernelTimestampsCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendQueryKernelTimestampsCb = pfnAppendQueryKernelTimestampsCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventGetEventPoolRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventGetEventPoolCb_t pfnGetEventPoolCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Event.pfnGetEventPoolCb = pfnGetEventPoolCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventGetSignalScopeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventGetSignalScopeCb_t pfnGetSignalScopeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Event.pfnGetSignalScopeCb = pfnGetSignalScopeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventGetWaitScopeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventGetWaitScopeCb_t pfnGetWaitScopeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Event.pfnGetWaitScopeCb = pfnGetWaitScopeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventPoolGetContextHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolGetContextHandleCb_t pfnGetContextHandleCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.EventPool.pfnGetContextHandleCb = pfnGetContextHandleCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventPoolGetFlagsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolGetFlagsCb_t pfnGetFlagsCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.EventPool.pfnGetFlagsCb = pfnGetFlagsCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerFenceCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceCreateCb_t pfnCreateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Fence.pfnCreateCb = pfnCreateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerFenceDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceDestroyCb_t pfnDestroyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Fence.pfnDestroyCb = pfnDestroyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerFenceHostSynchronizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceHostSynchronizeCb_t pfnHostSynchronizeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Fence.pfnHostSynchronizeCb = pfnHostSynchronizeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerFenceQueryStatusRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceQueryStatusCb_t pfnQueryStatusCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Fence.pfnQueryStatusCb = pfnQueryStatusCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerFenceResetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceResetCb_t pfnResetCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Fence.pfnResetCb = pfnResetCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerImageGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetPropertiesCb_t pfnGetPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Image.pfnGetPropertiesCb = pfnGetPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerImageCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageCreateCb_t pfnCreateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Image.pfnCreateCb = pfnCreateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerImageDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageDestroyCb_t pfnDestroyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Image.pfnDestroyCb = pfnDestroyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemAllocSharedRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemAllocSharedCb_t pfnAllocSharedCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnAllocSharedCb = pfnAllocSharedCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemAllocDeviceRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemAllocDeviceCb_t pfnAllocDeviceCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnAllocDeviceCb = pfnAllocDeviceCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemAllocHostRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemAllocHostCb_t pfnAllocHostCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnAllocHostCb = pfnAllocHostCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemFreeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemFreeCb_t pfnFreeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnFreeCb = pfnFreeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemGetAllocPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetAllocPropertiesCb_t pfnGetAllocPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnGetAllocPropertiesCb = pfnGetAllocPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemGetAddressRangeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetAddressRangeCb_t pfnGetAddressRangeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnGetAddressRangeCb = pfnGetAddressRangeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemGetIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetIpcHandleCb_t pfnGetIpcHandleCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnGetIpcHandleCb = pfnGetIpcHandleCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemGetIpcHandleFromFileDescriptorExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetIpcHandleFromFileDescriptorExpCb_t pfnGetIpcHandleFromFileDescriptorExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnGetIpcHandleFromFileDescriptorExpCb = pfnGetIpcHandleFromFileDescriptorExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemGetFileDescriptorFromIpcHandleExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetFileDescriptorFromIpcHandleExpCb_t pfnGetFileDescriptorFromIpcHandleExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnGetFileDescriptorFromIpcHandleExpCb = pfnGetFileDescriptorFromIpcHandleExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemPutIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemPutIpcHandleCb_t pfnPutIpcHandleCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnPutIpcHandleCb = pfnPutIpcHandleCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemOpenIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemOpenIpcHandleCb_t pfnOpenIpcHandleCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnOpenIpcHandleCb = pfnOpenIpcHandleCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemCloseIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemCloseIpcHandleCb_t pfnCloseIpcHandleCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnCloseIpcHandleCb = pfnCloseIpcHandleCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemSetAtomicAccessAttributeExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemSetAtomicAccessAttributeExpCb_t pfnSetAtomicAccessAttributeExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnSetAtomicAccessAttributeExpCb = pfnSetAtomicAccessAttributeExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemGetAtomicAccessAttributeExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetAtomicAccessAttributeExpCb_t pfnGetAtomicAccessAttributeExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnGetAtomicAccessAttributeExpCb = pfnGetAtomicAccessAttributeExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerModuleCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleCreateCb_t pfnCreateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Module.pfnCreateCb = pfnCreateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerModuleDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleDestroyCb_t pfnDestroyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Module.pfnDestroyCb = pfnDestroyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerModuleDynamicLinkRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleDynamicLinkCb_t pfnDynamicLinkCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Module.pfnDynamicLinkCb = pfnDynamicLinkCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerModuleBuildLogDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleBuildLogDestroyCb_t pfnDestroyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.ModuleBuildLog.pfnDestroyCb = pfnDestroyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerModuleBuildLogGetStringRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleBuildLogGetStringCb_t pfnGetStringCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.ModuleBuildLog.pfnGetStringCb = pfnGetStringCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerModuleGetNativeBinaryRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetNativeBinaryCb_t pfnGetNativeBinaryCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Module.pfnGetNativeBinaryCb = pfnGetNativeBinaryCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerModuleGetGlobalPointerRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetGlobalPointerCb_t pfnGetGlobalPointerCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Module.pfnGetGlobalPointerCb = pfnGetGlobalPointerCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerModuleGetKernelNamesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetKernelNamesCb_t pfnGetKernelNamesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Module.pfnGetKernelNamesCb = pfnGetKernelNamesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerModuleGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetPropertiesCb_t pfnGetPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Module.pfnGetPropertiesCb = pfnGetPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelCreateCb_t pfnCreateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnCreateCb = pfnCreateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelDestroyCb_t pfnDestroyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnDestroyCb = pfnDestroyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerModuleGetFunctionPointerRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetFunctionPointerCb_t pfnGetFunctionPointerCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Module.pfnGetFunctionPointerCb = pfnGetFunctionPointerCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelSetGroupSizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetGroupSizeCb_t pfnSetGroupSizeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnSetGroupSizeCb = pfnSetGroupSizeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelSuggestGroupSizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSuggestGroupSizeCb_t pfnSuggestGroupSizeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnSuggestGroupSizeCb = pfnSuggestGroupSizeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelSuggestMaxCooperativeGroupCountRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSuggestMaxCooperativeGroupCountCb_t pfnSuggestMaxCooperativeGroupCountCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnSuggestMaxCooperativeGroupCountCb = pfnSuggestMaxCooperativeGroupCountCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelSetArgumentValueRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetArgumentValueCb_t pfnSetArgumentValueCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnSetArgumentValueCb = pfnSetArgumentValueCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelSetIndirectAccessRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetIndirectAccessCb_t pfnSetIndirectAccessCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnSetIndirectAccessCb = pfnSetIndirectAccessCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelGetIndirectAccessRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetIndirectAccessCb_t pfnGetIndirectAccessCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnGetIndirectAccessCb = pfnGetIndirectAccessCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelGetSourceAttributesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetSourceAttributesCb_t pfnGetSourceAttributesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnGetSourceAttributesCb = pfnGetSourceAttributesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelSetCacheConfigRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetCacheConfigCb_t pfnSetCacheConfigCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnSetCacheConfigCb = pfnSetCacheConfigCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetPropertiesCb_t pfnGetPropertiesCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnGetPropertiesCb = pfnGetPropertiesCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelGetNameRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetNameCb_t pfnGetNameCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnGetNameCb = pfnGetNameCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendLaunchKernelRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchKernelCb_t pfnAppendLaunchKernelCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendLaunchKernelCb = pfnAppendLaunchKernelCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendLaunchCooperativeKernelRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchCooperativeKernelCb_t pfnAppendLaunchCooperativeKernelCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendLaunchCooperativeKernelCb = pfnAppendLaunchCooperativeKernelCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendLaunchKernelIndirectRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchKernelIndirectCb_t pfnAppendLaunchKernelIndirectCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendLaunchKernelIndirectCb = pfnAppendLaunchKernelIndirectCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendLaunchMultipleKernelsIndirectRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchMultipleKernelsIndirectCb_t pfnAppendLaunchMultipleKernelsIndirectCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendLaunchMultipleKernelsIndirectCb = pfnAppendLaunchMultipleKernelsIndirectCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerContextMakeMemoryResidentRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextMakeMemoryResidentCb_t pfnMakeMemoryResidentCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Context.pfnMakeMemoryResidentCb = pfnMakeMemoryResidentCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerContextEvictMemoryRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextEvictMemoryCb_t pfnEvictMemoryCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Context.pfnEvictMemoryCb = pfnEvictMemoryCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerContextMakeImageResidentRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextMakeImageResidentCb_t pfnMakeImageResidentCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Context.pfnMakeImageResidentCb = pfnMakeImageResidentCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerContextEvictImageRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextEvictImageCb_t pfnEvictImageCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Context.pfnEvictImageCb = pfnEvictImageCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerSamplerCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnSamplerCreateCb_t pfnCreateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Sampler.pfnCreateCb = pfnCreateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerSamplerDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnSamplerDestroyCb_t pfnDestroyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Sampler.pfnDestroyCb = pfnDestroyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemReserveRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemReserveCb_t pfnReserveCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.VirtualMem.pfnReserveCb = pfnReserveCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemFreeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemFreeCb_t pfnFreeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.VirtualMem.pfnFreeCb = pfnFreeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemQueryPageSizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemQueryPageSizeCb_t pfnQueryPageSizeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.VirtualMem.pfnQueryPageSizeCb = pfnQueryPageSizeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerPhysicalMemCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnPhysicalMemCreateCb_t pfnCreateCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.PhysicalMem.pfnCreateCb = pfnCreateCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerPhysicalMemDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnPhysicalMemDestroyCb_t pfnDestroyCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.PhysicalMem.pfnDestroyCb = pfnDestroyCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemMapRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemMapCb_t pfnMapCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.VirtualMem.pfnMapCb = pfnMapCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemUnmapRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemUnmapCb_t pfnUnmapCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.VirtualMem.pfnUnmapCb = pfnUnmapCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemSetAccessAttributeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemSetAccessAttributeCb_t pfnSetAccessAttributeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.VirtualMem.pfnSetAccessAttributeCb = pfnSetAccessAttributeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemGetAccessAttributeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemGetAccessAttributeCb_t pfnGetAccessAttributeCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.VirtualMem.pfnGetAccessAttributeCb = pfnGetAccessAttributeCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelSetGlobalOffsetExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetGlobalOffsetExpCb_t pfnSetGlobalOffsetExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnSetGlobalOffsetExpCb = pfnSetGlobalOffsetExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelGetBinaryExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetBinaryExpCb_t pfnGetBinaryExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnGetBinaryExpCb = pfnGetBinaryExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceImportExternalSemaphoreExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceImportExternalSemaphoreExtCb_t pfnImportExternalSemaphoreExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnImportExternalSemaphoreExtCb = pfnImportExternalSemaphoreExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceReleaseExternalSemaphoreExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceReleaseExternalSemaphoreExtCb_t pfnReleaseExternalSemaphoreExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnReleaseExternalSemaphoreExtCb = pfnReleaseExternalSemaphoreExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendSignalExternalSemaphoreExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendSignalExternalSemaphoreExtCb_t pfnAppendSignalExternalSemaphoreExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendSignalExternalSemaphoreExtCb = pfnAppendSignalExternalSemaphoreExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendWaitExternalSemaphoreExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendWaitExternalSemaphoreExtCb_t pfnAppendWaitExternalSemaphoreExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendWaitExternalSemaphoreExtCb = pfnAppendWaitExternalSemaphoreExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceReserveCacheExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceReserveCacheExtCb_t pfnReserveCacheExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnReserveCacheExtCb = pfnReserveCacheExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceSetCacheAdviceExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceSetCacheAdviceExtCb_t pfnSetCacheAdviceExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnSetCacheAdviceExtCb = pfnSetCacheAdviceExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventQueryTimestampsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryTimestampsExpCb_t pfnQueryTimestampsExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Event.pfnQueryTimestampsExpCb = pfnQueryTimestampsExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerImageGetMemoryPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetMemoryPropertiesExpCb_t pfnGetMemoryPropertiesExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Image.pfnGetMemoryPropertiesExpCb = pfnGetMemoryPropertiesExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerImageViewCreateExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageViewCreateExtCb_t pfnViewCreateExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Image.pfnViewCreateExtCb = pfnViewCreateExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerImageViewCreateExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageViewCreateExpCb_t pfnViewCreateExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Image.pfnViewCreateExpCb = pfnViewCreateExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerKernelSchedulingHintExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSchedulingHintExpCb_t pfnSchedulingHintExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Kernel.pfnSchedulingHintExpCb = pfnSchedulingHintExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDevicePciGetPropertiesExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDevicePciGetPropertiesExtCb_t pfnPciGetPropertiesExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnPciGetPropertiesExtCb = pfnPciGetPropertiesExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyToMemoryExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyToMemoryExtCb_t pfnAppendImageCopyToMemoryExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendImageCopyToMemoryExtCb = pfnAppendImageCopyToMemoryExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyFromMemoryExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyFromMemoryExtCb_t pfnAppendImageCopyFromMemoryExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnAppendImageCopyFromMemoryExtCb = pfnAppendImageCopyFromMemoryExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerImageGetAllocPropertiesExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetAllocPropertiesExtCb_t pfnGetAllocPropertiesExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Image.pfnGetAllocPropertiesExtCb = pfnGetAllocPropertiesExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerModuleInspectLinkageExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleInspectLinkageExtCb_t pfnInspectLinkageExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Module.pfnInspectLinkageExtCb = pfnInspectLinkageExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemFreeExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemFreeExtCb_t pfnFreeExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnFreeExtCb = pfnFreeExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerFabricVertexGetExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetExpCb_t pfnGetExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.FabricVertex.pfnGetExpCb = pfnGetExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerFabricVertexGetSubVerticesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetSubVerticesExpCb_t pfnGetSubVerticesExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.FabricVertex.pfnGetSubVerticesExpCb = pfnGetSubVerticesExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerFabricVertexGetPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetPropertiesExpCb_t pfnGetPropertiesExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.FabricVertex.pfnGetPropertiesExpCb = pfnGetPropertiesExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerFabricVertexGetDeviceExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetDeviceExpCb_t pfnGetDeviceExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.FabricVertex.pfnGetDeviceExpCb = pfnGetDeviceExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetFabricVertexExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetFabricVertexExpCb_t pfnGetFabricVertexExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Device.pfnGetFabricVertexExpCb = pfnGetFabricVertexExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerFabricEdgeGetExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricEdgeGetExpCb_t pfnGetExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.FabricEdge.pfnGetExpCb = pfnGetExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerFabricEdgeGetVerticesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricEdgeGetVerticesExpCb_t pfnGetVerticesExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.FabricEdge.pfnGetVerticesExpCb = pfnGetVerticesExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerFabricEdgeGetPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricEdgeGetPropertiesExpCb_t pfnGetPropertiesExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.FabricEdge.pfnGetPropertiesExpCb = pfnGetPropertiesExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerEventQueryKernelTimestampsExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryKernelTimestampsExtCb_t pfnQueryKernelTimestampsExtCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Event.pfnQueryKernelTimestampsExtCb = pfnQueryKernelTimestampsExtCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerRTASBuilderCreateExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderCreateExpCb_t pfnCreateExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.RTASBuilder.pfnCreateExpCb = pfnCreateExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerRTASBuilderGetBuildPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderGetBuildPropertiesExpCb_t pfnGetBuildPropertiesExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.RTASBuilder.pfnGetBuildPropertiesExpCb = pfnGetBuildPropertiesExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerDriverRTASFormatCompatibilityCheckExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverRTASFormatCompatibilityCheckExpCb_t pfnRTASFormatCompatibilityCheckExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Driver.pfnRTASFormatCompatibilityCheckExpCb = pfnRTASFormatCompatibilityCheckExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerRTASBuilderBuildExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderBuildExpCb_t pfnBuildExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.RTASBuilder.pfnBuildExpCb = pfnBuildExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerRTASBuilderDestroyExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderDestroyExpCb_t pfnDestroyExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.RTASBuilder.pfnDestroyExpCb = pfnDestroyExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerRTASParallelOperationCreateExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationCreateExpCb_t pfnCreateExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.RTASParallelOperation.pfnCreateExpCb = pfnCreateExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerRTASParallelOperationGetPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationGetPropertiesExpCb_t pfnGetPropertiesExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.RTASParallelOperation.pfnGetPropertiesExpCb = pfnGetPropertiesExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerRTASParallelOperationJoinExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationJoinExpCb_t pfnJoinExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.RTASParallelOperation.pfnJoinExpCb = pfnJoinExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerRTASParallelOperationDestroyExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationDestroyExpCb_t pfnDestroyExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.RTASParallelOperation.pfnDestroyExpCb = pfnDestroyExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerMemGetPitchFor2dImageRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetPitchFor2dImageCb_t pfnGetPitchFor2dImageCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Mem.pfnGetPitchFor2dImageCb = pfnGetPitchFor2dImageCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerImageGetDeviceOffsetExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetDeviceOffsetExpCb_t pfnGetDeviceOffsetExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.Image.pfnGetDeviceOffsetExpCb = pfnGetDeviceOffsetExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListCreateCloneExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCreateCloneExpCb_t pfnCreateCloneExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnCreateCloneExpCb = pfnCreateCloneExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListImmediateAppendCommandListsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListImmediateAppendCommandListsExpCb_t pfnImmediateAppendCommandListsExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnImmediateAppendCommandListsExpCb = pfnImmediateAppendCommandListsExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetNextCommandIdExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetNextCommandIdExpCb_t pfnGetNextCommandIdExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnGetNextCommandIdExpCb = pfnGetNextCommandIdExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetNextCommandIdWithKernelsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetNextCommandIdWithKernelsExpCb_t pfnGetNextCommandIdWithKernelsExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnGetNextCommandIdWithKernelsExpCb = pfnGetNextCommandIdWithKernelsExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListUpdateMutableCommandsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandsExpCb_t pfnUpdateMutableCommandsExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnUpdateMutableCommandsExpCb = pfnUpdateMutableCommandsExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListUpdateMutableCommandSignalEventExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandSignalEventExpCb_t pfnUpdateMutableCommandSignalEventExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnUpdateMutableCommandSignalEventExpCb = pfnUpdateMutableCommandSignalEventExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListUpdateMutableCommandWaitEventsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandWaitEventsExpCb_t pfnUpdateMutableCommandWaitEventsExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnUpdateMutableCommandWaitEventsExpCb = pfnUpdateMutableCommandWaitEventsExpCb; return result; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelTracerCommandListUpdateMutableCommandKernelsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandKernelsExpCb_t pfnUpdateMutableCommandKernelsExpCb ) { ze_result_t result; auto& cbs = tracing_layer::APITracer::fromHandle(hTracer)->getProEpilogues(callback_type, result); if (result == ZE_RESULT_SUCCESS) cbs.CommandList.pfnUpdateMutableCommandKernelsExpCb = pfnUpdateMutableCommandKernelsExpCb; return result; } } //extern Clevel-zero-1.20.6/source/layers/tracing/ze_trcddi.cpp000066400000000000000000016314431475521542100226070ustar00rootroot00000000000000/* * * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_trcddi.cpp * */ #include #include "ze_tracing_layer.h" namespace tracing_layer { /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeInit __zedlllocal ze_result_t ZE_APICALL zeInit( ze_init_flags_t flags ///< [in] initialization flags. ///< must be 0 (default) or a combination of ::ze_init_flag_t. ) { auto pfnInit = context.zeDdiTable.Global.pfnInit; if( nullptr == pfnInit) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Global.pfnInit, flags); // capture parameters ze_init_params_t tracerParams = { &flags }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnInitCb_t, Global, pfnInitCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Global.pfnInit, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.pflags); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGet __zedlllocal ze_result_t ZE_APICALL zeDriverGet( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ) { auto pfnGet = context.zeDdiTable.Driver.pfnGet; if( nullptr == pfnGet) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Driver.pfnGet, pCount, phDrivers); // capture parameters ze_driver_get_params_t tracerParams = { &pCount, &phDrivers }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetCb_t, Driver, pfnGetCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Driver.pfnGet, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.ppCount, *tracerParams.pphDrivers); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeInitDrivers __zedlllocal ze_result_t ZE_APICALL zeInitDrivers( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers, ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ze_init_driver_type_desc_t* desc ///< [in] descriptor containing the driver type initialization details ///< including ::ze_init_driver_type_flag_t combinations. ) { auto pfnInitDrivers = context.zeDdiTable.Global.pfnInitDrivers; if( nullptr == pfnInitDrivers) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Global.pfnInitDrivers, pCount, phDrivers, desc); // capture parameters ze_init_drivers_params_t tracerParams = { &pCount, &phDrivers, &desc }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnInitDriversCb_t, Global, pfnInitDriversCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Global.pfnInitDrivers, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.ppCount, *tracerParams.pphDrivers, *tracerParams.pdesc); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetApiVersion __zedlllocal ze_result_t ZE_APICALL zeDriverGetApiVersion( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_api_version_t* version ///< [out] api version ) { auto pfnGetApiVersion = context.zeDdiTable.Driver.pfnGetApiVersion; if( nullptr == pfnGetApiVersion) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Driver.pfnGetApiVersion, hDriver, version); // capture parameters ze_driver_get_api_version_params_t tracerParams = { &hDriver, &version }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetApiVersionCb_t, Driver, pfnGetApiVersionCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Driver.pfnGetApiVersion, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.pversion); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetProperties __zedlllocal ze_result_t ZE_APICALL zeDriverGetProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_properties_t* pDriverProperties ///< [in,out] query result for driver properties ) { auto pfnGetProperties = context.zeDdiTable.Driver.pfnGetProperties; if( nullptr == pfnGetProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Driver.pfnGetProperties, hDriver, pDriverProperties); // capture parameters ze_driver_get_properties_params_t tracerParams = { &hDriver, &pDriverProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetPropertiesCb_t, Driver, pfnGetPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Driver.pfnGetProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.ppDriverProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetIpcProperties __zedlllocal ze_result_t ZE_APICALL zeDriverGetIpcProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_ipc_properties_t* pIpcProperties ///< [in,out] query result for IPC properties ) { auto pfnGetIpcProperties = context.zeDdiTable.Driver.pfnGetIpcProperties; if( nullptr == pfnGetIpcProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Driver.pfnGetIpcProperties, hDriver, pIpcProperties); // capture parameters ze_driver_get_ipc_properties_params_t tracerParams = { &hDriver, &pIpcProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetIpcPropertiesCb_t, Driver, pfnGetIpcPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Driver.pfnGetIpcProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.ppIpcProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetExtensionProperties __zedlllocal ze_result_t ZE_APICALL zeDriverGetExtensionProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. ze_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { auto pfnGetExtensionProperties = context.zeDdiTable.Driver.pfnGetExtensionProperties; if( nullptr == pfnGetExtensionProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Driver.pfnGetExtensionProperties, hDriver, pCount, pExtensionProperties); // capture parameters ze_driver_get_extension_properties_params_t tracerParams = { &hDriver, &pCount, &pExtensionProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetExtensionPropertiesCb_t, Driver, pfnGetExtensionPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Driver.pfnGetExtensionProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.ppCount, *tracerParams.ppExtensionProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetExtensionFunctionAddress __zedlllocal ze_result_t ZE_APICALL zeDriverGetExtensionFunctionAddress( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { auto pfnGetExtensionFunctionAddress = context.zeDdiTable.Driver.pfnGetExtensionFunctionAddress; if( nullptr == pfnGetExtensionFunctionAddress) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Driver.pfnGetExtensionFunctionAddress, hDriver, name, ppFunctionAddress); // capture parameters ze_driver_get_extension_function_address_params_t tracerParams = { &hDriver, &name, &ppFunctionAddress }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetExtensionFunctionAddressCb_t, Driver, pfnGetExtensionFunctionAddressCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Driver.pfnGetExtensionFunctionAddress, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.pname, *tracerParams.pppFunctionAddress); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetLastErrorDescription __zedlllocal ze_result_t ZE_APICALL zeDriverGetLastErrorDescription( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char** ppString ///< [in,out] pointer to a null-terminated array of characters describing ///< cause of error. ) { auto pfnGetLastErrorDescription = context.zeDdiTable.Driver.pfnGetLastErrorDescription; if( nullptr == pfnGetLastErrorDescription) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Driver.pfnGetLastErrorDescription, hDriver, ppString); // capture parameters ze_driver_get_last_error_description_params_t tracerParams = { &hDriver, &ppString }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverGetLastErrorDescriptionCb_t, Driver, pfnGetLastErrorDescriptionCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Driver.pfnGetLastErrorDescription, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.pppString); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGet __zedlllocal ze_result_t ZE_APICALL zeDeviceGet( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of devices. ///< if count is zero, then the driver shall update the value with the ///< total number of devices available. ///< if count is greater than the number of devices available, then the ///< driver shall update the value with the correct number of devices available. ze_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of devices. ///< if count is less than the number of devices available, then driver ///< shall only retrieve that number of devices. ) { auto pfnGet = context.zeDdiTable.Device.pfnGet; if( nullptr == pfnGet) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGet, hDriver, pCount, phDevices); // capture parameters ze_device_get_params_t tracerParams = { &hDriver, &pCount, &phDevices }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetCb_t, Device, pfnGetCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGet, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.ppCount, *tracerParams.pphDevices); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetRootDevice __zedlllocal ze_result_t ZE_APICALL zeDeviceGetRootDevice( ze_device_handle_t hDevice, ///< [in] handle of the device object ze_device_handle_t* phRootDevice ///< [in,out] parent root device. ) { auto pfnGetRootDevice = context.zeDdiTable.Device.pfnGetRootDevice; if( nullptr == pfnGetRootDevice) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetRootDevice, hDevice, phRootDevice); // capture parameters ze_device_get_root_device_params_t tracerParams = { &hDevice, &phRootDevice }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetRootDeviceCb_t, Device, pfnGetRootDeviceCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetRootDevice, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.pphRootDevice); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetSubDevices __zedlllocal ze_result_t ZE_APICALL zeDeviceGetSubDevices( ze_device_handle_t hDevice, ///< [in] handle of the device object uint32_t* pCount, ///< [in,out] pointer to the number of sub-devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-devices available. ///< if count is greater than the number of sub-devices available, then the ///< driver shall update the value with the correct number of sub-devices available. ze_device_handle_t* phSubdevices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-devices. ///< if count is less than the number of sub-devices available, then driver ///< shall only retrieve that number of sub-devices. ) { auto pfnGetSubDevices = context.zeDdiTable.Device.pfnGetSubDevices; if( nullptr == pfnGetSubDevices) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetSubDevices, hDevice, pCount, phSubdevices); // capture parameters ze_device_get_sub_devices_params_t tracerParams = { &hDevice, &pCount, &phSubdevices }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetSubDevicesCb_t, Device, pfnGetSubDevicesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetSubDevices, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.ppCount, *tracerParams.pphSubdevices); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_properties_t* pDeviceProperties ///< [in,out] query result for device properties ) { auto pfnGetProperties = context.zeDdiTable.Device.pfnGetProperties; if( nullptr == pfnGetProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetProperties, hDevice, pDeviceProperties); // capture parameters ze_device_get_properties_params_t tracerParams = { &hDevice, &pDeviceProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetPropertiesCb_t, Device, pfnGetPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.ppDeviceProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetComputeProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetComputeProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_compute_properties_t* pComputeProperties ///< [in,out] query result for compute properties ) { auto pfnGetComputeProperties = context.zeDdiTable.Device.pfnGetComputeProperties; if( nullptr == pfnGetComputeProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetComputeProperties, hDevice, pComputeProperties); // capture parameters ze_device_get_compute_properties_params_t tracerParams = { &hDevice, &pComputeProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetComputePropertiesCb_t, Device, pfnGetComputePropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetComputeProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.ppComputeProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetModuleProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetModuleProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_module_properties_t* pModuleProperties///< [in,out] query result for module properties ) { auto pfnGetModuleProperties = context.zeDdiTable.Device.pfnGetModuleProperties; if( nullptr == pfnGetModuleProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetModuleProperties, hDevice, pModuleProperties); // capture parameters ze_device_get_module_properties_params_t tracerParams = { &hDevice, &pModuleProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetModulePropertiesCb_t, Device, pfnGetModulePropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetModuleProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.ppModuleProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetCommandQueueGroupProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetCommandQueueGroupProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of command queue group properties. ///< if count is zero, then the driver shall update the value with the ///< total number of command queue group properties available. ///< if count is greater than the number of command queue group properties ///< available, then the driver shall update the value with the correct ///< number of command queue group properties available. ze_command_queue_group_properties_t* pCommandQueueGroupProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< command queue group properties. ///< if count is less than the number of command queue group properties ///< available, then driver shall only retrieve that number of command ///< queue group properties. ) { auto pfnGetCommandQueueGroupProperties = context.zeDdiTable.Device.pfnGetCommandQueueGroupProperties; if( nullptr == pfnGetCommandQueueGroupProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetCommandQueueGroupProperties, hDevice, pCount, pCommandQueueGroupProperties); // capture parameters ze_device_get_command_queue_group_properties_params_t tracerParams = { &hDevice, &pCount, &pCommandQueueGroupProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetCommandQueueGroupPropertiesCb_t, Device, pfnGetCommandQueueGroupPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetCommandQueueGroupProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.ppCount, *tracerParams.ppCommandQueueGroupProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetMemoryProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetMemoryProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of memory properties. ///< if count is zero, then the driver shall update the value with the ///< total number of memory properties available. ///< if count is greater than the number of memory properties available, ///< then the driver shall update the value with the correct number of ///< memory properties available. ze_device_memory_properties_t* pMemProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< memory properties. ///< if count is less than the number of memory properties available, then ///< driver shall only retrieve that number of memory properties. ) { auto pfnGetMemoryProperties = context.zeDdiTable.Device.pfnGetMemoryProperties; if( nullptr == pfnGetMemoryProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetMemoryProperties, hDevice, pCount, pMemProperties); // capture parameters ze_device_get_memory_properties_params_t tracerParams = { &hDevice, &pCount, &pMemProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetMemoryPropertiesCb_t, Device, pfnGetMemoryPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetMemoryProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.ppCount, *tracerParams.ppMemProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetMemoryAccessProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetMemoryAccessProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_memory_access_properties_t* pMemAccessProperties ///< [in,out] query result for memory access properties ) { auto pfnGetMemoryAccessProperties = context.zeDdiTable.Device.pfnGetMemoryAccessProperties; if( nullptr == pfnGetMemoryAccessProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetMemoryAccessProperties, hDevice, pMemAccessProperties); // capture parameters ze_device_get_memory_access_properties_params_t tracerParams = { &hDevice, &pMemAccessProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetMemoryAccessPropertiesCb_t, Device, pfnGetMemoryAccessPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetMemoryAccessProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.ppMemAccessProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetCacheProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetCacheProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of cache properties. ///< if count is zero, then the driver shall update the value with the ///< total number of cache properties available. ///< if count is greater than the number of cache properties available, ///< then the driver shall update the value with the correct number of ///< cache properties available. ze_device_cache_properties_t* pCacheProperties ///< [in,out][optional][range(0, *pCount)] array of query results for cache properties. ///< if count is less than the number of cache properties available, then ///< driver shall only retrieve that number of cache properties. ) { auto pfnGetCacheProperties = context.zeDdiTable.Device.pfnGetCacheProperties; if( nullptr == pfnGetCacheProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetCacheProperties, hDevice, pCount, pCacheProperties); // capture parameters ze_device_get_cache_properties_params_t tracerParams = { &hDevice, &pCount, &pCacheProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetCachePropertiesCb_t, Device, pfnGetCachePropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetCacheProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.ppCount, *tracerParams.ppCacheProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetImageProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetImageProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_image_properties_t* pImageProperties ///< [in,out] query result for image properties ) { auto pfnGetImageProperties = context.zeDdiTable.Device.pfnGetImageProperties; if( nullptr == pfnGetImageProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetImageProperties, hDevice, pImageProperties); // capture parameters ze_device_get_image_properties_params_t tracerParams = { &hDevice, &pImageProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetImagePropertiesCb_t, Device, pfnGetImagePropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetImageProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.ppImageProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetExternalMemoryProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetExternalMemoryProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_external_memory_properties_t* pExternalMemoryProperties ///< [in,out] query result for external memory properties ) { auto pfnGetExternalMemoryProperties = context.zeDdiTable.Device.pfnGetExternalMemoryProperties; if( nullptr == pfnGetExternalMemoryProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetExternalMemoryProperties, hDevice, pExternalMemoryProperties); // capture parameters ze_device_get_external_memory_properties_params_t tracerParams = { &hDevice, &pExternalMemoryProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetExternalMemoryPropertiesCb_t, Device, pfnGetExternalMemoryPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetExternalMemoryProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.ppExternalMemoryProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetP2PProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetP2PProperties( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_device_p2p_properties_t* pP2PProperties ///< [in,out] Peer-to-Peer properties between source and peer device ) { auto pfnGetP2PProperties = context.zeDdiTable.Device.pfnGetP2PProperties; if( nullptr == pfnGetP2PProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetP2PProperties, hDevice, hPeerDevice, pP2PProperties); // capture parameters ze_device_get_p2_p_properties_params_t tracerParams = { &hDevice, &hPeerDevice, &pP2PProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetP2PPropertiesCb_t, Device, pfnGetP2PPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetP2PProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.phPeerDevice, *tracerParams.ppP2PProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceCanAccessPeer __zedlllocal ze_result_t ZE_APICALL zeDeviceCanAccessPeer( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_bool_t* value ///< [out] returned access capability ) { auto pfnCanAccessPeer = context.zeDdiTable.Device.pfnCanAccessPeer; if( nullptr == pfnCanAccessPeer) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnCanAccessPeer, hDevice, hPeerDevice, value); // capture parameters ze_device_can_access_peer_params_t tracerParams = { &hDevice, &hPeerDevice, &value }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceCanAccessPeerCb_t, Device, pfnCanAccessPeerCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnCanAccessPeer, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.phPeerDevice, *tracerParams.pvalue); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetStatus __zedlllocal ze_result_t ZE_APICALL zeDeviceGetStatus( ze_device_handle_t hDevice ///< [in] handle of the device ) { auto pfnGetStatus = context.zeDdiTable.Device.pfnGetStatus; if( nullptr == pfnGetStatus) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetStatus, hDevice); // capture parameters ze_device_get_status_params_t tracerParams = { &hDevice }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetStatusCb_t, Device, pfnGetStatusCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetStatus, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetGlobalTimestamps __zedlllocal ze_result_t ZE_APICALL zeDeviceGetGlobalTimestamps( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the ///< Host's global timestamp value. ) { auto pfnGetGlobalTimestamps = context.zeDdiTable.Device.pfnGetGlobalTimestamps; if( nullptr == pfnGetGlobalTimestamps) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnGetGlobalTimestamps, hDevice, hostTimestamp, deviceTimestamp); // capture parameters ze_device_get_global_timestamps_params_t tracerParams = { &hDevice, &hostTimestamp, &deviceTimestamp }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetGlobalTimestampsCb_t, Device, pfnGetGlobalTimestampsCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnGetGlobalTimestamps, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.phostTimestamp, *tracerParams.pdeviceTimestamp); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreate __zedlllocal ze_result_t ZE_APICALL zeContextCreate( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { auto pfnCreate = context.zeDdiTable.Context.pfnCreate; if( nullptr == pfnCreate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Context.pfnCreate, hDriver, desc, phContext); // capture parameters ze_context_create_params_t tracerParams = { &hDriver, &desc, &phContext }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnContextCreateCb_t, Context, pfnCreateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Context.pfnCreate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.pdesc, *tracerParams.pphContext); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreateEx __zedlllocal ze_result_t ZE_APICALL zeContextCreateEx( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< context has visibility. ///< if nullptr, then all devices and any sub-devices supported by the ///< driver instance are ///< visible to the context. ///< otherwise, the context only has visibility to the devices and any ///< sub-devices of the ///< devices in this array. ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { auto pfnCreateEx = context.zeDdiTable.Context.pfnCreateEx; if( nullptr == pfnCreateEx) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Context.pfnCreateEx, hDriver, desc, numDevices, phDevices, phContext); // capture parameters ze_context_create_ex_params_t tracerParams = { &hDriver, &desc, &numDevices, &phDevices, &phContext }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnContextCreateExCb_t, Context, pfnCreateExCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Context.pfnCreateEx, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.pdesc, *tracerParams.pnumDevices, *tracerParams.pphDevices, *tracerParams.pphContext); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextDestroy __zedlllocal ze_result_t ZE_APICALL zeContextDestroy( ze_context_handle_t hContext ///< [in][release] handle of context object to destroy ) { auto pfnDestroy = context.zeDdiTable.Context.pfnDestroy; if( nullptr == pfnDestroy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Context.pfnDestroy, hContext); // capture parameters ze_context_destroy_params_t tracerParams = { &hContext }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnContextDestroyCb_t, Context, pfnDestroyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Context.pfnDestroy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextGetStatus __zedlllocal ze_result_t ZE_APICALL zeContextGetStatus( ze_context_handle_t hContext ///< [in] handle of context object ) { auto pfnGetStatus = context.zeDdiTable.Context.pfnGetStatus; if( nullptr == pfnGetStatus) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Context.pfnGetStatus, hContext); // capture parameters ze_context_get_status_params_t tracerParams = { &hContext }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnContextGetStatusCb_t, Context, pfnGetStatusCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Context.pfnGetStatus, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueCreate __zedlllocal ze_result_t ZE_APICALL zeCommandQueueCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* desc, ///< [in] pointer to command queue descriptor ze_command_queue_handle_t* phCommandQueue ///< [out] pointer to handle of command queue object created ) { auto pfnCreate = context.zeDdiTable.CommandQueue.pfnCreate; if( nullptr == pfnCreate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandQueue.pfnCreate, hContext, hDevice, desc, phCommandQueue); // capture parameters ze_command_queue_create_params_t tracerParams = { &hContext, &hDevice, &desc, &phCommandQueue }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandQueueCreateCb_t, CommandQueue, pfnCreateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandQueue.pfnCreate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.pphCommandQueue); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueDestroy __zedlllocal ze_result_t ZE_APICALL zeCommandQueueDestroy( ze_command_queue_handle_t hCommandQueue ///< [in][release] handle of command queue object to destroy ) { auto pfnDestroy = context.zeDdiTable.CommandQueue.pfnDestroy; if( nullptr == pfnDestroy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandQueue.pfnDestroy, hCommandQueue); // capture parameters ze_command_queue_destroy_params_t tracerParams = { &hCommandQueue }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandQueueDestroyCb_t, CommandQueue, pfnDestroyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandQueue.pfnDestroy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandQueue); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueExecuteCommandLists __zedlllocal ze_result_t ZE_APICALL zeCommandQueueExecuteCommandLists( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t numCommandLists, ///< [in] number of command lists to execute ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] list of handles of the command lists ///< to execute ze_fence_handle_t hFence ///< [in][optional] handle of the fence to signal on completion ) { auto pfnExecuteCommandLists = context.zeDdiTable.CommandQueue.pfnExecuteCommandLists; if( nullptr == pfnExecuteCommandLists) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandQueue.pfnExecuteCommandLists, hCommandQueue, numCommandLists, phCommandLists, hFence); // capture parameters ze_command_queue_execute_command_lists_params_t tracerParams = { &hCommandQueue, &numCommandLists, &phCommandLists, &hFence }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandQueueExecuteCommandListsCb_t, CommandQueue, pfnExecuteCommandListsCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandQueue.pfnExecuteCommandLists, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandQueue, *tracerParams.pnumCommandLists, *tracerParams.pphCommandLists, *tracerParams.phFence); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueSynchronize __zedlllocal ze_result_t ZE_APICALL zeCommandQueueSynchronize( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the command queue; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { auto pfnSynchronize = context.zeDdiTable.CommandQueue.pfnSynchronize; if( nullptr == pfnSynchronize) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandQueue.pfnSynchronize, hCommandQueue, timeout); // capture parameters ze_command_queue_synchronize_params_t tracerParams = { &hCommandQueue, &timeout }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandQueueSynchronizeCb_t, CommandQueue, pfnSynchronizeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandQueue.pfnSynchronize, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandQueue, *tracerParams.ptimeout); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueGetOrdinal __zedlllocal ze_result_t ZE_APICALL zeCommandQueueGetOrdinal( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pOrdinal ///< [out] command queue group ordinal ) { auto pfnGetOrdinal = context.zeDdiTable.CommandQueue.pfnGetOrdinal; if( nullptr == pfnGetOrdinal) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandQueue.pfnGetOrdinal, hCommandQueue, pOrdinal); // capture parameters ze_command_queue_get_ordinal_params_t tracerParams = { &hCommandQueue, &pOrdinal }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandQueueGetOrdinalCb_t, CommandQueue, pfnGetOrdinalCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandQueue.pfnGetOrdinal, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandQueue, *tracerParams.ppOrdinal); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueGetIndex __zedlllocal ze_result_t ZE_APICALL zeCommandQueueGetIndex( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pIndex ///< [out] command queue index within the group ) { auto pfnGetIndex = context.zeDdiTable.CommandQueue.pfnGetIndex; if( nullptr == pfnGetIndex) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandQueue.pfnGetIndex, hCommandQueue, pIndex); // capture parameters ze_command_queue_get_index_params_t tracerParams = { &hCommandQueue, &pIndex }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandQueueGetIndexCb_t, CommandQueue, pfnGetIndexCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandQueue.pfnGetIndex, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandQueue, *tracerParams.ppIndex); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListCreate __zedlllocal ze_result_t ZE_APICALL zeCommandListCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_list_desc_t* desc, ///< [in] pointer to command list descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { auto pfnCreate = context.zeDdiTable.CommandList.pfnCreate; if( nullptr == pfnCreate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnCreate, hContext, hDevice, desc, phCommandList); // capture parameters ze_command_list_create_params_t tracerParams = { &hContext, &hDevice, &desc, &phCommandList }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListCreateCb_t, CommandList, pfnCreateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnCreate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.pphCommandList); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListCreateImmediate __zedlllocal ze_result_t ZE_APICALL zeCommandListCreateImmediate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* altdesc, ///< [in] pointer to command queue descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { auto pfnCreateImmediate = context.zeDdiTable.CommandList.pfnCreateImmediate; if( nullptr == pfnCreateImmediate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnCreateImmediate, hContext, hDevice, altdesc, phCommandList); // capture parameters ze_command_list_create_immediate_params_t tracerParams = { &hContext, &hDevice, &altdesc, &phCommandList }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListCreateImmediateCb_t, CommandList, pfnCreateImmediateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnCreateImmediate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.paltdesc, *tracerParams.pphCommandList); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListDestroy __zedlllocal ze_result_t ZE_APICALL zeCommandListDestroy( ze_command_list_handle_t hCommandList ///< [in][release] handle of command list object to destroy ) { auto pfnDestroy = context.zeDdiTable.CommandList.pfnDestroy; if( nullptr == pfnDestroy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnDestroy, hCommandList); // capture parameters ze_command_list_destroy_params_t tracerParams = { &hCommandList }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListDestroyCb_t, CommandList, pfnDestroyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnDestroy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListClose __zedlllocal ze_result_t ZE_APICALL zeCommandListClose( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to close ) { auto pfnClose = context.zeDdiTable.CommandList.pfnClose; if( nullptr == pfnClose) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnClose, hCommandList); // capture parameters ze_command_list_close_params_t tracerParams = { &hCommandList }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListCloseCb_t, CommandList, pfnCloseCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnClose, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListReset __zedlllocal ze_result_t ZE_APICALL zeCommandListReset( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to reset ) { auto pfnReset = context.zeDdiTable.CommandList.pfnReset; if( nullptr == pfnReset) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnReset, hCommandList); // capture parameters ze_command_list_reset_params_t tracerParams = { &hCommandList }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListResetCb_t, CommandList, pfnResetCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnReset, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendWriteGlobalTimestamp __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendWriteGlobalTimestamp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t* dstptr, ///< [in,out] pointer to memory where timestamp value will be written; must ///< be 8byte-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { auto pfnAppendWriteGlobalTimestamp = context.zeDdiTable.CommandList.pfnAppendWriteGlobalTimestamp; if( nullptr == pfnAppendWriteGlobalTimestamp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendWriteGlobalTimestamp, hCommandList, dstptr, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_write_global_timestamp_params_t tracerParams = { &hCommandList, &dstptr, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendWriteGlobalTimestampCb_t, CommandList, pfnAppendWriteGlobalTimestampCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendWriteGlobalTimestamp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pdstptr, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListHostSynchronize __zedlllocal ze_result_t ZE_APICALL zeCommandListHostSynchronize( ze_command_list_handle_t hCommandList, ///< [in] handle of the immediate command list uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the immediate command list; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { auto pfnHostSynchronize = context.zeDdiTable.CommandList.pfnHostSynchronize; if( nullptr == pfnHostSynchronize) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnHostSynchronize, hCommandList, timeout); // capture parameters ze_command_list_host_synchronize_params_t tracerParams = { &hCommandList, &timeout }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListHostSynchronizeCb_t, CommandList, pfnHostSynchronizeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnHostSynchronize, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.ptimeout); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetDeviceHandle __zedlllocal ze_result_t ZE_APICALL zeCommandListGetDeviceHandle( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_device_handle_t* phDevice ///< [out] handle of the device on which the command list was created ) { auto pfnGetDeviceHandle = context.zeDdiTable.CommandList.pfnGetDeviceHandle; if( nullptr == pfnGetDeviceHandle) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnGetDeviceHandle, hCommandList, phDevice); // capture parameters ze_command_list_get_device_handle_params_t tracerParams = { &hCommandList, &phDevice }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListGetDeviceHandleCb_t, CommandList, pfnGetDeviceHandleCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnGetDeviceHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pphDevice); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetContextHandle __zedlllocal ze_result_t ZE_APICALL zeCommandListGetContextHandle( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_context_handle_t* phContext ///< [out] handle of the context on which the command list was created ) { auto pfnGetContextHandle = context.zeDdiTable.CommandList.pfnGetContextHandle; if( nullptr == pfnGetContextHandle) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnGetContextHandle, hCommandList, phContext); // capture parameters ze_command_list_get_context_handle_params_t tracerParams = { &hCommandList, &phContext }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListGetContextHandleCb_t, CommandList, pfnGetContextHandleCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnGetContextHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pphContext); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetOrdinal __zedlllocal ze_result_t ZE_APICALL zeCommandListGetOrdinal( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t* pOrdinal ///< [out] command queue group ordinal to which command list is submitted ) { auto pfnGetOrdinal = context.zeDdiTable.CommandList.pfnGetOrdinal; if( nullptr == pfnGetOrdinal) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnGetOrdinal, hCommandList, pOrdinal); // capture parameters ze_command_list_get_ordinal_params_t tracerParams = { &hCommandList, &pOrdinal }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListGetOrdinalCb_t, CommandList, pfnGetOrdinalCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnGetOrdinal, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.ppOrdinal); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListImmediateGetIndex __zedlllocal ze_result_t ZE_APICALL zeCommandListImmediateGetIndex( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t* pIndex ///< [out] command queue index within the group to which the immediate ///< command list is submitted ) { auto pfnImmediateGetIndex = context.zeDdiTable.CommandList.pfnImmediateGetIndex; if( nullptr == pfnImmediateGetIndex) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnImmediateGetIndex, hCommandListImmediate, pIndex); // capture parameters ze_command_list_immediate_get_index_params_t tracerParams = { &hCommandListImmediate, &pIndex }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListImmediateGetIndexCb_t, CommandList, pfnImmediateGetIndexCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnImmediateGetIndex, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandListImmediate, *tracerParams.ppIndex); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListIsImmediate __zedlllocal ze_result_t ZE_APICALL zeCommandListIsImmediate( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_bool_t* pIsImmediate ///< [out] Boolean indicating whether the command list is an immediate ///< command list (true) or not (false) ) { auto pfnIsImmediate = context.zeDdiTable.CommandList.pfnIsImmediate; if( nullptr == pfnIsImmediate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnIsImmediate, hCommandList, pIsImmediate); // capture parameters ze_command_list_is_immediate_params_t tracerParams = { &hCommandList, &pIsImmediate }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListIsImmediateCb_t, CommandList, pfnIsImmediateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnIsImmediate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.ppIsImmediate); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendBarrier __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendBarrier( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { auto pfnAppendBarrier = context.zeDdiTable.CommandList.pfnAppendBarrier; if( nullptr == pfnAppendBarrier) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendBarrier, hCommandList, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_barrier_params_t tracerParams = { &hCommandList, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendBarrierCb_t, CommandList, pfnAppendBarrierCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendBarrier, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryRangesBarrier __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryRangesBarrier( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numRanges, ///< [in] number of memory ranges const size_t* pRangeSizes, ///< [in][range(0, numRanges)] array of sizes of memory range const void** pRanges, ///< [in][range(0, numRanges)] array of memory ranges ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { auto pfnAppendMemoryRangesBarrier = context.zeDdiTable.CommandList.pfnAppendMemoryRangesBarrier; if( nullptr == pfnAppendMemoryRangesBarrier) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendMemoryRangesBarrier, hCommandList, numRanges, pRangeSizes, pRanges, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_memory_ranges_barrier_params_t tracerParams = { &hCommandList, &numRanges, &pRangeSizes, &pRanges, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendMemoryRangesBarrierCb_t, CommandList, pfnAppendMemoryRangesBarrierCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendMemoryRangesBarrier, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pnumRanges, *tracerParams.ppRangeSizes, *tracerParams.ppRanges, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextSystemBarrier __zedlllocal ze_result_t ZE_APICALL zeContextSystemBarrier( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice ///< [in] handle of the device ) { auto pfnSystemBarrier = context.zeDdiTable.Context.pfnSystemBarrier; if( nullptr == pfnSystemBarrier) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Context.pfnSystemBarrier, hContext, hDevice); // capture parameters ze_context_system_barrier_params_t tracerParams = { &hContext, &hDevice }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnContextSystemBarrierCb_t, Context, pfnSystemBarrierCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Context.pfnSystemBarrier, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopy __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopy( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendMemoryCopy = context.zeDdiTable.CommandList.pfnAppendMemoryCopy; if( nullptr == pfnAppendMemoryCopy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendMemoryCopy, hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_memory_copy_params_t tracerParams = { &hCommandList, &dstptr, &srcptr, &size, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendMemoryCopyCb_t, CommandList, pfnAppendMemoryCopyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendMemoryCopy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pdstptr, *tracerParams.psrcptr, *tracerParams.psize, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryFill __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryFill( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* ptr, ///< [in] pointer to memory to initialize const void* pattern, ///< [in] pointer to value to initialize memory to size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to size_t size, ///< [in] size in bytes to initialize ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendMemoryFill = context.zeDdiTable.CommandList.pfnAppendMemoryFill; if( nullptr == pfnAppendMemoryFill) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendMemoryFill, hCommandList, ptr, pattern, pattern_size, size, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_memory_fill_params_t tracerParams = { &hCommandList, &ptr, &pattern, &pattern_size, &size, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendMemoryFillCb_t, CommandList, pfnAppendMemoryFillCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendMemoryFill, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pptr, *tracerParams.ppattern, *tracerParams.ppattern_size, *tracerParams.psize, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyRegion __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const ze_copy_region_t* dstRegion, ///< [in] pointer to destination region to copy to uint32_t dstPitch, ///< [in] destination pitch in bytes uint32_t dstSlicePitch, ///< [in] destination slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. const void* srcptr, ///< [in] pointer to source memory to copy from const ze_copy_region_t* srcRegion, ///< [in] pointer to source region to copy from uint32_t srcPitch, ///< [in] source pitch in bytes uint32_t srcSlicePitch, ///< [in] source slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendMemoryCopyRegion = context.zeDdiTable.CommandList.pfnAppendMemoryCopyRegion; if( nullptr == pfnAppendMemoryCopyRegion) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendMemoryCopyRegion, hCommandList, dstptr, dstRegion, dstPitch, dstSlicePitch, srcptr, srcRegion, srcPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_memory_copy_region_params_t tracerParams = { &hCommandList, &dstptr, &dstRegion, &dstPitch, &dstSlicePitch, &srcptr, &srcRegion, &srcPitch, &srcSlicePitch, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendMemoryCopyRegionCb_t, CommandList, pfnAppendMemoryCopyRegionCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendMemoryCopyRegion, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pdstptr, *tracerParams.pdstRegion, *tracerParams.pdstPitch, *tracerParams.pdstSlicePitch, *tracerParams.psrcptr, *tracerParams.psrcRegion, *tracerParams.psrcPitch, *tracerParams.psrcSlicePitch, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyFromContext __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyFromContext( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_context_handle_t hContextSrc, ///< [in] handle of source context object const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendMemoryCopyFromContext = context.zeDdiTable.CommandList.pfnAppendMemoryCopyFromContext; if( nullptr == pfnAppendMemoryCopyFromContext) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendMemoryCopyFromContext, hCommandList, dstptr, hContextSrc, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_memory_copy_from_context_params_t tracerParams = { &hCommandList, &dstptr, &hContextSrc, &srcptr, &size, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendMemoryCopyFromContextCb_t, CommandList, pfnAppendMemoryCopyFromContextCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendMemoryCopyFromContext, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pdstptr, *tracerParams.phContextSrc, *tracerParams.psrcptr, *tracerParams.psize, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopy __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopy( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendImageCopy = context.zeDdiTable.CommandList.pfnAppendImageCopy; if( nullptr == pfnAppendImageCopy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendImageCopy, hCommandList, hDstImage, hSrcImage, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_image_copy_params_t tracerParams = { &hCommandList, &hDstImage, &hSrcImage, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendImageCopyCb_t, CommandList, pfnAppendImageCopyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendImageCopy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.phDstImage, *tracerParams.phSrcImage, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyRegion __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendImageCopyRegion = context.zeDdiTable.CommandList.pfnAppendImageCopyRegion; if( nullptr == pfnAppendImageCopyRegion) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendImageCopyRegion, hCommandList, hDstImage, hSrcImage, pDstRegion, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_image_copy_region_params_t tracerParams = { &hCommandList, &hDstImage, &hSrcImage, &pDstRegion, &pSrcRegion, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendImageCopyRegionCb_t, CommandList, pfnAppendImageCopyRegionCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendImageCopyRegion, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.phDstImage, *tracerParams.phSrcImage, *tracerParams.ppDstRegion, *tracerParams.ppSrcRegion, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyToMemory __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemory( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendImageCopyToMemory = context.zeDdiTable.CommandList.pfnAppendImageCopyToMemory; if( nullptr == pfnAppendImageCopyToMemory) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendImageCopyToMemory, hCommandList, dstptr, hSrcImage, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_image_copy_to_memory_params_t tracerParams = { &hCommandList, &dstptr, &hSrcImage, &pSrcRegion, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendImageCopyToMemoryCb_t, CommandList, pfnAppendImageCopyToMemoryCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendImageCopyToMemory, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pdstptr, *tracerParams.phSrcImage, *tracerParams.ppSrcRegion, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyFromMemory __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyFromMemory( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendImageCopyFromMemory = context.zeDdiTable.CommandList.pfnAppendImageCopyFromMemory; if( nullptr == pfnAppendImageCopyFromMemory) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendImageCopyFromMemory, hCommandList, hDstImage, srcptr, pDstRegion, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_image_copy_from_memory_params_t tracerParams = { &hCommandList, &hDstImage, &srcptr, &pDstRegion, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendImageCopyFromMemoryCb_t, CommandList, pfnAppendImageCopyFromMemoryCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendImageCopyFromMemory, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.phDstImage, *tracerParams.psrcptr, *tracerParams.ppDstRegion, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryPrefetch __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryPrefetch( ze_command_list_handle_t hCommandList, ///< [in] handle of command list const void* ptr, ///< [in] pointer to start of the memory range to prefetch size_t size ///< [in] size in bytes of the memory range to prefetch ) { auto pfnAppendMemoryPrefetch = context.zeDdiTable.CommandList.pfnAppendMemoryPrefetch; if( nullptr == pfnAppendMemoryPrefetch) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendMemoryPrefetch, hCommandList, ptr, size); // capture parameters ze_command_list_append_memory_prefetch_params_t tracerParams = { &hCommandList, &ptr, &size }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendMemoryPrefetchCb_t, CommandList, pfnAppendMemoryPrefetchCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendMemoryPrefetch, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pptr, *tracerParams.psize); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemAdvise __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemAdvise( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_advice_t advice ///< [in] Memory advice for the memory range ) { auto pfnAppendMemAdvise = context.zeDdiTable.CommandList.pfnAppendMemAdvise; if( nullptr == pfnAppendMemAdvise) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendMemAdvise, hCommandList, hDevice, ptr, size, advice); // capture parameters ze_command_list_append_mem_advise_params_t tracerParams = { &hCommandList, &hDevice, &ptr, &size, &advice }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendMemAdviseCb_t, CommandList, pfnAppendMemAdviseCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendMemAdvise, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.phDevice, *tracerParams.pptr, *tracerParams.psize, *tracerParams.padvice); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolCreate __zedlllocal ze_result_t ZE_APICALL zeEventPoolCreate( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_event_pool_desc_t* desc, ///< [in] pointer to event pool descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< have visibility to the event pool. ///< if nullptr, then event pool is visible to all devices supported by the ///< driver instance. ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { auto pfnCreate = context.zeDdiTable.EventPool.pfnCreate; if( nullptr == pfnCreate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.EventPool.pfnCreate, hContext, desc, numDevices, phDevices, phEventPool); // capture parameters ze_event_pool_create_params_t tracerParams = { &hContext, &desc, &numDevices, &phDevices, &phEventPool }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventPoolCreateCb_t, EventPool, pfnCreateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.EventPool.pfnCreate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pdesc, *tracerParams.pnumDevices, *tracerParams.pphDevices, *tracerParams.pphEventPool); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolDestroy __zedlllocal ze_result_t ZE_APICALL zeEventPoolDestroy( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object to destroy ) { auto pfnDestroy = context.zeDdiTable.EventPool.pfnDestroy; if( nullptr == pfnDestroy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.EventPool.pfnDestroy, hEventPool); // capture parameters ze_event_pool_destroy_params_t tracerParams = { &hEventPool }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventPoolDestroyCb_t, EventPool, pfnDestroyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.EventPool.pfnDestroy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEventPool); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventCreate __zedlllocal ze_result_t ZE_APICALL zeEventCreate( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool const ze_event_desc_t* desc, ///< [in] pointer to event descriptor ze_event_handle_t* phEvent ///< [out] pointer to handle of event object created ) { auto pfnCreate = context.zeDdiTable.Event.pfnCreate; if( nullptr == pfnCreate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Event.pfnCreate, hEventPool, desc, phEvent); // capture parameters ze_event_create_params_t tracerParams = { &hEventPool, &desc, &phEvent }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventCreateCb_t, Event, pfnCreateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Event.pfnCreate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEventPool, *tracerParams.pdesc, *tracerParams.pphEvent); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventDestroy __zedlllocal ze_result_t ZE_APICALL zeEventDestroy( ze_event_handle_t hEvent ///< [in][release] handle of event object to destroy ) { auto pfnDestroy = context.zeDdiTable.Event.pfnDestroy; if( nullptr == pfnDestroy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Event.pfnDestroy, hEvent); // capture parameters ze_event_destroy_params_t tracerParams = { &hEvent }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventDestroyCb_t, Event, pfnDestroyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Event.pfnDestroy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEvent); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolGetIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolGetIpcHandle( ze_event_pool_handle_t hEventPool, ///< [in] handle of event pool object ze_ipc_event_pool_handle_t* phIpc ///< [out] Returned IPC event handle ) { auto pfnGetIpcHandle = context.zeDdiTable.EventPool.pfnGetIpcHandle; if( nullptr == pfnGetIpcHandle) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.EventPool.pfnGetIpcHandle, hEventPool, phIpc); // capture parameters ze_event_pool_get_ipc_handle_params_t tracerParams = { &hEventPool, &phIpc }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventPoolGetIpcHandleCb_t, EventPool, pfnGetIpcHandleCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.EventPool.pfnGetIpcHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEventPool, *tracerParams.pphIpc); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolPutIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolPutIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object associated with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc ///< [in] IPC event pool handle ) { auto pfnPutIpcHandle = context.zeDdiTable.EventPool.pfnPutIpcHandle; if( nullptr == pfnPutIpcHandle) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.EventPool.pfnPutIpcHandle, hContext, hIpc); // capture parameters ze_event_pool_put_ipc_handle_params_t tracerParams = { &hContext, &hIpc }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventPoolPutIpcHandleCb_t, EventPool, pfnPutIpcHandleCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.EventPool.pfnPutIpcHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phIpc); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolOpenIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolOpenIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object to associate with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc, ///< [in] IPC event pool handle ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { auto pfnOpenIpcHandle = context.zeDdiTable.EventPool.pfnOpenIpcHandle; if( nullptr == pfnOpenIpcHandle) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.EventPool.pfnOpenIpcHandle, hContext, hIpc, phEventPool); // capture parameters ze_event_pool_open_ipc_handle_params_t tracerParams = { &hContext, &hIpc, &phEventPool }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventPoolOpenIpcHandleCb_t, EventPool, pfnOpenIpcHandleCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.EventPool.pfnOpenIpcHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phIpc, *tracerParams.pphEventPool); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolCloseIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolCloseIpcHandle( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object ) { auto pfnCloseIpcHandle = context.zeDdiTable.EventPool.pfnCloseIpcHandle; if( nullptr == pfnCloseIpcHandle) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.EventPool.pfnCloseIpcHandle, hEventPool); // capture parameters ze_event_pool_close_ipc_handle_params_t tracerParams = { &hEventPool }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventPoolCloseIpcHandleCb_t, EventPool, pfnCloseIpcHandleCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.EventPool.pfnCloseIpcHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEventPool); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendSignalEvent __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendSignalEvent( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { auto pfnAppendSignalEvent = context.zeDdiTable.CommandList.pfnAppendSignalEvent; if( nullptr == pfnAppendSignalEvent) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendSignalEvent, hCommandList, hEvent); // capture parameters ze_command_list_append_signal_event_params_t tracerParams = { &hCommandList, &hEvent }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendSignalEventCb_t, CommandList, pfnAppendSignalEventCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendSignalEvent, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.phEvent); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendWaitOnEvents __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendWaitOnEvents( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] number of events to wait on before continuing ze_event_handle_t* phEvents ///< [in][range(0, numEvents)] handles of the events to wait on before ///< continuing ) { auto pfnAppendWaitOnEvents = context.zeDdiTable.CommandList.pfnAppendWaitOnEvents; if( nullptr == pfnAppendWaitOnEvents) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendWaitOnEvents, hCommandList, numEvents, phEvents); // capture parameters ze_command_list_append_wait_on_events_params_t tracerParams = { &hCommandList, &numEvents, &phEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendWaitOnEventsCb_t, CommandList, pfnAppendWaitOnEventsCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendWaitOnEvents, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pnumEvents, *tracerParams.pphEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventHostSignal __zedlllocal ze_result_t ZE_APICALL zeEventHostSignal( ze_event_handle_t hEvent ///< [in] handle of the event ) { auto pfnHostSignal = context.zeDdiTable.Event.pfnHostSignal; if( nullptr == pfnHostSignal) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Event.pfnHostSignal, hEvent); // capture parameters ze_event_host_signal_params_t tracerParams = { &hEvent }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventHostSignalCb_t, Event, pfnHostSignalCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Event.pfnHostSignal, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEvent); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventHostSynchronize __zedlllocal ze_result_t ZE_APICALL zeEventHostSynchronize( ze_event_handle_t hEvent, ///< [in] handle of the event uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeEventQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { auto pfnHostSynchronize = context.zeDdiTable.Event.pfnHostSynchronize; if( nullptr == pfnHostSynchronize) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Event.pfnHostSynchronize, hEvent, timeout); // capture parameters ze_event_host_synchronize_params_t tracerParams = { &hEvent, &timeout }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventHostSynchronizeCb_t, Event, pfnHostSynchronizeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Event.pfnHostSynchronize, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEvent, *tracerParams.ptimeout); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryStatus __zedlllocal ze_result_t ZE_APICALL zeEventQueryStatus( ze_event_handle_t hEvent ///< [in] handle of the event ) { auto pfnQueryStatus = context.zeDdiTable.Event.pfnQueryStatus; if( nullptr == pfnQueryStatus) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Event.pfnQueryStatus, hEvent); // capture parameters ze_event_query_status_params_t tracerParams = { &hEvent }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventQueryStatusCb_t, Event, pfnQueryStatusCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Event.pfnQueryStatus, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEvent); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendEventReset __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendEventReset( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { auto pfnAppendEventReset = context.zeDdiTable.CommandList.pfnAppendEventReset; if( nullptr == pfnAppendEventReset) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendEventReset, hCommandList, hEvent); // capture parameters ze_command_list_append_event_reset_params_t tracerParams = { &hCommandList, &hEvent }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendEventResetCb_t, CommandList, pfnAppendEventResetCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendEventReset, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.phEvent); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventHostReset __zedlllocal ze_result_t ZE_APICALL zeEventHostReset( ze_event_handle_t hEvent ///< [in] handle of the event ) { auto pfnHostReset = context.zeDdiTable.Event.pfnHostReset; if( nullptr == pfnHostReset) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Event.pfnHostReset, hEvent); // capture parameters ze_event_host_reset_params_t tracerParams = { &hEvent }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventHostResetCb_t, Event, pfnHostResetCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Event.pfnHostReset, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEvent); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryKernelTimestamp __zedlllocal ze_result_t ZE_APICALL zeEventQueryKernelTimestamp( ze_event_handle_t hEvent, ///< [in] handle of the event ze_kernel_timestamp_result_t* dstptr ///< [in,out] pointer to memory for where timestamp result will be written. ) { auto pfnQueryKernelTimestamp = context.zeDdiTable.Event.pfnQueryKernelTimestamp; if( nullptr == pfnQueryKernelTimestamp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Event.pfnQueryKernelTimestamp, hEvent, dstptr); // capture parameters ze_event_query_kernel_timestamp_params_t tracerParams = { &hEvent, &dstptr }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventQueryKernelTimestampCb_t, Event, pfnQueryKernelTimestampCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Event.pfnQueryKernelTimestamp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEvent, *tracerParams.pdstptr); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendQueryKernelTimestamps __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendQueryKernelTimestamps( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] the number of timestamp events to query ze_event_handle_t* phEvents, ///< [in][range(0, numEvents)] handles of timestamp events to query void* dstptr, ///< [in,out] pointer to memory where ::ze_kernel_timestamp_result_t will ///< be written; must be size-aligned. const size_t* pOffsets, ///< [in][optional][range(0, numEvents)] offset, in bytes, to write ///< results; address must be 4byte-aligned and offsets must be ///< size-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { auto pfnAppendQueryKernelTimestamps = context.zeDdiTable.CommandList.pfnAppendQueryKernelTimestamps; if( nullptr == pfnAppendQueryKernelTimestamps) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendQueryKernelTimestamps, hCommandList, numEvents, phEvents, dstptr, pOffsets, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_query_kernel_timestamps_params_t tracerParams = { &hCommandList, &numEvents, &phEvents, &dstptr, &pOffsets, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendQueryKernelTimestampsCb_t, CommandList, pfnAppendQueryKernelTimestampsCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendQueryKernelTimestamps, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pnumEvents, *tracerParams.pphEvents, *tracerParams.pdstptr, *tracerParams.ppOffsets, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventGetEventPool __zedlllocal ze_result_t ZE_APICALL zeEventGetEventPool( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_pool_handle_t* phEventPool ///< [out] handle of the event pool for the event ) { auto pfnGetEventPool = context.zeDdiTable.Event.pfnGetEventPool; if( nullptr == pfnGetEventPool) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Event.pfnGetEventPool, hEvent, phEventPool); // capture parameters ze_event_get_event_pool_params_t tracerParams = { &hEvent, &phEventPool }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventGetEventPoolCb_t, Event, pfnGetEventPoolCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Event.pfnGetEventPool, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEvent, *tracerParams.pphEventPool); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventGetSignalScope __zedlllocal ze_result_t ZE_APICALL zeEventGetSignalScope( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pSignalScope ///< [out] signal event scope. This is the scope of relevant cache ///< hierarchies that are flushed on a signal action before the event is ///< triggered. May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { auto pfnGetSignalScope = context.zeDdiTable.Event.pfnGetSignalScope; if( nullptr == pfnGetSignalScope) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Event.pfnGetSignalScope, hEvent, pSignalScope); // capture parameters ze_event_get_signal_scope_params_t tracerParams = { &hEvent, &pSignalScope }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventGetSignalScopeCb_t, Event, pfnGetSignalScopeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Event.pfnGetSignalScope, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEvent, *tracerParams.ppSignalScope); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventGetWaitScope __zedlllocal ze_result_t ZE_APICALL zeEventGetWaitScope( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pWaitScope ///< [out] wait event scope. This is the scope of relevant cache ///< hierarchies invalidated on a wait action after the event is complete. ///< May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { auto pfnGetWaitScope = context.zeDdiTable.Event.pfnGetWaitScope; if( nullptr == pfnGetWaitScope) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Event.pfnGetWaitScope, hEvent, pWaitScope); // capture parameters ze_event_get_wait_scope_params_t tracerParams = { &hEvent, &pWaitScope }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventGetWaitScopeCb_t, Event, pfnGetWaitScopeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Event.pfnGetWaitScope, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEvent, *tracerParams.ppWaitScope); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolGetContextHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolGetContextHandle( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_context_handle_t* phContext ///< [out] handle of the context on which the event pool was created ) { auto pfnGetContextHandle = context.zeDdiTable.EventPool.pfnGetContextHandle; if( nullptr == pfnGetContextHandle) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.EventPool.pfnGetContextHandle, hEventPool, phContext); // capture parameters ze_event_pool_get_context_handle_params_t tracerParams = { &hEventPool, &phContext }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventPoolGetContextHandleCb_t, EventPool, pfnGetContextHandleCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.EventPool.pfnGetContextHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEventPool, *tracerParams.pphContext); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolGetFlags __zedlllocal ze_result_t ZE_APICALL zeEventPoolGetFlags( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_event_pool_flags_t* pFlags ///< [out] creation flags used to create the event pool; may be 0 or a ///< valid combination of ::ze_event_pool_flag_t ) { auto pfnGetFlags = context.zeDdiTable.EventPool.pfnGetFlags; if( nullptr == pfnGetFlags) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.EventPool.pfnGetFlags, hEventPool, pFlags); // capture parameters ze_event_pool_get_flags_params_t tracerParams = { &hEventPool, &pFlags }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventPoolGetFlagsCb_t, EventPool, pfnGetFlagsCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.EventPool.pfnGetFlags, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEventPool, *tracerParams.ppFlags); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceCreate __zedlllocal ze_result_t ZE_APICALL zeFenceCreate( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of command queue const ze_fence_desc_t* desc, ///< [in] pointer to fence descriptor ze_fence_handle_t* phFence ///< [out] pointer to handle of fence object created ) { auto pfnCreate = context.zeDdiTable.Fence.pfnCreate; if( nullptr == pfnCreate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Fence.pfnCreate, hCommandQueue, desc, phFence); // capture parameters ze_fence_create_params_t tracerParams = { &hCommandQueue, &desc, &phFence }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnFenceCreateCb_t, Fence, pfnCreateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Fence.pfnCreate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandQueue, *tracerParams.pdesc, *tracerParams.pphFence); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceDestroy __zedlllocal ze_result_t ZE_APICALL zeFenceDestroy( ze_fence_handle_t hFence ///< [in][release] handle of fence object to destroy ) { auto pfnDestroy = context.zeDdiTable.Fence.pfnDestroy; if( nullptr == pfnDestroy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Fence.pfnDestroy, hFence); // capture parameters ze_fence_destroy_params_t tracerParams = { &hFence }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnFenceDestroyCb_t, Fence, pfnDestroyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Fence.pfnDestroy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phFence); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceHostSynchronize __zedlllocal ze_result_t ZE_APICALL zeFenceHostSynchronize( ze_fence_handle_t hFence, ///< [in] handle of the fence uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeFenceQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { auto pfnHostSynchronize = context.zeDdiTable.Fence.pfnHostSynchronize; if( nullptr == pfnHostSynchronize) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Fence.pfnHostSynchronize, hFence, timeout); // capture parameters ze_fence_host_synchronize_params_t tracerParams = { &hFence, &timeout }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnFenceHostSynchronizeCb_t, Fence, pfnHostSynchronizeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Fence.pfnHostSynchronize, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phFence, *tracerParams.ptimeout); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceQueryStatus __zedlllocal ze_result_t ZE_APICALL zeFenceQueryStatus( ze_fence_handle_t hFence ///< [in] handle of the fence ) { auto pfnQueryStatus = context.zeDdiTable.Fence.pfnQueryStatus; if( nullptr == pfnQueryStatus) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Fence.pfnQueryStatus, hFence); // capture parameters ze_fence_query_status_params_t tracerParams = { &hFence }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnFenceQueryStatusCb_t, Fence, pfnQueryStatusCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Fence.pfnQueryStatus, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phFence); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceReset __zedlllocal ze_result_t ZE_APICALL zeFenceReset( ze_fence_handle_t hFence ///< [in] handle of the fence ) { auto pfnReset = context.zeDdiTable.Fence.pfnReset; if( nullptr == pfnReset) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Fence.pfnReset, hFence); // capture parameters ze_fence_reset_params_t tracerParams = { &hFence }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnFenceResetCb_t, Fence, pfnResetCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Fence.pfnReset, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phFence); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetProperties __zedlllocal ze_result_t ZE_APICALL zeImageGetProperties( ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_properties_t* pImageProperties ///< [out] pointer to image properties ) { auto pfnGetProperties = context.zeDdiTable.Image.pfnGetProperties; if( nullptr == pfnGetProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Image.pfnGetProperties, hDevice, desc, pImageProperties); // capture parameters ze_image_get_properties_params_t tracerParams = { &hDevice, &desc, &pImageProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnImageGetPropertiesCb_t, Image, pfnGetPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Image.pfnGetProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.ppImageProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageCreate __zedlllocal ze_result_t ZE_APICALL zeImageCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t* phImage ///< [out] pointer to handle of image object created ) { auto pfnCreate = context.zeDdiTable.Image.pfnCreate; if( nullptr == pfnCreate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Image.pfnCreate, hContext, hDevice, desc, phImage); // capture parameters ze_image_create_params_t tracerParams = { &hContext, &hDevice, &desc, &phImage }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnImageCreateCb_t, Image, pfnCreateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Image.pfnCreate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.pphImage); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageDestroy __zedlllocal ze_result_t ZE_APICALL zeImageDestroy( ze_image_handle_t hImage ///< [in][release] handle of image object to destroy ) { auto pfnDestroy = context.zeDdiTable.Image.pfnDestroy; if( nullptr == pfnDestroy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Image.pfnDestroy, hImage); // capture parameters ze_image_destroy_params_t tracerParams = { &hImage }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnImageDestroyCb_t, Image, pfnDestroyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Image.pfnDestroy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phImage); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemAllocShared __zedlllocal ze_result_t ZE_APICALL zeMemAllocShared( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in][optional] device handle to associate with void** pptr ///< [out] pointer to shared allocation ) { auto pfnAllocShared = context.zeDdiTable.Mem.pfnAllocShared; if( nullptr == pfnAllocShared) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Mem.pfnAllocShared, hContext, device_desc, host_desc, size, alignment, hDevice, pptr); // capture parameters ze_mem_alloc_shared_params_t tracerParams = { &hContext, &device_desc, &host_desc, &size, &alignment, &hDevice, &pptr }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemAllocSharedCb_t, Mem, pfnAllocSharedCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Mem.pfnAllocShared, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pdevice_desc, *tracerParams.phost_desc, *tracerParams.psize, *tracerParams.palignment, *tracerParams.phDevice, *tracerParams.ppptr); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemAllocDevice __zedlllocal ze_result_t ZE_APICALL zeMemAllocDevice( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in] handle of the device void** pptr ///< [out] pointer to device allocation ) { auto pfnAllocDevice = context.zeDdiTable.Mem.pfnAllocDevice; if( nullptr == pfnAllocDevice) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Mem.pfnAllocDevice, hContext, device_desc, size, alignment, hDevice, pptr); // capture parameters ze_mem_alloc_device_params_t tracerParams = { &hContext, &device_desc, &size, &alignment, &hDevice, &pptr }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemAllocDeviceCb_t, Mem, pfnAllocDeviceCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Mem.pfnAllocDevice, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pdevice_desc, *tracerParams.psize, *tracerParams.palignment, *tracerParams.phDevice, *tracerParams.ppptr); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemAllocHost __zedlllocal ze_result_t ZE_APICALL zeMemAllocHost( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two void** pptr ///< [out] pointer to host allocation ) { auto pfnAllocHost = context.zeDdiTable.Mem.pfnAllocHost; if( nullptr == pfnAllocHost) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Mem.pfnAllocHost, hContext, host_desc, size, alignment, pptr); // capture parameters ze_mem_alloc_host_params_t tracerParams = { &hContext, &host_desc, &size, &alignment, &pptr }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemAllocHostCb_t, Mem, pfnAllocHostCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Mem.pfnAllocHost, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phost_desc, *tracerParams.psize, *tracerParams.palignment, *tracerParams.ppptr); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemFree __zedlllocal ze_result_t ZE_APICALL zeMemFree( ze_context_handle_t hContext, ///< [in] handle of the context object void* ptr ///< [in][release] pointer to memory to free ) { auto pfnFree = context.zeDdiTable.Mem.pfnFree; if( nullptr == pfnFree) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Mem.pfnFree, hContext, ptr); // capture parameters ze_mem_free_params_t tracerParams = { &hContext, &ptr }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemFreeCb_t, Mem, pfnFreeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Mem.pfnFree, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pptr); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetAllocProperties __zedlllocal ze_result_t ZE_APICALL zeMemGetAllocProperties( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query ze_memory_allocation_properties_t* pMemAllocProperties, ///< [in,out] query result for memory allocation properties ze_device_handle_t* phDevice ///< [out][optional] device associated with this allocation ) { auto pfnGetAllocProperties = context.zeDdiTable.Mem.pfnGetAllocProperties; if( nullptr == pfnGetAllocProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Mem.pfnGetAllocProperties, hContext, ptr, pMemAllocProperties, phDevice); // capture parameters ze_mem_get_alloc_properties_params_t tracerParams = { &hContext, &ptr, &pMemAllocProperties, &phDevice }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemGetAllocPropertiesCb_t, Mem, pfnGetAllocPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Mem.pfnGetAllocProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pptr, *tracerParams.ppMemAllocProperties, *tracerParams.pphDevice); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetAddressRange __zedlllocal ze_result_t ZE_APICALL zeMemGetAddressRange( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query void** pBase, ///< [in,out][optional] base address of the allocation size_t* pSize ///< [in,out][optional] size of the allocation ) { auto pfnGetAddressRange = context.zeDdiTable.Mem.pfnGetAddressRange; if( nullptr == pfnGetAddressRange) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Mem.pfnGetAddressRange, hContext, ptr, pBase, pSize); // capture parameters ze_mem_get_address_range_params_t tracerParams = { &hContext, &ptr, &pBase, &pSize }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemGetAddressRangeCb_t, Mem, pfnGetAddressRangeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Mem.pfnGetAddressRange, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pptr, *tracerParams.ppBase, *tracerParams.ppSize); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemGetIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to the device memory allocation ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { auto pfnGetIpcHandle = context.zeDdiTable.Mem.pfnGetIpcHandle; if( nullptr == pfnGetIpcHandle) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Mem.pfnGetIpcHandle, hContext, ptr, pIpcHandle); // capture parameters ze_mem_get_ipc_handle_params_t tracerParams = { &hContext, &ptr, &pIpcHandle }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemGetIpcHandleCb_t, Mem, pfnGetIpcHandleCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Mem.pfnGetIpcHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pptr, *tracerParams.ppIpcHandle); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetIpcHandleFromFileDescriptorExp __zedlllocal ze_result_t ZE_APICALL zeMemGetIpcHandleFromFileDescriptorExp( ze_context_handle_t hContext, ///< [in] handle of the context object uint64_t handle, ///< [in] file descriptor ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { auto pfnGetIpcHandleFromFileDescriptorExp = context.zeDdiTable.MemExp.pfnGetIpcHandleFromFileDescriptorExp; if( nullptr == pfnGetIpcHandleFromFileDescriptorExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.MemExp.pfnGetIpcHandleFromFileDescriptorExp, hContext, handle, pIpcHandle); // capture parameters ze_mem_get_ipc_handle_from_file_descriptor_exp_params_t tracerParams = { &hContext, &handle, &pIpcHandle }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemGetIpcHandleFromFileDescriptorExpCb_t, Mem, pfnGetIpcHandleFromFileDescriptorExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.MemExp.pfnGetIpcHandleFromFileDescriptorExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phandle, *tracerParams.ppIpcHandle); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetFileDescriptorFromIpcHandleExp __zedlllocal ze_result_t ZE_APICALL zeMemGetFileDescriptorFromIpcHandleExp( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t ipcHandle, ///< [in] IPC memory handle uint64_t* pHandle ///< [out] Returned file descriptor ) { auto pfnGetFileDescriptorFromIpcHandleExp = context.zeDdiTable.MemExp.pfnGetFileDescriptorFromIpcHandleExp; if( nullptr == pfnGetFileDescriptorFromIpcHandleExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.MemExp.pfnGetFileDescriptorFromIpcHandleExp, hContext, ipcHandle, pHandle); // capture parameters ze_mem_get_file_descriptor_from_ipc_handle_exp_params_t tracerParams = { &hContext, &ipcHandle, &pHandle }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemGetFileDescriptorFromIpcHandleExpCb_t, Mem, pfnGetFileDescriptorFromIpcHandleExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.MemExp.pfnGetFileDescriptorFromIpcHandleExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pipcHandle, *tracerParams.ppHandle); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemPutIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemPutIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t handle ///< [in] IPC memory handle ) { auto pfnPutIpcHandle = context.zeDdiTable.Mem.pfnPutIpcHandle; if( nullptr == pfnPutIpcHandle) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Mem.pfnPutIpcHandle, hContext, handle); // capture parameters ze_mem_put_ipc_handle_params_t tracerParams = { &hContext, &handle }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemPutIpcHandleCb_t, Mem, pfnPutIpcHandleCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Mem.pfnPutIpcHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phandle); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemOpenIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemOpenIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device to associate with the IPC memory handle ze_ipc_mem_handle_t handle, ///< [in] IPC memory handle ze_ipc_memory_flags_t flags, ///< [in] flags controlling the operation. ///< must be 0 (default) or a valid combination of ::ze_ipc_memory_flag_t. void** pptr ///< [out] pointer to device allocation in this process ) { auto pfnOpenIpcHandle = context.zeDdiTable.Mem.pfnOpenIpcHandle; if( nullptr == pfnOpenIpcHandle) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Mem.pfnOpenIpcHandle, hContext, hDevice, handle, flags, pptr); // capture parameters ze_mem_open_ipc_handle_params_t tracerParams = { &hContext, &hDevice, &handle, &flags, &pptr }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemOpenIpcHandleCb_t, Mem, pfnOpenIpcHandleCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Mem.pfnOpenIpcHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.phandle, *tracerParams.pflags, *tracerParams.ppptr); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemCloseIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemCloseIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr ///< [in][release] pointer to device allocation in this process ) { auto pfnCloseIpcHandle = context.zeDdiTable.Mem.pfnCloseIpcHandle; if( nullptr == pfnCloseIpcHandle) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Mem.pfnCloseIpcHandle, hContext, ptr); // capture parameters ze_mem_close_ipc_handle_params_t tracerParams = { &hContext, &ptr }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemCloseIpcHandleCb_t, Mem, pfnCloseIpcHandleCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Mem.pfnCloseIpcHandle, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pptr); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemSetAtomicAccessAttributeExp __zedlllocal ze_result_t ZE_APICALL zeMemSetAtomicAccessAttributeExp( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t attr ///< [in] Atomic access attributes to set for the specified range. ///< Must be 0 (default) or a valid combination of ::ze_memory_atomic_attr_exp_flag_t. ) { auto pfnSetAtomicAccessAttributeExp = context.zeDdiTable.MemExp.pfnSetAtomicAccessAttributeExp; if( nullptr == pfnSetAtomicAccessAttributeExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.MemExp.pfnSetAtomicAccessAttributeExp, hContext, hDevice, ptr, size, attr); // capture parameters ze_mem_set_atomic_access_attribute_exp_params_t tracerParams = { &hContext, &hDevice, &ptr, &size, &attr }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemSetAtomicAccessAttributeExpCb_t, Mem, pfnSetAtomicAccessAttributeExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.MemExp.pfnSetAtomicAccessAttributeExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pptr, *tracerParams.psize, *tracerParams.pattr); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetAtomicAccessAttributeExp __zedlllocal ze_result_t ZE_APICALL zeMemGetAtomicAccessAttributeExp( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t* pAttr ///< [out] Atomic access attributes for the specified range ) { auto pfnGetAtomicAccessAttributeExp = context.zeDdiTable.MemExp.pfnGetAtomicAccessAttributeExp; if( nullptr == pfnGetAtomicAccessAttributeExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.MemExp.pfnGetAtomicAccessAttributeExp, hContext, hDevice, ptr, size, pAttr); // capture parameters ze_mem_get_atomic_access_attribute_exp_params_t tracerParams = { &hContext, &hDevice, &ptr, &size, &pAttr }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemGetAtomicAccessAttributeExpCb_t, Mem, pfnGetAtomicAccessAttributeExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.MemExp.pfnGetAtomicAccessAttributeExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pptr, *tracerParams.psize, *tracerParams.ppAttr); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleCreate __zedlllocal ze_result_t ZE_APICALL zeModuleCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_module_desc_t* desc, ///< [in] pointer to module descriptor ze_module_handle_t* phModule, ///< [out] pointer to handle of module object created ze_module_build_log_handle_t* phBuildLog ///< [out][optional] pointer to handle of module's build log. ) { auto pfnCreate = context.zeDdiTable.Module.pfnCreate; if( nullptr == pfnCreate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Module.pfnCreate, hContext, hDevice, desc, phModule, phBuildLog); // capture parameters ze_module_create_params_t tracerParams = { &hContext, &hDevice, &desc, &phModule, &phBuildLog }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnModuleCreateCb_t, Module, pfnCreateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Module.pfnCreate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.pphModule, *tracerParams.pphBuildLog); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleDestroy __zedlllocal ze_result_t ZE_APICALL zeModuleDestroy( ze_module_handle_t hModule ///< [in][release] handle of the module ) { auto pfnDestroy = context.zeDdiTable.Module.pfnDestroy; if( nullptr == pfnDestroy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Module.pfnDestroy, hModule); // capture parameters ze_module_destroy_params_t tracerParams = { &hModule }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnModuleDestroyCb_t, Module, pfnDestroyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Module.pfnDestroy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phModule); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleDynamicLink __zedlllocal ze_result_t ZE_APICALL zeModuleDynamicLink( uint32_t numModules, ///< [in] number of modules to be linked pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to ///< dynamically link together. ze_module_build_log_handle_t* phLinkLog ///< [out][optional] pointer to handle of dynamic link log. ) { auto pfnDynamicLink = context.zeDdiTable.Module.pfnDynamicLink; if( nullptr == pfnDynamicLink) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Module.pfnDynamicLink, numModules, phModules, phLinkLog); // capture parameters ze_module_dynamic_link_params_t tracerParams = { &numModules, &phModules, &phLinkLog }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnModuleDynamicLinkCb_t, Module, pfnDynamicLinkCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Module.pfnDynamicLink, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.pnumModules, *tracerParams.pphModules, *tracerParams.pphLinkLog); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleBuildLogDestroy __zedlllocal ze_result_t ZE_APICALL zeModuleBuildLogDestroy( ze_module_build_log_handle_t hModuleBuildLog ///< [in][release] handle of the module build log object. ) { auto pfnDestroy = context.zeDdiTable.ModuleBuildLog.pfnDestroy; if( nullptr == pfnDestroy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.ModuleBuildLog.pfnDestroy, hModuleBuildLog); // capture parameters ze_module_build_log_destroy_params_t tracerParams = { &hModuleBuildLog }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnModuleBuildLogDestroyCb_t, ModuleBuildLog, pfnDestroyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.ModuleBuildLog.pfnDestroy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phModuleBuildLog); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleBuildLogGetString __zedlllocal ze_result_t ZE_APICALL zeModuleBuildLogGetString( ze_module_build_log_handle_t hModuleBuildLog, ///< [in] handle of the module build log object. size_t* pSize, ///< [in,out] size of build log string. char* pBuildLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { auto pfnGetString = context.zeDdiTable.ModuleBuildLog.pfnGetString; if( nullptr == pfnGetString) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.ModuleBuildLog.pfnGetString, hModuleBuildLog, pSize, pBuildLog); // capture parameters ze_module_build_log_get_string_params_t tracerParams = { &hModuleBuildLog, &pSize, &pBuildLog }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnModuleBuildLogGetStringCb_t, ModuleBuildLog, pfnGetStringCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.ModuleBuildLog.pfnGetString, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phModuleBuildLog, *tracerParams.ppSize, *tracerParams.ppBuildLog); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetNativeBinary __zedlllocal ze_result_t ZE_APICALL zeModuleGetNativeBinary( ze_module_handle_t hModule, ///< [in] handle of the module size_t* pSize, ///< [in,out] size of native binary in bytes. uint8_t* pModuleNativeBinary ///< [in,out][optional] byte pointer to native binary ) { auto pfnGetNativeBinary = context.zeDdiTable.Module.pfnGetNativeBinary; if( nullptr == pfnGetNativeBinary) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Module.pfnGetNativeBinary, hModule, pSize, pModuleNativeBinary); // capture parameters ze_module_get_native_binary_params_t tracerParams = { &hModule, &pSize, &pModuleNativeBinary }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnModuleGetNativeBinaryCb_t, Module, pfnGetNativeBinaryCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Module.pfnGetNativeBinary, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phModule, *tracerParams.ppSize, *tracerParams.ppModuleNativeBinary); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetGlobalPointer __zedlllocal ze_result_t ZE_APICALL zeModuleGetGlobalPointer( ze_module_handle_t hModule, ///< [in] handle of the module const char* pGlobalName, ///< [in] name of global variable in module size_t* pSize, ///< [in,out][optional] size of global variable void** pptr ///< [in,out][optional] device visible pointer ) { auto pfnGetGlobalPointer = context.zeDdiTable.Module.pfnGetGlobalPointer; if( nullptr == pfnGetGlobalPointer) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Module.pfnGetGlobalPointer, hModule, pGlobalName, pSize, pptr); // capture parameters ze_module_get_global_pointer_params_t tracerParams = { &hModule, &pGlobalName, &pSize, &pptr }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnModuleGetGlobalPointerCb_t, Module, pfnGetGlobalPointerCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Module.pfnGetGlobalPointer, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phModule, *tracerParams.ppGlobalName, *tracerParams.ppSize, *tracerParams.ppptr); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetKernelNames __zedlllocal ze_result_t ZE_APICALL zeModuleGetKernelNames( ze_module_handle_t hModule, ///< [in] handle of the module uint32_t* pCount, ///< [in,out] pointer to the number of names. ///< if count is zero, then the driver shall update the value with the ///< total number of names available. ///< if count is greater than the number of names available, then the ///< driver shall update the value with the correct number of names available. const char** pNames ///< [in,out][optional][range(0, *pCount)] array of names of functions. ///< if count is less than the number of names available, then driver shall ///< only retrieve that number of names. ) { auto pfnGetKernelNames = context.zeDdiTable.Module.pfnGetKernelNames; if( nullptr == pfnGetKernelNames) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Module.pfnGetKernelNames, hModule, pCount, pNames); // capture parameters ze_module_get_kernel_names_params_t tracerParams = { &hModule, &pCount, &pNames }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnModuleGetKernelNamesCb_t, Module, pfnGetKernelNamesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Module.pfnGetKernelNames, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phModule, *tracerParams.ppCount, *tracerParams.ppNames); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetProperties __zedlllocal ze_result_t ZE_APICALL zeModuleGetProperties( ze_module_handle_t hModule, ///< [in] handle of the module ze_module_properties_t* pModuleProperties ///< [in,out] query result for module properties. ) { auto pfnGetProperties = context.zeDdiTable.Module.pfnGetProperties; if( nullptr == pfnGetProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Module.pfnGetProperties, hModule, pModuleProperties); // capture parameters ze_module_get_properties_params_t tracerParams = { &hModule, &pModuleProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnModuleGetPropertiesCb_t, Module, pfnGetPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Module.pfnGetProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phModule, *tracerParams.ppModuleProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelCreate __zedlllocal ze_result_t ZE_APICALL zeKernelCreate( ze_module_handle_t hModule, ///< [in] handle of the module const ze_kernel_desc_t* desc, ///< [in] pointer to kernel descriptor ze_kernel_handle_t* phKernel ///< [out] handle of the Function object ) { auto pfnCreate = context.zeDdiTable.Kernel.pfnCreate; if( nullptr == pfnCreate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Kernel.pfnCreate, hModule, desc, phKernel); // capture parameters ze_kernel_create_params_t tracerParams = { &hModule, &desc, &phKernel }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelCreateCb_t, Kernel, pfnCreateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Kernel.pfnCreate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phModule, *tracerParams.pdesc, *tracerParams.pphKernel); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelDestroy __zedlllocal ze_result_t ZE_APICALL zeKernelDestroy( ze_kernel_handle_t hKernel ///< [in][release] handle of the kernel object ) { auto pfnDestroy = context.zeDdiTable.Kernel.pfnDestroy; if( nullptr == pfnDestroy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Kernel.pfnDestroy, hKernel); // capture parameters ze_kernel_destroy_params_t tracerParams = { &hKernel }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelDestroyCb_t, Kernel, pfnDestroyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Kernel.pfnDestroy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetFunctionPointer __zedlllocal ze_result_t ZE_APICALL zeModuleGetFunctionPointer( ze_module_handle_t hModule, ///< [in] handle of the module const char* pFunctionName, ///< [in] Name of function to retrieve function pointer for. void** pfnFunction ///< [out] pointer to function. ) { auto pfnGetFunctionPointer = context.zeDdiTable.Module.pfnGetFunctionPointer; if( nullptr == pfnGetFunctionPointer) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Module.pfnGetFunctionPointer, hModule, pFunctionName, pfnFunction); // capture parameters ze_module_get_function_pointer_params_t tracerParams = { &hModule, &pFunctionName, &pfnFunction }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnModuleGetFunctionPointerCb_t, Module, pfnGetFunctionPointerCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Module.pfnGetFunctionPointer, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phModule, *tracerParams.ppFunctionName, *tracerParams.ppfnFunction); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetGroupSize __zedlllocal ze_result_t ZE_APICALL zeKernelSetGroupSize( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t groupSizeX, ///< [in] group size for X dimension to use for this kernel uint32_t groupSizeY, ///< [in] group size for Y dimension to use for this kernel uint32_t groupSizeZ ///< [in] group size for Z dimension to use for this kernel ) { auto pfnSetGroupSize = context.zeDdiTable.Kernel.pfnSetGroupSize; if( nullptr == pfnSetGroupSize) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Kernel.pfnSetGroupSize, hKernel, groupSizeX, groupSizeY, groupSizeZ); // capture parameters ze_kernel_set_group_size_params_t tracerParams = { &hKernel, &groupSizeX, &groupSizeY, &groupSizeZ }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelSetGroupSizeCb_t, Kernel, pfnSetGroupSizeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Kernel.pfnSetGroupSize, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.pgroupSizeX, *tracerParams.pgroupSizeY, *tracerParams.pgroupSizeZ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSuggestGroupSize __zedlllocal ze_result_t ZE_APICALL zeKernelSuggestGroupSize( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t globalSizeX, ///< [in] global width for X dimension uint32_t globalSizeY, ///< [in] global width for Y dimension uint32_t globalSizeZ, ///< [in] global width for Z dimension uint32_t* groupSizeX, ///< [out] recommended size of group for X dimension uint32_t* groupSizeY, ///< [out] recommended size of group for Y dimension uint32_t* groupSizeZ ///< [out] recommended size of group for Z dimension ) { auto pfnSuggestGroupSize = context.zeDdiTable.Kernel.pfnSuggestGroupSize; if( nullptr == pfnSuggestGroupSize) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Kernel.pfnSuggestGroupSize, hKernel, globalSizeX, globalSizeY, globalSizeZ, groupSizeX, groupSizeY, groupSizeZ); // capture parameters ze_kernel_suggest_group_size_params_t tracerParams = { &hKernel, &globalSizeX, &globalSizeY, &globalSizeZ, &groupSizeX, &groupSizeY, &groupSizeZ }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelSuggestGroupSizeCb_t, Kernel, pfnSuggestGroupSizeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Kernel.pfnSuggestGroupSize, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.pglobalSizeX, *tracerParams.pglobalSizeY, *tracerParams.pglobalSizeZ, *tracerParams.pgroupSizeX, *tracerParams.pgroupSizeY, *tracerParams.pgroupSizeZ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSuggestMaxCooperativeGroupCount __zedlllocal ze_result_t ZE_APICALL zeKernelSuggestMaxCooperativeGroupCount( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* totalGroupCount ///< [out] recommended total group count. ) { auto pfnSuggestMaxCooperativeGroupCount = context.zeDdiTable.Kernel.pfnSuggestMaxCooperativeGroupCount; if( nullptr == pfnSuggestMaxCooperativeGroupCount) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Kernel.pfnSuggestMaxCooperativeGroupCount, hKernel, totalGroupCount); // capture parameters ze_kernel_suggest_max_cooperative_group_count_params_t tracerParams = { &hKernel, &totalGroupCount }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelSuggestMaxCooperativeGroupCountCb_t, Kernel, pfnSuggestMaxCooperativeGroupCountCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Kernel.pfnSuggestMaxCooperativeGroupCount, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.ptotalGroupCount); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetArgumentValue __zedlllocal ze_result_t ZE_APICALL zeKernelSetArgumentValue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t argIndex, ///< [in] argument index in range [0, num args - 1] size_t argSize, ///< [in] size of argument type const void* pArgValue ///< [in][optional] argument value represented as matching arg type. If ///< null then argument value is considered null. ) { auto pfnSetArgumentValue = context.zeDdiTable.Kernel.pfnSetArgumentValue; if( nullptr == pfnSetArgumentValue) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Kernel.pfnSetArgumentValue, hKernel, argIndex, argSize, pArgValue); // capture parameters ze_kernel_set_argument_value_params_t tracerParams = { &hKernel, &argIndex, &argSize, &pArgValue }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelSetArgumentValueCb_t, Kernel, pfnSetArgumentValueCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Kernel.pfnSetArgumentValue, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.pargIndex, *tracerParams.pargSize, *tracerParams.ppArgValue); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetIndirectAccess __zedlllocal ze_result_t ZE_APICALL zeKernelSetIndirectAccess( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t flags ///< [in] kernel indirect access flags ) { auto pfnSetIndirectAccess = context.zeDdiTable.Kernel.pfnSetIndirectAccess; if( nullptr == pfnSetIndirectAccess) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Kernel.pfnSetIndirectAccess, hKernel, flags); // capture parameters ze_kernel_set_indirect_access_params_t tracerParams = { &hKernel, &flags }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelSetIndirectAccessCb_t, Kernel, pfnSetIndirectAccessCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Kernel.pfnSetIndirectAccess, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.pflags); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetIndirectAccess __zedlllocal ze_result_t ZE_APICALL zeKernelGetIndirectAccess( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t* pFlags ///< [out] query result for kernel indirect access flags. ) { auto pfnGetIndirectAccess = context.zeDdiTable.Kernel.pfnGetIndirectAccess; if( nullptr == pfnGetIndirectAccess) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Kernel.pfnGetIndirectAccess, hKernel, pFlags); // capture parameters ze_kernel_get_indirect_access_params_t tracerParams = { &hKernel, &pFlags }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelGetIndirectAccessCb_t, Kernel, pfnGetIndirectAccessCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Kernel.pfnGetIndirectAccess, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.ppFlags); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetSourceAttributes __zedlllocal ze_result_t ZE_APICALL zeKernelGetSourceAttributes( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* pSize, ///< [in,out] pointer to size of string in bytes, including ///< null-terminating character. char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including ///< a null-terminating character, is returned in pSize. ///< Otherwise, pString must point to valid application memory that is ///< greater than or equal to *pSize bytes in length, and on return the ///< pointed-to string will contain a space-separated list of kernel source attributes. ) { auto pfnGetSourceAttributes = context.zeDdiTable.Kernel.pfnGetSourceAttributes; if( nullptr == pfnGetSourceAttributes) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Kernel.pfnGetSourceAttributes, hKernel, pSize, pString); // capture parameters ze_kernel_get_source_attributes_params_t tracerParams = { &hKernel, &pSize, &pString }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelGetSourceAttributesCb_t, Kernel, pfnGetSourceAttributesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Kernel.pfnGetSourceAttributes, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.ppSize, *tracerParams.ppString); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetCacheConfig __zedlllocal ze_result_t ZE_APICALL zeKernelSetCacheConfig( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_cache_config_flags_t flags ///< [in] cache configuration. ///< must be 0 (default configuration) or a valid combination of ::ze_cache_config_flag_t. ) { auto pfnSetCacheConfig = context.zeDdiTable.Kernel.pfnSetCacheConfig; if( nullptr == pfnSetCacheConfig) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Kernel.pfnSetCacheConfig, hKernel, flags); // capture parameters ze_kernel_set_cache_config_params_t tracerParams = { &hKernel, &flags }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelSetCacheConfigCb_t, Kernel, pfnSetCacheConfigCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Kernel.pfnSetCacheConfig, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.pflags); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetProperties __zedlllocal ze_result_t ZE_APICALL zeKernelGetProperties( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_properties_t* pKernelProperties ///< [in,out] query result for kernel properties. ) { auto pfnGetProperties = context.zeDdiTable.Kernel.pfnGetProperties; if( nullptr == pfnGetProperties) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Kernel.pfnGetProperties, hKernel, pKernelProperties); // capture parameters ze_kernel_get_properties_params_t tracerParams = { &hKernel, &pKernelProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelGetPropertiesCb_t, Kernel, pfnGetPropertiesCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Kernel.pfnGetProperties, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.ppKernelProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetName __zedlllocal ze_result_t ZE_APICALL zeKernelGetName( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object size_t* pSize, ///< [in,out] size of kernel name string, including null terminator, in ///< bytes. char* pName ///< [in,out][optional] char pointer to kernel name. ) { auto pfnGetName = context.zeDdiTable.Kernel.pfnGetName; if( nullptr == pfnGetName) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Kernel.pfnGetName, hKernel, pSize, pName); // capture parameters ze_kernel_get_name_params_t tracerParams = { &hKernel, &pSize, &pName }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelGetNameCb_t, Kernel, pfnGetNameCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Kernel.pfnGetName, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.ppSize, *tracerParams.ppName); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchKernel __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchKernel( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendLaunchKernel = context.zeDdiTable.CommandList.pfnAppendLaunchKernel; if( nullptr == pfnAppendLaunchKernel) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendLaunchKernel, hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_launch_kernel_params_t tracerParams = { &hCommandList, &hKernel, &pLaunchFuncArgs, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendLaunchKernelCb_t, CommandList, pfnAppendLaunchKernelCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendLaunchKernel, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.phKernel, *tracerParams.ppLaunchFuncArgs, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchCooperativeKernel __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchCooperativeKernel( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendLaunchCooperativeKernel = context.zeDdiTable.CommandList.pfnAppendLaunchCooperativeKernel; if( nullptr == pfnAppendLaunchCooperativeKernel) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendLaunchCooperativeKernel, hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_launch_cooperative_kernel_params_t tracerParams = { &hCommandList, &hKernel, &pLaunchFuncArgs, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendLaunchCooperativeKernelCb_t, CommandList, pfnAppendLaunchCooperativeKernelCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendLaunchCooperativeKernel, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.phKernel, *tracerParams.ppLaunchFuncArgs, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchKernelIndirect __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchKernelIndirect( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in] pointer to device buffer that will contain thread group launch ///< arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendLaunchKernelIndirect = context.zeDdiTable.CommandList.pfnAppendLaunchKernelIndirect; if( nullptr == pfnAppendLaunchKernelIndirect) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendLaunchKernelIndirect, hCommandList, hKernel, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_launch_kernel_indirect_params_t tracerParams = { &hCommandList, &hKernel, &pLaunchArgumentsBuffer, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendLaunchKernelIndirectCb_t, CommandList, pfnAppendLaunchKernelIndirectCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendLaunchKernelIndirect, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.phKernel, *tracerParams.ppLaunchArgumentsBuffer, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchMultipleKernelsIndirect __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchMultipleKernelsIndirect( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] maximum number of kernels to launch ze_kernel_handle_t* phKernels, ///< [in][range(0, numKernels)] handles of the kernel objects const uint32_t* pCountBuffer, ///< [in] pointer to device memory location that will contain the actual ///< number of kernels to launch; value must be less than or equal to ///< numKernels const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in][range(0, numKernels)] pointer to device buffer that will contain ///< a contiguous array of thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendLaunchMultipleKernelsIndirect = context.zeDdiTable.CommandList.pfnAppendLaunchMultipleKernelsIndirect; if( nullptr == pfnAppendLaunchMultipleKernelsIndirect) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendLaunchMultipleKernelsIndirect, hCommandList, numKernels, phKernels, pCountBuffer, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_launch_multiple_kernels_indirect_params_t tracerParams = { &hCommandList, &numKernels, &phKernels, &pCountBuffer, &pLaunchArgumentsBuffer, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendLaunchMultipleKernelsIndirectCb_t, CommandList, pfnAppendLaunchMultipleKernelsIndirectCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendLaunchMultipleKernelsIndirect, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pnumKernels, *tracerParams.pphKernels, *tracerParams.ppCountBuffer, *tracerParams.ppLaunchArgumentsBuffer, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextMakeMemoryResident __zedlllocal ze_result_t ZE_APICALL zeContextMakeMemoryResident( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to make resident size_t size ///< [in] size in bytes to make resident ) { auto pfnMakeMemoryResident = context.zeDdiTable.Context.pfnMakeMemoryResident; if( nullptr == pfnMakeMemoryResident) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Context.pfnMakeMemoryResident, hContext, hDevice, ptr, size); // capture parameters ze_context_make_memory_resident_params_t tracerParams = { &hContext, &hDevice, &ptr, &size }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnContextMakeMemoryResidentCb_t, Context, pfnMakeMemoryResidentCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Context.pfnMakeMemoryResident, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pptr, *tracerParams.psize); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextEvictMemory __zedlllocal ze_result_t ZE_APICALL zeContextEvictMemory( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to evict size_t size ///< [in] size in bytes to evict ) { auto pfnEvictMemory = context.zeDdiTable.Context.pfnEvictMemory; if( nullptr == pfnEvictMemory) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Context.pfnEvictMemory, hContext, hDevice, ptr, size); // capture parameters ze_context_evict_memory_params_t tracerParams = { &hContext, &hDevice, &ptr, &size }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnContextEvictMemoryCb_t, Context, pfnEvictMemoryCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Context.pfnEvictMemory, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pptr, *tracerParams.psize); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextMakeImageResident __zedlllocal ze_result_t ZE_APICALL zeContextMakeImageResident( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make resident ) { auto pfnMakeImageResident = context.zeDdiTable.Context.pfnMakeImageResident; if( nullptr == pfnMakeImageResident) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Context.pfnMakeImageResident, hContext, hDevice, hImage); // capture parameters ze_context_make_image_resident_params_t tracerParams = { &hContext, &hDevice, &hImage }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnContextMakeImageResidentCb_t, Context, pfnMakeImageResidentCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Context.pfnMakeImageResident, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.phImage); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextEvictImage __zedlllocal ze_result_t ZE_APICALL zeContextEvictImage( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make evict ) { auto pfnEvictImage = context.zeDdiTable.Context.pfnEvictImage; if( nullptr == pfnEvictImage) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Context.pfnEvictImage, hContext, hDevice, hImage); // capture parameters ze_context_evict_image_params_t tracerParams = { &hContext, &hDevice, &hImage }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnContextEvictImageCb_t, Context, pfnEvictImageCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Context.pfnEvictImage, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.phImage); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeSamplerCreate __zedlllocal ze_result_t ZE_APICALL zeSamplerCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_sampler_desc_t* desc, ///< [in] pointer to sampler descriptor ze_sampler_handle_t* phSampler ///< [out] handle of the sampler ) { auto pfnCreate = context.zeDdiTable.Sampler.pfnCreate; if( nullptr == pfnCreate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Sampler.pfnCreate, hContext, hDevice, desc, phSampler); // capture parameters ze_sampler_create_params_t tracerParams = { &hContext, &hDevice, &desc, &phSampler }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnSamplerCreateCb_t, Sampler, pfnCreateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Sampler.pfnCreate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.pphSampler); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeSamplerDestroy __zedlllocal ze_result_t ZE_APICALL zeSamplerDestroy( ze_sampler_handle_t hSampler ///< [in][release] handle of the sampler ) { auto pfnDestroy = context.zeDdiTable.Sampler.pfnDestroy; if( nullptr == pfnDestroy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Sampler.pfnDestroy, hSampler); // capture parameters ze_sampler_destroy_params_t tracerParams = { &hSampler }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnSamplerDestroyCb_t, Sampler, pfnDestroyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Sampler.pfnDestroy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phSampler); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemReserve __zedlllocal ze_result_t ZE_APICALL zeVirtualMemReserve( ze_context_handle_t hContext, ///< [in] handle of the context object const void* pStart, ///< [in][optional] pointer to start of region to reserve. If nullptr then ///< implementation will choose a start address. size_t size, ///< [in] size in bytes to reserve; must be page aligned. void** pptr ///< [out] pointer to virtual reservation. ) { auto pfnReserve = context.zeDdiTable.VirtualMem.pfnReserve; if( nullptr == pfnReserve) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.VirtualMem.pfnReserve, hContext, pStart, size, pptr); // capture parameters ze_virtual_mem_reserve_params_t tracerParams = { &hContext, &pStart, &size, &pptr }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnVirtualMemReserveCb_t, VirtualMem, pfnReserveCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.VirtualMem.pfnReserve, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.ppStart, *tracerParams.psize, *tracerParams.ppptr); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemFree __zedlllocal ze_result_t ZE_APICALL zeVirtualMemFree( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to free. size_t size ///< [in] size in bytes to free; must be page aligned. ) { auto pfnFree = context.zeDdiTable.VirtualMem.pfnFree; if( nullptr == pfnFree) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.VirtualMem.pfnFree, hContext, ptr, size); // capture parameters ze_virtual_mem_free_params_t tracerParams = { &hContext, &ptr, &size }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnVirtualMemFreeCb_t, VirtualMem, pfnFreeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.VirtualMem.pfnFree, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pptr, *tracerParams.psize); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemQueryPageSize __zedlllocal ze_result_t ZE_APICALL zeVirtualMemQueryPageSize( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] unaligned allocation size in bytes size_t* pagesize ///< [out] pointer to page size to use for start address and size ///< alignments. ) { auto pfnQueryPageSize = context.zeDdiTable.VirtualMem.pfnQueryPageSize; if( nullptr == pfnQueryPageSize) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.VirtualMem.pfnQueryPageSize, hContext, hDevice, size, pagesize); // capture parameters ze_virtual_mem_query_page_size_params_t tracerParams = { &hContext, &hDevice, &size, &pagesize }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnVirtualMemQueryPageSizeCb_t, VirtualMem, pfnQueryPageSizeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.VirtualMem.pfnQueryPageSize, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.psize, *tracerParams.ppagesize); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zePhysicalMemCreate __zedlllocal ze_result_t ZE_APICALL zePhysicalMemCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) { auto pfnCreate = context.zeDdiTable.PhysicalMem.pfnCreate; if( nullptr == pfnCreate) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.PhysicalMem.pfnCreate, hContext, hDevice, desc, phPhysicalMemory); // capture parameters ze_physical_mem_create_params_t tracerParams = { &hContext, &hDevice, &desc, &phPhysicalMemory }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnPhysicalMemCreateCb_t, PhysicalMem, pfnCreateCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.PhysicalMem.pfnCreate, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.pphPhysicalMemory); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zePhysicalMemDestroy __zedlllocal ze_result_t ZE_APICALL zePhysicalMemDestroy( ze_context_handle_t hContext, ///< [in] handle of the context object ze_physical_mem_handle_t hPhysicalMemory ///< [in][release] handle of physical memory object to destroy ) { auto pfnDestroy = context.zeDdiTable.PhysicalMem.pfnDestroy; if( nullptr == pfnDestroy) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.PhysicalMem.pfnDestroy, hContext, hPhysicalMemory); // capture parameters ze_physical_mem_destroy_params_t tracerParams = { &hContext, &hPhysicalMemory }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnPhysicalMemDestroyCb_t, PhysicalMem, pfnDestroyCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.PhysicalMem.pfnDestroy, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phPhysicalMemory); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemMap __zedlllocal ze_result_t ZE_APICALL zeVirtualMemMap( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address range to map. size_t size, ///< [in] size in bytes of virtual address range to map; must be page ///< aligned. ze_physical_mem_handle_t hPhysicalMemory, ///< [in] handle to physical memory object. size_t offset, ///< [in] offset into physical memory allocation object; must be page ///< aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { auto pfnMap = context.zeDdiTable.VirtualMem.pfnMap; if( nullptr == pfnMap) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.VirtualMem.pfnMap, hContext, ptr, size, hPhysicalMemory, offset, access); // capture parameters ze_virtual_mem_map_params_t tracerParams = { &hContext, &ptr, &size, &hPhysicalMemory, &offset, &access }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnVirtualMemMapCb_t, VirtualMem, pfnMapCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.VirtualMem.pfnMap, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pptr, *tracerParams.psize, *tracerParams.phPhysicalMemory, *tracerParams.poffset, *tracerParams.paccess); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemUnmap __zedlllocal ze_result_t ZE_APICALL zeVirtualMemUnmap( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to unmap. size_t size ///< [in] size in bytes to unmap; must be page aligned. ) { auto pfnUnmap = context.zeDdiTable.VirtualMem.pfnUnmap; if( nullptr == pfnUnmap) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.VirtualMem.pfnUnmap, hContext, ptr, size); // capture parameters ze_virtual_mem_unmap_params_t tracerParams = { &hContext, &ptr, &size }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnVirtualMemUnmapCb_t, VirtualMem, pfnUnmapCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.VirtualMem.pfnUnmap, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pptr, *tracerParams.psize); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemSetAccessAttribute __zedlllocal ze_result_t ZE_APICALL zeVirtualMemSetAccessAttribute( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of reserved virtual address region. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { auto pfnSetAccessAttribute = context.zeDdiTable.VirtualMem.pfnSetAccessAttribute; if( nullptr == pfnSetAccessAttribute) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.VirtualMem.pfnSetAccessAttribute, hContext, ptr, size, access); // capture parameters ze_virtual_mem_set_access_attribute_params_t tracerParams = { &hContext, &ptr, &size, &access }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnVirtualMemSetAccessAttributeCb_t, VirtualMem, pfnSetAccessAttributeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.VirtualMem.pfnSetAccessAttribute, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pptr, *tracerParams.psize, *tracerParams.paccess); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemGetAccessAttribute __zedlllocal ze_result_t ZE_APICALL zeVirtualMemGetAccessAttribute( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address region for query. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t* access, ///< [out] query result for page access attribute. size_t* outSize ///< [out] query result for size of virtual address range, starting at ptr, ///< that shares same access attribute. ) { auto pfnGetAccessAttribute = context.zeDdiTable.VirtualMem.pfnGetAccessAttribute; if( nullptr == pfnGetAccessAttribute) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.VirtualMem.pfnGetAccessAttribute, hContext, ptr, size, access, outSize); // capture parameters ze_virtual_mem_get_access_attribute_params_t tracerParams = { &hContext, &ptr, &size, &access, &outSize }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnVirtualMemGetAccessAttributeCb_t, VirtualMem, pfnGetAccessAttributeCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.VirtualMem.pfnGetAccessAttribute, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.pptr, *tracerParams.psize, *tracerParams.paccess, *tracerParams.poutSize); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetGlobalOffsetExp __zedlllocal ze_result_t ZE_APICALL zeKernelSetGlobalOffsetExp( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t offsetX, ///< [in] global offset for X dimension to use for this kernel uint32_t offsetY, ///< [in] global offset for Y dimension to use for this kernel uint32_t offsetZ ///< [in] global offset for Z dimension to use for this kernel ) { auto pfnSetGlobalOffsetExp = context.zeDdiTable.KernelExp.pfnSetGlobalOffsetExp; if( nullptr == pfnSetGlobalOffsetExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.KernelExp.pfnSetGlobalOffsetExp, hKernel, offsetX, offsetY, offsetZ); // capture parameters ze_kernel_set_global_offset_exp_params_t tracerParams = { &hKernel, &offsetX, &offsetY, &offsetZ }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelSetGlobalOffsetExpCb_t, Kernel, pfnSetGlobalOffsetExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.KernelExp.pfnSetGlobalOffsetExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.poffsetX, *tracerParams.poffsetY, *tracerParams.poffsetZ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetBinaryExp __zedlllocal ze_result_t ZE_APICALL zeKernelGetBinaryExp( ze_kernel_handle_t hKernel, ///< [in] Kernel handle. size_t* pSize, ///< [in,out] pointer to variable with size of GEN ISA binary. uint8_t* pKernelBinary ///< [in,out] pointer to storage area for GEN ISA binary function. ) { auto pfnGetBinaryExp = context.zeDdiTable.KernelExp.pfnGetBinaryExp; if( nullptr == pfnGetBinaryExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.KernelExp.pfnGetBinaryExp, hKernel, pSize, pKernelBinary); // capture parameters ze_kernel_get_binary_exp_params_t tracerParams = { &hKernel, &pSize, &pKernelBinary }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelGetBinaryExpCb_t, Kernel, pfnGetBinaryExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.KernelExp.pfnGetBinaryExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.ppSize, *tracerParams.ppKernelBinary); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceImportExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeDeviceImportExternalSemaphoreExt( ze_device_handle_t hDevice, ///< [in] The device handle. const ze_external_semaphore_ext_desc_t* desc, ///< [in] The pointer to external semaphore descriptor. ze_external_semaphore_ext_handle_t* phSemaphore ///< [out] The handle of the external semaphore imported. ) { auto pfnImportExternalSemaphoreExt = context.zeDdiTable.Device.pfnImportExternalSemaphoreExt; if( nullptr == pfnImportExternalSemaphoreExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnImportExternalSemaphoreExt, hDevice, desc, phSemaphore); // capture parameters ze_device_import_external_semaphore_ext_params_t tracerParams = { &hDevice, &desc, &phSemaphore }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceImportExternalSemaphoreExtCb_t, Device, pfnImportExternalSemaphoreExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnImportExternalSemaphoreExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.pphSemaphore); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceReleaseExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeDeviceReleaseExternalSemaphoreExt( ze_external_semaphore_ext_handle_t hSemaphore ///< [in] The handle of the external semaphore. ) { auto pfnReleaseExternalSemaphoreExt = context.zeDdiTable.Device.pfnReleaseExternalSemaphoreExt; if( nullptr == pfnReleaseExternalSemaphoreExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnReleaseExternalSemaphoreExt, hSemaphore); // capture parameters ze_device_release_external_semaphore_ext_params_t tracerParams = { &hSemaphore }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceReleaseExternalSemaphoreExtCb_t, Device, pfnReleaseExternalSemaphoreExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnReleaseExternalSemaphoreExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phSemaphore); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendSignalExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendSignalExternalSemaphoreExt( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in][range(0, numSemaphores)] The vector of external semaphore handles ///< to be appended into command list. ze_external_semaphore_signal_params_ext_t* signalParams,///< [in] Signal parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendSignalExternalSemaphoreExt = context.zeDdiTable.CommandList.pfnAppendSignalExternalSemaphoreExt; if( nullptr == pfnAppendSignalExternalSemaphoreExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendSignalExternalSemaphoreExt, hCommandList, numSemaphores, phSemaphores, signalParams, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_signal_external_semaphore_ext_params_t tracerParams = { &hCommandList, &numSemaphores, &phSemaphores, &signalParams, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendSignalExternalSemaphoreExtCb_t, CommandList, pfnAppendSignalExternalSemaphoreExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendSignalExternalSemaphoreExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pnumSemaphores, *tracerParams.pphSemaphores, *tracerParams.psignalParams, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendWaitExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendWaitExternalSemaphoreExt( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in] [range(0,numSemaphores)] The vector of external semaphore handles ///< to append into command list. ze_external_semaphore_wait_params_ext_t* waitParams,///< [in] Wait parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendWaitExternalSemaphoreExt = context.zeDdiTable.CommandList.pfnAppendWaitExternalSemaphoreExt; if( nullptr == pfnAppendWaitExternalSemaphoreExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendWaitExternalSemaphoreExt, hCommandList, numSemaphores, phSemaphores, waitParams, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_wait_external_semaphore_ext_params_t tracerParams = { &hCommandList, &numSemaphores, &phSemaphores, &waitParams, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendWaitExternalSemaphoreExtCb_t, CommandList, pfnAppendWaitExternalSemaphoreExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendWaitExternalSemaphoreExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pnumSemaphores, *tracerParams.pphSemaphores, *tracerParams.pwaitParams, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceReserveCacheExt __zedlllocal ze_result_t ZE_APICALL zeDeviceReserveCacheExt( ze_device_handle_t hDevice, ///< [in] handle of the device object size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the ///< driver shall default to last level of cache and attempt to reserve in ///< that cache. size_t cacheReservationSize ///< [in] value for reserving size, in bytes. If zero, then the driver ///< shall remove prior reservation ) { auto pfnReserveCacheExt = context.zeDdiTable.Device.pfnReserveCacheExt; if( nullptr == pfnReserveCacheExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnReserveCacheExt, hDevice, cacheLevel, cacheReservationSize); // capture parameters ze_device_reserve_cache_ext_params_t tracerParams = { &hDevice, &cacheLevel, &cacheReservationSize }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceReserveCacheExtCb_t, Device, pfnReserveCacheExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnReserveCacheExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.pcacheLevel, *tracerParams.pcacheReservationSize); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceSetCacheAdviceExt __zedlllocal ze_result_t ZE_APICALL zeDeviceSetCacheAdviceExt( ze_device_handle_t hDevice, ///< [in] handle of the device object void* ptr, ///< [in] memory pointer to query size_t regionSize, ///< [in] region size, in pages ze_cache_ext_region_t cacheRegion ///< [in] reservation region ) { auto pfnSetCacheAdviceExt = context.zeDdiTable.Device.pfnSetCacheAdviceExt; if( nullptr == pfnSetCacheAdviceExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnSetCacheAdviceExt, hDevice, ptr, regionSize, cacheRegion); // capture parameters ze_device_set_cache_advice_ext_params_t tracerParams = { &hDevice, &ptr, ®ionSize, &cacheRegion }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceSetCacheAdviceExtCb_t, Device, pfnSetCacheAdviceExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnSetCacheAdviceExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.pptr, *tracerParams.pregionSize, *tracerParams.pcacheRegion); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryTimestampsExp __zedlllocal ze_result_t ZE_APICALL zeEventQueryTimestampsExp( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of timestamp results. ///< if count is zero, then the driver shall update the value with the ///< total number of timestamps available. ///< if count is greater than the number of timestamps available, then the ///< driver shall update the value with the correct number of timestamps available. ze_kernel_timestamp_result_t* pTimestamps ///< [in,out][optional][range(0, *pCount)] array of timestamp results. ///< if count is less than the number of timestamps available, then driver ///< shall only retrieve that number of timestamps. ) { auto pfnQueryTimestampsExp = context.zeDdiTable.EventExp.pfnQueryTimestampsExp; if( nullptr == pfnQueryTimestampsExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.EventExp.pfnQueryTimestampsExp, hEvent, hDevice, pCount, pTimestamps); // capture parameters ze_event_query_timestamps_exp_params_t tracerParams = { &hEvent, &hDevice, &pCount, &pTimestamps }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventQueryTimestampsExpCb_t, Event, pfnQueryTimestampsExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.EventExp.pfnQueryTimestampsExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEvent, *tracerParams.phDevice, *tracerParams.ppCount, *tracerParams.ppTimestamps); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetMemoryPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeImageGetMemoryPropertiesExp( ze_image_handle_t hImage, ///< [in] handle of image object ze_image_memory_properties_exp_t* pMemoryProperties ///< [in,out] query result for image memory properties. ) { auto pfnGetMemoryPropertiesExp = context.zeDdiTable.ImageExp.pfnGetMemoryPropertiesExp; if( nullptr == pfnGetMemoryPropertiesExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.ImageExp.pfnGetMemoryPropertiesExp, hImage, pMemoryProperties); // capture parameters ze_image_get_memory_properties_exp_params_t tracerParams = { &hImage, &pMemoryProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnImageGetMemoryPropertiesExpCb_t, Image, pfnGetMemoryPropertiesExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.ImageExp.pfnGetMemoryPropertiesExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phImage, *tracerParams.ppMemoryProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageViewCreateExt __zedlllocal ze_result_t ZE_APICALL zeImageViewCreateExt( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { auto pfnViewCreateExt = context.zeDdiTable.Image.pfnViewCreateExt; if( nullptr == pfnViewCreateExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Image.pfnViewCreateExt, hContext, hDevice, desc, hImage, phImageView); // capture parameters ze_image_view_create_ext_params_t tracerParams = { &hContext, &hDevice, &desc, &hImage, &phImageView }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnImageViewCreateExtCb_t, Image, pfnViewCreateExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Image.pfnViewCreateExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.phImage, *tracerParams.pphImageView); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageViewCreateExp __zedlllocal ze_result_t ZE_APICALL zeImageViewCreateExp( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { auto pfnViewCreateExp = context.zeDdiTable.ImageExp.pfnViewCreateExp; if( nullptr == pfnViewCreateExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.ImageExp.pfnViewCreateExp, hContext, hDevice, desc, hImage, phImageView); // capture parameters ze_image_view_create_exp_params_t tracerParams = { &hContext, &hDevice, &desc, &hImage, &phImageView }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnImageViewCreateExpCb_t, Image, pfnViewCreateExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.ImageExp.pfnViewCreateExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pdesc, *tracerParams.phImage, *tracerParams.pphImageView); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSchedulingHintExp __zedlllocal ze_result_t ZE_APICALL zeKernelSchedulingHintExp( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_scheduling_hint_exp_desc_t* pHint ///< [in] pointer to kernel scheduling hint descriptor ) { auto pfnSchedulingHintExp = context.zeDdiTable.KernelExp.pfnSchedulingHintExp; if( nullptr == pfnSchedulingHintExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.KernelExp.pfnSchedulingHintExp, hKernel, pHint); // capture parameters ze_kernel_scheduling_hint_exp_params_t tracerParams = { &hKernel, &pHint }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnKernelSchedulingHintExpCb_t, Kernel, pfnSchedulingHintExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.KernelExp.pfnSchedulingHintExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phKernel, *tracerParams.ppHint); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDevicePciGetPropertiesExt __zedlllocal ze_result_t ZE_APICALL zeDevicePciGetPropertiesExt( ze_device_handle_t hDevice, ///< [in] handle of the device object. ze_pci_ext_properties_t* pPciProperties ///< [in,out] returns the PCI properties of the device. ) { auto pfnPciGetPropertiesExt = context.zeDdiTable.Device.pfnPciGetPropertiesExt; if( nullptr == pfnPciGetPropertiesExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Device.pfnPciGetPropertiesExt, hDevice, pPciProperties); // capture parameters ze_device_pci_get_properties_ext_params_t tracerParams = { &hDevice, &pPciProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDevicePciGetPropertiesExtCb_t, Device, pfnPciGetPropertiesExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Device.pfnPciGetPropertiesExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.ppPciProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyToMemoryExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemoryExt( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor uint32_t destRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being written uint32_t destSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being written ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendImageCopyToMemoryExt = context.zeDdiTable.CommandList.pfnAppendImageCopyToMemoryExt; if( nullptr == pfnAppendImageCopyToMemoryExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendImageCopyToMemoryExt, hCommandList, dstptr, hSrcImage, pSrcRegion, destRowPitch, destSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_image_copy_to_memory_ext_params_t tracerParams = { &hCommandList, &dstptr, &hSrcImage, &pSrcRegion, &destRowPitch, &destSlicePitch, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendImageCopyToMemoryExtCb_t, CommandList, pfnAppendImageCopyToMemoryExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendImageCopyToMemoryExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pdstptr, *tracerParams.phSrcImage, *tracerParams.ppSrcRegion, *tracerParams.pdestRowPitch, *tracerParams.pdestSlicePitch, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyFromMemoryExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyFromMemoryExt( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor uint32_t srcRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being read uint32_t srcSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being read ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnAppendImageCopyFromMemoryExt = context.zeDdiTable.CommandList.pfnAppendImageCopyFromMemoryExt; if( nullptr == pfnAppendImageCopyFromMemoryExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandList.pfnAppendImageCopyFromMemoryExt, hCommandList, hDstImage, srcptr, pDstRegion, srcRowPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_append_image_copy_from_memory_ext_params_t tracerParams = { &hCommandList, &hDstImage, &srcptr, &pDstRegion, &srcRowPitch, &srcSlicePitch, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListAppendImageCopyFromMemoryExtCb_t, CommandList, pfnAppendImageCopyFromMemoryExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandList.pfnAppendImageCopyFromMemoryExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.phDstImage, *tracerParams.psrcptr, *tracerParams.ppDstRegion, *tracerParams.psrcRowPitch, *tracerParams.psrcSlicePitch, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetAllocPropertiesExt __zedlllocal ze_result_t ZE_APICALL zeImageGetAllocPropertiesExt( ze_context_handle_t hContext, ///< [in] handle of the context object ze_image_handle_t hImage, ///< [in] handle of image object to query ze_image_allocation_ext_properties_t* pImageAllocProperties ///< [in,out] query result for image allocation properties ) { auto pfnGetAllocPropertiesExt = context.zeDdiTable.Image.pfnGetAllocPropertiesExt; if( nullptr == pfnGetAllocPropertiesExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Image.pfnGetAllocPropertiesExt, hContext, hImage, pImageAllocProperties); // capture parameters ze_image_get_alloc_properties_ext_params_t tracerParams = { &hContext, &hImage, &pImageAllocProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnImageGetAllocPropertiesExtCb_t, Image, pfnGetAllocPropertiesExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Image.pfnGetAllocPropertiesExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phImage, *tracerParams.ppImageAllocProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleInspectLinkageExt __zedlllocal ze_result_t ZE_APICALL zeModuleInspectLinkageExt( ze_linkage_inspection_ext_desc_t* pInspectDesc, ///< [in] pointer to linkage inspection descriptor structure. uint32_t numModules, ///< [in] number of modules to be inspected pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to be ///< inspected for import dependencies. ze_module_build_log_handle_t* phLog ///< [out] pointer to handle of linkage inspection log. Log object will ///< contain separate lists of imports, un-resolvable imports, and exports. ) { auto pfnInspectLinkageExt = context.zeDdiTable.Module.pfnInspectLinkageExt; if( nullptr == pfnInspectLinkageExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Module.pfnInspectLinkageExt, pInspectDesc, numModules, phModules, phLog); // capture parameters ze_module_inspect_linkage_ext_params_t tracerParams = { &pInspectDesc, &numModules, &phModules, &phLog }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnModuleInspectLinkageExtCb_t, Module, pfnInspectLinkageExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Module.pfnInspectLinkageExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.ppInspectDesc, *tracerParams.pnumModules, *tracerParams.pphModules, *tracerParams.pphLog); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemFreeExt __zedlllocal ze_result_t ZE_APICALL zeMemFreeExt( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_memory_free_ext_desc_t* pMemFreeDesc, ///< [in] pointer to memory free descriptor void* ptr ///< [in][release] pointer to memory to free ) { auto pfnFreeExt = context.zeDdiTable.Mem.pfnFreeExt; if( nullptr == pfnFreeExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Mem.pfnFreeExt, hContext, pMemFreeDesc, ptr); // capture parameters ze_mem_free_ext_params_t tracerParams = { &hContext, &pMemFreeDesc, &ptr }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemFreeExtCb_t, Mem, pfnFreeExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Mem.pfnFreeExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.ppMemFreeDesc, *tracerParams.pptr); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetExp( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric vertices available. ///< if count is greater than the number of fabric vertices available, then ///< the driver shall update the value with the correct number of fabric ///< vertices available. ze_fabric_vertex_handle_t* phVertices ///< [in,out][optional][range(0, *pCount)] array of handle of fabric vertices. ///< if count is less than the number of fabric vertices available, then ///< driver shall only retrieve that number of fabric vertices. ) { auto pfnGetExp = context.zeDdiTable.FabricVertexExp.pfnGetExp; if( nullptr == pfnGetExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.FabricVertexExp.pfnGetExp, hDriver, pCount, phVertices); // capture parameters ze_fabric_vertex_get_exp_params_t tracerParams = { &hDriver, &pCount, &phVertices }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnFabricVertexGetExpCb_t, FabricVertex, pfnGetExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.FabricVertexExp.pfnGetExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.ppCount, *tracerParams.pphVertices); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetSubVerticesExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetSubVerticesExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex object uint32_t* pCount, ///< [in,out] pointer to the number of sub-vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-vertices available. ///< if count is greater than the number of sub-vertices available, then ///< the driver shall update the value with the correct number of ///< sub-vertices available. ze_fabric_vertex_handle_t* phSubvertices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-vertices. ///< if count is less than the number of sub-vertices available, then ///< driver shall only retrieve that number of sub-vertices. ) { auto pfnGetSubVerticesExp = context.zeDdiTable.FabricVertexExp.pfnGetSubVerticesExp; if( nullptr == pfnGetSubVerticesExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.FabricVertexExp.pfnGetSubVerticesExp, hVertex, pCount, phSubvertices); // capture parameters ze_fabric_vertex_get_sub_vertices_exp_params_t tracerParams = { &hVertex, &pCount, &phSubvertices }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnFabricVertexGetSubVerticesExpCb_t, FabricVertex, pfnGetSubVerticesExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.FabricVertexExp.pfnGetSubVerticesExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phVertex, *tracerParams.ppCount, *tracerParams.pphSubvertices); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetPropertiesExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_fabric_vertex_exp_properties_t* pVertexProperties///< [in,out] query result for fabric vertex properties ) { auto pfnGetPropertiesExp = context.zeDdiTable.FabricVertexExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.FabricVertexExp.pfnGetPropertiesExp, hVertex, pVertexProperties); // capture parameters ze_fabric_vertex_get_properties_exp_params_t tracerParams = { &hVertex, &pVertexProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnFabricVertexGetPropertiesExpCb_t, FabricVertex, pfnGetPropertiesExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.FabricVertexExp.pfnGetPropertiesExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phVertex, *tracerParams.ppVertexProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetDeviceExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetDeviceExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_device_handle_t* phDevice ///< [out] device handle corresponding to fabric vertex ) { auto pfnGetDeviceExp = context.zeDdiTable.FabricVertexExp.pfnGetDeviceExp; if( nullptr == pfnGetDeviceExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.FabricVertexExp.pfnGetDeviceExp, hVertex, phDevice); // capture parameters ze_fabric_vertex_get_device_exp_params_t tracerParams = { &hVertex, &phDevice }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnFabricVertexGetDeviceExpCb_t, FabricVertex, pfnGetDeviceExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.FabricVertexExp.pfnGetDeviceExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phVertex, *tracerParams.pphDevice); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetFabricVertexExp __zedlllocal ze_result_t ZE_APICALL zeDeviceGetFabricVertexExp( ze_device_handle_t hDevice, ///< [in] handle of the device ze_fabric_vertex_handle_t* phVertex ///< [out] fabric vertex handle corresponding to device ) { auto pfnGetFabricVertexExp = context.zeDdiTable.DeviceExp.pfnGetFabricVertexExp; if( nullptr == pfnGetFabricVertexExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.DeviceExp.pfnGetFabricVertexExp, hDevice, phVertex); // capture parameters ze_device_get_fabric_vertex_exp_params_t tracerParams = { &hDevice, &phVertex }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDeviceGetFabricVertexExpCb_t, Device, pfnGetFabricVertexExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.DeviceExp.pfnGetFabricVertexExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDevice, *tracerParams.pphVertex); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricEdgeGetExp __zedlllocal ze_result_t ZE_APICALL zeFabricEdgeGetExp( ze_fabric_vertex_handle_t hVertexA, ///< [in] handle of first fabric vertex instance ze_fabric_vertex_handle_t hVertexB, ///< [in] handle of second fabric vertex instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric edges. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric edges available. ///< if count is greater than the number of fabric edges available, then ///< the driver shall update the value with the correct number of fabric ///< edges available. ze_fabric_edge_handle_t* phEdges ///< [in,out][optional][range(0, *pCount)] array of handle of fabric edges. ///< if count is less than the number of fabric edges available, then ///< driver shall only retrieve that number of fabric edges. ) { auto pfnGetExp = context.zeDdiTable.FabricEdgeExp.pfnGetExp; if( nullptr == pfnGetExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.FabricEdgeExp.pfnGetExp, hVertexA, hVertexB, pCount, phEdges); // capture parameters ze_fabric_edge_get_exp_params_t tracerParams = { &hVertexA, &hVertexB, &pCount, &phEdges }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnFabricEdgeGetExpCb_t, FabricEdge, pfnGetExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.FabricEdgeExp.pfnGetExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phVertexA, *tracerParams.phVertexB, *tracerParams.ppCount, *tracerParams.pphEdges); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricEdgeGetVerticesExp __zedlllocal ze_result_t ZE_APICALL zeFabricEdgeGetVerticesExp( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge instance ze_fabric_vertex_handle_t* phVertexA, ///< [out] fabric vertex connected to one end of the given fabric edge. ze_fabric_vertex_handle_t* phVertexB ///< [out] fabric vertex connected to other end of the given fabric edge. ) { auto pfnGetVerticesExp = context.zeDdiTable.FabricEdgeExp.pfnGetVerticesExp; if( nullptr == pfnGetVerticesExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.FabricEdgeExp.pfnGetVerticesExp, hEdge, phVertexA, phVertexB); // capture parameters ze_fabric_edge_get_vertices_exp_params_t tracerParams = { &hEdge, &phVertexA, &phVertexB }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnFabricEdgeGetVerticesExpCb_t, FabricEdge, pfnGetVerticesExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.FabricEdgeExp.pfnGetVerticesExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEdge, *tracerParams.pphVertexA, *tracerParams.pphVertexB); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricEdgeGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeFabricEdgeGetPropertiesExp( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge ze_fabric_edge_exp_properties_t* pEdgeProperties///< [in,out] query result for fabric edge properties ) { auto pfnGetPropertiesExp = context.zeDdiTable.FabricEdgeExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.FabricEdgeExp.pfnGetPropertiesExp, hEdge, pEdgeProperties); // capture parameters ze_fabric_edge_get_properties_exp_params_t tracerParams = { &hEdge, &pEdgeProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnFabricEdgeGetPropertiesExpCb_t, FabricEdge, pfnGetPropertiesExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.FabricEdgeExp.pfnGetPropertiesExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEdge, *tracerParams.ppEdgeProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryKernelTimestampsExt __zedlllocal ze_result_t ZE_APICALL zeEventQueryKernelTimestampsExt( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of event packets available. ///< - This value is implementation specific. ///< - if `*pCount` is zero, then the driver shall update the value with ///< the total number of event packets available. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver shall update the value with the correct value. ///< - Buffer(s) for query results must be sized by the application to ///< accommodate a minimum of `*pCount` elements. ze_event_query_kernel_timestamps_results_ext_properties_t* pResults ///< [in,out][optional][range(0, *pCount)] pointer to event query ///< properties structure(s). ///< - This parameter may be null when `*pCount` is zero. ///< - if `*pCount` is less than the number of event packets available, ///< the driver may only update `*pCount` elements, starting at element zero. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver may only update the valid elements. ) { auto pfnQueryKernelTimestampsExt = context.zeDdiTable.Event.pfnQueryKernelTimestampsExt; if( nullptr == pfnQueryKernelTimestampsExt) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Event.pfnQueryKernelTimestampsExt, hEvent, hDevice, pCount, pResults); // capture parameters ze_event_query_kernel_timestamps_ext_params_t tracerParams = { &hEvent, &hDevice, &pCount, &pResults }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnEventQueryKernelTimestampsExtCb_t, Event, pfnQueryKernelTimestampsExtCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Event.pfnQueryKernelTimestampsExt, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phEvent, *tracerParams.phDevice, *tracerParams.ppCount, *tracerParams.ppResults); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderCreateExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderCreateExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object const ze_rtas_builder_exp_desc_t* pDescriptor, ///< [in] pointer to builder descriptor ze_rtas_builder_exp_handle_t* phBuilder ///< [out] handle of builder object ) { auto pfnCreateExp = context.zeDdiTable.RTASBuilderExp.pfnCreateExp; if( nullptr == pfnCreateExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASBuilderExp.pfnCreateExp, hDriver, pDescriptor, phBuilder); // capture parameters ze_rtas_builder_create_exp_params_t tracerParams = { &hDriver, &pDescriptor, &phBuilder }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASBuilderCreateExpCb_t, RTASBuilder, pfnCreateExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASBuilderExp.pfnCreateExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.ppDescriptor, *tracerParams.pphBuilder); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderGetBuildPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderGetBuildPropertiesExp( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor ze_rtas_builder_exp_properties_t* pProperties ///< [in,out] query result for builder properties ) { auto pfnGetBuildPropertiesExp = context.zeDdiTable.RTASBuilderExp.pfnGetBuildPropertiesExp; if( nullptr == pfnGetBuildPropertiesExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASBuilderExp.pfnGetBuildPropertiesExp, hBuilder, pBuildOpDescriptor, pProperties); // capture parameters ze_rtas_builder_get_build_properties_exp_params_t tracerParams = { &hBuilder, &pBuildOpDescriptor, &pProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASBuilderGetBuildPropertiesExpCb_t, RTASBuilder, pfnGetBuildPropertiesExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASBuilderExp.pfnGetBuildPropertiesExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phBuilder, *tracerParams.ppBuildOpDescriptor, *tracerParams.ppProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverRTASFormatCompatibilityCheckExp __zedlllocal ze_result_t ZE_APICALL zeDriverRTASFormatCompatibilityCheckExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_format_exp_t rtasFormatA, ///< [in] operand A ze_rtas_format_exp_t rtasFormatB ///< [in] operand B ) { auto pfnRTASFormatCompatibilityCheckExp = context.zeDdiTable.DriverExp.pfnRTASFormatCompatibilityCheckExp; if( nullptr == pfnRTASFormatCompatibilityCheckExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.DriverExp.pfnRTASFormatCompatibilityCheckExp, hDriver, rtasFormatA, rtasFormatB); // capture parameters ze_driver_rtas_format_compatibility_check_exp_params_t tracerParams = { &hDriver, &rtasFormatA, &rtasFormatB }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnDriverRTASFormatCompatibilityCheckExpCb_t, Driver, pfnRTASFormatCompatibilityCheckExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.DriverExp.pfnRTASFormatCompatibilityCheckExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.prtasFormatA, *tracerParams.prtasFormatB); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderBuildExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderBuildExp( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used ///< during acceleration structure construction size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes void* pRtasBuffer, ///< [in] pointer to destination buffer size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks ze_rtas_aabb_exp_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration ///< structure bounds size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in ///< bytes ) { auto pfnBuildExp = context.zeDdiTable.RTASBuilderExp.pfnBuildExp; if( nullptr == pfnBuildExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASBuilderExp.pfnBuildExp, hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes); // capture parameters ze_rtas_builder_build_exp_params_t tracerParams = { &hBuilder, &pBuildOpDescriptor, &pScratchBuffer, &scratchBufferSizeBytes, &pRtasBuffer, &rtasBufferSizeBytes, &hParallelOperation, &pBuildUserPtr, &pBounds, &pRtasBufferSizeBytes }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASBuilderBuildExpCb_t, RTASBuilder, pfnBuildExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASBuilderExp.pfnBuildExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phBuilder, *tracerParams.ppBuildOpDescriptor, *tracerParams.ppScratchBuffer, *tracerParams.pscratchBufferSizeBytes, *tracerParams.ppRtasBuffer, *tracerParams.prtasBufferSizeBytes, *tracerParams.phParallelOperation, *tracerParams.ppBuildUserPtr, *tracerParams.ppBounds, *tracerParams.ppRtasBufferSizeBytes); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderDestroyExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderDestroyExp( ze_rtas_builder_exp_handle_t hBuilder ///< [in][release] handle of builder object to destroy ) { auto pfnDestroyExp = context.zeDdiTable.RTASBuilderExp.pfnDestroyExp; if( nullptr == pfnDestroyExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASBuilderExp.pfnDestroyExp, hBuilder); // capture parameters ze_rtas_builder_destroy_exp_params_t tracerParams = { &hBuilder }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASBuilderDestroyExpCb_t, RTASBuilder, pfnDestroyExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASBuilderExp.pfnDestroyExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phBuilder); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationCreateExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationCreateExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_parallel_operation_exp_handle_t* phParallelOperation///< [out] handle of parallel operation object ) { auto pfnCreateExp = context.zeDdiTable.RTASParallelOperationExp.pfnCreateExp; if( nullptr == pfnCreateExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASParallelOperationExp.pfnCreateExp, hDriver, phParallelOperation); // capture parameters ze_rtas_parallel_operation_create_exp_params_t tracerParams = { &hDriver, &phParallelOperation }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASParallelOperationCreateExpCb_t, RTASParallelOperation, pfnCreateExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASParallelOperationExp.pfnCreateExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phDriver, *tracerParams.pphParallelOperation); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationGetPropertiesExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in] handle of parallel operation object ze_rtas_parallel_operation_exp_properties_t* pProperties///< [in,out] query result for parallel operation properties ) { auto pfnGetPropertiesExp = context.zeDdiTable.RTASParallelOperationExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASParallelOperationExp.pfnGetPropertiesExp, hParallelOperation, pProperties); // capture parameters ze_rtas_parallel_operation_get_properties_exp_params_t tracerParams = { &hParallelOperation, &pProperties }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASParallelOperationGetPropertiesExpCb_t, RTASParallelOperation, pfnGetPropertiesExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASParallelOperationExp.pfnGetPropertiesExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phParallelOperation, *tracerParams.ppProperties); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationJoinExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationJoinExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in] handle of parallel operation object ) { auto pfnJoinExp = context.zeDdiTable.RTASParallelOperationExp.pfnJoinExp; if( nullptr == pfnJoinExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASParallelOperationExp.pfnJoinExp, hParallelOperation); // capture parameters ze_rtas_parallel_operation_join_exp_params_t tracerParams = { &hParallelOperation }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASParallelOperationJoinExpCb_t, RTASParallelOperation, pfnJoinExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASParallelOperationExp.pfnJoinExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phParallelOperation); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationDestroyExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationDestroyExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy ) { auto pfnDestroyExp = context.zeDdiTable.RTASParallelOperationExp.pfnDestroyExp; if( nullptr == pfnDestroyExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.RTASParallelOperationExp.pfnDestroyExp, hParallelOperation); // capture parameters ze_rtas_parallel_operation_destroy_exp_params_t tracerParams = { &hParallelOperation }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnRTASParallelOperationDestroyExpCb_t, RTASParallelOperation, pfnDestroyExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.RTASParallelOperationExp.pfnDestroyExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phParallelOperation); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetPitchFor2dImage __zedlllocal ze_result_t ZE_APICALL zeMemGetPitchFor2dImage( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device size_t imageWidth, ///< [in] imageWidth size_t imageHeight, ///< [in] imageHeight unsigned int elementSizeInBytes, ///< [in] Element size in bytes size_t * rowPitch ///< [out] rowPitch ) { auto pfnGetPitchFor2dImage = context.zeDdiTable.Mem.pfnGetPitchFor2dImage; if( nullptr == pfnGetPitchFor2dImage) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.Mem.pfnGetPitchFor2dImage, hContext, hDevice, imageWidth, imageHeight, elementSizeInBytes, rowPitch); // capture parameters ze_mem_get_pitch_for2d_image_params_t tracerParams = { &hContext, &hDevice, &imageWidth, &imageHeight, &elementSizeInBytes, &rowPitch }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnMemGetPitchFor2dImageCb_t, Mem, pfnGetPitchFor2dImageCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.Mem.pfnGetPitchFor2dImage, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phContext, *tracerParams.phDevice, *tracerParams.pimageWidth, *tracerParams.pimageHeight, *tracerParams.pelementSizeInBytes, *tracerParams.prowPitch); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetDeviceOffsetExp __zedlllocal ze_result_t ZE_APICALL zeImageGetDeviceOffsetExp( ze_image_handle_t hImage, ///< [in] handle of the image uint64_t* pDeviceOffset ///< [out] bindless device offset for image ) { auto pfnGetDeviceOffsetExp = context.zeDdiTable.ImageExp.pfnGetDeviceOffsetExp; if( nullptr == pfnGetDeviceOffsetExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.ImageExp.pfnGetDeviceOffsetExp, hImage, pDeviceOffset); // capture parameters ze_image_get_device_offset_exp_params_t tracerParams = { &hImage, &pDeviceOffset }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnImageGetDeviceOffsetExpCb_t, Image, pfnGetDeviceOffsetExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.ImageExp.pfnGetDeviceOffsetExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phImage, *tracerParams.ppDeviceOffset); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListCreateCloneExp __zedlllocal ze_result_t ZE_APICALL zeCommandListCreateCloneExp( ze_command_list_handle_t hCommandList, ///< [in] handle to source command list (the command list to clone) ze_command_list_handle_t* phClonedCommandList ///< [out] pointer to handle of the cloned command list ) { auto pfnCreateCloneExp = context.zeDdiTable.CommandListExp.pfnCreateCloneExp; if( nullptr == pfnCreateCloneExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandListExp.pfnCreateCloneExp, hCommandList, phClonedCommandList); // capture parameters ze_command_list_create_clone_exp_params_t tracerParams = { &hCommandList, &phClonedCommandList }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListCreateCloneExpCb_t, CommandList, pfnCreateCloneExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandListExp.pfnCreateCloneExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pphClonedCommandList); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListImmediateAppendCommandListsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListImmediateAppendCommandListsExp( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t numCommandLists, ///< [in] number of command lists ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion ///< - if not null, this event is signaled after the completion of all ///< appended command lists uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended ///< command lists; must be 0 if nullptr == phWaitEvents ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing appended command lists. ///< - if not null, all wait events must be satisfied prior to the start ///< of any appended command list(s) ) { auto pfnImmediateAppendCommandListsExp = context.zeDdiTable.CommandListExp.pfnImmediateAppendCommandListsExp; if( nullptr == pfnImmediateAppendCommandListsExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandListExp.pfnImmediateAppendCommandListsExp, hCommandListImmediate, numCommandLists, phCommandLists, hSignalEvent, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_immediate_append_command_lists_exp_params_t tracerParams = { &hCommandListImmediate, &numCommandLists, &phCommandLists, &hSignalEvent, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListImmediateAppendCommandListsExpCb_t, CommandList, pfnImmediateAppendCommandListsExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandListExp.pfnImmediateAppendCommandListsExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandListImmediate, *tracerParams.pnumCommandLists, *tracerParams.pphCommandLists, *tracerParams.phSignalEvent, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdExp __zedlllocal ze_result_t ZE_APICALL zeCommandListGetNextCommandIdExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in] pointer to mutable command identifier descriptor uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { auto pfnGetNextCommandIdExp = context.zeDdiTable.CommandListExp.pfnGetNextCommandIdExp; if( nullptr == pfnGetNextCommandIdExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandListExp.pfnGetNextCommandIdExp, hCommandList, desc, pCommandId); // capture parameters ze_command_list_get_next_command_id_exp_params_t tracerParams = { &hCommandList, &desc, &pCommandId }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListGetNextCommandIdExpCb_t, CommandList, pfnGetNextCommandIdExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandListExp.pfnGetNextCommandIdExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pdesc, *tracerParams.ppCommandId); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdWithKernelsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListGetNextCommandIdWithKernelsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in][out] pointer to mutable command identifier descriptor uint32_t numKernels, ///< [in][optional] number of entries on phKernels list ze_kernel_handle_t* phKernels, ///< [in][optional][range(0, numKernels)] list of kernels that user can ///< switch between using ::zeCommandListUpdateMutableCommandKernelsExp ///< call uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { auto pfnGetNextCommandIdWithKernelsExp = context.zeDdiTable.CommandListExp.pfnGetNextCommandIdWithKernelsExp; if( nullptr == pfnGetNextCommandIdWithKernelsExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandListExp.pfnGetNextCommandIdWithKernelsExp, hCommandList, desc, numKernels, phKernels, pCommandId); // capture parameters ze_command_list_get_next_command_id_with_kernels_exp_params_t tracerParams = { &hCommandList, &desc, &numKernels, &phKernels, &pCommandId }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListGetNextCommandIdWithKernelsExpCb_t, CommandList, pfnGetNextCommandIdWithKernelsExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandListExp.pfnGetNextCommandIdWithKernelsExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pdesc, *tracerParams.pnumKernels, *tracerParams.pphKernels, *tracerParams.ppCommandId); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_commands_exp_desc_t* desc ///< [in] pointer to mutable commands descriptor; multiple descriptors may ///< be chained via `pNext` member ) { auto pfnUpdateMutableCommandsExp = context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandsExp; if( nullptr == pfnUpdateMutableCommandsExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandsExp, hCommandList, desc); // capture parameters ze_command_list_update_mutable_commands_exp_params_t tracerParams = { &hCommandList, &desc }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListUpdateMutableCommandsExpCb_t, CommandList, pfnUpdateMutableCommandsExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandsExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pdesc); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandSignalEventExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandSignalEventExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier ze_event_handle_t hSignalEvent ///< [in][optional] handle of the event to signal on completion ) { auto pfnUpdateMutableCommandSignalEventExp = context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandSignalEventExp; if( nullptr == pfnUpdateMutableCommandSignalEventExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandSignalEventExp, hCommandList, commandId, hSignalEvent); // capture parameters ze_command_list_update_mutable_command_signal_event_exp_params_t tracerParams = { &hCommandList, &commandId, &hSignalEvent }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListUpdateMutableCommandSignalEventExpCb_t, CommandList, pfnUpdateMutableCommandSignalEventExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandSignalEventExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pcommandId, *tracerParams.phSignalEvent); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandWaitEventsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandWaitEventsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier uint32_t numWaitEvents, ///< [in][optional] the number of wait events ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { auto pfnUpdateMutableCommandWaitEventsExp = context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandWaitEventsExp; if( nullptr == pfnUpdateMutableCommandWaitEventsExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandWaitEventsExp, hCommandList, commandId, numWaitEvents, phWaitEvents); // capture parameters ze_command_list_update_mutable_command_wait_events_exp_params_t tracerParams = { &hCommandList, &commandId, &numWaitEvents, &phWaitEvents }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListUpdateMutableCommandWaitEventsExpCb_t, CommandList, pfnUpdateMutableCommandWaitEventsExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandWaitEventsExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pcommandId, *tracerParams.pnumWaitEvents, *tracerParams.pphWaitEvents); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandKernelsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandKernelsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] the number of kernels to update uint64_t* pCommandId, ///< [in][range(0, numKernels)] command identifier ze_kernel_handle_t* phKernels ///< [in][range(0, numKernels)] handle of the kernel for a command ///< identifier to switch to ) { auto pfnUpdateMutableCommandKernelsExp = context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandKernelsExp; if( nullptr == pfnUpdateMutableCommandKernelsExp) return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; ZE_HANDLE_TRACER_RECURSION(context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandKernelsExp, hCommandList, numKernels, pCommandId, phKernels); // capture parameters ze_command_list_update_mutable_command_kernels_exp_params_t tracerParams = { &hCommandList, &numKernels, &pCommandId, &phKernels }; tracing_layer::APITracerCallbackDataImp apiCallbackData; ZE_GEN_PER_API_CALLBACK_STATE(apiCallbackData, ze_pfnCommandListUpdateMutableCommandKernelsExpCb_t, CommandList, pfnUpdateMutableCommandKernelsExpCb); return tracing_layer::APITracerWrapperImp(context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandKernelsExp, &tracerParams, apiCallbackData.apiOrdinal, apiCallbackData.prologCallbacks, apiCallbackData.epilogCallbacks, *tracerParams.phCommandList, *tracerParams.pnumKernels, *tracerParams.ppCommandId, *tracerParams.pphKernels); } } // namespace tracing_layer #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Global table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetGlobalProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_global_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.Global; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnInit = pDdiTable->pfnInit; pDdiTable->pfnInit = tracing_layer::zeInit; dditable.pfnInitDrivers = pDdiTable->pfnInitDrivers; pDdiTable->pfnInitDrivers = tracing_layer::zeInitDrivers; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASBuilderExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetRTASBuilderExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_rtas_builder_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.RTASBuilderExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreateExp = pDdiTable->pfnCreateExp; pDdiTable->pfnCreateExp = tracing_layer::zeRTASBuilderCreateExp; dditable.pfnGetBuildPropertiesExp = pDdiTable->pfnGetBuildPropertiesExp; pDdiTable->pfnGetBuildPropertiesExp = tracing_layer::zeRTASBuilderGetBuildPropertiesExp; dditable.pfnBuildExp = pDdiTable->pfnBuildExp; pDdiTable->pfnBuildExp = tracing_layer::zeRTASBuilderBuildExp; dditable.pfnDestroyExp = pDdiTable->pfnDestroyExp; pDdiTable->pfnDestroyExp = tracing_layer::zeRTASBuilderDestroyExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASParallelOperationExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetRTASParallelOperationExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_rtas_parallel_operation_exp_dditable_t* pDdiTable///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.RTASParallelOperationExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreateExp = pDdiTable->pfnCreateExp; pDdiTable->pfnCreateExp = tracing_layer::zeRTASParallelOperationCreateExp; dditable.pfnGetPropertiesExp = pDdiTable->pfnGetPropertiesExp; pDdiTable->pfnGetPropertiesExp = tracing_layer::zeRTASParallelOperationGetPropertiesExp; dditable.pfnJoinExp = pDdiTable->pfnJoinExp; pDdiTable->pfnJoinExp = tracing_layer::zeRTASParallelOperationJoinExp; dditable.pfnDestroyExp = pDdiTable->pfnDestroyExp; pDdiTable->pfnDestroyExp = tracing_layer::zeRTASParallelOperationDestroyExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Driver table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDriverProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_driver_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.Driver; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGet = pDdiTable->pfnGet; pDdiTable->pfnGet = tracing_layer::zeDriverGet; dditable.pfnGetApiVersion = pDdiTable->pfnGetApiVersion; pDdiTable->pfnGetApiVersion = tracing_layer::zeDriverGetApiVersion; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = tracing_layer::zeDriverGetProperties; dditable.pfnGetIpcProperties = pDdiTable->pfnGetIpcProperties; pDdiTable->pfnGetIpcProperties = tracing_layer::zeDriverGetIpcProperties; dditable.pfnGetExtensionProperties = pDdiTable->pfnGetExtensionProperties; pDdiTable->pfnGetExtensionProperties = tracing_layer::zeDriverGetExtensionProperties; dditable.pfnGetExtensionFunctionAddress = pDdiTable->pfnGetExtensionFunctionAddress; pDdiTable->pfnGetExtensionFunctionAddress = tracing_layer::zeDriverGetExtensionFunctionAddress; dditable.pfnGetLastErrorDescription = pDdiTable->pfnGetLastErrorDescription; pDdiTable->pfnGetLastErrorDescription = tracing_layer::zeDriverGetLastErrorDescription; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DriverExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDriverExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_driver_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.DriverExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnRTASFormatCompatibilityCheckExp = pDdiTable->pfnRTASFormatCompatibilityCheckExp; pDdiTable->pfnRTASFormatCompatibilityCheckExp = tracing_layer::zeDriverRTASFormatCompatibilityCheckExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.Device; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGet = pDdiTable->pfnGet; pDdiTable->pfnGet = tracing_layer::zeDeviceGet; dditable.pfnGetSubDevices = pDdiTable->pfnGetSubDevices; pDdiTable->pfnGetSubDevices = tracing_layer::zeDeviceGetSubDevices; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = tracing_layer::zeDeviceGetProperties; dditable.pfnGetComputeProperties = pDdiTable->pfnGetComputeProperties; pDdiTable->pfnGetComputeProperties = tracing_layer::zeDeviceGetComputeProperties; dditable.pfnGetModuleProperties = pDdiTable->pfnGetModuleProperties; pDdiTable->pfnGetModuleProperties = tracing_layer::zeDeviceGetModuleProperties; dditable.pfnGetCommandQueueGroupProperties = pDdiTable->pfnGetCommandQueueGroupProperties; pDdiTable->pfnGetCommandQueueGroupProperties = tracing_layer::zeDeviceGetCommandQueueGroupProperties; dditable.pfnGetMemoryProperties = pDdiTable->pfnGetMemoryProperties; pDdiTable->pfnGetMemoryProperties = tracing_layer::zeDeviceGetMemoryProperties; dditable.pfnGetMemoryAccessProperties = pDdiTable->pfnGetMemoryAccessProperties; pDdiTable->pfnGetMemoryAccessProperties = tracing_layer::zeDeviceGetMemoryAccessProperties; dditable.pfnGetCacheProperties = pDdiTable->pfnGetCacheProperties; pDdiTable->pfnGetCacheProperties = tracing_layer::zeDeviceGetCacheProperties; dditable.pfnGetImageProperties = pDdiTable->pfnGetImageProperties; pDdiTable->pfnGetImageProperties = tracing_layer::zeDeviceGetImageProperties; dditable.pfnGetExternalMemoryProperties = pDdiTable->pfnGetExternalMemoryProperties; pDdiTable->pfnGetExternalMemoryProperties = tracing_layer::zeDeviceGetExternalMemoryProperties; dditable.pfnGetP2PProperties = pDdiTable->pfnGetP2PProperties; pDdiTable->pfnGetP2PProperties = tracing_layer::zeDeviceGetP2PProperties; dditable.pfnCanAccessPeer = pDdiTable->pfnCanAccessPeer; pDdiTable->pfnCanAccessPeer = tracing_layer::zeDeviceCanAccessPeer; dditable.pfnGetStatus = pDdiTable->pfnGetStatus; pDdiTable->pfnGetStatus = tracing_layer::zeDeviceGetStatus; dditable.pfnGetGlobalTimestamps = pDdiTable->pfnGetGlobalTimestamps; pDdiTable->pfnGetGlobalTimestamps = tracing_layer::zeDeviceGetGlobalTimestamps; dditable.pfnImportExternalSemaphoreExt = pDdiTable->pfnImportExternalSemaphoreExt; pDdiTable->pfnImportExternalSemaphoreExt = tracing_layer::zeDeviceImportExternalSemaphoreExt; dditable.pfnReleaseExternalSemaphoreExt = pDdiTable->pfnReleaseExternalSemaphoreExt; pDdiTable->pfnReleaseExternalSemaphoreExt = tracing_layer::zeDeviceReleaseExternalSemaphoreExt; dditable.pfnReserveCacheExt = pDdiTable->pfnReserveCacheExt; pDdiTable->pfnReserveCacheExt = tracing_layer::zeDeviceReserveCacheExt; dditable.pfnSetCacheAdviceExt = pDdiTable->pfnSetCacheAdviceExt; pDdiTable->pfnSetCacheAdviceExt = tracing_layer::zeDeviceSetCacheAdviceExt; dditable.pfnPciGetPropertiesExt = pDdiTable->pfnPciGetPropertiesExt; pDdiTable->pfnPciGetPropertiesExt = tracing_layer::zeDevicePciGetPropertiesExt; dditable.pfnGetRootDevice = pDdiTable->pfnGetRootDevice; pDdiTable->pfnGetRootDevice = tracing_layer::zeDeviceGetRootDevice; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.DeviceExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetFabricVertexExp = pDdiTable->pfnGetFabricVertexExp; pDdiTable->pfnGetFabricVertexExp = tracing_layer::zeDeviceGetFabricVertexExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Context table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetContextProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_context_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.Context; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = tracing_layer::zeContextCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = tracing_layer::zeContextDestroy; dditable.pfnGetStatus = pDdiTable->pfnGetStatus; pDdiTable->pfnGetStatus = tracing_layer::zeContextGetStatus; dditable.pfnSystemBarrier = pDdiTable->pfnSystemBarrier; pDdiTable->pfnSystemBarrier = tracing_layer::zeContextSystemBarrier; dditable.pfnMakeMemoryResident = pDdiTable->pfnMakeMemoryResident; pDdiTable->pfnMakeMemoryResident = tracing_layer::zeContextMakeMemoryResident; dditable.pfnEvictMemory = pDdiTable->pfnEvictMemory; pDdiTable->pfnEvictMemory = tracing_layer::zeContextEvictMemory; dditable.pfnMakeImageResident = pDdiTable->pfnMakeImageResident; pDdiTable->pfnMakeImageResident = tracing_layer::zeContextMakeImageResident; dditable.pfnEvictImage = pDdiTable->pfnEvictImage; pDdiTable->pfnEvictImage = tracing_layer::zeContextEvictImage; dditable.pfnCreateEx = pDdiTable->pfnCreateEx; pDdiTable->pfnCreateEx = tracing_layer::zeContextCreateEx; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandQueue table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandQueueProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_queue_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.CommandQueue; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = tracing_layer::zeCommandQueueCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = tracing_layer::zeCommandQueueDestroy; dditable.pfnExecuteCommandLists = pDdiTable->pfnExecuteCommandLists; pDdiTable->pfnExecuteCommandLists = tracing_layer::zeCommandQueueExecuteCommandLists; dditable.pfnSynchronize = pDdiTable->pfnSynchronize; pDdiTable->pfnSynchronize = tracing_layer::zeCommandQueueSynchronize; dditable.pfnGetOrdinal = pDdiTable->pfnGetOrdinal; pDdiTable->pfnGetOrdinal = tracing_layer::zeCommandQueueGetOrdinal; dditable.pfnGetIndex = pDdiTable->pfnGetIndex; pDdiTable->pfnGetIndex = tracing_layer::zeCommandQueueGetIndex; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandList table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandListProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_list_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.CommandList; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = tracing_layer::zeCommandListCreate; dditable.pfnCreateImmediate = pDdiTable->pfnCreateImmediate; pDdiTable->pfnCreateImmediate = tracing_layer::zeCommandListCreateImmediate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = tracing_layer::zeCommandListDestroy; dditable.pfnClose = pDdiTable->pfnClose; pDdiTable->pfnClose = tracing_layer::zeCommandListClose; dditable.pfnReset = pDdiTable->pfnReset; pDdiTable->pfnReset = tracing_layer::zeCommandListReset; dditable.pfnAppendWriteGlobalTimestamp = pDdiTable->pfnAppendWriteGlobalTimestamp; pDdiTable->pfnAppendWriteGlobalTimestamp = tracing_layer::zeCommandListAppendWriteGlobalTimestamp; dditable.pfnAppendBarrier = pDdiTable->pfnAppendBarrier; pDdiTable->pfnAppendBarrier = tracing_layer::zeCommandListAppendBarrier; dditable.pfnAppendMemoryRangesBarrier = pDdiTable->pfnAppendMemoryRangesBarrier; pDdiTable->pfnAppendMemoryRangesBarrier = tracing_layer::zeCommandListAppendMemoryRangesBarrier; dditable.pfnAppendMemoryCopy = pDdiTable->pfnAppendMemoryCopy; pDdiTable->pfnAppendMemoryCopy = tracing_layer::zeCommandListAppendMemoryCopy; dditable.pfnAppendMemoryFill = pDdiTable->pfnAppendMemoryFill; pDdiTable->pfnAppendMemoryFill = tracing_layer::zeCommandListAppendMemoryFill; dditable.pfnAppendMemoryCopyRegion = pDdiTable->pfnAppendMemoryCopyRegion; pDdiTable->pfnAppendMemoryCopyRegion = tracing_layer::zeCommandListAppendMemoryCopyRegion; dditable.pfnAppendMemoryCopyFromContext = pDdiTable->pfnAppendMemoryCopyFromContext; pDdiTable->pfnAppendMemoryCopyFromContext = tracing_layer::zeCommandListAppendMemoryCopyFromContext; dditable.pfnAppendImageCopy = pDdiTable->pfnAppendImageCopy; pDdiTable->pfnAppendImageCopy = tracing_layer::zeCommandListAppendImageCopy; dditable.pfnAppendImageCopyRegion = pDdiTable->pfnAppendImageCopyRegion; pDdiTable->pfnAppendImageCopyRegion = tracing_layer::zeCommandListAppendImageCopyRegion; dditable.pfnAppendImageCopyToMemory = pDdiTable->pfnAppendImageCopyToMemory; pDdiTable->pfnAppendImageCopyToMemory = tracing_layer::zeCommandListAppendImageCopyToMemory; dditable.pfnAppendImageCopyFromMemory = pDdiTable->pfnAppendImageCopyFromMemory; pDdiTable->pfnAppendImageCopyFromMemory = tracing_layer::zeCommandListAppendImageCopyFromMemory; dditable.pfnAppendMemoryPrefetch = pDdiTable->pfnAppendMemoryPrefetch; pDdiTable->pfnAppendMemoryPrefetch = tracing_layer::zeCommandListAppendMemoryPrefetch; dditable.pfnAppendMemAdvise = pDdiTable->pfnAppendMemAdvise; pDdiTable->pfnAppendMemAdvise = tracing_layer::zeCommandListAppendMemAdvise; dditable.pfnAppendSignalEvent = pDdiTable->pfnAppendSignalEvent; pDdiTable->pfnAppendSignalEvent = tracing_layer::zeCommandListAppendSignalEvent; dditable.pfnAppendWaitOnEvents = pDdiTable->pfnAppendWaitOnEvents; pDdiTable->pfnAppendWaitOnEvents = tracing_layer::zeCommandListAppendWaitOnEvents; dditable.pfnAppendEventReset = pDdiTable->pfnAppendEventReset; pDdiTable->pfnAppendEventReset = tracing_layer::zeCommandListAppendEventReset; dditable.pfnAppendQueryKernelTimestamps = pDdiTable->pfnAppendQueryKernelTimestamps; pDdiTable->pfnAppendQueryKernelTimestamps = tracing_layer::zeCommandListAppendQueryKernelTimestamps; dditable.pfnAppendLaunchKernel = pDdiTable->pfnAppendLaunchKernel; pDdiTable->pfnAppendLaunchKernel = tracing_layer::zeCommandListAppendLaunchKernel; dditable.pfnAppendLaunchCooperativeKernel = pDdiTable->pfnAppendLaunchCooperativeKernel; pDdiTable->pfnAppendLaunchCooperativeKernel = tracing_layer::zeCommandListAppendLaunchCooperativeKernel; dditable.pfnAppendLaunchKernelIndirect = pDdiTable->pfnAppendLaunchKernelIndirect; pDdiTable->pfnAppendLaunchKernelIndirect = tracing_layer::zeCommandListAppendLaunchKernelIndirect; dditable.pfnAppendLaunchMultipleKernelsIndirect = pDdiTable->pfnAppendLaunchMultipleKernelsIndirect; pDdiTable->pfnAppendLaunchMultipleKernelsIndirect = tracing_layer::zeCommandListAppendLaunchMultipleKernelsIndirect; dditable.pfnAppendSignalExternalSemaphoreExt = pDdiTable->pfnAppendSignalExternalSemaphoreExt; pDdiTable->pfnAppendSignalExternalSemaphoreExt = tracing_layer::zeCommandListAppendSignalExternalSemaphoreExt; dditable.pfnAppendWaitExternalSemaphoreExt = pDdiTable->pfnAppendWaitExternalSemaphoreExt; pDdiTable->pfnAppendWaitExternalSemaphoreExt = tracing_layer::zeCommandListAppendWaitExternalSemaphoreExt; dditable.pfnAppendImageCopyToMemoryExt = pDdiTable->pfnAppendImageCopyToMemoryExt; pDdiTable->pfnAppendImageCopyToMemoryExt = tracing_layer::zeCommandListAppendImageCopyToMemoryExt; dditable.pfnAppendImageCopyFromMemoryExt = pDdiTable->pfnAppendImageCopyFromMemoryExt; pDdiTable->pfnAppendImageCopyFromMemoryExt = tracing_layer::zeCommandListAppendImageCopyFromMemoryExt; dditable.pfnHostSynchronize = pDdiTable->pfnHostSynchronize; pDdiTable->pfnHostSynchronize = tracing_layer::zeCommandListHostSynchronize; dditable.pfnGetDeviceHandle = pDdiTable->pfnGetDeviceHandle; pDdiTable->pfnGetDeviceHandle = tracing_layer::zeCommandListGetDeviceHandle; dditable.pfnGetContextHandle = pDdiTable->pfnGetContextHandle; pDdiTable->pfnGetContextHandle = tracing_layer::zeCommandListGetContextHandle; dditable.pfnGetOrdinal = pDdiTable->pfnGetOrdinal; pDdiTable->pfnGetOrdinal = tracing_layer::zeCommandListGetOrdinal; dditable.pfnImmediateGetIndex = pDdiTable->pfnImmediateGetIndex; pDdiTable->pfnImmediateGetIndex = tracing_layer::zeCommandListImmediateGetIndex; dditable.pfnIsImmediate = pDdiTable->pfnIsImmediate; pDdiTable->pfnIsImmediate = tracing_layer::zeCommandListIsImmediate; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandListExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandListExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_list_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.CommandListExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetNextCommandIdWithKernelsExp = pDdiTable->pfnGetNextCommandIdWithKernelsExp; pDdiTable->pfnGetNextCommandIdWithKernelsExp = tracing_layer::zeCommandListGetNextCommandIdWithKernelsExp; dditable.pfnUpdateMutableCommandKernelsExp = pDdiTable->pfnUpdateMutableCommandKernelsExp; pDdiTable->pfnUpdateMutableCommandKernelsExp = tracing_layer::zeCommandListUpdateMutableCommandKernelsExp; dditable.pfnCreateCloneExp = pDdiTable->pfnCreateCloneExp; pDdiTable->pfnCreateCloneExp = tracing_layer::zeCommandListCreateCloneExp; dditable.pfnImmediateAppendCommandListsExp = pDdiTable->pfnImmediateAppendCommandListsExp; pDdiTable->pfnImmediateAppendCommandListsExp = tracing_layer::zeCommandListImmediateAppendCommandListsExp; dditable.pfnGetNextCommandIdExp = pDdiTable->pfnGetNextCommandIdExp; pDdiTable->pfnGetNextCommandIdExp = tracing_layer::zeCommandListGetNextCommandIdExp; dditable.pfnUpdateMutableCommandsExp = pDdiTable->pfnUpdateMutableCommandsExp; pDdiTable->pfnUpdateMutableCommandsExp = tracing_layer::zeCommandListUpdateMutableCommandsExp; dditable.pfnUpdateMutableCommandSignalEventExp = pDdiTable->pfnUpdateMutableCommandSignalEventExp; pDdiTable->pfnUpdateMutableCommandSignalEventExp = tracing_layer::zeCommandListUpdateMutableCommandSignalEventExp; dditable.pfnUpdateMutableCommandWaitEventsExp = pDdiTable->pfnUpdateMutableCommandWaitEventsExp; pDdiTable->pfnUpdateMutableCommandWaitEventsExp = tracing_layer::zeCommandListUpdateMutableCommandWaitEventsExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Event table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.Event; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = tracing_layer::zeEventCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = tracing_layer::zeEventDestroy; dditable.pfnHostSignal = pDdiTable->pfnHostSignal; pDdiTable->pfnHostSignal = tracing_layer::zeEventHostSignal; dditable.pfnHostSynchronize = pDdiTable->pfnHostSynchronize; pDdiTable->pfnHostSynchronize = tracing_layer::zeEventHostSynchronize; dditable.pfnQueryStatus = pDdiTable->pfnQueryStatus; pDdiTable->pfnQueryStatus = tracing_layer::zeEventQueryStatus; dditable.pfnHostReset = pDdiTable->pfnHostReset; pDdiTable->pfnHostReset = tracing_layer::zeEventHostReset; dditable.pfnQueryKernelTimestamp = pDdiTable->pfnQueryKernelTimestamp; pDdiTable->pfnQueryKernelTimestamp = tracing_layer::zeEventQueryKernelTimestamp; dditable.pfnQueryKernelTimestampsExt = pDdiTable->pfnQueryKernelTimestampsExt; pDdiTable->pfnQueryKernelTimestampsExt = tracing_layer::zeEventQueryKernelTimestampsExt; dditable.pfnGetEventPool = pDdiTable->pfnGetEventPool; pDdiTable->pfnGetEventPool = tracing_layer::zeEventGetEventPool; dditable.pfnGetSignalScope = pDdiTable->pfnGetSignalScope; pDdiTable->pfnGetSignalScope = tracing_layer::zeEventGetSignalScope; dditable.pfnGetWaitScope = pDdiTable->pfnGetWaitScope; pDdiTable->pfnGetWaitScope = tracing_layer::zeEventGetWaitScope; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's EventExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.EventExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnQueryTimestampsExp = pDdiTable->pfnQueryTimestampsExp; pDdiTable->pfnQueryTimestampsExp = tracing_layer::zeEventQueryTimestampsExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's EventPool table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventPoolProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_pool_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.EventPool; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = tracing_layer::zeEventPoolCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = tracing_layer::zeEventPoolDestroy; dditable.pfnGetIpcHandle = pDdiTable->pfnGetIpcHandle; pDdiTable->pfnGetIpcHandle = tracing_layer::zeEventPoolGetIpcHandle; dditable.pfnOpenIpcHandle = pDdiTable->pfnOpenIpcHandle; pDdiTable->pfnOpenIpcHandle = tracing_layer::zeEventPoolOpenIpcHandle; dditable.pfnCloseIpcHandle = pDdiTable->pfnCloseIpcHandle; pDdiTable->pfnCloseIpcHandle = tracing_layer::zeEventPoolCloseIpcHandle; dditable.pfnPutIpcHandle = pDdiTable->pfnPutIpcHandle; pDdiTable->pfnPutIpcHandle = tracing_layer::zeEventPoolPutIpcHandle; dditable.pfnGetContextHandle = pDdiTable->pfnGetContextHandle; pDdiTable->pfnGetContextHandle = tracing_layer::zeEventPoolGetContextHandle; dditable.pfnGetFlags = pDdiTable->pfnGetFlags; pDdiTable->pfnGetFlags = tracing_layer::zeEventPoolGetFlags; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Fence table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFenceProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fence_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.Fence; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = tracing_layer::zeFenceCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = tracing_layer::zeFenceDestroy; dditable.pfnHostSynchronize = pDdiTable->pfnHostSynchronize; pDdiTable->pfnHostSynchronize = tracing_layer::zeFenceHostSynchronize; dditable.pfnQueryStatus = pDdiTable->pfnQueryStatus; pDdiTable->pfnQueryStatus = tracing_layer::zeFenceQueryStatus; dditable.pfnReset = pDdiTable->pfnReset; pDdiTable->pfnReset = tracing_layer::zeFenceReset; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Image table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetImageProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_image_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.Image; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = tracing_layer::zeImageGetProperties; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = tracing_layer::zeImageCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = tracing_layer::zeImageDestroy; dditable.pfnGetAllocPropertiesExt = pDdiTable->pfnGetAllocPropertiesExt; pDdiTable->pfnGetAllocPropertiesExt = tracing_layer::zeImageGetAllocPropertiesExt; dditable.pfnViewCreateExt = pDdiTable->pfnViewCreateExt; pDdiTable->pfnViewCreateExt = tracing_layer::zeImageViewCreateExt; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ImageExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetImageExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_image_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.ImageExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetMemoryPropertiesExp = pDdiTable->pfnGetMemoryPropertiesExp; pDdiTable->pfnGetMemoryPropertiesExp = tracing_layer::zeImageGetMemoryPropertiesExp; dditable.pfnViewCreateExp = pDdiTable->pfnViewCreateExp; pDdiTable->pfnViewCreateExp = tracing_layer::zeImageViewCreateExp; dditable.pfnGetDeviceOffsetExp = pDdiTable->pfnGetDeviceOffsetExp; pDdiTable->pfnGetDeviceOffsetExp = tracing_layer::zeImageGetDeviceOffsetExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Kernel table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetKernelProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_kernel_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.Kernel; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = tracing_layer::zeKernelCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = tracing_layer::zeKernelDestroy; dditable.pfnSetCacheConfig = pDdiTable->pfnSetCacheConfig; pDdiTable->pfnSetCacheConfig = tracing_layer::zeKernelSetCacheConfig; dditable.pfnSetGroupSize = pDdiTable->pfnSetGroupSize; pDdiTable->pfnSetGroupSize = tracing_layer::zeKernelSetGroupSize; dditable.pfnSuggestGroupSize = pDdiTable->pfnSuggestGroupSize; pDdiTable->pfnSuggestGroupSize = tracing_layer::zeKernelSuggestGroupSize; dditable.pfnSuggestMaxCooperativeGroupCount = pDdiTable->pfnSuggestMaxCooperativeGroupCount; pDdiTable->pfnSuggestMaxCooperativeGroupCount = tracing_layer::zeKernelSuggestMaxCooperativeGroupCount; dditable.pfnSetArgumentValue = pDdiTable->pfnSetArgumentValue; pDdiTable->pfnSetArgumentValue = tracing_layer::zeKernelSetArgumentValue; dditable.pfnSetIndirectAccess = pDdiTable->pfnSetIndirectAccess; pDdiTable->pfnSetIndirectAccess = tracing_layer::zeKernelSetIndirectAccess; dditable.pfnGetIndirectAccess = pDdiTable->pfnGetIndirectAccess; pDdiTable->pfnGetIndirectAccess = tracing_layer::zeKernelGetIndirectAccess; dditable.pfnGetSourceAttributes = pDdiTable->pfnGetSourceAttributes; pDdiTable->pfnGetSourceAttributes = tracing_layer::zeKernelGetSourceAttributes; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = tracing_layer::zeKernelGetProperties; dditable.pfnGetName = pDdiTable->pfnGetName; pDdiTable->pfnGetName = tracing_layer::zeKernelGetName; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's KernelExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetKernelExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_kernel_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.KernelExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnSetGlobalOffsetExp = pDdiTable->pfnSetGlobalOffsetExp; pDdiTable->pfnSetGlobalOffsetExp = tracing_layer::zeKernelSetGlobalOffsetExp; dditable.pfnGetBinaryExp = pDdiTable->pfnGetBinaryExp; pDdiTable->pfnGetBinaryExp = tracing_layer::zeKernelGetBinaryExp; dditable.pfnSchedulingHintExp = pDdiTable->pfnSchedulingHintExp; pDdiTable->pfnSchedulingHintExp = tracing_layer::zeKernelSchedulingHintExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Mem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.Mem; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnAllocShared = pDdiTable->pfnAllocShared; pDdiTable->pfnAllocShared = tracing_layer::zeMemAllocShared; dditable.pfnAllocDevice = pDdiTable->pfnAllocDevice; pDdiTable->pfnAllocDevice = tracing_layer::zeMemAllocDevice; dditable.pfnAllocHost = pDdiTable->pfnAllocHost; pDdiTable->pfnAllocHost = tracing_layer::zeMemAllocHost; dditable.pfnFree = pDdiTable->pfnFree; pDdiTable->pfnFree = tracing_layer::zeMemFree; dditable.pfnGetAllocProperties = pDdiTable->pfnGetAllocProperties; pDdiTable->pfnGetAllocProperties = tracing_layer::zeMemGetAllocProperties; dditable.pfnGetAddressRange = pDdiTable->pfnGetAddressRange; pDdiTable->pfnGetAddressRange = tracing_layer::zeMemGetAddressRange; dditable.pfnGetIpcHandle = pDdiTable->pfnGetIpcHandle; pDdiTable->pfnGetIpcHandle = tracing_layer::zeMemGetIpcHandle; dditable.pfnOpenIpcHandle = pDdiTable->pfnOpenIpcHandle; pDdiTable->pfnOpenIpcHandle = tracing_layer::zeMemOpenIpcHandle; dditable.pfnCloseIpcHandle = pDdiTable->pfnCloseIpcHandle; pDdiTable->pfnCloseIpcHandle = tracing_layer::zeMemCloseIpcHandle; dditable.pfnFreeExt = pDdiTable->pfnFreeExt; pDdiTable->pfnFreeExt = tracing_layer::zeMemFreeExt; dditable.pfnPutIpcHandle = pDdiTable->pfnPutIpcHandle; pDdiTable->pfnPutIpcHandle = tracing_layer::zeMemPutIpcHandle; dditable.pfnGetPitchFor2dImage = pDdiTable->pfnGetPitchFor2dImage; pDdiTable->pfnGetPitchFor2dImage = tracing_layer::zeMemGetPitchFor2dImage; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MemExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetMemExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_mem_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.MemExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetIpcHandleFromFileDescriptorExp = pDdiTable->pfnGetIpcHandleFromFileDescriptorExp; pDdiTable->pfnGetIpcHandleFromFileDescriptorExp = tracing_layer::zeMemGetIpcHandleFromFileDescriptorExp; dditable.pfnGetFileDescriptorFromIpcHandleExp = pDdiTable->pfnGetFileDescriptorFromIpcHandleExp; pDdiTable->pfnGetFileDescriptorFromIpcHandleExp = tracing_layer::zeMemGetFileDescriptorFromIpcHandleExp; dditable.pfnSetAtomicAccessAttributeExp = pDdiTable->pfnSetAtomicAccessAttributeExp; pDdiTable->pfnSetAtomicAccessAttributeExp = tracing_layer::zeMemSetAtomicAccessAttributeExp; dditable.pfnGetAtomicAccessAttributeExp = pDdiTable->pfnGetAtomicAccessAttributeExp; pDdiTable->pfnGetAtomicAccessAttributeExp = tracing_layer::zeMemGetAtomicAccessAttributeExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Module table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetModuleProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_module_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.Module; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = tracing_layer::zeModuleCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = tracing_layer::zeModuleDestroy; dditable.pfnDynamicLink = pDdiTable->pfnDynamicLink; pDdiTable->pfnDynamicLink = tracing_layer::zeModuleDynamicLink; dditable.pfnGetNativeBinary = pDdiTable->pfnGetNativeBinary; pDdiTable->pfnGetNativeBinary = tracing_layer::zeModuleGetNativeBinary; dditable.pfnGetGlobalPointer = pDdiTable->pfnGetGlobalPointer; pDdiTable->pfnGetGlobalPointer = tracing_layer::zeModuleGetGlobalPointer; dditable.pfnGetKernelNames = pDdiTable->pfnGetKernelNames; pDdiTable->pfnGetKernelNames = tracing_layer::zeModuleGetKernelNames; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = tracing_layer::zeModuleGetProperties; dditable.pfnGetFunctionPointer = pDdiTable->pfnGetFunctionPointer; pDdiTable->pfnGetFunctionPointer = tracing_layer::zeModuleGetFunctionPointer; dditable.pfnInspectLinkageExt = pDdiTable->pfnInspectLinkageExt; pDdiTable->pfnInspectLinkageExt = tracing_layer::zeModuleInspectLinkageExt; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ModuleBuildLog table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetModuleBuildLogProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_module_build_log_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.ModuleBuildLog; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = tracing_layer::zeModuleBuildLogDestroy; dditable.pfnGetString = pDdiTable->pfnGetString; pDdiTable->pfnGetString = tracing_layer::zeModuleBuildLogGetString; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's PhysicalMem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetPhysicalMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_physical_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.PhysicalMem; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = tracing_layer::zePhysicalMemCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = tracing_layer::zePhysicalMemDestroy; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Sampler table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetSamplerProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_sampler_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.Sampler; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = tracing_layer::zeSamplerCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = tracing_layer::zeSamplerDestroy; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's VirtualMem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetVirtualMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_virtual_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.VirtualMem; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnReserve = pDdiTable->pfnReserve; pDdiTable->pfnReserve = tracing_layer::zeVirtualMemReserve; dditable.pfnFree = pDdiTable->pfnFree; pDdiTable->pfnFree = tracing_layer::zeVirtualMemFree; dditable.pfnQueryPageSize = pDdiTable->pfnQueryPageSize; pDdiTable->pfnQueryPageSize = tracing_layer::zeVirtualMemQueryPageSize; dditable.pfnMap = pDdiTable->pfnMap; pDdiTable->pfnMap = tracing_layer::zeVirtualMemMap; dditable.pfnUnmap = pDdiTable->pfnUnmap; pDdiTable->pfnUnmap = tracing_layer::zeVirtualMemUnmap; dditable.pfnSetAccessAttribute = pDdiTable->pfnSetAccessAttribute; pDdiTable->pfnSetAccessAttribute = tracing_layer::zeVirtualMemSetAccessAttribute; dditable.pfnGetAccessAttribute = pDdiTable->pfnGetAccessAttribute; pDdiTable->pfnGetAccessAttribute = tracing_layer::zeVirtualMemGetAccessAttribute; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricEdgeExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFabricEdgeExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fabric_edge_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.FabricEdgeExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetExp = pDdiTable->pfnGetExp; pDdiTable->pfnGetExp = tracing_layer::zeFabricEdgeGetExp; dditable.pfnGetVerticesExp = pDdiTable->pfnGetVerticesExp; pDdiTable->pfnGetVerticesExp = tracing_layer::zeFabricEdgeGetVerticesExp; dditable.pfnGetPropertiesExp = pDdiTable->pfnGetPropertiesExp; pDdiTable->pfnGetPropertiesExp = tracing_layer::zeFabricEdgeGetPropertiesExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricVertexExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFabricVertexExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fabric_vertex_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = tracing_layer::context.zeDdiTable.FabricVertexExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(tracing_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(tracing_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetExp = pDdiTable->pfnGetExp; pDdiTable->pfnGetExp = tracing_layer::zeFabricVertexGetExp; dditable.pfnGetSubVerticesExp = pDdiTable->pfnGetSubVerticesExp; pDdiTable->pfnGetSubVerticesExp = tracing_layer::zeFabricVertexGetSubVerticesExp; dditable.pfnGetPropertiesExp = pDdiTable->pfnGetPropertiesExp; pDdiTable->pfnGetPropertiesExp = tracing_layer::zeFabricVertexGetPropertiesExp; dditable.pfnGetDeviceExp = pDdiTable->pfnGetDeviceExp; pDdiTable->pfnGetDeviceExp = tracing_layer::zeFabricVertexGetDeviceExp; return result; } #if defined(__cplusplus) }; #endif level-zero-1.20.6/source/layers/validation/000077500000000000000000000000001475521542100206235ustar00rootroot00000000000000level-zero-1.20.6/source/layers/validation/CMakeLists.txt000066400000000000000000000034001475521542100233600ustar00rootroot00000000000000# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: MIT set(TARGET_NAME ze_validation_layer) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ZeValidationLayerVersion.rc.in ${CMAKE_CURRENT_BINARY_DIR}/ZeValidationLayerVersion.rc @ONLY) add_library(${TARGET_NAME} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/ze_validation_layer.h ${CMAKE_CURRENT_SOURCE_DIR}/ze_validation_layer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_valddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zet_valddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zes_valddi.cpp ${CMAKE_CURRENT_BINARY_DIR}/ZeValidationLayerVersion.rc ) target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common ${CMAKE_CURRENT_SOURCE_DIR}/handle_lifetime_tracking ${CMAKE_CURRENT_SOURCE_DIR}/checkers/parameter_validation ${CMAKE_CURRENT_SOURCE_DIR}/checkers/template ${CMAKE_CURRENT_SOURCE_DIR}/../../utils ) target_link_libraries(${TARGET_NAME} PRIVATE level_zero_utils) if(UNIX) set(GCC_COVERAGE_COMPILE_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}") endif() set_target_properties(${TARGET_NAME} PROPERTIES VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" SOVERSION "${PROJECT_VERSION_MAJOR}" ) install(TARGETS ze_validation_layer ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero-devel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT level-zero LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT level-zero NAMELINK_COMPONENT level-zero-devel ) add_subdirectory(handle_lifetime_tracking) add_subdirectory(checkers) level-zero-1.20.6/source/layers/validation/CONTRIBUTING.md000066400000000000000000000104351475521542100230570ustar00rootroot00000000000000# Contributing We encourage anyone who wants to contribute to the validation layer to submit [Issues](https://github.com/oneapi-src/level-zero/issues) and [Pull Requests](https://github.com/oneapi-src/level-zero/pulls). We will help review these for proper alignment with the [Level Zero Specification](https://spec.oneapi.com/level-zero/latest/index.html). ## C++ Coding Standards * C++14 maximum support * Avoid C Arrays, replace with `std::array<>` / `std::vector<>` * Avoid "magic numbers" * Avoid C-style memory allocations in favor of C++ * Use `nullptr` instead of `NULL` * Don't add `void` to empty argument lists * Use `std::unique_ptr` in place of `std::auto_ptr` ## Validation Checkers * To allow for dynamic validation of input/outputs from all Level Zero APIs, the Validation Layer supports pluggable validation checkers. * These pluggable validation checkers are compiled into the Validation layer and can be enabled thru per checker environment variables. * Current Checkers are: * * `PARAMETER_VALIDATION` * To create your own checker, one must first generate the skeleton for the new checker using the `scripts/generate_checker.py`. * Generate a checker template thru: * * `python3 ./scripts/generate_checker.py .` * * this will create a new folder at `source/layers/validation/checkers/` * * this folder will have 3 files, the `CMakeLists.txt` include file, `zel__checker.cpp`, and `zel__checker.h` * * Naming Convention of the Checkers in the generator is `PascalCase`. * * An `EXAMPLE` Checker is located [here](./checkers/template/zel_template_checker.cpp) * Once one has generated the checker files, one can define intercepts for any of the functions in the Level Zero Specification. * Each function allows for Prologue and Epilogue intercepts to check both the pre and post call parameters. * In your generated class, one can overide any functions with: * * `Prologue(` * * `Epilogue(` * Once your checker meets your needs, include your checker in the compile by adding your new checker folder to: * * `source/layers/validation/checkers/CMakeLists.txt` * Your new checker will need to be enabled during runtime with `ZEL_ENABLE__CHECKER=1` when the validation layer is enabled with `ZE_ENABLE_VALIDATION_LAYER=1`. ## Sign Your Work Please use the sign-off line at the end of your patch. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. To do so, if you can certify the below (from [developercertificate.org](http://developercertificate.org/)): ``` Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 660 York Street, Suite 102, San Francisco, CA 94110 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` Then add a line to every git commit message: Signed-off-by: Kris Smith Use your real name (sorry, no pseudonyms or anonymous contributions). If you set your `user.name` and `user.email` git configs, you can sign your commit automatically with `git commit -s`.level-zero-1.20.6/source/layers/validation/README.md000066400000000000000000000114111475521542100221000ustar00rootroot00000000000000# Level Zero Validation Layer ## Introduction The Level Zero driver implementations [by design](https://oneapi-src.github.io/level-zero-spec/level-zero/latest/core/INTRO.html#error-handling) do minimal error checking and do not guard against invalid API programming. The Level Zero Validation layer is intended to be the primary Level Zero API error handling mechanism. The validation layer can be enabled at runtime with environment settings. When validation layer is enabled, L0 loader will inject calls to validation layer into L0 API DDI tables. When validation layer is not enabled, it is completely removed from the call path and has no performance cost. ## Usage The validation layer is built into a shared library named libze_validation_layer.so or ze_validation_layer.dll. This library must be in your library search path. The validation layer can be enabled at runtime by setting `ZE_ENABLE_VALIDATION_LAYER=1` Level Zero Loader will read this environment settings when either `zeInit` or `zesInit` is called and set up the DDI function pointer tables accordingly. By default, no validation modes will be enabled. The individual validation modes must be enabled with the following environment settings: - `ZE_ENABLE_PARAMETER_VALIDATION` - `ZE_ENABLE_HANDLE_LIFETIME` - `ZEL_ENABLE_EVENTS_CHECKER` - `ZEL_ENABLE_BASIC_LEAK_CHECKER` - `ZE_ENABLE_THREADING_VALIDATION` (Not yet Implemented) ## Validation Modes ### `ZE_ENABLE_PARAMETER_VALIDATION` Parameter Validation mode maintains no internal state. It performs the following checks on each API before calling into driver: - Non-optional input pointers must not be `nullptr` - Non-optional input handles must not be `0` - Input flags must only have valid flag values set - Input enums values must not be greater than max defined value - (Planned) `stype` must be set to a valid `ze_structure_type_t` for struct - (Planned) `pNext` must be `nullptr` or point to a valid extension struct If a check fails, the appropriate error code is returned and the driver API is not called. ### `ZE_ENABLE_HANDLE_LIFETIME` This mode maintains an internal mapping of each handle type to a state structure. - When handle is created it is added to map - When handle is destroyed it is removed from map - When application inputs a handle it is validated - validates handles are properly destroyed - Additional per handle state checks added as needed - Example - Check ze_cmdlist_handle_t open or closed ### `ZEL_ENABLE_EVENTS_CHECKER` The Events Checker validates usage of events. - It is designed to detect potential deadlocks that might occur due to improper event usage in the Level Zero API. It prints out warning messages for user when it detects a potential deadlock. - In some cases it may also detect whether an event is being used more than once without being reset. Consider a case in which a single event is signaled from twice. ### `ZEL_ENABLE_BASIC_LEAK_CHECKER` Basic leak checker in the validation layer which tracks the Create and Destroy calls for a given handle type and reports if a create/destroy is missing. #### Sample Output ``` ---------------------------------------------------------------------- zeContextCreate = 1 \---> zeContextDestroy = 1 zeCommandQueueCreate = 1 \---> zeCommandQueueDestroy = 1 zeModuleCreate = 1 \---> zeModuleDestroy = 1 zeKernelCreate = 1 \---> zeKernelDestroy = 1 zeEventPoolCreate = 1 \---> zeEventPoolDestroy = 1 zeCommandListCreateImmediate = 1 | zeCommandListCreate = 1 \---> zeCommandListDestroy = 1 ---> LEAK = 1 zeEventCreate = 2 \---> zeEventDestroy = 2 zeFenceCreate = 1 \---> zeFenceDestroy = 1 zeImageCreate = 0 \---> zeImageDestroy = 0 zeSamplerCreate = 0 \---> zeSamplerDestroy = 0 zeMemAllocDevice = 0 | zeMemAllocHost = 1 | zeMemAllocShared = 0 \---> zeMemFree = 1 ``` ### `ZE_ENABLE_THREADING_VALIDATION` (Not yet Implemeneted) Validates: - Objects are not concurrently reused in free-threaded API calls ## Testing There is a small set of negative test cases designed to test the validation layer in the [level zero tests repo](https://github.com/oneapi-src/level-zero-tests/tree/master/negative_tests). It is desired to add new unit tests directly into validation layer repo that executes with null driver and does not have additional dependencies. Help Wanted! ## Contributing See [CONTRIBUTING](CONTRIBUTING.md) for more information. level-zero-1.20.6/source/layers/validation/ZeValidationLayerVersion.rc.in000066400000000000000000000024061475521542100265140ustar00rootroot00000000000000#define VER_FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@ #define VER_FILEVERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@\0" #define VER_PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@ #define VER_PRODUCTVERSION_STR "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@\0" #define VER_FILEDESCRIPTION_STR "oneAPI Level Zero Validation Layer for Windows(R) Level Zero Drivers" #define VER_PRODUCT_NAME_STR "oneAPI Level Zero Validation Layer for Windows(R)" #define VER_LEGALCOPYRIGHT_STR "Copyright (C) 2020 Intel Corporation" 1 VERSIONINFO FILEVERSION VER_FILEVERSION PRODUCTVERSION VER_PRODUCTVERSION BEGIN BLOCK "StringFileInfo" BEGIN BLOCK "040904E4" BEGIN VALUE "FileDescription", VER_FILEDESCRIPTION_STR VALUE "FileVersion", VER_FILEVERSION_STR VALUE "ProductVersion", VER_PRODUCTVERSION_STR VALUE "ProductName", VER_PRODUCT_NAME_STR VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR END END BLOCK "VarFileInfo" BEGIN VALUE "Translation", 0x409, 1252 END ENDlevel-zero-1.20.6/source/layers/validation/checkers/000077500000000000000000000000001475521542100224125ustar00rootroot00000000000000level-zero-1.20.6/source/layers/validation/checkers/CMakeLists.txt000066400000000000000000000002001475521542100251420ustar00rootroot00000000000000add_subdirectory(basic_leak) add_subdirectory(events_checker) add_subdirectory(parameter_validation) add_subdirectory(template) level-zero-1.20.6/source/layers/validation/checkers/basic_leak/000077500000000000000000000000001475521542100244675ustar00rootroot00000000000000level-zero-1.20.6/source/layers/validation/checkers/basic_leak/CMakeLists.txt000066400000000000000000000002431475521542100272260ustar00rootroot00000000000000target_sources(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/zel_basic_leak_checker.h ${CMAKE_CURRENT_LIST_DIR}/zel_basic_leak_checker.cpp )level-zero-1.20.6/source/layers/validation/checkers/basic_leak/zel_basic_leak_checker.cpp000066400000000000000000000310031475521542100316030ustar00rootroot00000000000000/* * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_basic_leak_checker.cpp * */ #include "zel_basic_leak_checker.h" #include #include #include #include namespace validation_layer { class basic_leakChecker basic_leak_checker; basic_leakChecker::basic_leakChecker() { enablebasic_leak = getenv_tobool( "ZEL_ENABLE_BASIC_LEAK_CHECKER" ); if(enablebasic_leak) { basic_leakChecker::ZEbasic_leakChecker *zeChecker = new basic_leakChecker::ZEbasic_leakChecker; basic_leakChecker::ZESbasic_leakChecker *zesChecker = new basic_leakChecker::ZESbasic_leakChecker; basic_leakChecker::ZETbasic_leakChecker *zetChecker = new basic_leakChecker::ZETbasic_leakChecker; basic_leak_checker.zeValidation = zeChecker; basic_leak_checker.zetValidation = zetChecker; basic_leak_checker.zesValidation = zesChecker; validation_layer::context.validationHandlers.push_back(&basic_leak_checker); } } basic_leakChecker::~basic_leakChecker() { if(enablebasic_leak) { delete basic_leak_checker.zeValidation; delete basic_leak_checker.zetValidation; delete basic_leak_checker.zesValidation; } } struct ctorsAndDtors { std::vector ctors; std::vector dtors; }; static std::vector createDestroySet() { return { {{"zeContextCreate"}, {"zeContextDestroy"}}, {{"zeCommandQueueCreate"}, {"zeCommandQueueDestroy"}}, {{"zeModuleCreate"}, {"zeModuleDestroy"}}, {{"zeKernelCreate"}, {"zeKernelDestroy"}}, {{"zeEventPoolCreate"}, {"zeEventPoolDestroy"}}, {{"zeCommandListCreateImmediate", "zeCommandListCreate"}, {"zeCommandListDestroy"}}, {{"zeEventCreate"}, {"zeEventDestroy"}}, {{"zeFenceCreate"}, {"zeFenceDestroy"}}, {{"zeImageCreate", "zeImageViewCreateExt"}, {"zeImageDestroy"}}, {{"zeSamplerCreate"}, {"zeSamplerDestroy"}}, {{"zeMemAllocDevice", "zeMemAllocHost", "zeMemAllocShared"}, {"zeMemFree", "zeMemFreeExt"}} }; } basic_leakChecker::ZEbasic_leakChecker::ZEbasic_leakChecker() { // initialize counts for all functions that should be tracked auto set = createDestroySet(); for (const auto &s : set) { for (auto &name : s.ctors) { counts[name] = 0; } for (auto &name : s.dtors) { counts[name] = 0; } } } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeContextCreateEpilogue(ze_driver_handle_t, const ze_context_desc_t *, ze_context_handle_t*, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeContextCreate"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeContextDestroyEpilogue(ze_context_handle_t, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeContextDestroy"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeCommandQueueCreateEpilogue(ze_context_handle_t, ze_device_handle_t, const ze_command_queue_desc_t *, ze_command_queue_handle_t *, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeCommandQueueCreate"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeCommandQueueDestroyEpilogue(ze_command_queue_handle_t, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeCommandQueueDestroy"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeModuleCreateEpilogue(ze_context_handle_t, ze_device_handle_t, const ze_module_desc_t*, ze_module_handle_t*, ze_module_build_log_handle_t*, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeModuleCreate"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeModuleDestroyEpilogue(ze_module_handle_t, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeModuleDestroy"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeKernelCreateEpilogue(ze_module_handle_t, const ze_kernel_desc_t*, ze_kernel_handle_t*, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeKernelCreate"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeKernelDestroyEpilogue(ze_kernel_handle_t, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeKernelDestroy"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeEventPoolCreateEpilogue(ze_context_handle_t, const ze_event_pool_desc_t*, uint32_t, ze_device_handle_t*, ze_event_pool_handle_t*, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeEventPoolCreate"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeEventPoolDestroyEpilogue(ze_event_pool_handle_t, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeEventPoolDestroy"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeCommandListCreateImmediateEpilogue(ze_context_handle_t, ze_device_handle_t, const ze_command_queue_desc_t*, ze_command_list_handle_t*, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeCommandListCreateImmediate"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeCommandListCreateEpilogue(ze_context_handle_t, ze_device_handle_t, const ze_command_list_desc_t*, ze_command_list_handle_t*, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeCommandListCreate"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeCommandListDestroyEpilogue(ze_command_list_handle_t, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeCommandListDestroy"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeEventCreateEpilogue(ze_event_pool_handle_t, const ze_event_desc_t *, ze_event_handle_t *, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeEventCreate"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeEventDestroyEpilogue(ze_event_handle_t, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeEventDestroy"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeFenceCreateEpilogue(ze_command_queue_handle_t, const ze_fence_desc_t *, ze_fence_handle_t*, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeFenceCreate"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeFenceDestroyEpilogue(ze_fence_handle_t, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeFenceDestroy"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeImageCreateEpilogue(ze_context_handle_t, ze_device_handle_t, const ze_image_desc_t*, ze_image_handle_t*, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeImageCreate"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeImageViewCreateExtEpilogue(ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t hImage, ze_image_handle_t* phImageView , ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeImageViewCreateExt"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeImageDestroyEpilogue(ze_image_handle_t, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeImageDestroy"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeSamplerCreateEpilogue(ze_context_handle_t, ze_device_handle_t, const ze_sampler_desc_t*, ze_sampler_handle_t*, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeSamplerCreate"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeSamplerDestroyEpilogue(ze_sampler_handle_t, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeSamplerDestroy"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeMemAllocDeviceEpilogue(ze_context_handle_t, const ze_device_mem_alloc_desc_t *, size_t, size_t, ze_device_handle_t, void **, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeMemAllocDevice"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeMemAllocHostEpilogue(ze_context_handle_t, const ze_host_mem_alloc_desc_t *, size_t, size_t, void **, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeMemAllocHost"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeMemAllocSharedEpilogue(ze_context_handle_t, const ze_device_mem_alloc_desc_t *, const ze_host_mem_alloc_desc_t *, size_t, size_t, ze_device_handle_t, void **, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeMemAllocShared"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeMemFreeEpilogue(ze_context_handle_t, void *, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeMemFree"); } return result; } ze_result_t basic_leakChecker::ZEbasic_leakChecker::zeMemFreeExtEpilogue(ze_context_handle_t, const ze_memory_free_ext_desc_t*, void *, ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { countFunctionCall("zeMemFreeExt"); } return result; } void basic_leakChecker::ZEbasic_leakChecker::countFunctionCall(const std::string &functionName) { auto it = counts.find(functionName); // make sure there is no insertion happening during program exeuction // as inserting to the map is not thread safe if (it == counts.end()) { return; } it->second.fetch_add(1, std::memory_order_relaxed); } basic_leakChecker::ZEbasic_leakChecker::~ZEbasic_leakChecker() { std::cerr << "Check balance of create/destroy calls\n"; std::cerr << "----------------------------------------------------------\n"; auto set = createDestroySet(); for (const auto &s : set) { auto &ctors = s.ctors; auto &dtors = s.dtors; int64_t diff = 0; for (size_t i = 0; i < ctors.size(); i++) { auto name = ctors[i]; auto zeCount = counts[name].load(); diff += zeCount; if (i > 0) { std::cerr << " |\n"; } std::cerr << std::setw(30) << std::right << name; std::cerr << " = "; std::cerr << std::setw(5) << std::left << zeCount; } std::cerr << " \\--->"; for (size_t i = 0; i < dtors.size(); i++) { auto name = dtors[i]; auto zeCount = counts[name].load(); diff -= zeCount; if (i > 0) { std::cerr << "\n"; std::cerr << std::setw(44) << std::right << "\\--->"; } std::cerr << std::setw(30) << std::right << name; std::cerr << " = "; std::cerr << std::setw(5) << std::left << zeCount; } if (diff) { std::cerr << " ---> LEAK = " << diff; } std::cerr << std::endl; } } } level-zero-1.20.6/source/layers/validation/checkers/basic_leak/zel_basic_leak_checker.h000066400000000000000000000146301475521542100312570ustar00rootroot00000000000000/* * * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_basic_leak_checker.h * */ #pragma once #include #include #include #include "ze_api.h" #include "ze_validation_layer.h" namespace validation_layer { // Counts the number of calls to each function and reports (in the dtor) // the difference between the number of calls to create and destroy functions // if there is a mismatch. // // The functions to track are passed in the constructor. // // A sample output is this: // ------------------------------------------------------------------------ // zeContextCreate = 1 \---> zeContextDestroy = 1 // zeCommandQueueCreate = 1 \---> zeCommandQueueDestroy = 1 // zeModuleCreate = 1 \---> zeModuleDestroy = 1 // zeKernelCreate = 1 \---> zeKernelDestroy = 1 // zeEventPoolCreate = 1 \---> zeEventPoolDestroy = 1 // zeCommandListCreateImmediate = 1 | // zeCommandListCreate = 1 \---> zeCommandListDestroy = 1 ---> LEAK = 1 // zeEventCreate = 2 \---> zeEventDestroy = 2 // zeFenceCreate = 1 \---> zeFenceDestroy = 1 // zeImageCreate = 0 \---> zeImageDestroy = 0 // zeSamplerCreate = 0 \---> zeSamplerDestroy = 0 // zeMemAllocDevice = 0 | // zeMemAllocHost = 1 | // zeMemAllocShared = 0 \---> zeMemFree = 1 // \---> zeMemFreeExt = 0 // class __zedlllocal basic_leakChecker : public validationChecker{ public: basic_leakChecker(); ~basic_leakChecker(); class ZEbasic_leakChecker : public ZEValidationEntryPoints { public: ZEbasic_leakChecker(); ~ZEbasic_leakChecker(); ze_result_t zeContextCreateEpilogue(ze_driver_handle_t, const ze_context_desc_t *, ze_context_handle_t*, ze_result_t result) override; ze_result_t zeContextDestroyEpilogue(ze_context_handle_t, ze_result_t result) override; ze_result_t zeCommandQueueCreateEpilogue(ze_context_handle_t, ze_device_handle_t, const ze_command_queue_desc_t *, ze_command_queue_handle_t *, ze_result_t result) override; ze_result_t zeCommandQueueDestroyEpilogue(ze_command_queue_handle_t, ze_result_t result) override; ze_result_t zeModuleCreateEpilogue(ze_context_handle_t, ze_device_handle_t, const ze_module_desc_t*, ze_module_handle_t*, ze_module_build_log_handle_t*, ze_result_t result) override; ze_result_t zeModuleDestroyEpilogue(ze_module_handle_t, ze_result_t result) override; ze_result_t zeKernelCreateEpilogue(ze_module_handle_t, const ze_kernel_desc_t*, ze_kernel_handle_t*, ze_result_t result) override; ze_result_t zeKernelDestroyEpilogue(ze_kernel_handle_t, ze_result_t result) override; ze_result_t zeEventPoolCreateEpilogue(ze_context_handle_t, const ze_event_pool_desc_t*, uint32_t, ze_device_handle_t*, ze_event_pool_handle_t*, ze_result_t result) override; ze_result_t zeEventPoolDestroyEpilogue(ze_event_pool_handle_t, ze_result_t result) override; ze_result_t zeCommandListCreateImmediateEpilogue(ze_context_handle_t, ze_device_handle_t, const ze_command_queue_desc_t*, ze_command_list_handle_t*, ze_result_t result) override; ze_result_t zeCommandListCreateEpilogue(ze_context_handle_t, ze_device_handle_t, const ze_command_list_desc_t*, ze_command_list_handle_t*, ze_result_t result) override; ze_result_t zeCommandListDestroyEpilogue(ze_command_list_handle_t, ze_result_t result) override; ze_result_t zeEventCreateEpilogue(ze_event_pool_handle_t, const ze_event_desc_t *, ze_event_handle_t *, ze_result_t result) override; ze_result_t zeEventDestroyEpilogue(ze_event_handle_t, ze_result_t result) override; ze_result_t zeFenceCreateEpilogue(ze_command_queue_handle_t, const ze_fence_desc_t *, ze_fence_handle_t*, ze_result_t result) override; ze_result_t zeFenceDestroyEpilogue(ze_fence_handle_t, ze_result_t result) override; ze_result_t zeImageCreateEpilogue(ze_context_handle_t, ze_device_handle_t, const ze_image_desc_t*, ze_image_handle_t*, ze_result_t result) override; ze_result_t zeImageViewCreateExtEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t hImage, ze_image_handle_t* phImageView , ze_result_t result) override; ze_result_t zeImageDestroyEpilogue(ze_image_handle_t, ze_result_t result) override; ze_result_t zeSamplerCreateEpilogue(ze_context_handle_t, ze_device_handle_t, const ze_sampler_desc_t*, ze_sampler_handle_t*, ze_result_t result) override; ze_result_t zeSamplerDestroyEpilogue(ze_sampler_handle_t, ze_result_t result) override; ze_result_t zeMemAllocDeviceEpilogue(ze_context_handle_t, const ze_device_mem_alloc_desc_t *, size_t, size_t, ze_device_handle_t, void **, ze_result_t result) override; ze_result_t zeMemAllocHostEpilogue(ze_context_handle_t, const ze_host_mem_alloc_desc_t *, size_t, size_t, void **, ze_result_t result) override; ze_result_t zeMemAllocSharedEpilogue(ze_context_handle_t, const ze_device_mem_alloc_desc_t *, const ze_host_mem_alloc_desc_t *, size_t, size_t, ze_device_handle_t, void **, ze_result_t result) override; ze_result_t zeMemFreeEpilogue(ze_context_handle_t, void *, ze_result_t result) override; ze_result_t zeMemFreeExtEpilogue(ze_context_handle_t, const ze_memory_free_ext_desc_t*, void *, ze_result_t result) override; private: void countFunctionCall(const std::string &functionName); std::unordered_map> counts; }; class ZESbasic_leakChecker : public ZESValidationEntryPoints {}; class ZETbasic_leakChecker : public ZETValidationEntryPoints {}; bool enablebasic_leak = false; }; extern class basic_leakChecker basic_leak_checker; }level-zero-1.20.6/source/layers/validation/checkers/events_checker/000077500000000000000000000000001475521542100254025ustar00rootroot00000000000000level-zero-1.20.6/source/layers/validation/checkers/events_checker/CMakeLists.txt000066400000000000000000000004571475521542100301500ustar00rootroot00000000000000target_sources(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/zel_events_checker.h ${CMAKE_CURRENT_LIST_DIR}/zel_events_checker.cpp ${THIRD_PARTY_SOURCE_DIR}/xla/graphcycles.cc ) target_include_directories(${TARGET_NAME} PRIVATE ${THIRD_PARTY_SOURCE_DIR} ) level-zero-1.20.6/source/layers/validation/checkers/events_checker/DESIGN.md000066400000000000000000000042041475521542100266750ustar00rootroot00000000000000# Events Deadlock Checker Design Document This document outlines the design and implementation details of the events checker. ## Introduction The Events Checker validates usage of events. - It is designed to detect potential deadlocks that might occur due to improper event usage in the Level Zero API. It prints out warning messages for user when it detects a potential deadlock. - It may also detect whether an event is being used more than once without being reset. Consider a case in which a single event is signaled from twice. ## Objectives - Detect potential deadlocks caused by event usage. - Provide detailed information to help developers identify and resolve deadlock issues. ## Design Overview The checker creates an internal Directed Acyclic Graph (DAG) of dependencies between API calls (the actions that are nodes in the graph) and events (the edges in the graph). It also maintains a topological sort and when an attempt is made to insert an edge that causes a cycle in the graph it warns the user of a potential deadlock and returns without inserting that edge. ## API Implemented ### zeEventCreate ### zeEventDestroy ### zeCommandListAppendMemoryCopy ### zeCommandListAppendWriteGlobalTimestamp ### zeCommandListAppendBarrier ### zeCommandListAppendMemoryRangesBarrier ### zeCommandListAppendMemoryFill ### zeCommandListAppendMemoryCopyRegion ### zeCommandListAppendMemoryCopyFromContext ### zeCommandListAppendImageCopy ### zeCommandListAppendImageCopyRegion ### zeCommandListAppendImageCopyToMemory ### zeCommandListAppendImageCopyFromMemory ### zeCommandListAppendSignalEvent ### zeCommandListAppendWaitOnEvents ### zeEventHostSignal ### zeCommandListAppendEventReset ### zeEventHostReset ### zeCommandListAppendQueryKernelTimestamp ### zeCommandListAppendLaunchKernel ### zeCommandListAppendLaunchCooperativeKernel ### zeCommandListAppendLaunchKernelIndirect ### zeCommandListAppendLaunchMultipleKernelsIndirect ### zeCommandListUpdateMutableCommandSignalEventExp ### zeCommandListUpdateMutableCommandWaitEventsExp ### zeCommandListAppendImageCopyToMemoryExt ### zeCommandListAppendImageCopyFromMemoryExt ### zeCommandListImmediateAppendCommandListsExp level-zero-1.20.6/source/layers/validation/checkers/events_checker/zel_events_checker.cpp000066400000000000000000001031561475521542100317560ustar00rootroot00000000000000/* * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_events_checker.cpp * */ #include "zel_events_checker.h" #include #include namespace validation_layer { class eventsChecker events_checker; eventsChecker::eventsChecker() { enableEvents = getenv_tobool("ZEL_ENABLE_EVENTS_CHECKER"); if (enableEvents) { eventsChecker::ZEeventsChecker *zeChecker = new eventsChecker::ZEeventsChecker; eventsChecker::ZESeventsChecker *zesChecker = new eventsChecker::ZESeventsChecker; eventsChecker::ZETeventsChecker *zetChecker = new eventsChecker::ZETeventsChecker; events_checker.zeValidation = zeChecker; events_checker.zesValidation = zesChecker; events_checker.zetValidation = zetChecker; validation_layer::context.validationHandlers.push_back(&events_checker); } } eventsChecker::~eventsChecker() { if (enableEvents) { delete events_checker.zeValidation; delete events_checker.zesValidation; delete events_checker.zetValidation; } } ze_result_t eventsChecker::ZEeventsChecker::zeEventCreateEpilogue( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool const ze_event_desc_t *desc, ///< [in] pointer to event descriptor ze_event_handle_t *phEvent, ///< [out] pointer to handle of event object created ze_result_t result ) { if(result != ZE_RESULT_SUCCESS) { return ZE_RESULT_SUCCESS; } eventToDagID[*phEvent] = invalidDagID; return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeEventDestroyEpilogue( ze_event_handle_t hEvent, ///< [in][release] handle of event object to destroy ze_result_t result ) { if(result != ZE_RESULT_SUCCESS) { return ZE_RESULT_SUCCESS; } if (eventToDagID.find(hEvent) != eventToDagID.end()) { // Delete event from eventToDagID but not from the dagIDToAction map as it may be needed for printing the discription of the action when printing path in the DAG. eventToDagID.erase(hEvent); } return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendMemoryCopyPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void *dstptr, ///< [in] pointer to destination memory to copy to const void *srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendMemoryCopy", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendWriteGlobalTimestampPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t *dstptr, ///< [in,out] pointer to memory where timestamp value will be written; must ///< be 8byte-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { checkForDeadlock("zeCommandListAppendWriteGlobalTimestamp", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendBarrierPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { checkForDeadlock("zeCommandListAppendBarrier", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendMemoryRangesBarrierPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numRanges, ///< [in] number of memory ranges const size_t *pRangeSizes, ///< [in][range(0, numRanges)] array of sizes of memory range const void **pRanges, ///< [in][range(0, numRanges)] array of memory ranges ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { checkForDeadlock("zeCommandListAppendMemoryRangesBarrier", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendMemoryFillPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void *ptr, ///< [in] pointer to memory to initialize const void *pattern, ///< [in] pointer to value to initialize memory to size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to size_t size, ///< [in] size in bytes to initialize ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendMemoryFill", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendMemoryCopyRegionPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void *dstptr, ///< [in] pointer to destination memory to copy to const ze_copy_region_t *dstRegion, ///< [in] pointer to destination region to copy to uint32_t dstPitch, ///< [in] destination pitch in bytes uint32_t dstSlicePitch, ///< [in] destination slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. const void *srcptr, ///< [in] pointer to source memory to copy from const ze_copy_region_t *srcRegion, ///< [in] pointer to source region to copy from uint32_t srcPitch, ///< [in] source pitch in bytes uint32_t srcSlicePitch, ///< [in] source slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendMemoryCopyRegion", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendMemoryCopyFromContextPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void *dstptr, ///< [in] pointer to destination memory to copy to ze_context_handle_t hContextSrc, ///< [in] handle of source context object const void *srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendMemoryCopyFromContext", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendImageCopyPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendImageCopy", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendImageCopyRegionPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t *pDstRegion, ///< [in][optional] destination region descriptor const ze_image_region_t *pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendImageCopyRegion", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendImageCopyToMemoryPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void *dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t *pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendImageCopyToMemory", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendImageCopyFromMemoryPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void *srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t *pDstRegion, ///< [in][optional] destination region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendImageCopyFromMemory", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendSignalEventPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { checkForDeadlock("zeCommandListAppendSignalEvent", hEvent, 0, nullptr); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendWaitOnEventsPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] number of events to wait on before continuing ze_event_handle_t *phEvents ///< [in][range(0, numEvents)] handles of the events to wait on before ///< continuing ) { checkForDeadlock("zeCommandListAppendWaitOnEvents", nullptr, numEvents, phEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeEventHostSignalPrologue( ze_event_handle_t hEvent ///< [in] handle of the event ) { checkForDeadlock("zeEventHostSignal", hEvent, 0, nullptr); return ZE_RESULT_SUCCESS; } void eventsChecker::ZEeventsChecker::resetEventInEventToDagID( const std::string &zeCallDisc, /// action discription const ze_event_handle_t hEvent ///< [in] handle of the event ) { auto it = eventToDagID.find(hEvent); // Check if user is using invalid events, hint if it doesn't exist in eventToDagID. if (it == eventToDagID.end()) { std::cerr << "Warning: hSignalEvent {" << hEvent << "} might be an invalid event in call to " << zeCallDisc << std::endl; return; } if (it->second != invalidDagID) { auto action = dagIDToAction.find(it->second); if (action != dagIDToAction.end()) { action->second.second = invalidEventAddress; // Reset } it->second = invalidDagID; // Reset } } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendEventResetPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { resetEventInEventToDagID("zeCommandListAppendEventReset", hEvent); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeEventHostResetPrologue( ze_event_handle_t hEvent ///< [in] handle of the event ) { resetEventInEventToDagID("zeEventHostReset", hEvent); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendQueryKernelTimestampsPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] the number of timestamp events to query ze_event_handle_t *phEvents, ///< [in][range(0, numEvents)] handles of timestamp events to query void *dstptr, ///< [in,out] pointer to memory where ::ze_kernel_timestamp_result_t will ///< be written; must be size-aligned. const size_t *pOffsets, ///< [in][optional][range(0, numEvents)] offset, in bytes, to write ///< results; address must be 4byte-aligned and offsets must be ///< size-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { checkForDeadlock("zeCommandListAppendQueryKernelTimestamps", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendLaunchKernelPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t *pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendLaunchKernel", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendLaunchCooperativeKernelPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t *pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendLaunchCooperativeKernel", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendLaunchKernelIndirectPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t *pLaunchArgumentsBuffer, ///< [in] pointer to device buffer that will contain thread group launch ///< arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendLaunchKernelIndirect", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendLaunchMultipleKernelsIndirectPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] maximum number of kernels to launch ze_kernel_handle_t *phKernels, ///< [in][range(0, numKernels)] handles of the kernel objects const uint32_t *pCountBuffer, ///< [in] pointer to device memory location that will contain the actual ///< number of kernels to launch; value must be less than or equal to ///< numKernels const ze_group_count_t *pLaunchArgumentsBuffer, ///< [in][range(0, numKernels)] pointer to device buffer that will contain ///< a contiguous array of thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendLaunchMultipleKernelsIndirect", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListUpdateMutableCommandSignalEventExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier ze_event_handle_t hSignalEvent ///< [in][optional] handle of the event to signal on completion ) { checkForDeadlock("zeCommandListUpdateMutableCommandSignalEventExp", hSignalEvent, 0, nullptr); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListUpdateMutableCommandWaitEventsExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier uint32_t numWaitEvents, ///< [in][optional] the number of wait events ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListUpdateMutableCommandWaitEventsExp", nullptr, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendImageCopyToMemoryExtPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void *dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t *pSrcRegion, ///< [in][optional] source region descriptor uint32_t destRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being written uint32_t destSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being written ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendImageCopyToMemoryExt", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListAppendImageCopyFromMemoryExtPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void *srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t *pDstRegion, ///< [in][optional] destination region descriptor uint32_t srcRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being read uint32_t srcSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being read ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { checkForDeadlock("zeCommandListAppendImageCopyFromMemoryExt", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } ze_result_t eventsChecker::ZEeventsChecker::zeCommandListImmediateAppendCommandListsExpPrologue( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t numCommandLists, ///< [in] number of command lists ze_command_list_handle_t *phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion ///< - if not null, this event is signaled after the completion of all ///< appended command lists uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended ///< command lists; must be 0 if nullptr == phWaitEvents ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing appended command lists. ///< - if not null, all wait events must be satisfied prior to the start ///< of any appended command list(s) ) { checkForDeadlock("zeCommandListImmediateAppendCommandListsExp", hSignalEvent, numWaitEvents, phWaitEvents); return ZE_RESULT_SUCCESS; } void eventsChecker::ZEeventsChecker::validateSignalEventOwnership(const std::string &zeCallDisc, const ze_event_handle_t hSignalEvent) { const auto it = eventToDagID.find(hSignalEvent); if (it != eventToDagID.end() && it->second != invalidDagID) { const auto actionIt = dagIDToAction.find(it->second); if (actionIt != dagIDToAction.end()) { const std::string previousActionOwner = actionIt->second.first; std::cerr << "Warning: " << zeCallDisc << " is using the same ze_event_handle_t for signal {" << hSignalEvent << "} which has been previously used by: " << previousActionOwner << std::endl; } } } void eventsChecker::ZEeventsChecker::checkForDeadlock( const std::string &zeCallDisc, /// action discription const ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to forming the outgoing edge in the DAG const uint32_t numWaitEvents, ///< [in][optional] number of events that point to this action. const ze_event_handle_t *phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events that point to this action. ) { uint32_t this_action_new_node_id = invalidDagID; if (hSignalEvent != nullptr) { auto it = eventToDagID.find(hSignalEvent); // Check if user is using invalid events, hint if it doesn't exist in eventToDagID. if (it == eventToDagID.end()) { std::cerr << "Warning: hSignalEvent {" << hSignalEvent << "} might be an invalid event in call to " << zeCallDisc << std::endl; return; } // A passive check to see if the user is using the same event for multiple actions. // It only print warnings and does not stop the event deadlock checker. validateSignalEventOwnership(zeCallDisc, hSignalEvent); if (it->second != invalidDagID) { // This event already exists in the DAG. Get the DAG node ID. // For example when there is indeed a deadlock it would have already been created. this_action_new_node_id = it->second; } } for (uint32_t i = 0; i < numWaitEvents; i++) { if (eventToDagID.find(phWaitEvents[i]) == eventToDagID.end()) { std::cerr << "Warning: phWaitEvents {" << hSignalEvent << "} might be an invalid event in call to " << zeCallDisc << std::endl; return; } } if (this_action_new_node_id == invalidDagID) { // Create node in DAG this_action_new_node_id = addNodeInDag(); // Now we know where the hSignalEvent points from/out in the DAG. Update the eventToDagID map. eventToDagID[hSignalEvent] = this_action_new_node_id; } // Add this action to the actionToDagID map. std::ostringstream oss; oss << zeCallDisc << ": (hSignalEvent{" << hSignalEvent << "}, phWaitEvents{"; for (uint32_t i = 0; i < numWaitEvents; i++) { oss << phWaitEvents[i]; if (i < numWaitEvents - 1) { oss << ", "; } } oss << "})"; std::string action = oss.str(); // Convert the stream to a string. dagIDToAction[this_action_new_node_id] = actionAndSignalEvent(action, hSignalEvent); // Form the dependency in the DAG for (uint32_t i = 0; i < numWaitEvents; i++) { auto it = eventToDagID.find(phWaitEvents[i]); if (it == eventToDagID.end()) { std::cerr << "Warning: phWaitEvents {" << phWaitEvents[i] << "} might be an invalid event in call to " << zeCallDisc << std::endl; return; } uint32_t dagID = it->second; if (dagID == invalidDagID) { // Create a new node in the DAG for this wait event. That action will be created some time in the future. dagID = addNodeInDag(); it->second = dagID; } auto getActionDetails = [&](int dagID) -> std::string { auto actionIt = dagIDToAction.find(dagID); return (actionIt != dagIDToAction.end()) ? actionIt->second.first : "PLACEHOLDER"; }; if (!addEdgeInDag(dagID, this_action_new_node_id)) { std::string fromAction = getActionDetails(dagID); std::string toAction = getActionDetails(this_action_new_node_id); std::cerr << "Warning: There may be a potential event deadlock!\n"; std::cerr << "Adding the following dependency would create a cycle in the DAG:\n\tFrom: " << fromAction << "\n\tTo: " << toAction << "\n"; std::cerr << "There is already a path:\n"; constexpr uint32_t maxPathLength = 15; auto path = dag.PathDagIDs(this_action_new_node_id, dagID, maxPathLength); auto dagIDsInPath = path.first; std::cerr << getActionDetails(dagIDsInPath[0]) << "\n"; std::string spacePrefix = ""; for (uint32_t j = 1; j < dagIDsInPath.size(); j++) { std::cerr << spacePrefix << "|\n" << spacePrefix << "-> " << getActionDetails(dagIDsInPath[j]) << "\n"; spacePrefix += " "; } if (path.second) { std::cerr << spacePrefix << "|\n" << spacePrefix << "-> ...\n"; } } } } } // namespace validation_layer level-zero-1.20.6/source/layers/validation/checkers/events_checker/zel_events_checker.h000066400000000000000000000215601475521542100314210ustar00rootroot00000000000000/* * * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_events_checker.h * */ #pragma once #include "xla/graphcycles.h" #include "ze_api.h" #include "ze_validation_layer.h" #include #include namespace validation_layer { constexpr uint32_t invalidDagID = (std::numeric_limits::max)(); constexpr ze_event_handle_t invalidEventAddress = (std::numeric_limits::max)(); using actionAndSignalEvent = std::pair; class __zedlllocal eventsChecker : public validationChecker { public: eventsChecker(); ~eventsChecker(); class ZEeventsChecker : public ZEValidationEntryPoints { public: ze_result_t zeEventCreateEpilogue(ze_event_pool_handle_t hEventPool, const ze_event_desc_t *desc, ze_event_handle_t *phEvent, ze_result_t result) override; ze_result_t zeEventDestroyEpilogue(ze_event_handle_t hEvent, ze_result_t result) override; ze_result_t zeCommandListAppendMemoryCopyPrologue(ze_command_list_handle_t hCommandList, void *dstptr, const void *srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendWriteGlobalTimestampPrologue(ze_command_list_handle_t hCommandList, uint64_t *dstptr, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendBarrierPrologue(ze_command_list_handle_t hCommandList, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendMemoryRangesBarrierPrologue(ze_command_list_handle_t hCommandList, uint32_t numRanges, const size_t *pRangeSizes, const void **pRanges, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendMemoryFillPrologue(ze_command_list_handle_t hCommandList, void *ptr, const void *pattern, size_t pattern_size, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendMemoryCopyRegionPrologue(ze_command_list_handle_t hCommandList, void *dstptr, const ze_copy_region_t *dstRegion, uint32_t dstPitch, uint32_t dstSlicePitch, const void *srcptr, const ze_copy_region_t *srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendMemoryCopyFromContextPrologue(ze_command_list_handle_t hCommandList, void *dstptr, ze_context_handle_t hContextSrc, const void *srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendImageCopyPrologue(ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendImageCopyRegionPrologue(ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, const ze_image_region_t *pDstRegion, const ze_image_region_t *pSrcRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendImageCopyToMemoryPrologue(ze_command_list_handle_t hCommandList, void *dstptr, ze_image_handle_t hSrcImage, const ze_image_region_t *pSrcRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendImageCopyFromMemoryPrologue(ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, const void *srcptr, const ze_image_region_t *pDstRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendSignalEventPrologue(ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent) override; ze_result_t zeCommandListAppendWaitOnEventsPrologue(ze_command_list_handle_t hCommandList, uint32_t numEvents, ze_event_handle_t *phEvents) override; ze_result_t zeEventHostSignalPrologue(ze_event_handle_t hEvent) override; ze_result_t zeCommandListAppendEventResetPrologue(ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent) override; ze_result_t zeEventHostResetPrologue(ze_event_handle_t hEvent) override; ze_result_t zeCommandListAppendQueryKernelTimestampsPrologue(ze_command_list_handle_t hCommandList, uint32_t numEvents, ze_event_handle_t *phEvents, void *dstptr, const size_t *pOffsets, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendLaunchKernelPrologue(ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t *pLaunchFuncArgs, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendLaunchCooperativeKernelPrologue(ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t *pLaunchFuncArgs, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendLaunchKernelIndirectPrologue(ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t *pLaunchArgumentsBuffer, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendLaunchMultipleKernelsIndirectPrologue(ze_command_list_handle_t hCommandList, uint32_t numKernels, ze_kernel_handle_t *phKernels, const uint32_t *pCountBuffer, const ze_group_count_t *pLaunchArgumentsBuffer, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListUpdateMutableCommandSignalEventExpPrologue(ze_command_list_handle_t hCommandList, uint64_t commandId, ze_event_handle_t hSignalEvent) override; ze_result_t zeCommandListUpdateMutableCommandWaitEventsExpPrologue(ze_command_list_handle_t hCommandList, uint64_t commandId, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendImageCopyToMemoryExtPrologue(ze_command_list_handle_t hCommandList, void *dstptr, ze_image_handle_t hSrcImage, const ze_image_region_t *pSrcRegion, uint32_t destRowPitch, uint32_t destSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListAppendImageCopyFromMemoryExtPrologue(ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, const void *srcptr, const ze_image_region_t *pDstRegion, uint32_t srcRowPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; ze_result_t zeCommandListImmediateAppendCommandListsExpPrologue(ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t *phCommandLists, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents) override; private: // Add node in the DAG and get its ID. int addNodeInDag() { return dag.NewNode(); } // Add edge in the DAG. bool addEdgeInDag(uint32_t x, uint32_t y) { return dag.InsertEdge(x, y); } // In case the user uses a single hSignalEvent twice or more, which is an ill usage. void validateSignalEventOwnership(const std::string &zeCallDisc, const ze_event_handle_t hSignalEvent); // Inserts new actions and events in the DAG based on the ze. void checkForDeadlock(const std::string &zeCallDisc, const ze_event_handle_t hSignalEvent, const uint32_t numWaitEvents, const ze_event_handle_t *phWaitEvents); // Reset the event to have an invalid DAG ID such that it can be reused. // Useful for zeCalls such as zeCommandListAppendEventReset and zeEventHostReset. void resetEventInEventToDagID(const std::string &zeCallDisc, ze_event_handle_t hEvent); // The DAG structure. xla::GraphCycles dag; // events point from/out to a DAG node. This map stores the DAG ID for each event (if there is one). std::unordered_map eventToDagID; // This map acts as a bi-directional map to eventToDagID. It maps DAG ID to a pair containing action description and signal event. std::unordered_map dagIDToAction; }; class ZESeventsChecker : public ZESValidationEntryPoints {}; class ZETeventsChecker : public ZETValidationEntryPoints {}; bool enableEvents = false; }; extern class eventsChecker events_checker; } // namespace validation_layerlevel-zero-1.20.6/source/layers/validation/checkers/parameter_validation/000077500000000000000000000000001475521542100266045ustar00rootroot00000000000000level-zero-1.20.6/source/layers/validation/checkers/parameter_validation/CMakeLists.txt000066400000000000000000000007311475521542100313450ustar00rootroot00000000000000target_sources(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/param_validation.h ${CMAKE_CURRENT_LIST_DIR}/ze_parameter_validation.cpp ${CMAKE_CURRENT_LIST_DIR}/ze_parameter_validation.h ${CMAKE_CURRENT_LIST_DIR}/zes_parameter_validation.cpp ${CMAKE_CURRENT_LIST_DIR}/zes_parameter_validation.h ${CMAKE_CURRENT_LIST_DIR}/zet_parameter_validation.cpp ${CMAKE_CURRENT_LIST_DIR}/zet_parameter_validation.h ) level-zero-1.20.6/source/layers/validation/checkers/parameter_validation/extension_validation.inl000066400000000000000000001133011475521542100335350ustar00rootroot00000000000000/* * * Copyright (C) 2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file extension_validation.inl * */ #include // High threshold for experimental driver extension values #define ZEX_EXPERIMENTAL_DRIVER_EXTENSION_MAX 0x00100000 template inline ze_result_t validateStructureTypes(const void *descriptorPtr, std::vector &baseTypesVector, std::vector &extensionTypesVector) { const B *pBase = reinterpret_cast (descriptorPtr); if (pBase == nullptr) { return ZE_RESULT_ERROR_INVALID_ARGUMENT; } bool validBaseTypeFound = false; for (auto t : (baseTypesVector)) { if (pBase->stype == t) { validBaseTypeFound = true; break; } } if (!validBaseTypeFound) { return ZE_RESULT_ERROR_INVALID_ARGUMENT; } pBase = reinterpret_cast(pBase->pNext); if ((extensionTypesVector).size()) { while(pBase) { bool validExtensionTypeFound = false; for (auto t : (extensionTypesVector)) { if (pBase->stype == t) { validExtensionTypeFound = true; // if extension type is ZE_STRUCTURE_TYPE_MODULE_PROGRAM_EXP_DESC // then base type->format must be ZE_MODULE_FORMAT_IL_SPIRV if (std::is_same::value && (ZE_STRUCTURE_TYPE_MODULE_PROGRAM_EXP_DESC == static_cast(t))){ if (ZE_MODULE_FORMAT_IL_SPIRV != reinterpret_cast(descriptorPtr)->format){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } } break; } } // If the value is greater than the // experimental driver max extension value, then return error. if (!validExtensionTypeFound && pBase->stype >= ZEX_EXPERIMENTAL_DRIVER_EXTENSION_MAX) { return ZE_RESULT_ERROR_INVALID_ARGUMENT; } pBase = reinterpret_cast(pBase->pNext); } } // Check for invalid stype values, if the value is greater than the // experimental driver max extension value, then return error. if (pBase && pBase->stype >= ZEX_EXPERIMENTAL_DRIVER_EXTENSION_MAX) { return ZE_RESULT_ERROR_INVALID_ARGUMENT; } return ZE_RESULT_SUCCESS; } /* Begin ze_api cases */ template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_device_p2p_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_P2P_PROPERTIES}; std::vector types = {ZE_STRUCTURE_TYPE_DEVICE_P2P_BANDWIDTH_EXP_PROPERTIES}; return validateStructureTypes (descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_pci_ext_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_PCI_EXT_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_device_memory_properties_t *descriptor) { if (descriptor == nullptr) { return ZE_RESULT_SUCCESS; } std::vector baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_MEMORY_PROPERTIES}; std::vector types = {ZE_STRUCTURE_TYPE_DEVICE_MEMORY_EXT_PROPERTIES}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_device_memory_access_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_MEMORY_ACCESS_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_kernel_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_KERNEL_PROPERTIES}; std::vector types = {ZE_STRUCTURE_TYPE_FLOAT_ATOMIC_EXT_PROPERTIES, ZE_STRUCTURE_TYPE_SCHEDULING_HINT_EXP_PROPERTIES, ZE_STRUCTURE_TYPE_DEVICE_RAYTRACING_EXT_PROPERTIES, ZE_STRUCTURE_TYPE_KERNEL_PREFERRED_GROUP_SIZE_PROPERTIES}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_device_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES, ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES_1_2}; std::vector types = {ZE_STRUCTURE_TYPE_DEVICE_LUID_EXT_PROPERTIES, ZE_STRUCTURE_TYPE_EU_COUNT_EXT, ZE_STRUCTURE_TYPE_DEVICE_IP_VERSION_EXT, ZE_STRUCTURE_TYPE_MUTABLE_COMMAND_LIST_EXP_PROPERTIES}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_device_cache_properties_t *descriptor) { if (descriptor == nullptr) { return ZE_RESULT_SUCCESS; } std::vector baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_CACHE_PROPERTIES}; std::vector types = {ZE_STRUCTURE_TYPE_CACHE_RESERVATION_EXT_DESC}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_device_image_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_IMAGE_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_device_compute_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_COMPUTE_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_device_module_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_MODULE_PROPERTIES}; std::vector types = { ZE_STRUCTURE_TYPE_FLOAT_ATOMIC_EXT_PROPERTIES, ZE_STRUCTURE_TYPE_SCHEDULING_HINT_EXP_PROPERTIES, ZE_STRUCTURE_TYPE_DEVICE_RAYTRACING_EXT_PROPERTIES}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_command_queue_group_properties_t *descriptor) { if (descriptor == nullptr) { return ZE_RESULT_SUCCESS; } std::vector baseTypes = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_GROUP_PROPERTIES}; std::vector types = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_GROUP_PROPERTIES, ZE_STRUCTURE_TYPE_COPY_BANDWIDTH_EXP_PROPERTIES}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_device_external_memory_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_EXTERNAL_MEMORY_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_driver_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_DRIVER_PROPERTIES}; std::vector types = {ZE_STRUCTURE_TYPE_DRIVER_MEMORY_FREE_EXT_PROPERTIES}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_driver_ipc_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_DRIVER_IPC_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_image_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_IMAGE_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_memory_allocation_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_MEMORY_ALLOCATION_PROPERTIES}; std::vector types = {ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_FD, ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_WIN32, ZE_STRUCTURE_TYPE_MEMORY_SUB_ALLOCATIONS_EXP_PROPERTIES}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_image_allocation_ext_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_IMAGE_ALLOCATION_EXT_PROPERTIES}; std::vector types = {ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_FD, ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_WIN32}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_module_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_MODULE_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_fabric_vertex_exp_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_FABRIC_VERTEX_EXP_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_fabric_edge_exp_properties_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_FABRIC_EDGE_EXP_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_context_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_CONTEXT_DESC}; std::vector types = {ZE_STRUCTURE_TYPE_POWER_SAVING_HINT_EXP_DESC}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_command_queue_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_command_list_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC}; // std::vector types = {ZEX_STRUCTURE_TYPE_MUTABLE_COMMAND_LIST_DESCRIPTOR}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_event_pool_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_EVENT_POOL_DESC}; std::vector types = {ZE_STRUCTURE_TYPE_COUNTER_BASED_EVENT_POOL_EXP_DESC}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_event_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_EVENT_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_fence_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_FENCE_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_image_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_IMAGE_DESC}; std::vector types = {ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMPORT_FD, ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMPORT_WIN32, ZE_STRUCTURE_TYPE_MEMORY_COMPRESSION_HINTS_EXT_DESC}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_device_mem_alloc_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC}; std::vector types = {ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC, ZE_STRUCTURE_TYPE_RAYTRACING_MEM_ALLOC_EXT_DESC, ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_DESC, ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMPORT_FD, ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMPORT_WIN32, ZE_STRUCTURE_TYPE_MEMORY_COMPRESSION_HINTS_EXT_DESC}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_host_mem_alloc_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC}; std::vector types = {ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC, ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_DESC, ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMPORT_FD, ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMPORT_WIN32, ZE_STRUCTURE_TYPE_MEMORY_COMPRESSION_HINTS_EXT_DESC}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_module_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_MODULE_DESC}; std::vector types = {ZE_STRUCTURE_TYPE_MODULE_PROGRAM_EXP_DESC}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_kernel_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_KERNEL_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_sampler_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_SAMPLER_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_physical_mem_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_PHYSICAL_MEM_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_scheduling_hint_exp_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_SCHEDULING_HINT_EXP_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } // couldn't find implementation template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_linkage_inspection_ext_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_LINKAGE_INSPECTION_EXT_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_memory_free_ext_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_MEMORY_FREE_EXT_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_image_memory_properties_exp_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_IMAGE_MEMORY_EXP_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } // ze_driver_extension_properties_t is an [out] only structure, without stype, pNext template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_driver_extension_properties_t *descriptor) { return ZE_RESULT_SUCCESS; } // THIS ONE IS PROBABLY NOT A VALID TEST template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_image_view_planar_ext_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_IMAGE_VIEW_PLANAR_EXT_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } // THIS ONE IS PROBABLY NOT A VALID TEST template <> inline ze_result_t ParameterValidation::validateExtensions(const ze_image_view_planar_exp_desc_t *descriptor) { std::vector baseTypes = {ZE_STRUCTURE_TYPE_IMAGE_VIEW_PLANAR_EXP_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } /* Begin zet_api entries */ template <> inline ze_result_t ParameterValidation::validateExtensions(const zet_metric_group_properties_t *descriptor) { std::vector baseTypes = {ZET_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES}; std::vector types = {ZET_STRUCTURE_TYPE_GLOBAL_METRICS_TIMESTAMPS_EXP_PROPERTIES}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zet_metric_properties_t *descriptor) { std::vector baseTypes = {ZET_STRUCTURE_TYPE_METRIC_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zet_metric_streamer_desc_t *descriptor) { std::vector baseTypes = {ZET_STRUCTURE_TYPE_METRIC_STREAMER_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zet_metric_query_pool_desc_t *descriptor) { std::vector baseTypes = {ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zet_profile_properties_t *descriptor) { std::vector baseTypes = {ZET_STRUCTURE_TYPE_PROFILE_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zet_device_debug_properties_t *descriptor) { std::vector baseTypes = {ZET_STRUCTURE_TYPE_DEVICE_DEBUG_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zet_debug_memory_space_desc_t *descriptor) { std::vector baseTypes = {ZET_STRUCTURE_TYPE_DEBUG_MEMORY_SPACE_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zet_debug_regset_properties_t *descriptor) { if (descriptor == nullptr) { return ZE_RESULT_SUCCESS; } std::vector baseTypes = {ZET_STRUCTURE_TYPE_DEBUG_REGSET_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zet_tracer_exp_desc_t *descriptor) { std::vector baseTypes = {ZET_STRUCTURE_TYPE_TRACER_EXP_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } /* Begin zes_api entries */ template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_device_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_DEVICE_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_pci_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_PCI_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_pci_bar_properties_t *descriptor) { if (descriptor == nullptr) { return ZE_RESULT_SUCCESS; } std::vector baseTypes = {ZES_STRUCTURE_TYPE_PCI_BAR_PROPERTIES}; std::vector types = {ZES_STRUCTURE_TYPE_PCI_BAR_PROPERTIES_1_2}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_diag_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_DIAG_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_engine_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_ENGINE_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_fabric_port_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_FABRIC_PORT_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_fan_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_FAN_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_firmware_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_FIRMWARE_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_freq_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_FREQ_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_led_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_LED_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_mem_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_MEM_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_perf_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_PERF_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_power_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_POWER_PROPERTIES}; std::vector types = {ZES_STRUCTURE_TYPE_POWER_LIMIT_EXT_DESC, ZES_STRUCTURE_TYPE_POWER_EXT_PROPERTIES}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_psu_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_PSU_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_ras_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_RAS_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_sched_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_SCHED_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_sched_timeout_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_SCHED_TIMEOUT_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_sched_timeslice_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_SCHED_TIMESLICE_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_standby_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_STANDBY_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_temp_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_TEMP_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_device_state_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_DEVICE_STATE}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_process_state_t *descriptor) { if (descriptor == nullptr) { return ZE_RESULT_SUCCESS; } std::vector baseTypes = {ZES_STRUCTURE_TYPE_PROCESS_STATE}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_pci_state_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_PCI_STATE}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_fabric_port_config_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_FABRIC_PORT_CONFIG}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_fabric_port_state_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_FABRIC_PORT_STATE}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_fan_config_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_FAN_CONFIG}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_freq_state_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_FREQ_STATE}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_oc_capabilities_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_OC_CAPABILITIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_led_state_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_LED_STATE}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_mem_state_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_MEM_STATE}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_psu_state_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_PSU_STATE}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } // This one is odd. I don't find any actual uses of this one. template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_base_state_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_BASE_STATE}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_ras_config_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_RAS_CONFIG}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_ras_state_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_RAS_STATE}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_temp_config_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_TEMP_CONFIG}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_device_ecc_desc_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_DEVICE_ECC_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_device_ecc_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_DEVICE_ECC_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_power_limit_ext_desc_t *descriptor) { if (descriptor == nullptr) { return ZE_RESULT_SUCCESS; } std::vector baseTypes = {ZES_STRUCTURE_TYPE_POWER_LIMIT_EXT_DESC}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } template <> inline ze_result_t ParameterValidation::validateExtensions(const zes_overclock_properties_t *descriptor) { std::vector baseTypes = {ZES_STRUCTURE_TYPE_OVERCLOCK_PROPERTIES}; std::vector types = {}; return validateStructureTypes(descriptor, baseTypes, types); } level-zero-1.20.6/source/layers/validation/checkers/parameter_validation/param_validation.h000066400000000000000000000034241475521542100322720ustar00rootroot00000000000000 #pragma once #include "ze_validation_layer.h" #include "ze_parameter_validation.h" #include "zet_parameter_validation.h" #include "zes_parameter_validation.h" #include namespace validation_layer { class parameterValidationChecker : public validationChecker { public: parameterValidationChecker(); ~parameterValidationChecker(); bool enableParameterValidation = false; }; extern class parameterValidationChecker parameterChecker; class ParameterValidation { public: ZEParameterValidation zeParamValidation; ZESParameterValidation zesParamValidation; ZETParameterValidation zetParamValidation; template static ze_result_t validateExtensions(T descriptor); }; template ze_result_t ParameterValidation::validateExtensions(T descriptor){ const ze_base_properties_t *base = reinterpret_cast (descriptor); while(base){ if((base->stype > ZE_STRUCTURE_TYPE_EXTERNAL_MEMORY_EXPORT_WIN32 && base->stype < ZE_STRUCTURE_TYPE_DEVICE_RAYTRACING_EXT_PROPERTIES) || (base->stype > ZE_STRUCTURE_TYPE_IMAGE_VIEW_PLANAR_EXT_DESC && base->stype < ZE_STRUCTURE_TYPE_RELAXED_ALLOCATION_LIMITS_EXP_DESC) || (base->stype > ZE_STRUCTURE_TYPE_MEMORY_SUB_ALLOCATIONS_EXP_PROPERTIES && base->stype < ZE_STRUCTURE_TYPE_MUTABLE_COMMAND_LIST_EXP_PROPERTIES) || base->stype > ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC) return ZE_RESULT_ERROR_INVALID_ARGUMENT; base = reinterpret_cast(base->pNext); } return ZE_RESULT_SUCCESS; } #include "extension_validation.inl" }level-zero-1.20.6/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.cpp000066400000000000000000005244411475521542100342120ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See valddi.cpp.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_parameter_validation.cpp * */ #include "ze_validation_layer.h" #include "param_validation.h" namespace validation_layer { class parameterValidationChecker parameterChecker; parameterValidationChecker::parameterValidationChecker() { enableParameterValidation = getenv_tobool( "ZE_ENABLE_PARAMETER_VALIDATION" ); if(enableParameterValidation) { ZEParameterValidation *zeChecker = new ZEParameterValidation; ZESParameterValidation *zesChecker = new ZESParameterValidation; ZETParameterValidation *zetChecker = new ZETParameterValidation; parameterChecker.zeValidation = zeChecker; parameterChecker.zetValidation = zetChecker; parameterChecker.zesValidation = zesChecker; validation_layer::context.getInstance().validationHandlers.push_back(¶meterChecker); } } parameterValidationChecker::~parameterValidationChecker() { if(enableParameterValidation) { delete parameterChecker.zeValidation; delete parameterChecker.zetValidation; delete parameterChecker.zesValidation; } } ze_result_t ZEParameterValidation::zeInitPrologue( ze_init_flags_t flags ///< [in] initialization flags. ///< must be 0 (default) or a combination of ::ze_init_flag_t. ) { if( 0x3 < flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDriverGetPrologue( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ) { if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeInitDriversPrologue( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers, ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ze_init_driver_type_desc_t* desc ///< [in] descriptor containing the driver type initialization details ///< including ::ze_init_driver_type_flag_t combinations. ) { if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x0 == desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeDriverGetApiVersionPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_api_version_t* version ///< [out] api version ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == version ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDriverGetPropertiesPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_properties_t* pDriverProperties ///< [in,out] query result for driver properties ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pDriverProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pDriverProperties); } ze_result_t ZEParameterValidation::zeDriverGetIpcPropertiesPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_ipc_properties_t* pIpcProperties ///< [in,out] query result for IPC properties ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pIpcProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pIpcProperties); } ze_result_t ZEParameterValidation::zeDriverGetExtensionPropertiesPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. ze_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pExtensionProperties); } ze_result_t ZEParameterValidation::zeDriverGetExtensionFunctionAddressPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == name ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == ppFunctionAddress ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDriverGetLastErrorDescriptionPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char** ppString ///< [in,out] pointer to a null-terminated array of characters describing ///< cause of error. ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ppString ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDeviceGetPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of devices. ///< if count is zero, then the driver shall update the value with the ///< total number of devices available. ///< if count is greater than the number of devices available, then the ///< driver shall update the value with the correct number of devices available. ze_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of devices. ///< if count is less than the number of devices available, then driver ///< shall only retrieve that number of devices. ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDeviceGetRootDevicePrologue( ze_device_handle_t hDevice, ///< [in] handle of the device object ze_device_handle_t* phRootDevice ///< [in,out] parent root device. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phRootDevice ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDeviceGetSubDevicesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device object uint32_t* pCount, ///< [in,out] pointer to the number of sub-devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-devices available. ///< if count is greater than the number of sub-devices available, then the ///< driver shall update the value with the correct number of sub-devices available. ze_device_handle_t* phSubdevices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-devices. ///< if count is less than the number of sub-devices available, then driver ///< shall only retrieve that number of sub-devices. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDeviceGetPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_properties_t* pDeviceProperties ///< [in,out] query result for device properties ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pDeviceProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pDeviceProperties); } ze_result_t ZEParameterValidation::zeDeviceGetComputePropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_compute_properties_t* pComputeProperties ///< [in,out] query result for compute properties ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pComputeProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pComputeProperties); } ze_result_t ZEParameterValidation::zeDeviceGetModulePropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_module_properties_t* pModuleProperties///< [in,out] query result for module properties ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pModuleProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pModuleProperties); } ze_result_t ZEParameterValidation::zeDeviceGetCommandQueueGroupPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of command queue group properties. ///< if count is zero, then the driver shall update the value with the ///< total number of command queue group properties available. ///< if count is greater than the number of command queue group properties ///< available, then the driver shall update the value with the correct ///< number of command queue group properties available. ze_command_queue_group_properties_t* pCommandQueueGroupProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< command queue group properties. ///< if count is less than the number of command queue group properties ///< available, then driver shall only retrieve that number of command ///< queue group properties. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pCommandQueueGroupProperties); } ze_result_t ZEParameterValidation::zeDeviceGetMemoryPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of memory properties. ///< if count is zero, then the driver shall update the value with the ///< total number of memory properties available. ///< if count is greater than the number of memory properties available, ///< then the driver shall update the value with the correct number of ///< memory properties available. ze_device_memory_properties_t* pMemProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< memory properties. ///< if count is less than the number of memory properties available, then ///< driver shall only retrieve that number of memory properties. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pMemProperties); } ze_result_t ZEParameterValidation::zeDeviceGetMemoryAccessPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_memory_access_properties_t* pMemAccessProperties ///< [in,out] query result for memory access properties ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pMemAccessProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pMemAccessProperties); } ze_result_t ZEParameterValidation::zeDeviceGetCachePropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of cache properties. ///< if count is zero, then the driver shall update the value with the ///< total number of cache properties available. ///< if count is greater than the number of cache properties available, ///< then the driver shall update the value with the correct number of ///< cache properties available. ze_device_cache_properties_t* pCacheProperties ///< [in,out][optional][range(0, *pCount)] array of query results for cache properties. ///< if count is less than the number of cache properties available, then ///< driver shall only retrieve that number of cache properties. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pCacheProperties); } ze_result_t ZEParameterValidation::zeDeviceGetImagePropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_image_properties_t* pImageProperties ///< [in,out] query result for image properties ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pImageProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pImageProperties); } ze_result_t ZEParameterValidation::zeDeviceGetExternalMemoryPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_external_memory_properties_t* pExternalMemoryProperties ///< [in,out] query result for external memory properties ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pExternalMemoryProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pExternalMemoryProperties); } ze_result_t ZEParameterValidation::zeDeviceGetP2PPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_device_p2p_properties_t* pP2PProperties ///< [in,out] Peer-to-Peer properties between source and peer device ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hPeerDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pP2PProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pP2PProperties); } ze_result_t ZEParameterValidation::zeDeviceCanAccessPeerPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_bool_t* value ///< [out] returned access capability ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hPeerDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == value ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDeviceGetStatusPrologue( ze_device_handle_t hDevice ///< [in] handle of the device ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDeviceGetGlobalTimestampsPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the ///< Host's global timestamp value. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hostTimestamp ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == deviceTimestamp ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeContextCreatePrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phContext ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x1 < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeContextCreateExPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< context has visibility. ///< if nullptr, then all devices and any sub-devices supported by the ///< driver instance are ///< visible to the context. ///< otherwise, the context only has visibility to the devices and any ///< sub-devices of the ///< devices in this array. ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phContext ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x1 < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( (nullptr == phDevices) && (0 < numDevices) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeContextDestroyPrologue( ze_context_handle_t hContext ///< [in][release] handle of context object to destroy ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeContextGetStatusPrologue( ze_context_handle_t hContext ///< [in] handle of context object ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandQueueCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* desc, ///< [in] pointer to command queue descriptor ze_command_queue_handle_t* phCommandQueue ///< [out] pointer to handle of command queue object created ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phCommandQueue ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x3 < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS < desc->mode ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH < desc->priority ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeCommandQueueDestroyPrologue( ze_command_queue_handle_t hCommandQueue ///< [in][release] handle of command queue object to destroy ) { if( nullptr == hCommandQueue ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandQueueExecuteCommandListsPrologue( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t numCommandLists, ///< [in] number of command lists to execute ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] list of handles of the command lists ///< to execute ze_fence_handle_t hFence ///< [in][optional] handle of the fence to signal on completion ) { if( nullptr == hCommandQueue ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phCommandLists ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0 == numCommandLists ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandQueueSynchronizePrologue( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the command queue; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { if( nullptr == hCommandQueue ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandQueueGetOrdinalPrologue( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pOrdinal ///< [out] command queue group ordinal ) { if( nullptr == hCommandQueue ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pOrdinal ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandQueueGetIndexPrologue( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pIndex ///< [out] command queue index within the group ) { if( nullptr == hCommandQueue ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pIndex ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_list_desc_t* desc, ///< [in] pointer to command list descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x1f < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeCommandListCreateImmediatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* altdesc, ///< [in] pointer to command queue descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == altdesc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x3 < altdesc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS < altdesc->mode ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH < altdesc->priority ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(altdesc); } ze_result_t ZEParameterValidation::zeCommandListDestroyPrologue( ze_command_list_handle_t hCommandList ///< [in][release] handle of command list object to destroy ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListClosePrologue( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to close ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListResetPrologue( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to reset ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendWriteGlobalTimestampPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t* dstptr, ///< [in,out] pointer to memory where timestamp value will be written; must ///< be 8byte-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == dstptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListHostSynchronizePrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the immediate command list uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the immediate command list; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListGetDeviceHandlePrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_device_handle_t* phDevice ///< [out] handle of the device on which the command list was created ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phDevice ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListGetContextHandlePrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_context_handle_t* phContext ///< [out] handle of the context on which the command list was created ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phContext ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListGetOrdinalPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t* pOrdinal ///< [out] command queue group ordinal to which command list is submitted ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pOrdinal ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListImmediateGetIndexPrologue( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t* pIndex ///< [out] command queue index within the group to which the immediate ///< command list is submitted ) { if( nullptr == hCommandListImmediate ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pIndex ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListIsImmediatePrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_bool_t* pIsImmediate ///< [out] Boolean indicating whether the command list is an immediate ///< command list (true) or not (false) ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pIsImmediate ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendBarrierPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendMemoryRangesBarrierPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numRanges, ///< [in] number of memory ranges const size_t* pRangeSizes, ///< [in][range(0, numRanges)] array of sizes of memory range const void** pRanges, ///< [in][range(0, numRanges)] array of memory ranges ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pRangeSizes ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pRanges ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeContextSystemBarrierPrologue( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice ///< [in] handle of the device ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendMemoryCopyPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == dstptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == srcptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendMemoryFillPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* ptr, ///< [in] pointer to memory to initialize const void* pattern, ///< [in] pointer to value to initialize memory to size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to size_t size, ///< [in] size in bytes to initialize ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pattern ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendMemoryCopyRegionPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const ze_copy_region_t* dstRegion, ///< [in] pointer to destination region to copy to uint32_t dstPitch, ///< [in] destination pitch in bytes uint32_t dstSlicePitch, ///< [in] destination slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. const void* srcptr, ///< [in] pointer to source memory to copy from const ze_copy_region_t* srcRegion, ///< [in] pointer to source region to copy from uint32_t srcPitch, ///< [in] source pitch in bytes uint32_t srcSlicePitch, ///< [in] source slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == dstptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == dstRegion ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == srcptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == srcRegion ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendMemoryCopyFromContextPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_context_handle_t hContextSrc, ///< [in] handle of source context object const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hContextSrc ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == dstptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == srcptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendImageCopyPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDstImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hSrcImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendImageCopyRegionPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDstImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hSrcImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendImageCopyToMemoryPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hSrcImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == dstptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendImageCopyFromMemoryPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDstImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == srcptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendMemoryPrefetchPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list const void* ptr, ///< [in] pointer to start of the memory range to prefetch size_t size ///< [in] size in bytes of the memory range to prefetch ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendMemAdvisePrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_advice_t advice ///< [in] Memory advice for the memory range ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZE_MEMORY_ADVICE_CLEAR_SYSTEM_MEMORY_PREFERRED_LOCATION < advice ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventPoolCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_event_pool_desc_t* desc, ///< [in] pointer to event pool descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< have visibility to the event pool. ///< if nullptr, then event pool is visible to all devices supported by the ///< driver instance. ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phEventPool ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0xf < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0 == desc->count ) return ZE_RESULT_ERROR_INVALID_SIZE; if( (nullptr == phDevices) && (0 < numDevices) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeEventPoolDestroyPrologue( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object to destroy ) { if( nullptr == hEventPool ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventCreatePrologue( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool const ze_event_desc_t* desc, ///< [in] pointer to event descriptor ze_event_handle_t* phEvent ///< [out] pointer to handle of event object created ) { if( nullptr == hEventPool ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phEvent ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x7 < desc->signal ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0x7 < desc->wait ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeEventDestroyPrologue( ze_event_handle_t hEvent ///< [in][release] handle of event object to destroy ) { if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventPoolGetIpcHandlePrologue( ze_event_pool_handle_t hEventPool, ///< [in] handle of event pool object ze_ipc_event_pool_handle_t* phIpc ///< [out] Returned IPC event handle ) { if( nullptr == hEventPool ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phIpc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventPoolPutIpcHandlePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object associated with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc ///< [in] IPC event pool handle ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventPoolOpenIpcHandlePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object to associate with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc, ///< [in] IPC event pool handle ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phEventPool ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventPoolCloseIpcHandlePrologue( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object ) { if( nullptr == hEventPool ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendSignalEventPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendWaitOnEventsPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] number of events to wait on before continuing ze_event_handle_t* phEvents ///< [in][range(0, numEvents)] handles of the events to wait on before ///< continuing ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phEvents ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventHostSignalPrologue( ze_event_handle_t hEvent ///< [in] handle of the event ) { if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventHostSynchronizePrologue( ze_event_handle_t hEvent, ///< [in] handle of the event uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeEventQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventQueryStatusPrologue( ze_event_handle_t hEvent ///< [in] handle of the event ) { if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendEventResetPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventHostResetPrologue( ze_event_handle_t hEvent ///< [in] handle of the event ) { if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventQueryKernelTimestampPrologue( ze_event_handle_t hEvent, ///< [in] handle of the event ze_kernel_timestamp_result_t* dstptr ///< [in,out] pointer to memory for where timestamp result will be written. ) { if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == dstptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendQueryKernelTimestampsPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] the number of timestamp events to query ze_event_handle_t* phEvents, ///< [in][range(0, numEvents)] handles of timestamp events to query void* dstptr, ///< [in,out] pointer to memory where ::ze_kernel_timestamp_result_t will ///< be written; must be size-aligned. const size_t* pOffsets, ///< [in][optional][range(0, numEvents)] offset, in bytes, to write ///< results; address must be 4byte-aligned and offsets must be ///< size-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phEvents ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == dstptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventGetEventPoolPrologue( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_pool_handle_t* phEventPool ///< [out] handle of the event pool for the event ) { if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phEventPool ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventGetSignalScopePrologue( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pSignalScope ///< [out] signal event scope. This is the scope of relevant cache ///< hierarchies that are flushed on a signal action before the event is ///< triggered. May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pSignalScope ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventGetWaitScopePrologue( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pWaitScope ///< [out] wait event scope. This is the scope of relevant cache ///< hierarchies invalidated on a wait action after the event is complete. ///< May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pWaitScope ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventPoolGetContextHandlePrologue( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_context_handle_t* phContext ///< [out] handle of the context on which the event pool was created ) { if( nullptr == hEventPool ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phContext ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventPoolGetFlagsPrologue( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_event_pool_flags_t* pFlags ///< [out] creation flags used to create the event pool; may be 0 or a ///< valid combination of ::ze_event_pool_flag_t ) { if( nullptr == hEventPool ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pFlags ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeFenceCreatePrologue( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of command queue const ze_fence_desc_t* desc, ///< [in] pointer to fence descriptor ze_fence_handle_t* phFence ///< [out] pointer to handle of fence object created ) { if( nullptr == hCommandQueue ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phFence ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x1 < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeFenceDestroyPrologue( ze_fence_handle_t hFence ///< [in][release] handle of fence object to destroy ) { if( nullptr == hFence ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeFenceHostSynchronizePrologue( ze_fence_handle_t hFence, ///< [in] handle of the fence uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeFenceQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { if( nullptr == hFence ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeFenceQueryStatusPrologue( ze_fence_handle_t hFence ///< [in] handle of the fence ) { if( nullptr == hFence ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeFenceResetPrologue( ze_fence_handle_t hFence ///< [in] handle of the fence ) { if( nullptr == hFence ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeImageGetPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_properties_t* pImageProperties ///< [out] pointer to image properties ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pImageProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x3 < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_IMAGE_TYPE_BUFFER < desc->type ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; auto retVal = ZE_RESULT_SUCCESS; retVal = ParameterValidation::validateExtensions(desc); if(retVal) return retVal; retVal = ParameterValidation::validateExtensions(pImageProperties); return retVal; } ze_result_t ZEParameterValidation::zeImageCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t* phImage ///< [out] pointer to handle of image object created ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phImage ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x3 < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_IMAGE_TYPE_BUFFER < desc->type ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeImageDestroyPrologue( ze_image_handle_t hImage ///< [in][release] handle of image object to destroy ) { if( nullptr == hImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeMemAllocSharedPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in][optional] device handle to associate with void** pptr ///< [out] pointer to shared allocation ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == device_desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == host_desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x7 < device_desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0xf < host_desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0 == size ) return ZE_RESULT_ERROR_UNSUPPORTED_SIZE; if( 0 != (alignment & (alignment - 1)) ) return ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT; auto retVal = ZE_RESULT_SUCCESS; retVal = ParameterValidation::validateExtensions(device_desc); if(retVal) return retVal; retVal = ParameterValidation::validateExtensions(host_desc); return retVal; } ze_result_t ZEParameterValidation::zeMemAllocDevicePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in] handle of the device void** pptr ///< [out] pointer to device allocation ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == device_desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x7 < device_desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0 == size ) return ZE_RESULT_ERROR_UNSUPPORTED_SIZE; if( 0 != (alignment & (alignment - 1)) ) return ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT; return ParameterValidation::validateExtensions(device_desc); } ze_result_t ZEParameterValidation::zeMemAllocHostPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two void** pptr ///< [out] pointer to host allocation ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == host_desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0xf < host_desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0 == size ) return ZE_RESULT_ERROR_UNSUPPORTED_SIZE; if( 0 != (alignment & (alignment - 1)) ) return ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT; return ParameterValidation::validateExtensions(host_desc); } ze_result_t ZEParameterValidation::zeMemFreePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object void* ptr ///< [in][release] pointer to memory to free ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeMemGetAllocPropertiesPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query ze_memory_allocation_properties_t* pMemAllocProperties, ///< [in,out] query result for memory allocation properties ze_device_handle_t* phDevice ///< [out][optional] device associated with this allocation ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pMemAllocProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pMemAllocProperties); } ze_result_t ZEParameterValidation::zeMemGetAddressRangePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query void** pBase, ///< [in,out][optional] base address of the allocation size_t* pSize ///< [in,out][optional] size of the allocation ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeMemGetIpcHandlePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to the device memory allocation ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pIpcHandle ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeMemGetIpcHandleFromFileDescriptorExpPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object uint64_t handle, ///< [in] file descriptor ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pIpcHandle ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeMemGetFileDescriptorFromIpcHandleExpPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t ipcHandle, ///< [in] IPC memory handle uint64_t* pHandle ///< [out] Returned file descriptor ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pHandle ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeMemPutIpcHandlePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t handle ///< [in] IPC memory handle ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeMemOpenIpcHandlePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device to associate with the IPC memory handle ze_ipc_mem_handle_t handle, ///< [in] IPC memory handle ze_ipc_memory_flags_t flags, ///< [in] flags controlling the operation. ///< must be 0 (default) or a valid combination of ::ze_ipc_memory_flag_t. void** pptr ///< [out] pointer to device allocation in this process ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( 0x3 < flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == pptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeMemCloseIpcHandlePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr ///< [in][release] pointer to device allocation in this process ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeMemSetAtomicAccessAttributeExpPrologue( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t attr ///< [in] Atomic access attributes to set for the specified range. ///< Must be 0 (default) or a valid combination of ::ze_memory_atomic_attr_exp_flag_t. ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x7f < attr ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeMemGetAtomicAccessAttributeExpPrologue( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t* pAttr ///< [out] Atomic access attributes for the specified range ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pAttr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeModuleCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_module_desc_t* desc, ///< [in] pointer to module descriptor ze_module_handle_t* phModule, ///< [out] pointer to handle of module object created ze_module_build_log_handle_t* phBuildLog ///< [out][optional] pointer to handle of module's build log. ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == desc->pInputModule ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phModule ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZE_MODULE_FORMAT_NATIVE < desc->format ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0 == desc->inputSize ) return ZE_RESULT_ERROR_INVALID_SIZE; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeModuleDestroyPrologue( ze_module_handle_t hModule ///< [in][release] handle of the module ) { if( nullptr == hModule ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeModuleDynamicLinkPrologue( uint32_t numModules, ///< [in] number of modules to be linked pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to ///< dynamically link together. ze_module_build_log_handle_t* phLinkLog ///< [out][optional] pointer to handle of dynamic link log. ) { if( nullptr == phModules ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeModuleBuildLogDestroyPrologue( ze_module_build_log_handle_t hModuleBuildLog ///< [in][release] handle of the module build log object. ) { if( nullptr == hModuleBuildLog ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeModuleBuildLogGetStringPrologue( ze_module_build_log_handle_t hModuleBuildLog, ///< [in] handle of the module build log object. size_t* pSize, ///< [in,out] size of build log string. char* pBuildLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { if( nullptr == hModuleBuildLog ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeModuleGetNativeBinaryPrologue( ze_module_handle_t hModule, ///< [in] handle of the module size_t* pSize, ///< [in,out] size of native binary in bytes. uint8_t* pModuleNativeBinary ///< [in,out][optional] byte pointer to native binary ) { if( nullptr == hModule ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeModuleGetGlobalPointerPrologue( ze_module_handle_t hModule, ///< [in] handle of the module const char* pGlobalName, ///< [in] name of global variable in module size_t* pSize, ///< [in,out][optional] size of global variable void** pptr ///< [in,out][optional] device visible pointer ) { if( nullptr == hModule ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pGlobalName ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeModuleGetKernelNamesPrologue( ze_module_handle_t hModule, ///< [in] handle of the module uint32_t* pCount, ///< [in,out] pointer to the number of names. ///< if count is zero, then the driver shall update the value with the ///< total number of names available. ///< if count is greater than the number of names available, then the ///< driver shall update the value with the correct number of names available. const char** pNames ///< [in,out][optional][range(0, *pCount)] array of names of functions. ///< if count is less than the number of names available, then driver shall ///< only retrieve that number of names. ) { if( nullptr == hModule ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeModuleGetPropertiesPrologue( ze_module_handle_t hModule, ///< [in] handle of the module ze_module_properties_t* pModuleProperties ///< [in,out] query result for module properties. ) { if( nullptr == hModule ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pModuleProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pModuleProperties); } ze_result_t ZEParameterValidation::zeKernelCreatePrologue( ze_module_handle_t hModule, ///< [in] handle of the module const ze_kernel_desc_t* desc, ///< [in] pointer to kernel descriptor ze_kernel_handle_t* phKernel ///< [out] handle of the Function object ) { if( nullptr == hModule ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == desc->pKernelName ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phKernel ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x3 < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeKernelDestroyPrologue( ze_kernel_handle_t hKernel ///< [in][release] handle of the kernel object ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeModuleGetFunctionPointerPrologue( ze_module_handle_t hModule, ///< [in] handle of the module const char* pFunctionName, ///< [in] Name of function to retrieve function pointer for. void** pfnFunction ///< [out] pointer to function. ) { if( nullptr == hModule ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pFunctionName ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pfnFunction ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeKernelSetGroupSizePrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t groupSizeX, ///< [in] group size for X dimension to use for this kernel uint32_t groupSizeY, ///< [in] group size for Y dimension to use for this kernel uint32_t groupSizeZ ///< [in] group size for Z dimension to use for this kernel ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeKernelSuggestGroupSizePrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t globalSizeX, ///< [in] global width for X dimension uint32_t globalSizeY, ///< [in] global width for Y dimension uint32_t globalSizeZ, ///< [in] global width for Z dimension uint32_t* groupSizeX, ///< [out] recommended size of group for X dimension uint32_t* groupSizeY, ///< [out] recommended size of group for Y dimension uint32_t* groupSizeZ ///< [out] recommended size of group for Z dimension ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == groupSizeX ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == groupSizeY ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == groupSizeZ ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeKernelSuggestMaxCooperativeGroupCountPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* totalGroupCount ///< [out] recommended total group count. ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == totalGroupCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeKernelSetArgumentValuePrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t argIndex, ///< [in] argument index in range [0, num args - 1] size_t argSize, ///< [in] size of argument type const void* pArgValue ///< [in][optional] argument value represented as matching arg type. If ///< null then argument value is considered null. ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeKernelSetIndirectAccessPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t flags ///< [in] kernel indirect access flags ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( 0x7 < flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeKernelGetIndirectAccessPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t* pFlags ///< [out] query result for kernel indirect access flags. ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pFlags ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeKernelGetSourceAttributesPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* pSize, ///< [in,out] pointer to size of string in bytes, including ///< null-terminating character. char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including ///< a null-terminating character, is returned in pSize. ///< Otherwise, pString must point to valid application memory that is ///< greater than or equal to *pSize bytes in length, and on return the ///< pointed-to string will contain a space-separated list of kernel source attributes. ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeKernelSetCacheConfigPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_cache_config_flags_t flags ///< [in] cache configuration. ///< must be 0 (default configuration) or a valid combination of ::ze_cache_config_flag_t. ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( 0x3 < flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeKernelGetPropertiesPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_properties_t* pKernelProperties ///< [in,out] query result for kernel properties. ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pKernelProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pKernelProperties); } ze_result_t ZEParameterValidation::zeKernelGetNamePrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object size_t* pSize, ///< [in,out] size of kernel name string, including null terminator, in ///< bytes. char* pName ///< [in,out][optional] char pointer to kernel name. ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendLaunchKernelPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pLaunchFuncArgs ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendLaunchCooperativeKernelPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pLaunchFuncArgs ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendLaunchKernelIndirectPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in] pointer to device buffer that will contain thread group launch ///< arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pLaunchArgumentsBuffer ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendLaunchMultipleKernelsIndirectPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] maximum number of kernels to launch ze_kernel_handle_t* phKernels, ///< [in][range(0, numKernels)] handles of the kernel objects const uint32_t* pCountBuffer, ///< [in] pointer to device memory location that will contain the actual ///< number of kernels to launch; value must be less than or equal to ///< numKernels const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in][range(0, numKernels)] pointer to device buffer that will contain ///< a contiguous array of thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phKernels ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pCountBuffer ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pLaunchArgumentsBuffer ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeContextMakeMemoryResidentPrologue( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to make resident size_t size ///< [in] size in bytes to make resident ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeContextEvictMemoryPrologue( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to evict size_t size ///< [in] size in bytes to evict ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeContextMakeImageResidentPrologue( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make resident ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeContextEvictImagePrologue( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make evict ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeSamplerCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_sampler_desc_t* desc, ///< [in] pointer to sampler descriptor ze_sampler_handle_t* phSampler ///< [out] handle of the sampler ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phSampler ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZE_SAMPLER_ADDRESS_MODE_MIRROR < desc->addressMode ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_SAMPLER_FILTER_MODE_LINEAR < desc->filterMode ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeSamplerDestroyPrologue( ze_sampler_handle_t hSampler ///< [in][release] handle of the sampler ) { if( nullptr == hSampler ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeVirtualMemReservePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* pStart, ///< [in][optional] pointer to start of region to reserve. If nullptr then ///< implementation will choose a start address. size_t size, ///< [in] size in bytes to reserve; must be page aligned. void** pptr ///< [out] pointer to virtual reservation. ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0 == size ) return ZE_RESULT_ERROR_UNSUPPORTED_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeVirtualMemFreePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to free. size_t size ///< [in] size in bytes to free; must be page aligned. ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0 == size ) return ZE_RESULT_ERROR_UNSUPPORTED_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeVirtualMemQueryPageSizePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] unaligned allocation size in bytes size_t* pagesize ///< [out] pointer to page size to use for start address and size ///< alignments. ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pagesize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0 == size ) return ZE_RESULT_ERROR_UNSUPPORTED_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zePhysicalMemCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phPhysicalMemory ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x3 < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0 == desc->size ) return ZE_RESULT_ERROR_UNSUPPORTED_SIZE; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zePhysicalMemDestroyPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_physical_mem_handle_t hPhysicalMemory ///< [in][release] handle of physical memory object to destroy ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hPhysicalMemory ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeVirtualMemMapPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address range to map. size_t size, ///< [in] size in bytes of virtual address range to map; must be page ///< aligned. ze_physical_mem_handle_t hPhysicalMemory, ///< [in] handle to physical memory object. size_t offset, ///< [in] offset into physical memory allocation object; must be page ///< aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hPhysicalMemory ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY < access ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0 == size ) return ZE_RESULT_ERROR_UNSUPPORTED_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeVirtualMemUnmapPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to unmap. size_t size ///< [in] size in bytes to unmap; must be page aligned. ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0 == size ) return ZE_RESULT_ERROR_UNSUPPORTED_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeVirtualMemSetAccessAttributePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of reserved virtual address region. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY < access ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0 == size ) return ZE_RESULT_ERROR_UNSUPPORTED_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeVirtualMemGetAccessAttributePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address region for query. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t* access, ///< [out] query result for page access attribute. size_t* outSize ///< [out] query result for size of virtual address range, starting at ptr, ///< that shares same access attribute. ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == access ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == outSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0 == size ) return ZE_RESULT_ERROR_UNSUPPORTED_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeKernelSetGlobalOffsetExpPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t offsetX, ///< [in] global offset for X dimension to use for this kernel uint32_t offsetY, ///< [in] global offset for Y dimension to use for this kernel uint32_t offsetZ ///< [in] global offset for Z dimension to use for this kernel ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeKernelGetBinaryExpPrologue( ze_kernel_handle_t hKernel, ///< [in] Kernel handle. size_t* pSize, ///< [in,out] pointer to variable with size of GEN ISA binary. uint8_t* pKernelBinary ///< [in,out] pointer to storage area for GEN ISA binary function. ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pKernelBinary ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDeviceImportExternalSemaphoreExtPrologue( ze_device_handle_t hDevice, ///< [in] The device handle. const ze_external_semaphore_ext_desc_t* desc, ///< [in] The pointer to external semaphore descriptor. ze_external_semaphore_ext_handle_t* phSemaphore ///< [out] The handle of the external semaphore imported. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phSemaphore ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x1ff < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeDeviceReleaseExternalSemaphoreExtPrologue( ze_external_semaphore_ext_handle_t hSemaphore ///< [in] The handle of the external semaphore. ) { if( nullptr == hSemaphore ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendSignalExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in][range(0, numSemaphores)] The vector of external semaphore handles ///< to be appended into command list. ze_external_semaphore_signal_params_ext_t* signalParams,///< [in] Signal parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phSemaphores ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == signalParams ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; if( (nullptr == phSemaphores) && (0 < numSemaphores) ) return ZE_RESULT_ERROR_INVALID_SIZE; if( (nullptr == signalParams) && (0 < numSemaphores) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendWaitExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in] [range(0,numSemaphores)] The vector of external semaphore handles ///< to append into command list. ze_external_semaphore_wait_params_ext_t* waitParams,///< [in] Wait parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phSemaphores ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == waitParams ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; if( (nullptr == phSemaphores) && (0 < numSemaphores) ) return ZE_RESULT_ERROR_INVALID_SIZE; if( (nullptr == waitParams) && (0 < numSemaphores) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDeviceReserveCacheExtPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device object size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the ///< driver shall default to last level of cache and attempt to reserve in ///< that cache. size_t cacheReservationSize ///< [in] value for reserving size, in bytes. If zero, then the driver ///< shall remove prior reservation ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDeviceSetCacheAdviceExtPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device object void* ptr, ///< [in] memory pointer to query size_t regionSize, ///< [in] region size, in pages ze_cache_ext_region_t cacheRegion ///< [in] reservation region ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZE_CACHE_EXT_REGION_NON_RESERVED < cacheRegion ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeEventQueryTimestampsExpPrologue( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of timestamp results. ///< if count is zero, then the driver shall update the value with the ///< total number of timestamps available. ///< if count is greater than the number of timestamps available, then the ///< driver shall update the value with the correct number of timestamps available. ze_kernel_timestamp_result_t* pTimestamps ///< [in,out][optional][range(0, *pCount)] array of timestamp results. ///< if count is less than the number of timestamps available, then driver ///< shall only retrieve that number of timestamps. ) { if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeImageGetMemoryPropertiesExpPrologue( ze_image_handle_t hImage, ///< [in] handle of image object ze_image_memory_properties_exp_t* pMemoryProperties ///< [in,out] query result for image memory properties. ) { if( nullptr == hImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pMemoryProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pMemoryProperties); } ze_result_t ZEParameterValidation::zeImageViewCreateExtPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phImageView ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x3 < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_IMAGE_TYPE_BUFFER < desc->type ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeImageViewCreateExpPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phImageView ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x3 < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_IMAGE_TYPE_BUFFER < desc->type ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeKernelSchedulingHintExpPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_scheduling_hint_exp_desc_t* pHint ///< [in] pointer to kernel scheduling hint descriptor ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pHint ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x7 < pHint->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(pHint); } ze_result_t ZEParameterValidation::zeDevicePciGetPropertiesExtPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device object. ze_pci_ext_properties_t* pPciProperties ///< [in,out] returns the PCI properties of the device. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pPciProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pPciProperties); } ze_result_t ZEParameterValidation::zeCommandListAppendImageCopyToMemoryExtPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor uint32_t destRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being written uint32_t destSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being written ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hSrcImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == dstptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListAppendImageCopyFromMemoryExtPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor uint32_t srcRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being read uint32_t srcSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being read ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDstImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == srcptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeImageGetAllocPropertiesExtPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_image_handle_t hImage, ///< [in] handle of image object to query ze_image_allocation_ext_properties_t* pImageAllocProperties ///< [in,out] query result for image allocation properties ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pImageAllocProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pImageAllocProperties); } ze_result_t ZEParameterValidation::zeModuleInspectLinkageExtPrologue( ze_linkage_inspection_ext_desc_t* pInspectDesc, ///< [in] pointer to linkage inspection descriptor structure. uint32_t numModules, ///< [in] number of modules to be inspected pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to be ///< inspected for import dependencies. ze_module_build_log_handle_t* phLog ///< [out] pointer to handle of linkage inspection log. Log object will ///< contain separate lists of imports, un-resolvable imports, and exports. ) { if( nullptr == pInspectDesc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phModules ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phLog ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x7 < pInspectDesc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(pInspectDesc); } ze_result_t ZEParameterValidation::zeMemFreeExtPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_memory_free_ext_desc_t* pMemFreeDesc, ///< [in] pointer to memory free descriptor void* ptr ///< [in][release] pointer to memory to free ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pMemFreeDesc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == ptr ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x3 < pMemFreeDesc->freePolicy ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(pMemFreeDesc); } ze_result_t ZEParameterValidation::zeFabricVertexGetExpPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric vertices available. ///< if count is greater than the number of fabric vertices available, then ///< the driver shall update the value with the correct number of fabric ///< vertices available. ze_fabric_vertex_handle_t* phVertices ///< [in,out][optional][range(0, *pCount)] array of handle of fabric vertices. ///< if count is less than the number of fabric vertices available, then ///< driver shall only retrieve that number of fabric vertices. ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeFabricVertexGetSubVerticesExpPrologue( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex object uint32_t* pCount, ///< [in,out] pointer to the number of sub-vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-vertices available. ///< if count is greater than the number of sub-vertices available, then ///< the driver shall update the value with the correct number of ///< sub-vertices available. ze_fabric_vertex_handle_t* phSubvertices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-vertices. ///< if count is less than the number of sub-vertices available, then ///< driver shall only retrieve that number of sub-vertices. ) { if( nullptr == hVertex ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeFabricVertexGetPropertiesExpPrologue( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_fabric_vertex_exp_properties_t* pVertexProperties///< [in,out] query result for fabric vertex properties ) { if( nullptr == hVertex ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pVertexProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pVertexProperties); } ze_result_t ZEParameterValidation::zeFabricVertexGetDeviceExpPrologue( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_device_handle_t* phDevice ///< [out] device handle corresponding to fabric vertex ) { if( nullptr == hVertex ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phDevice ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeDeviceGetFabricVertexExpPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_fabric_vertex_handle_t* phVertex ///< [out] fabric vertex handle corresponding to device ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phVertex ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeFabricEdgeGetExpPrologue( ze_fabric_vertex_handle_t hVertexA, ///< [in] handle of first fabric vertex instance ze_fabric_vertex_handle_t hVertexB, ///< [in] handle of second fabric vertex instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric edges. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric edges available. ///< if count is greater than the number of fabric edges available, then ///< the driver shall update the value with the correct number of fabric ///< edges available. ze_fabric_edge_handle_t* phEdges ///< [in,out][optional][range(0, *pCount)] array of handle of fabric edges. ///< if count is less than the number of fabric edges available, then ///< driver shall only retrieve that number of fabric edges. ) { if( nullptr == hVertexA ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hVertexB ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeFabricEdgeGetVerticesExpPrologue( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge instance ze_fabric_vertex_handle_t* phVertexA, ///< [out] fabric vertex connected to one end of the given fabric edge. ze_fabric_vertex_handle_t* phVertexB ///< [out] fabric vertex connected to other end of the given fabric edge. ) { if( nullptr == hEdge ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phVertexA ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phVertexB ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeFabricEdgeGetPropertiesExpPrologue( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge ze_fabric_edge_exp_properties_t* pEdgeProperties///< [in,out] query result for fabric edge properties ) { if( nullptr == hEdge ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pEdgeProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pEdgeProperties); } ze_result_t ZEParameterValidation::zeEventQueryKernelTimestampsExtPrologue( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of event packets available. ///< - This value is implementation specific. ///< - if `*pCount` is zero, then the driver shall update the value with ///< the total number of event packets available. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver shall update the value with the correct value. ///< - Buffer(s) for query results must be sized by the application to ///< accommodate a minimum of `*pCount` elements. ze_event_query_kernel_timestamps_results_ext_properties_t* pResults ///< [in,out][optional][range(0, *pCount)] pointer to event query ///< properties structure(s). ///< - This parameter may be null when `*pCount` is zero. ///< - if `*pCount` is less than the number of event packets available, ///< the driver may only update `*pCount` elements, starting at element zero. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver may only update the valid elements. ) { if( nullptr == hEvent ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pResults); } ze_result_t ZEParameterValidation::zeRTASBuilderCreateExpPrologue( ze_driver_handle_t hDriver, ///< [in] handle of driver object const ze_rtas_builder_exp_desc_t* pDescriptor, ///< [in] pointer to builder descriptor ze_rtas_builder_exp_handle_t* phBuilder ///< [out] handle of builder object ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pDescriptor ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phBuilder ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZE_RTAS_BUILDER_EXP_VERSION_CURRENT < pDescriptor->builderVersion ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(pDescriptor); } ze_result_t ZEParameterValidation::zeRTASBuilderGetBuildPropertiesExpPrologue( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor ze_rtas_builder_exp_properties_t* pProperties ///< [in,out] query result for builder properties ) { if( nullptr == hBuilder ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pBuildOpDescriptor ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZE_RTAS_FORMAT_EXP_INVALID < pBuildOpDescriptor->rtasFormat ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH < pBuildOpDescriptor->buildQuality ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0x3 < pBuildOpDescriptor->buildFlags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; auto retVal = ZE_RESULT_SUCCESS; retVal = ParameterValidation::validateExtensions(pBuildOpDescriptor); if(retVal) return retVal; retVal = ParameterValidation::validateExtensions(pProperties); return retVal; } ze_result_t ZEParameterValidation::zeDriverRTASFormatCompatibilityCheckExpPrologue( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_format_exp_t rtasFormatA, ///< [in] operand A ze_rtas_format_exp_t rtasFormatB ///< [in] operand B ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZE_RTAS_FORMAT_EXP_INVALID < rtasFormatA ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_RTAS_FORMAT_EXP_INVALID < rtasFormatB ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeRTASBuilderBuildExpPrologue( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used ///< during acceleration structure construction size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes void* pRtasBuffer, ///< [in] pointer to destination buffer size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks ze_rtas_aabb_exp_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration ///< structure bounds size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in ///< bytes ) { if( nullptr == hBuilder ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pBuildOpDescriptor ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pScratchBuffer ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pRtasBuffer ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZE_RTAS_FORMAT_EXP_INVALID < pBuildOpDescriptor->rtasFormat ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH < pBuildOpDescriptor->buildQuality ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( 0x3 < pBuildOpDescriptor->buildFlags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(pBuildOpDescriptor); } ze_result_t ZEParameterValidation::zeRTASBuilderDestroyExpPrologue( ze_rtas_builder_exp_handle_t hBuilder ///< [in][release] handle of builder object to destroy ) { if( nullptr == hBuilder ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeRTASParallelOperationCreateExpPrologue( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_parallel_operation_exp_handle_t* phParallelOperation///< [out] handle of parallel operation object ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phParallelOperation ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeRTASParallelOperationGetPropertiesExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in] handle of parallel operation object ze_rtas_parallel_operation_exp_properties_t* pProperties///< [in,out] query result for parallel operation properties ) { if( nullptr == hParallelOperation ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZEParameterValidation::zeRTASParallelOperationJoinExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in] handle of parallel operation object ) { if( nullptr == hParallelOperation ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeRTASParallelOperationDestroyExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy ) { if( nullptr == hParallelOperation ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeMemGetPitchFor2dImagePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device size_t imageWidth, ///< [in] imageWidth size_t imageHeight, ///< [in] imageHeight unsigned int elementSizeInBytes, ///< [in] Element size in bytes size_t * rowPitch ///< [out] rowPitch ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeImageGetDeviceOffsetExpPrologue( ze_image_handle_t hImage, ///< [in] handle of the image uint64_t* pDeviceOffset ///< [out] bindless device offset for image ) { if( nullptr == hImage ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pDeviceOffset ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListCreateCloneExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle to source command list (the command list to clone) ze_command_list_handle_t* phClonedCommandList ///< [out] pointer to handle of the cloned command list ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phClonedCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListImmediateAppendCommandListsExpPrologue( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t numCommandLists, ///< [in] number of command lists ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion ///< - if not null, this event is signaled after the completion of all ///< appended command lists uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended ///< command lists; must be 0 if nullptr == phWaitEvents ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing appended command lists. ///< - if not null, all wait events must be satisfied prior to the start ///< of any appended command list(s) ) { if( nullptr == hCommandListImmediate ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phCommandLists ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListGetNextCommandIdExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in] pointer to mutable command identifier descriptor uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pCommandId ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0xff < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeCommandListGetNextCommandIdWithKernelsExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in][out] pointer to mutable command identifier descriptor uint32_t numKernels, ///< [in][optional] number of entries on phKernels list ze_kernel_handle_t* phKernels, ///< [in][optional][range(0, numKernels)] list of kernels that user can ///< switch between using ::zeCommandListUpdateMutableCommandKernelsExp ///< call uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pCommandId ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0xff < desc->flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeCommandListUpdateMutableCommandsExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_commands_exp_desc_t* desc ///< [in] pointer to mutable commands descriptor; multiple descriptors may ///< be chained via `pNext` member ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(desc); } ze_result_t ZEParameterValidation::zeCommandListUpdateMutableCommandSignalEventExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier ze_event_handle_t hSignalEvent ///< [in][optional] handle of the event to signal on completion ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListUpdateMutableCommandWaitEventsExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier uint32_t numWaitEvents, ///< [in][optional] the number of wait events ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZEParameterValidation::zeCommandListUpdateMutableCommandKernelsExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] the number of kernels to update uint64_t* pCommandId, ///< [in][range(0, numKernels)] command identifier ze_kernel_handle_t* phKernels ///< [in][range(0, numKernels)] handle of the kernel for a command ///< identifier to switch to ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCommandId ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phKernels ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } }level-zero-1.20.6/source/layers/validation/checkers/parameter_validation/ze_parameter_validation.h000066400000000000000000000761601475521542100336570ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See param.h.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_parameter_validation.h * */ #pragma once #include "ze_validation_layer.h" #include "ze_entry_points.h" namespace validation_layer { class ZEParameterValidation : public ZEValidationEntryPoints { public: ze_result_t zeInitPrologue( ze_init_flags_t flags ) override; ze_result_t zeDriverGetPrologue( uint32_t* pCount, ze_driver_handle_t* phDrivers ) override; ze_result_t zeInitDriversPrologue( uint32_t* pCount, ze_driver_handle_t* phDrivers, ze_init_driver_type_desc_t* desc ) override; ze_result_t zeDriverGetApiVersionPrologue( ze_driver_handle_t hDriver, ze_api_version_t* version ) override; ze_result_t zeDriverGetPropertiesPrologue( ze_driver_handle_t hDriver, ze_driver_properties_t* pDriverProperties ) override; ze_result_t zeDriverGetIpcPropertiesPrologue( ze_driver_handle_t hDriver, ze_driver_ipc_properties_t* pIpcProperties ) override; ze_result_t zeDriverGetExtensionPropertiesPrologue( ze_driver_handle_t hDriver, uint32_t* pCount, ze_driver_extension_properties_t* pExtensionProperties ) override; ze_result_t zeDriverGetExtensionFunctionAddressPrologue( ze_driver_handle_t hDriver, const char* name, void** ppFunctionAddress ) override; ze_result_t zeDriverGetLastErrorDescriptionPrologue( ze_driver_handle_t hDriver, const char** ppString ) override; ze_result_t zeDeviceGetPrologue( ze_driver_handle_t hDriver, uint32_t* pCount, ze_device_handle_t* phDevices ) override; ze_result_t zeDeviceGetRootDevicePrologue( ze_device_handle_t hDevice, ze_device_handle_t* phRootDevice ) override; ze_result_t zeDeviceGetSubDevicesPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_handle_t* phSubdevices ) override; ze_result_t zeDeviceGetPropertiesPrologue( ze_device_handle_t hDevice, ze_device_properties_t* pDeviceProperties ) override; ze_result_t zeDeviceGetComputePropertiesPrologue( ze_device_handle_t hDevice, ze_device_compute_properties_t* pComputeProperties ) override; ze_result_t zeDeviceGetModulePropertiesPrologue( ze_device_handle_t hDevice, ze_device_module_properties_t* pModuleProperties ) override; ze_result_t zeDeviceGetCommandQueueGroupPropertiesPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_command_queue_group_properties_t* pCommandQueueGroupProperties ) override; ze_result_t zeDeviceGetMemoryPropertiesPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_memory_properties_t* pMemProperties ) override; ze_result_t zeDeviceGetMemoryAccessPropertiesPrologue( ze_device_handle_t hDevice, ze_device_memory_access_properties_t* pMemAccessProperties ) override; ze_result_t zeDeviceGetCachePropertiesPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_cache_properties_t* pCacheProperties ) override; ze_result_t zeDeviceGetImagePropertiesPrologue( ze_device_handle_t hDevice, ze_device_image_properties_t* pImageProperties ) override; ze_result_t zeDeviceGetExternalMemoryPropertiesPrologue( ze_device_handle_t hDevice, ze_device_external_memory_properties_t* pExternalMemoryProperties ) override; ze_result_t zeDeviceGetP2PPropertiesPrologue( ze_device_handle_t hDevice, ze_device_handle_t hPeerDevice, ze_device_p2p_properties_t* pP2PProperties ) override; ze_result_t zeDeviceCanAccessPeerPrologue( ze_device_handle_t hDevice, ze_device_handle_t hPeerDevice, ze_bool_t* value ) override; ze_result_t zeDeviceGetStatusPrologue( ze_device_handle_t hDevice ) override; ze_result_t zeDeviceGetGlobalTimestampsPrologue( ze_device_handle_t hDevice, uint64_t* hostTimestamp, uint64_t* deviceTimestamp ) override; ze_result_t zeContextCreatePrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, ze_context_handle_t* phContext ) override; ze_result_t zeContextCreateExPrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, uint32_t numDevices, ze_device_handle_t* phDevices, ze_context_handle_t* phContext ) override; ze_result_t zeContextDestroyPrologue( ze_context_handle_t hContext ) override; ze_result_t zeContextGetStatusPrologue( ze_context_handle_t hContext ) override; ze_result_t zeCommandQueueCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_queue_desc_t* desc, ze_command_queue_handle_t* phCommandQueue ) override; ze_result_t zeCommandQueueDestroyPrologue( ze_command_queue_handle_t hCommandQueue ) override; ze_result_t zeCommandQueueExecuteCommandListsPrologue( ze_command_queue_handle_t hCommandQueue, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, ze_fence_handle_t hFence ) override; ze_result_t zeCommandQueueSynchronizePrologue( ze_command_queue_handle_t hCommandQueue, uint64_t timeout ) override; ze_result_t zeCommandQueueGetOrdinalPrologue( ze_command_queue_handle_t hCommandQueue, uint32_t* pOrdinal ) override; ze_result_t zeCommandQueueGetIndexPrologue( ze_command_queue_handle_t hCommandQueue, uint32_t* pIndex ) override; ze_result_t zeCommandListCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_list_desc_t* desc, ze_command_list_handle_t* phCommandList ) override; ze_result_t zeCommandListCreateImmediatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_queue_desc_t* altdesc, ze_command_list_handle_t* phCommandList ) override; ze_result_t zeCommandListDestroyPrologue( ze_command_list_handle_t hCommandList ) override; ze_result_t zeCommandListClosePrologue( ze_command_list_handle_t hCommandList ) override; ze_result_t zeCommandListResetPrologue( ze_command_list_handle_t hCommandList ) override; ze_result_t zeCommandListAppendWriteGlobalTimestampPrologue( ze_command_list_handle_t hCommandList, uint64_t* dstptr, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListHostSynchronizePrologue( ze_command_list_handle_t hCommandList, uint64_t timeout ) override; ze_result_t zeCommandListGetDeviceHandlePrologue( ze_command_list_handle_t hCommandList, ze_device_handle_t* phDevice ) override; ze_result_t zeCommandListGetContextHandlePrologue( ze_command_list_handle_t hCommandList, ze_context_handle_t* phContext ) override; ze_result_t zeCommandListGetOrdinalPrologue( ze_command_list_handle_t hCommandList, uint32_t* pOrdinal ) override; ze_result_t zeCommandListImmediateGetIndexPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t* pIndex ) override; ze_result_t zeCommandListIsImmediatePrologue( ze_command_list_handle_t hCommandList, ze_bool_t* pIsImmediate ) override; ze_result_t zeCommandListAppendBarrierPrologue( ze_command_list_handle_t hCommandList, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryRangesBarrierPrologue( ze_command_list_handle_t hCommandList, uint32_t numRanges, const size_t* pRangeSizes, const void** pRanges, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeContextSystemBarrierPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice ) override; ze_result_t zeCommandListAppendMemoryCopyPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryFillPrologue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryCopyRegionPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const ze_copy_region_t* dstRegion, uint32_t dstPitch, uint32_t dstSlicePitch, const void* srcptr, const ze_copy_region_t* srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryCopyFromContextPrologue( ze_command_list_handle_t hCommandList, void* dstptr, ze_context_handle_t hContextSrc, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendImageCopyPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendImageCopyRegionPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, const ze_image_region_t* pDstRegion, const ze_image_region_t* pSrcRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendImageCopyToMemoryPrologue( ze_command_list_handle_t hCommandList, void* dstptr, ze_image_handle_t hSrcImage, const ze_image_region_t* pSrcRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendImageCopyFromMemoryPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, const void* srcptr, const ze_image_region_t* pDstRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryPrefetchPrologue( ze_command_list_handle_t hCommandList, const void* ptr, size_t size ) override; ze_result_t zeCommandListAppendMemAdvisePrologue( ze_command_list_handle_t hCommandList, ze_device_handle_t hDevice, const void* ptr, size_t size, ze_memory_advice_t advice ) override; ze_result_t zeEventPoolCreatePrologue( ze_context_handle_t hContext, const ze_event_pool_desc_t* desc, uint32_t numDevices, ze_device_handle_t* phDevices, ze_event_pool_handle_t* phEventPool ) override; ze_result_t zeEventPoolDestroyPrologue( ze_event_pool_handle_t hEventPool ) override; ze_result_t zeEventCreatePrologue( ze_event_pool_handle_t hEventPool, const ze_event_desc_t* desc, ze_event_handle_t* phEvent ) override; ze_result_t zeEventDestroyPrologue( ze_event_handle_t hEvent ) override; ze_result_t zeEventPoolGetIpcHandlePrologue( ze_event_pool_handle_t hEventPool, ze_ipc_event_pool_handle_t* phIpc ) override; ze_result_t zeEventPoolPutIpcHandlePrologue( ze_context_handle_t hContext, ze_ipc_event_pool_handle_t hIpc ) override; ze_result_t zeEventPoolOpenIpcHandlePrologue( ze_context_handle_t hContext, ze_ipc_event_pool_handle_t hIpc, ze_event_pool_handle_t* phEventPool ) override; ze_result_t zeEventPoolCloseIpcHandlePrologue( ze_event_pool_handle_t hEventPool ) override; ze_result_t zeCommandListAppendSignalEventPrologue( ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent ) override; ze_result_t zeCommandListAppendWaitOnEventsPrologue( ze_command_list_handle_t hCommandList, uint32_t numEvents, ze_event_handle_t* phEvents ) override; ze_result_t zeEventHostSignalPrologue( ze_event_handle_t hEvent ) override; ze_result_t zeEventHostSynchronizePrologue( ze_event_handle_t hEvent, uint64_t timeout ) override; ze_result_t zeEventQueryStatusPrologue( ze_event_handle_t hEvent ) override; ze_result_t zeCommandListAppendEventResetPrologue( ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent ) override; ze_result_t zeEventHostResetPrologue( ze_event_handle_t hEvent ) override; ze_result_t zeEventQueryKernelTimestampPrologue( ze_event_handle_t hEvent, ze_kernel_timestamp_result_t* dstptr ) override; ze_result_t zeCommandListAppendQueryKernelTimestampsPrologue( ze_command_list_handle_t hCommandList, uint32_t numEvents, ze_event_handle_t* phEvents, void* dstptr, const size_t* pOffsets, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeEventGetEventPoolPrologue( ze_event_handle_t hEvent, ze_event_pool_handle_t* phEventPool ) override; ze_result_t zeEventGetSignalScopePrologue( ze_event_handle_t hEvent, ze_event_scope_flags_t* pSignalScope ) override; ze_result_t zeEventGetWaitScopePrologue( ze_event_handle_t hEvent, ze_event_scope_flags_t* pWaitScope ) override; ze_result_t zeEventPoolGetContextHandlePrologue( ze_event_pool_handle_t hEventPool, ze_context_handle_t* phContext ) override; ze_result_t zeEventPoolGetFlagsPrologue( ze_event_pool_handle_t hEventPool, ze_event_pool_flags_t* pFlags ) override; ze_result_t zeFenceCreatePrologue( ze_command_queue_handle_t hCommandQueue, const ze_fence_desc_t* desc, ze_fence_handle_t* phFence ) override; ze_result_t zeFenceDestroyPrologue( ze_fence_handle_t hFence ) override; ze_result_t zeFenceHostSynchronizePrologue( ze_fence_handle_t hFence, uint64_t timeout ) override; ze_result_t zeFenceQueryStatusPrologue( ze_fence_handle_t hFence ) override; ze_result_t zeFenceResetPrologue( ze_fence_handle_t hFence ) override; ze_result_t zeImageGetPropertiesPrologue( ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_properties_t* pImageProperties ) override; ze_result_t zeImageCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t* phImage ) override; ze_result_t zeImageDestroyPrologue( ze_image_handle_t hImage ) override; ze_result_t zeMemAllocSharedPrologue( ze_context_handle_t hContext, const ze_device_mem_alloc_desc_t* device_desc, const ze_host_mem_alloc_desc_t* host_desc, size_t size, size_t alignment, ze_device_handle_t hDevice, void** pptr ) override; ze_result_t zeMemAllocDevicePrologue( ze_context_handle_t hContext, const ze_device_mem_alloc_desc_t* device_desc, size_t size, size_t alignment, ze_device_handle_t hDevice, void** pptr ) override; ze_result_t zeMemAllocHostPrologue( ze_context_handle_t hContext, const ze_host_mem_alloc_desc_t* host_desc, size_t size, size_t alignment, void** pptr ) override; ze_result_t zeMemFreePrologue( ze_context_handle_t hContext, void* ptr ) override; ze_result_t zeMemGetAllocPropertiesPrologue( ze_context_handle_t hContext, const void* ptr, ze_memory_allocation_properties_t* pMemAllocProperties, ze_device_handle_t* phDevice ) override; ze_result_t zeMemGetAddressRangePrologue( ze_context_handle_t hContext, const void* ptr, void** pBase, size_t* pSize ) override; ze_result_t zeMemGetIpcHandlePrologue( ze_context_handle_t hContext, const void* ptr, ze_ipc_mem_handle_t* pIpcHandle ) override; ze_result_t zeMemGetIpcHandleFromFileDescriptorExpPrologue( ze_context_handle_t hContext, uint64_t handle, ze_ipc_mem_handle_t* pIpcHandle ) override; ze_result_t zeMemGetFileDescriptorFromIpcHandleExpPrologue( ze_context_handle_t hContext, ze_ipc_mem_handle_t ipcHandle, uint64_t* pHandle ) override; ze_result_t zeMemPutIpcHandlePrologue( ze_context_handle_t hContext, ze_ipc_mem_handle_t handle ) override; ze_result_t zeMemOpenIpcHandlePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_ipc_mem_handle_t handle, ze_ipc_memory_flags_t flags, void** pptr ) override; ze_result_t zeMemCloseIpcHandlePrologue( ze_context_handle_t hContext, const void* ptr ) override; ze_result_t zeMemSetAtomicAccessAttributeExpPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const void* ptr, size_t size, ze_memory_atomic_attr_exp_flags_t attr ) override; ze_result_t zeMemGetAtomicAccessAttributeExpPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const void* ptr, size_t size, ze_memory_atomic_attr_exp_flags_t* pAttr ) override; ze_result_t zeModuleCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_module_desc_t* desc, ze_module_handle_t* phModule, ze_module_build_log_handle_t* phBuildLog ) override; ze_result_t zeModuleDestroyPrologue( ze_module_handle_t hModule ) override; ze_result_t zeModuleDynamicLinkPrologue( uint32_t numModules, ze_module_handle_t* phModules, ze_module_build_log_handle_t* phLinkLog ) override; ze_result_t zeModuleBuildLogDestroyPrologue( ze_module_build_log_handle_t hModuleBuildLog ) override; ze_result_t zeModuleBuildLogGetStringPrologue( ze_module_build_log_handle_t hModuleBuildLog, size_t* pSize, char* pBuildLog ) override; ze_result_t zeModuleGetNativeBinaryPrologue( ze_module_handle_t hModule, size_t* pSize, uint8_t* pModuleNativeBinary ) override; ze_result_t zeModuleGetGlobalPointerPrologue( ze_module_handle_t hModule, const char* pGlobalName, size_t* pSize, void** pptr ) override; ze_result_t zeModuleGetKernelNamesPrologue( ze_module_handle_t hModule, uint32_t* pCount, const char** pNames ) override; ze_result_t zeModuleGetPropertiesPrologue( ze_module_handle_t hModule, ze_module_properties_t* pModuleProperties ) override; ze_result_t zeKernelCreatePrologue( ze_module_handle_t hModule, const ze_kernel_desc_t* desc, ze_kernel_handle_t* phKernel ) override; ze_result_t zeKernelDestroyPrologue( ze_kernel_handle_t hKernel ) override; ze_result_t zeModuleGetFunctionPointerPrologue( ze_module_handle_t hModule, const char* pFunctionName, void** pfnFunction ) override; ze_result_t zeKernelSetGroupSizePrologue( ze_kernel_handle_t hKernel, uint32_t groupSizeX, uint32_t groupSizeY, uint32_t groupSizeZ ) override; ze_result_t zeKernelSuggestGroupSizePrologue( ze_kernel_handle_t hKernel, uint32_t globalSizeX, uint32_t globalSizeY, uint32_t globalSizeZ, uint32_t* groupSizeX, uint32_t* groupSizeY, uint32_t* groupSizeZ ) override; ze_result_t zeKernelSuggestMaxCooperativeGroupCountPrologue( ze_kernel_handle_t hKernel, uint32_t* totalGroupCount ) override; ze_result_t zeKernelSetArgumentValuePrologue( ze_kernel_handle_t hKernel, uint32_t argIndex, size_t argSize, const void* pArgValue ) override; ze_result_t zeKernelSetIndirectAccessPrologue( ze_kernel_handle_t hKernel, ze_kernel_indirect_access_flags_t flags ) override; ze_result_t zeKernelGetIndirectAccessPrologue( ze_kernel_handle_t hKernel, ze_kernel_indirect_access_flags_t* pFlags ) override; ze_result_t zeKernelGetSourceAttributesPrologue( ze_kernel_handle_t hKernel, uint32_t* pSize, char** pString ) override; ze_result_t zeKernelSetCacheConfigPrologue( ze_kernel_handle_t hKernel, ze_cache_config_flags_t flags ) override; ze_result_t zeKernelGetPropertiesPrologue( ze_kernel_handle_t hKernel, ze_kernel_properties_t* pKernelProperties ) override; ze_result_t zeKernelGetNamePrologue( ze_kernel_handle_t hKernel, size_t* pSize, char* pName ) override; ze_result_t zeCommandListAppendLaunchKernelPrologue( ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t* pLaunchFuncArgs, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendLaunchCooperativeKernelPrologue( ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t* pLaunchFuncArgs, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendLaunchKernelIndirectPrologue( ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t* pLaunchArgumentsBuffer, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendLaunchMultipleKernelsIndirectPrologue( ze_command_list_handle_t hCommandList, uint32_t numKernels, ze_kernel_handle_t* phKernels, const uint32_t* pCountBuffer, const ze_group_count_t* pLaunchArgumentsBuffer, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeContextMakeMemoryResidentPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, void* ptr, size_t size ) override; ze_result_t zeContextEvictMemoryPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, void* ptr, size_t size ) override; ze_result_t zeContextMakeImageResidentPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_image_handle_t hImage ) override; ze_result_t zeContextEvictImagePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_image_handle_t hImage ) override; ze_result_t zeSamplerCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_sampler_desc_t* desc, ze_sampler_handle_t* phSampler ) override; ze_result_t zeSamplerDestroyPrologue( ze_sampler_handle_t hSampler ) override; ze_result_t zeVirtualMemReservePrologue( ze_context_handle_t hContext, const void* pStart, size_t size, void** pptr ) override; ze_result_t zeVirtualMemFreePrologue( ze_context_handle_t hContext, const void* ptr, size_t size ) override; ze_result_t zeVirtualMemQueryPageSizePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, size_t size, size_t* pagesize ) override; ze_result_t zePhysicalMemCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_physical_mem_desc_t* desc, ze_physical_mem_handle_t* phPhysicalMemory ) override; ze_result_t zePhysicalMemDestroyPrologue( ze_context_handle_t hContext, ze_physical_mem_handle_t hPhysicalMemory ) override; ze_result_t zeVirtualMemMapPrologue( ze_context_handle_t hContext, const void* ptr, size_t size, ze_physical_mem_handle_t hPhysicalMemory, size_t offset, ze_memory_access_attribute_t access ) override; ze_result_t zeVirtualMemUnmapPrologue( ze_context_handle_t hContext, const void* ptr, size_t size ) override; ze_result_t zeVirtualMemSetAccessAttributePrologue( ze_context_handle_t hContext, const void* ptr, size_t size, ze_memory_access_attribute_t access ) override; ze_result_t zeVirtualMemGetAccessAttributePrologue( ze_context_handle_t hContext, const void* ptr, size_t size, ze_memory_access_attribute_t* access, size_t* outSize ) override; ze_result_t zeKernelSetGlobalOffsetExpPrologue( ze_kernel_handle_t hKernel, uint32_t offsetX, uint32_t offsetY, uint32_t offsetZ ) override; ze_result_t zeKernelGetBinaryExpPrologue( ze_kernel_handle_t hKernel, size_t* pSize, uint8_t* pKernelBinary ) override; ze_result_t zeDeviceImportExternalSemaphoreExtPrologue( ze_device_handle_t hDevice, const ze_external_semaphore_ext_desc_t* desc, ze_external_semaphore_ext_handle_t* phSemaphore ) override; ze_result_t zeDeviceReleaseExternalSemaphoreExtPrologue( ze_external_semaphore_ext_handle_t hSemaphore ) override; ze_result_t zeCommandListAppendSignalExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_signal_params_ext_t* signalParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendWaitExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_wait_params_ext_t* waitParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeDeviceReserveCacheExtPrologue( ze_device_handle_t hDevice, size_t cacheLevel, size_t cacheReservationSize ) override; ze_result_t zeDeviceSetCacheAdviceExtPrologue( ze_device_handle_t hDevice, void* ptr, size_t regionSize, ze_cache_ext_region_t cacheRegion ) override; ze_result_t zeEventQueryTimestampsExpPrologue( ze_event_handle_t hEvent, ze_device_handle_t hDevice, uint32_t* pCount, ze_kernel_timestamp_result_t* pTimestamps ) override; ze_result_t zeImageGetMemoryPropertiesExpPrologue( ze_image_handle_t hImage, ze_image_memory_properties_exp_t* pMemoryProperties ) override; ze_result_t zeImageViewCreateExtPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t hImage, ze_image_handle_t* phImageView ) override; ze_result_t zeImageViewCreateExpPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t hImage, ze_image_handle_t* phImageView ) override; ze_result_t zeKernelSchedulingHintExpPrologue( ze_kernel_handle_t hKernel, ze_scheduling_hint_exp_desc_t* pHint ) override; ze_result_t zeDevicePciGetPropertiesExtPrologue( ze_device_handle_t hDevice, ze_pci_ext_properties_t* pPciProperties ) override; ze_result_t zeCommandListAppendImageCopyToMemoryExtPrologue( ze_command_list_handle_t hCommandList, void* dstptr, ze_image_handle_t hSrcImage, const ze_image_region_t* pSrcRegion, uint32_t destRowPitch, uint32_t destSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendImageCopyFromMemoryExtPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, const void* srcptr, const ze_image_region_t* pDstRegion, uint32_t srcRowPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeImageGetAllocPropertiesExtPrologue( ze_context_handle_t hContext, ze_image_handle_t hImage, ze_image_allocation_ext_properties_t* pImageAllocProperties ) override; ze_result_t zeModuleInspectLinkageExtPrologue( ze_linkage_inspection_ext_desc_t* pInspectDesc, uint32_t numModules, ze_module_handle_t* phModules, ze_module_build_log_handle_t* phLog ) override; ze_result_t zeMemFreeExtPrologue( ze_context_handle_t hContext, const ze_memory_free_ext_desc_t* pMemFreeDesc, void* ptr ) override; ze_result_t zeFabricVertexGetExpPrologue( ze_driver_handle_t hDriver, uint32_t* pCount, ze_fabric_vertex_handle_t* phVertices ) override; ze_result_t zeFabricVertexGetSubVerticesExpPrologue( ze_fabric_vertex_handle_t hVertex, uint32_t* pCount, ze_fabric_vertex_handle_t* phSubvertices ) override; ze_result_t zeFabricVertexGetPropertiesExpPrologue( ze_fabric_vertex_handle_t hVertex, ze_fabric_vertex_exp_properties_t* pVertexProperties ) override; ze_result_t zeFabricVertexGetDeviceExpPrologue( ze_fabric_vertex_handle_t hVertex, ze_device_handle_t* phDevice ) override; ze_result_t zeDeviceGetFabricVertexExpPrologue( ze_device_handle_t hDevice, ze_fabric_vertex_handle_t* phVertex ) override; ze_result_t zeFabricEdgeGetExpPrologue( ze_fabric_vertex_handle_t hVertexA, ze_fabric_vertex_handle_t hVertexB, uint32_t* pCount, ze_fabric_edge_handle_t* phEdges ) override; ze_result_t zeFabricEdgeGetVerticesExpPrologue( ze_fabric_edge_handle_t hEdge, ze_fabric_vertex_handle_t* phVertexA, ze_fabric_vertex_handle_t* phVertexB ) override; ze_result_t zeFabricEdgeGetPropertiesExpPrologue( ze_fabric_edge_handle_t hEdge, ze_fabric_edge_exp_properties_t* pEdgeProperties ) override; ze_result_t zeEventQueryKernelTimestampsExtPrologue( ze_event_handle_t hEvent, ze_device_handle_t hDevice, uint32_t* pCount, ze_event_query_kernel_timestamps_results_ext_properties_t* pResults ) override; ze_result_t zeRTASBuilderCreateExpPrologue( ze_driver_handle_t hDriver, const ze_rtas_builder_exp_desc_t* pDescriptor, ze_rtas_builder_exp_handle_t* phBuilder ) override; ze_result_t zeRTASBuilderGetBuildPropertiesExpPrologue( ze_rtas_builder_exp_handle_t hBuilder, const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ze_rtas_builder_exp_properties_t* pProperties ) override; ze_result_t zeDriverRTASFormatCompatibilityCheckExpPrologue( ze_driver_handle_t hDriver, ze_rtas_format_exp_t rtasFormatA, ze_rtas_format_exp_t rtasFormatB ) override; ze_result_t zeRTASBuilderBuildExpPrologue( ze_rtas_builder_exp_handle_t hBuilder, const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, void* pScratchBuffer, size_t scratchBufferSizeBytes, void* pRtasBuffer, size_t rtasBufferSizeBytes, ze_rtas_parallel_operation_exp_handle_t hParallelOperation, void* pBuildUserPtr, ze_rtas_aabb_exp_t* pBounds, size_t* pRtasBufferSizeBytes ) override; ze_result_t zeRTASBuilderDestroyExpPrologue( ze_rtas_builder_exp_handle_t hBuilder ) override; ze_result_t zeRTASParallelOperationCreateExpPrologue( ze_driver_handle_t hDriver, ze_rtas_parallel_operation_exp_handle_t* phParallelOperation ) override; ze_result_t zeRTASParallelOperationGetPropertiesExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ze_rtas_parallel_operation_exp_properties_t* pProperties ) override; ze_result_t zeRTASParallelOperationJoinExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ) override; ze_result_t zeRTASParallelOperationDestroyExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ) override; ze_result_t zeMemGetPitchFor2dImagePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, size_t imageWidth, size_t imageHeight, unsigned int elementSizeInBytes, size_t * rowPitch ) override; ze_result_t zeImageGetDeviceOffsetExpPrologue( ze_image_handle_t hImage, uint64_t* pDeviceOffset ) override; ze_result_t zeCommandListCreateCloneExpPrologue( ze_command_list_handle_t hCommandList, ze_command_list_handle_t* phClonedCommandList ) override; ze_result_t zeCommandListImmediateAppendCommandListsExpPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListGetNextCommandIdExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint64_t* pCommandId ) override; ze_result_t zeCommandListGetNextCommandIdWithKernelsExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint32_t numKernels, ze_kernel_handle_t* phKernels, uint64_t* pCommandId ) override; ze_result_t zeCommandListUpdateMutableCommandsExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_commands_exp_desc_t* desc ) override; ze_result_t zeCommandListUpdateMutableCommandSignalEventExpPrologue( ze_command_list_handle_t hCommandList, uint64_t commandId, ze_event_handle_t hSignalEvent ) override; ze_result_t zeCommandListUpdateMutableCommandWaitEventsExpPrologue( ze_command_list_handle_t hCommandList, uint64_t commandId, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListUpdateMutableCommandKernelsExpPrologue( ze_command_list_handle_t hCommandList, uint32_t numKernels, uint64_t* pCommandId, ze_kernel_handle_t* phKernels ) override; }; }zes_parameter_validation.cpp000066400000000000000000004062751475521542100343220ustar00rootroot00000000000000level-zero-1.20.6/source/layers/validation/checkers/parameter_validation/* * ***THIS FILE IS GENERATED. *** * See valddi.cpp.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_parameter_validation.cpp * */ #include "ze_validation_layer.h" #include "param_validation.h" namespace validation_layer { ze_result_t ZESParameterValidation::zesInitPrologue( zes_init_flags_t flags ///< [in] initialization flags. ///< currently unused, must be 0 (default). ) { if( 0x1 < flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDriverGetPrologue( uint32_t* pCount, ///< [in,out] pointer to the number of sysman driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of sysman drivers available. ///< if count is greater than the number of sysman drivers available, then ///< the loader shall update the value with the correct number of sysman ///< drivers available. zes_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of sysman driver instance handles. ///< if count is less than the number of sysman drivers available, then the ///< loader shall only retrieve that number of sysman drivers. ) { if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDriverGetExtensionPropertiesPrologue( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. zes_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pExtensionProperties); } ze_result_t ZESParameterValidation::zesDriverGetExtensionFunctionAddressPrologue( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == name ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == ppFunctionAddress ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceGetPrologue( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance uint32_t* pCount, ///< [in,out] pointer to the number of sysman devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sysman devices available. ///< if count is greater than the number of sysman devices available, then ///< the driver shall update the value with the correct number of sysman ///< devices available. zes_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of sysman devices. ///< if count is less than the number of sysman devices available, then ///< driver shall only retrieve that number of sysman devices. ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceGetPropertiesPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_properties_t* pProperties ///< [in,out] Structure that will contain information about the device. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesDeviceGetStatePrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_state_t* pState ///< [in,out] Structure that will contain information about the device. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pState); } ze_result_t ZESParameterValidation::zesDeviceResetPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device ze_bool_t force ///< [in] If set to true, all applications that are currently using the ///< device will be forcibly killed. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceResetExtPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device zes_reset_properties_t* pProperties ///< [in] Device reset properties to apply ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesDeviceProcessesGetStatePrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device uint32_t* pCount, ///< [in,out] pointer to the number of processes. ///< if count is zero, then the driver shall update the value with the ///< total number of processes currently attached to the device. ///< if count is greater than the number of processes currently attached to ///< the device, then the driver shall update the value with the correct ///< number of processes. zes_process_state_t* pProcesses ///< [in,out][optional][range(0, *pCount)] array of process information. ///< if count is less than the number of processes currently attached to ///< the device, then the driver shall only retrieve information about that ///< number of processes. In this case, the return code will ::ZE_RESULT_ERROR_INVALID_SIZE. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProcesses); } ze_result_t ZESParameterValidation::zesDevicePciGetPropertiesPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_properties_t* pProperties ///< [in,out] Will contain the PCI properties. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesDevicePciGetStatePrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_state_t* pState ///< [in,out] Will contain the PCI properties. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pState); } ze_result_t ZESParameterValidation::zesDevicePciGetBarsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of PCI bars. ///< if count is zero, then the driver shall update the value with the ///< total number of PCI bars that are setup. ///< if count is greater than the number of PCI bars that are setup, then ///< the driver shall update the value with the correct number of PCI bars. zes_pci_bar_properties_t* pProperties ///< [in,out][optional][range(0, *pCount)] array of information about setup ///< PCI bars. ///< if count is less than the number of PCI bars that are setup, then the ///< driver shall only retrieve information about that number of PCI bars. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesDevicePciGetStatsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_stats_t* pStats ///< [in,out] Will contain a snapshot of the latest stats. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pStats ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceSetOverclockWaiverPrologue( zes_device_handle_t hDevice ///< [in] Sysman handle of the device. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceGetOverclockDomainsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pOverclockDomains ///< [in,out] Returns the overclock domains that are supported (a bit for ///< each of enum ::zes_overclock_domain_t). If no bits are set, the device ///< doesn't support overclocking. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pOverclockDomains ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceGetOverclockControlsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_domain_t domainType, ///< [in] Domain type. uint32_t* pAvailableControls ///< [in,out] Returns the overclock controls that are supported for the ///< specified overclock domain (a bit for each of enum ///< ::zes_overclock_control_t). ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZES_OVERCLOCK_DOMAIN_ADM < domainType ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == pAvailableControls ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceResetOverclockSettingsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. ze_bool_t onShippedState ///< [in] True will reset to shipped state; false will reset to ///< manufacturing state ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceReadOverclockStatePrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_mode_t* pOverclockMode, ///< [out] One of overclock mode. ze_bool_t* pWaiverSetting, ///< [out] Waiver setting: 0 = Waiver not set, 1 = waiver has been set. ze_bool_t* pOverclockState, ///< [out] Current settings 0 =manufacturing state, 1= shipped state).. zes_pending_action_t* pPendingAction, ///< [out] This enum is returned when the driver attempts to set an ///< overclock control or reset overclock settings. ze_bool_t* pPendingReset ///< [out] Pending reset 0 =manufacturing state, 1= shipped state).. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pOverclockMode ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pWaiverSetting ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pOverclockState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pPendingAction ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pPendingReset ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumOverclockDomainsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_overclock_handle_t* phDomainHandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesOverclockGetDomainPropertiesPrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_properties_t* pDomainProperties ///< [in,out] The overclock properties for the specified domain. ) { if( nullptr == hDomainHandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pDomainProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pDomainProperties); } ze_result_t ZESParameterValidation::zesOverclockGetDomainVFPropertiesPrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_property_t* pVFProperties ///< [in,out] The VF min,max,step for a specified domain. ) { if( nullptr == hDomainHandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pVFProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesOverclockGetDomainControlPropertiesPrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Handle for the component. zes_control_property_t* pControlProperties ///< [in,out] overclock control values. ) { if( nullptr == hDomainHandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == pControlProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesOverclockGetControlCurrentValuePrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [in,out] Getting overclock control value for the specified control. ) { if( nullptr == hDomainHandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == pValue ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesOverclockGetControlPendingValuePrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [out] Returns the pending value for a given control. The units and ///< format of the value depend on the control type. ) { if( nullptr == hDomainHandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == pValue ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesOverclockSetControlUserValuePrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. double pValue, ///< [in] The new value of the control. The units and format of the value ///< depend on the control type. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ) { if( nullptr == hDomainHandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == pPendingAction ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesOverclockGetControlStatePrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. zes_control_state_t* pControlState, ///< [out] Current overclock control state. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ) { if( nullptr == hDomainHandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == pControlState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pPendingAction ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesOverclockGetVFPointValuesPrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. zes_vf_array_type_t VFArrayType, ///< [in] User,Default or Live VF array to read from uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t* PointValue ///< [out] Returns the frequency in 1kHz units or voltage in millivolt ///< units from the custom V-F curve at the specified zero-based index ) { if( nullptr == hDomainHandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZES_VF_TYPE_FREQ < VFType ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( ZES_VF_ARRAY_TYPE_LIVE_VF_ARRAY < VFArrayType ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == PointValue ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesOverclockSetVFPointValuesPrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t PointValue ///< [in] Writes frequency in 1kHz units or voltage in millivolt units to ///< custom V-F curve at the specified zero-based index ) { if( nullptr == hDomainHandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZES_VF_TYPE_FREQ < VFType ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumDiagnosticTestSuitesPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_diag_handle_t* phDiagnostics ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDiagnosticsGetPropertiesPrologue( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. zes_diag_properties_t* pProperties ///< [in,out] Structure describing the properties of a diagnostics test ///< suite ) { if( nullptr == hDiagnostics ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesDiagnosticsGetTestsPrologue( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of tests. ///< if count is zero, then the driver shall update the value with the ///< total number of tests that are available. ///< if count is greater than the number of tests that are available, then ///< the driver shall update the value with the correct number of tests. zes_diag_test_t* pTests ///< [in,out][optional][range(0, *pCount)] array of information about ///< individual tests sorted by increasing value of the `index` member of ::zes_diag_test_t. ///< if count is less than the number of tests that are available, then the ///< driver shall only retrieve that number of tests. ) { if( nullptr == hDiagnostics ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDiagnosticsRunTestsPrologue( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t startIndex, ///< [in] The index of the first test to run. Set to ///< ::ZES_DIAG_FIRST_TEST_INDEX to start from the beginning. uint32_t endIndex, ///< [in] The index of the last test to run. Set to ///< ::ZES_DIAG_LAST_TEST_INDEX to complete all tests after the start test. zes_diag_result_t* pResult ///< [in,out] The result of the diagnostics ) { if( nullptr == hDiagnostics ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pResult ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEccAvailablePrologue( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pAvailable ///< [out] ECC functionality is available (true)/unavailable (false). ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pAvailable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEccConfigurablePrologue( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pConfigurable ///< [out] ECC can be enabled/disabled (true)/enabled/disabled (false). ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pConfigurable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceGetEccStatePrologue( zes_device_handle_t hDevice, ///< [in] Handle for the component. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pState); } ze_result_t ZESParameterValidation::zesDeviceSetEccStatePrologue( zes_device_handle_t hDevice, ///< [in] Handle for the component. const zes_device_ecc_desc_t* newState, ///< [in] Pointer to desired ECC state. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == newState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZES_DEVICE_ECC_STATE_DISABLED < newState->state ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; auto retVal = ZE_RESULT_SUCCESS; retVal = ParameterValidation::validateExtensions(newState); if(retVal) return retVal; retVal = ParameterValidation::validateExtensions(pState); return retVal; } ze_result_t ZESParameterValidation::zesDeviceEnumEngineGroupsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_engine_handle_t* phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesEngineGetPropertiesPrologue( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_properties_t* pProperties ///< [in,out] The properties for the specified engine group. ) { if( nullptr == hEngine ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesEngineGetActivityPrologue( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_stats_t* pStats ///< [in,out] Will contain a snapshot of the engine group activity ///< counters. ) { if( nullptr == hEngine ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pStats ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEventRegisterPrologue( zes_device_handle_t hDevice, ///< [in] The device handle. zes_event_type_flags_t events ///< [in] List of events to listen to. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( 0xffff < events ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDriverEventListenPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT32_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phDevices ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pNumDeviceEvents ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pEvents ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDriverEventListenExPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT64_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phDevices ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pNumDeviceEvents ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pEvents ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumFabricPortsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fabric_port_handle_t* phPort ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFabricPortGetPropertiesPrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_properties_t* pProperties ///< [in,out] Will contain properties of the Fabric Port. ) { if( nullptr == hPort ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesFabricPortGetLinkTypePrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_link_type_t* pLinkType ///< [in,out] Will contain details about the link attached to the Fabric ///< port. ) { if( nullptr == hPort ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pLinkType ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFabricPortGetConfigPrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_config_t* pConfig ///< [in,out] Will contain configuration of the Fabric Port. ) { if( nullptr == hPort ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pConfig ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pConfig); } ze_result_t ZESParameterValidation::zesFabricPortSetConfigPrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. const zes_fabric_port_config_t* pConfig ///< [in] Contains new configuration of the Fabric Port. ) { if( nullptr == hPort ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pConfig ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pConfig); } ze_result_t ZESParameterValidation::zesFabricPortGetStatePrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_state_t* pState ///< [in,out] Will contain the current state of the Fabric Port ) { if( nullptr == hPort ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pState); } ze_result_t ZESParameterValidation::zesFabricPortGetThroughputPrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_throughput_t* pThroughput ///< [in,out] Will contain the Fabric port throughput counters. ) { if( nullptr == hPort ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pThroughput ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFabricPortGetFabricErrorCountersPrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_error_counters_t* pErrors ///< [in,out] Will contain the Fabric port Error counters. ) { if( nullptr == hPort ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pErrors ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pErrors); } ze_result_t ZESParameterValidation::zesFabricPortGetMultiPortThroughputPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t numPorts, ///< [in] Number of ports enumerated in function ::zesDeviceEnumFabricPorts zes_fabric_port_handle_t* phPort, ///< [in][range(0, numPorts)] array of fabric port handles provided by user ///< to gather throughput values. zes_fabric_port_throughput_t** pThroughput ///< [out][range(0, numPorts)] array of fabric port throughput counters ///< from multiple ports of type ::zes_fabric_port_throughput_t. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phPort ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pThroughput ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumFansPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fan_handle_t* phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFanGetPropertiesPrologue( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_properties_t* pProperties ///< [in,out] Will contain the properties of the fan. ) { if( nullptr == hFan ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesFanGetConfigPrologue( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_config_t* pConfig ///< [in,out] Will contain the current configuration of the fan. ) { if( nullptr == hFan ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pConfig ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pConfig); } ze_result_t ZESParameterValidation::zesFanSetDefaultModePrologue( zes_fan_handle_t hFan ///< [in] Handle for the component. ) { if( nullptr == hFan ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFanSetFixedSpeedModePrologue( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_t* speed ///< [in] The fixed fan speed setting ) { if( nullptr == hFan ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == speed ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFanSetSpeedTableModePrologue( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_table_t* speedTable ///< [in] A table containing temperature/speed pairs. ) { if( nullptr == hFan ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == speedTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFanGetStatePrologue( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned. int32_t* pSpeed ///< [in,out] Will contain the current speed of the fan in the units ///< requested. A value of -1 indicates that the fan speed cannot be ///< measured. ) { if( nullptr == hFan ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZES_FAN_SPEED_UNITS_PERCENT < units ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == pSpeed ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumFirmwaresPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_firmware_handle_t* phFirmware ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFirmwareGetPropertiesPrologue( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. zes_firmware_properties_t* pProperties ///< [in,out] Pointer to an array that will hold the properties of the ///< firmware ) { if( nullptr == hFirmware ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesFirmwareFlashPrologue( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. void* pImage, ///< [in] Image of the new firmware to flash. uint32_t size ///< [in] Size of the flash image. ) { if( nullptr == hFirmware ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pImage ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFirmwareGetFlashProgressPrologue( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. uint32_t* pCompletionPercent ///< [in,out] Pointer to the Completion Percentage of Firmware Update ) { if( nullptr == hFirmware ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCompletionPercent ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFirmwareGetConsoleLogsPrologue( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. size_t* pSize, ///< [in,out] size of firmware log char* pFirmwareLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { if( nullptr == hFirmware ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumFrequencyDomainsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_freq_handle_t* phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyGetPropertiesPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_properties_t* pProperties ///< [in,out] The frequency properties for the specified domain. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesFrequencyGetAvailableClocksPrologue( zes_freq_handle_t hFrequency, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of frequencies. ///< if count is zero, then the driver shall update the value with the ///< total number of frequencies that are available. ///< if count is greater than the number of frequencies that are available, ///< then the driver shall update the value with the correct number of frequencies. double* phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of ///< MHz and sorted from slowest to fastest. ///< if count is less than the number of frequencies that are available, ///< then the driver shall only retrieve that number of frequencies. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyGetRangePrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_range_t* pLimits ///< [in,out] The range between which the hardware can operate for the ///< specified domain. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pLimits ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencySetRangePrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. const zes_freq_range_t* pLimits ///< [in] The limits between which the hardware can operate for the ///< specified domain. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pLimits ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyGetStatePrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_state_t* pState ///< [in,out] Frequency state for the specified domain. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pState); } ze_result_t ZESParameterValidation::zesFrequencyGetThrottleTimePrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_throttle_time_t* pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the ///< specified domain. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pThrottleTime ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyOcGetCapabilitiesPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_capabilities_t* pOcCapabilities ///< [in,out] Pointer to the capabilities structure. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pOcCapabilities ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pOcCapabilities); } ze_result_t ZESParameterValidation::zesFrequencyOcGetFrequencyTargetPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentOcFrequency ///< [out] Overclocking Frequency in MHz, if extended moded is supported, ///< will returned in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCurrentOcFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyOcSetFrequencyTargetPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentOcFrequency ///< [in] Overclocking Frequency in MHz, if extended moded is supported, it ///< could be set in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyOcGetVoltageTargetPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentVoltageTarget, ///< [out] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double* pCurrentVoltageOffset ///< [out] This voltage offset is applied to all points on the ///< voltage/frequency curve, including the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCurrentVoltageTarget ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pCurrentVoltageOffset ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyOcSetVoltageTargetPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentVoltageTarget, ///< [in] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double CurrentVoltageOffset ///< [in] This voltage offset is applied to all points on the ///< voltage/frequency curve, include the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyOcSetModePrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t CurrentOcMode ///< [in] Current Overclocking Mode ::zes_oc_mode_t. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZES_OC_MODE_FIXED < CurrentOcMode ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyOcGetModePrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t* pCurrentOcMode ///< [out] Current Overclocking Mode ::zes_oc_mode_t. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCurrentOcMode ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyOcGetIccMaxPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcIccMax ///< [in,out] Will contain the maximum current limit in Amperes on ///< successful return. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pOcIccMax ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyOcSetIccMaxPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocIccMax ///< [in] The new maximum current limit in Amperes. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyOcGetTjMaxPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcTjMax ///< [in,out] Will contain the maximum temperature limit in degrees Celsius ///< on successful return. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pOcTjMax ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFrequencyOcSetTjMaxPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocTjMax ///< [in] The new maximum temperature limit in degrees Celsius. ) { if( nullptr == hFrequency ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumLedsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_led_handle_t* phLed ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesLedGetPropertiesPrologue( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_properties_t* pProperties ///< [in,out] Will contain the properties of the LED. ) { if( nullptr == hLed ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesLedGetStatePrologue( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_state_t* pState ///< [in,out] Will contain the current state of the LED. ) { if( nullptr == hLed ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pState); } ze_result_t ZESParameterValidation::zesLedSetStatePrologue( zes_led_handle_t hLed, ///< [in] Handle for the component. ze_bool_t enable ///< [in] Set to TRUE to turn the LED on, FALSE to turn off. ) { if( nullptr == hLed ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesLedSetColorPrologue( zes_led_handle_t hLed, ///< [in] Handle for the component. const zes_led_color_t* pColor ///< [in] New color of the LED. ) { if( nullptr == hLed ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pColor ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumMemoryModulesPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_mem_handle_t* phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesMemoryGetPropertiesPrologue( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_properties_t* pProperties ///< [in,out] Will contain memory properties. ) { if( nullptr == hMemory ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesMemoryGetStatePrologue( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_state_t* pState ///< [in,out] Will contain the current health and allocated memory. ) { if( nullptr == hMemory ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pState); } ze_result_t ZESParameterValidation::zesMemoryGetBandwidthPrologue( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_bandwidth_t* pBandwidth ///< [in,out] Will contain the total number of bytes read from and written ///< to memory, as well as the current maximum bandwidth. ) { if( nullptr == hMemory ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pBandwidth ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumPerformanceFactorDomainsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_perf_handle_t* phPerf ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesPerformanceFactorGetPropertiesPrologue( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. zes_perf_properties_t* pProperties ///< [in,out] Will contain information about the specified Performance ///< Factor domain. ) { if( nullptr == hPerf ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesPerformanceFactorGetConfigPrologue( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double* pFactor ///< [in,out] Will contain the actual Performance Factor being used by the ///< hardware (may not be the same as the requested Performance Factor). ) { if( nullptr == hPerf ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pFactor ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesPerformanceFactorSetConfigPrologue( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double factor ///< [in] The new Performance Factor. ) { if( nullptr == hPerf ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumPowerDomainsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_pwr_handle_t* phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceGetCardPowerDomainPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pwr_handle_t* phPower ///< [in,out] power domain handle for the entire PCIe card. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phPower ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesPowerGetPropertiesPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_properties_t* pProperties ///< [in,out] Structure that will contain property data. ) { if( nullptr == hPower ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesPowerGetEnergyCounterPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_energy_counter_t* pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and ///< timestamp when the last counter value was measured. ) { if( nullptr == hPower ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pEnergy ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesPowerGetLimitsPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_sustained_limit_t* pSustained, ///< [in,out][optional] The sustained power limit. If this is null, the ///< current sustained power limits will not be returned. zes_power_burst_limit_t* pBurst, ///< [in,out][optional] The burst power limit. If this is null, the current ///< peak power limits will not be returned. zes_power_peak_limit_t* pPeak ///< [in,out][optional] The peak power limit. If this is null, the peak ///< power limits will not be returned. ) { if( nullptr == hPower ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesPowerSetLimitsPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. const zes_power_sustained_limit_t* pSustained, ///< [in][optional] The sustained power limit. If this is null, no changes ///< will be made to the sustained power limits. const zes_power_burst_limit_t* pBurst, ///< [in][optional] The burst power limit. If this is null, no changes will ///< be made to the burst power limits. const zes_power_peak_limit_t* pPeak ///< [in][optional] The peak power limit. If this is null, no changes will ///< be made to the peak power limits. ) { if( nullptr == hPower ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesPowerGetEnergyThresholdPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_energy_threshold_t* pThreshold ///< [in,out] Returns information about the energy threshold setting - ///< enabled/energy threshold/process ID. ) { if( nullptr == hPower ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pThreshold ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesPowerSetEnergyThresholdPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. double threshold ///< [in] The energy threshold to be set in joules. ) { if( nullptr == hPower ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumPsusPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_psu_handle_t* phPsu ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesPsuGetPropertiesPrologue( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_properties_t* pProperties ///< [in,out] Will contain the properties of the power supply. ) { if( nullptr == hPsu ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesPsuGetStatePrologue( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_state_t* pState ///< [in,out] Will contain the current state of the power supply. ) { if( nullptr == hPsu ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pState); } ze_result_t ZESParameterValidation::zesDeviceEnumRasErrorSetsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_ras_handle_t* phRas ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesRasGetPropertiesPrologue( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_properties_t* pProperties ///< [in,out] Structure describing RAS properties ) { if( nullptr == hRas ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesRasGetConfigPrologue( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_config_t* pConfig ///< [in,out] Will be populed with the current RAS configuration - ///< thresholds used to trigger events ) { if( nullptr == hRas ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pConfig ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pConfig); } ze_result_t ZESParameterValidation::zesRasSetConfigPrologue( zes_ras_handle_t hRas, ///< [in] Handle for the component. const zes_ras_config_t* pConfig ///< [in] Change the RAS configuration - thresholds used to trigger events ) { if( nullptr == hRas ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pConfig ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pConfig); } ze_result_t ZESParameterValidation::zesRasGetStatePrologue( zes_ras_handle_t hRas, ///< [in] Handle for the component. ze_bool_t clear, ///< [in] Set to 1 to clear the counters of this type zes_ras_state_t* pState ///< [in,out] Breakdown of where errors have occurred ) { if( nullptr == hRas ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pState ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pState); } ze_result_t ZESParameterValidation::zesDeviceEnumSchedulersPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_sched_handle_t* phScheduler ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesSchedulerGetPropertiesPrologue( zes_sched_handle_t hScheduler, ///< [in] Handle for the component. zes_sched_properties_t* pProperties ///< [in,out] Structure that will contain property data. ) { if( nullptr == hScheduler ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesSchedulerGetCurrentModePrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_mode_t* pMode ///< [in,out] Will contain the current scheduler mode. ) { if( nullptr == hScheduler ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pMode ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesSchedulerGetTimeoutModePropertiesPrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeout_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ) { if( nullptr == hScheduler ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pConfig ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pConfig); } ze_result_t ZESParameterValidation::zesSchedulerGetTimesliceModePropertiesPrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeslice_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ) { if( nullptr == hScheduler ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pConfig ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pConfig); } ze_result_t ZESParameterValidation::zesSchedulerSetTimeoutModePrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeout_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { if( nullptr == hScheduler ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pNeedReload ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesSchedulerSetTimesliceModePrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeslice_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { if( nullptr == hScheduler ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pNeedReload ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesSchedulerSetExclusiveModePrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { if( nullptr == hScheduler ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pNeedReload ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesSchedulerSetComputeUnitDebugModePrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { if( nullptr == hScheduler ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pNeedReload ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumStandbyDomainsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_standby_handle_t* phStandby ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesStandbyGetPropertiesPrologue( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_properties_t* pProperties ///< [in,out] Will contain the standby hardware properties. ) { if( nullptr == hStandby ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesStandbyGetModePrologue( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t* pMode ///< [in,out] Will contain the current standby mode. ) { if( nullptr == hStandby ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pMode ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesStandbySetModePrologue( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t mode ///< [in] New standby mode. ) { if( nullptr == hStandby ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZES_STANDBY_PROMO_MODE_NEVER < mode ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumTemperatureSensorsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_temp_handle_t* phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesTemperatureGetPropertiesPrologue( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_properties_t* pProperties ///< [in,out] Will contain the temperature sensor properties. ) { if( nullptr == hTemperature ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesTemperatureGetConfigPrologue( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_config_t* pConfig ///< [in,out] Returns current configuration. ) { if( nullptr == hTemperature ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pConfig ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pConfig); } ze_result_t ZESParameterValidation::zesTemperatureSetConfigPrologue( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. const zes_temp_config_t* pConfig ///< [in] New configuration. ) { if( nullptr == hTemperature ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pConfig ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pConfig); } ze_result_t ZESParameterValidation::zesTemperatureGetStatePrologue( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. double* pTemperature ///< [in,out] Will contain the temperature read from the specified sensor ///< in degrees Celsius. ) { if( nullptr == hTemperature ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pTemperature ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesPowerGetLimitsExtPrologue( zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. uint32_t* pCount, ///< [in,out] Pointer to the number of power limit descriptors. If count is ///< zero, then the driver shall update the value with the total number of ///< components of this type that are available. If count is greater than ///< the number of components of this type that are available, then the ///< driver shall update the value with the correct number of components. zes_power_limit_ext_desc_t* pSustained ///< [in,out][optional][range(0, *pCount)] Array of query results for power ///< limit descriptors. If count is less than the number of components of ///< this type that are available, then the driver shall only retrieve that ///< number of components. ) { if( nullptr == hPower ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pSustained); } ze_result_t ZESParameterValidation::zesPowerSetLimitsExtPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. uint32_t* pCount, ///< [in] Pointer to the number of power limit descriptors. zes_power_limit_ext_desc_t* pSustained ///< [in][optional][range(0, *pCount)] Array of power limit descriptors. ) { if( nullptr == hPower ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pSustained); } ze_result_t ZESParameterValidation::zesEngineGetActivityExtPrologue( zes_engine_handle_t hEngine, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_engine_stats_t* pStats ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector with engine stat for ///< PF at index 0 of the vector followed by user provided pCount-1 number ///< of VF engine stats. ) { if( nullptr == hEngine ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesRasGetStateExpPrologue( zes_ras_handle_t hRas, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of RAS state structures that can be retrieved. ///< if count is zero, then the driver shall update the value with the ///< total number of error categories for which state can be retrieved. ///< if count is greater than the number of RAS states available, then the ///< driver shall update the value with the correct number of RAS states available. zes_ras_state_exp_t* pState ///< [in,out][optional][range(0, *pCount)] array of query results for RAS ///< error states for different categories. ///< if count is less than the number of RAS states available, then driver ///< shall only retrieve that number of RAS states. ) { if( nullptr == hRas ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesRasClearStateExpPrologue( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_error_category_exp_t category ///< [in] category for which error counter is to be cleared. ) { if( nullptr == hRas ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZES_RAS_ERROR_CATEGORY_EXP_L3FABRIC_ERRORS < category ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFirmwareGetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. char* pVersion ///< [in,out] NULL terminated string value. The string "unknown" will be ///< returned if this property cannot be determined. ) { if( nullptr == hFirmware ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pVersion ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesFirmwareSetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware ///< [in] Handle for the component. ) { if( nullptr == hFirmware ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceGetSubDevicePropertiesExpPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of sub devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub devices currently attached to the device. ///< if count is greater than the number of sub devices currently attached ///< to the device, then the driver shall update the value with the correct ///< number of sub devices. zes_subdevice_exp_properties_t* pSubdeviceProps ///< [in,out][optional][range(0, *pCount)] array of sub device property structures. ///< if count is less than the number of sysman sub devices available, then ///< the driver shall only retrieve that number of sub device property structures. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pSubdeviceProps); } ze_result_t ZESParameterValidation::zesDriverGetDeviceByUuidExpPrologue( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance zes_uuid_t uuid, ///< [in] universal unique identifier. zes_device_handle_t* phDevice, ///< [out] Sysman handle of the device. ze_bool_t* onSubdevice, ///< [out] True if the UUID belongs to the sub-device; false means that ///< UUID belongs to the root device. uint32_t* subdeviceId ///< [out] If onSubdevice is true, this gives the ID of the sub-device ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phDevice ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == onSubdevice ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == subdeviceId ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumActiveVFExpPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesVFManagementGetVFPropertiesExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. ) { if( nullptr == hVFhandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZESParameterValidation::zesVFManagementGetVFMemoryUtilizationExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ) { if( nullptr == hVFhandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesVFManagementGetVFEngineUtilizationExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ) { if( nullptr == hVFhandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesVFManagementSetVFTelemetryModeExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. ze_bool_t enable ///< [in] Enable utilization telemetry. ) { if( nullptr == hVFhandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( 0xf < flags ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. uint64_t samplingInterval ///< [in] Sampling interval value. ) { if( nullptr == hVFhandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( 0xf < flag ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesDeviceEnumEnabledVFExpPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesVFManagementGetVFCapabilitiesExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ) { if( nullptr == hVFhandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCapability ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pCapability); } ze_result_t ZESParameterValidation::zesVFManagementGetVFMemoryUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ) { if( nullptr == hVFhandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesVFManagementGetVFEngineUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ) { if( nullptr == hVFhandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZESParameterValidation::zesVFManagementGetVFCapabilitiesExp2Prologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp2_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ) { if( nullptr == hVFhandle ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCapability ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pCapability); } }level-zero-1.20.6/source/layers/validation/checkers/parameter_validation/zes_parameter_validation.h000066400000000000000000000510661475521542100340400ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See param.h.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_parameter_validation.h * */ #pragma once #include "ze_validation_layer.h" #include "zes_entry_points.h" namespace validation_layer { class ZESParameterValidation : public ZESValidationEntryPoints { public: ze_result_t zesInitPrologue( zes_init_flags_t flags ) override; ze_result_t zesDriverGetPrologue( uint32_t* pCount, zes_driver_handle_t* phDrivers ) override; ze_result_t zesDriverGetExtensionPropertiesPrologue( zes_driver_handle_t hDriver, uint32_t* pCount, zes_driver_extension_properties_t* pExtensionProperties ) override; ze_result_t zesDriverGetExtensionFunctionAddressPrologue( zes_driver_handle_t hDriver, const char* name, void** ppFunctionAddress ) override; ze_result_t zesDeviceGetPrologue( zes_driver_handle_t hDriver, uint32_t* pCount, zes_device_handle_t* phDevices ) override; ze_result_t zesDeviceGetPropertiesPrologue( zes_device_handle_t hDevice, zes_device_properties_t* pProperties ) override; ze_result_t zesDeviceGetStatePrologue( zes_device_handle_t hDevice, zes_device_state_t* pState ) override; ze_result_t zesDeviceResetPrologue( zes_device_handle_t hDevice, ze_bool_t force ) override; ze_result_t zesDeviceResetExtPrologue( zes_device_handle_t hDevice, zes_reset_properties_t* pProperties ) override; ze_result_t zesDeviceProcessesGetStatePrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_process_state_t* pProcesses ) override; ze_result_t zesDevicePciGetPropertiesPrologue( zes_device_handle_t hDevice, zes_pci_properties_t* pProperties ) override; ze_result_t zesDevicePciGetStatePrologue( zes_device_handle_t hDevice, zes_pci_state_t* pState ) override; ze_result_t zesDevicePciGetBarsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_pci_bar_properties_t* pProperties ) override; ze_result_t zesDevicePciGetStatsPrologue( zes_device_handle_t hDevice, zes_pci_stats_t* pStats ) override; ze_result_t zesDeviceSetOverclockWaiverPrologue( zes_device_handle_t hDevice ) override; ze_result_t zesDeviceGetOverclockDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pOverclockDomains ) override; ze_result_t zesDeviceGetOverclockControlsPrologue( zes_device_handle_t hDevice, zes_overclock_domain_t domainType, uint32_t* pAvailableControls ) override; ze_result_t zesDeviceResetOverclockSettingsPrologue( zes_device_handle_t hDevice, ze_bool_t onShippedState ) override; ze_result_t zesDeviceReadOverclockStatePrologue( zes_device_handle_t hDevice, zes_overclock_mode_t* pOverclockMode, ze_bool_t* pWaiverSetting, ze_bool_t* pOverclockState, zes_pending_action_t* pPendingAction, ze_bool_t* pPendingReset ) override; ze_result_t zesDeviceEnumOverclockDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_overclock_handle_t* phDomainHandle ) override; ze_result_t zesOverclockGetDomainPropertiesPrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_properties_t* pDomainProperties ) override; ze_result_t zesOverclockGetDomainVFPropertiesPrologue( zes_overclock_handle_t hDomainHandle, zes_vf_property_t* pVFProperties ) override; ze_result_t zesOverclockGetDomainControlPropertiesPrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, zes_control_property_t* pControlProperties ) override; ze_result_t zesOverclockGetControlCurrentValuePrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, double* pValue ) override; ze_result_t zesOverclockGetControlPendingValuePrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, double* pValue ) override; ze_result_t zesOverclockSetControlUserValuePrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, double pValue, zes_pending_action_t* pPendingAction ) override; ze_result_t zesOverclockGetControlStatePrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, zes_control_state_t* pControlState, zes_pending_action_t* pPendingAction ) override; ze_result_t zesOverclockGetVFPointValuesPrologue( zes_overclock_handle_t hDomainHandle, zes_vf_type_t VFType, zes_vf_array_type_t VFArrayType, uint32_t PointIndex, uint32_t* PointValue ) override; ze_result_t zesOverclockSetVFPointValuesPrologue( zes_overclock_handle_t hDomainHandle, zes_vf_type_t VFType, uint32_t PointIndex, uint32_t PointValue ) override; ze_result_t zesDeviceEnumDiagnosticTestSuitesPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_diag_handle_t* phDiagnostics ) override; ze_result_t zesDiagnosticsGetPropertiesPrologue( zes_diag_handle_t hDiagnostics, zes_diag_properties_t* pProperties ) override; ze_result_t zesDiagnosticsGetTestsPrologue( zes_diag_handle_t hDiagnostics, uint32_t* pCount, zes_diag_test_t* pTests ) override; ze_result_t zesDiagnosticsRunTestsPrologue( zes_diag_handle_t hDiagnostics, uint32_t startIndex, uint32_t endIndex, zes_diag_result_t* pResult ) override; ze_result_t zesDeviceEccAvailablePrologue( zes_device_handle_t hDevice, ze_bool_t* pAvailable ) override; ze_result_t zesDeviceEccConfigurablePrologue( zes_device_handle_t hDevice, ze_bool_t* pConfigurable ) override; ze_result_t zesDeviceGetEccStatePrologue( zes_device_handle_t hDevice, zes_device_ecc_properties_t* pState ) override; ze_result_t zesDeviceSetEccStatePrologue( zes_device_handle_t hDevice, const zes_device_ecc_desc_t* newState, zes_device_ecc_properties_t* pState ) override; ze_result_t zesDeviceEnumEngineGroupsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_engine_handle_t* phEngine ) override; ze_result_t zesEngineGetPropertiesPrologue( zes_engine_handle_t hEngine, zes_engine_properties_t* pProperties ) override; ze_result_t zesEngineGetActivityPrologue( zes_engine_handle_t hEngine, zes_engine_stats_t* pStats ) override; ze_result_t zesDeviceEventRegisterPrologue( zes_device_handle_t hDevice, zes_event_type_flags_t events ) override; ze_result_t zesDriverEventListenPrologue( ze_driver_handle_t hDriver, uint32_t timeout, uint32_t count, zes_device_handle_t* phDevices, uint32_t* pNumDeviceEvents, zes_event_type_flags_t* pEvents ) override; ze_result_t zesDriverEventListenExPrologue( ze_driver_handle_t hDriver, uint64_t timeout, uint32_t count, zes_device_handle_t* phDevices, uint32_t* pNumDeviceEvents, zes_event_type_flags_t* pEvents ) override; ze_result_t zesDeviceEnumFabricPortsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_fabric_port_handle_t* phPort ) override; ze_result_t zesFabricPortGetPropertiesPrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_properties_t* pProperties ) override; ze_result_t zesFabricPortGetLinkTypePrologue( zes_fabric_port_handle_t hPort, zes_fabric_link_type_t* pLinkType ) override; ze_result_t zesFabricPortGetConfigPrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_config_t* pConfig ) override; ze_result_t zesFabricPortSetConfigPrologue( zes_fabric_port_handle_t hPort, const zes_fabric_port_config_t* pConfig ) override; ze_result_t zesFabricPortGetStatePrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_state_t* pState ) override; ze_result_t zesFabricPortGetThroughputPrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_throughput_t* pThroughput ) override; ze_result_t zesFabricPortGetFabricErrorCountersPrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_error_counters_t* pErrors ) override; ze_result_t zesFabricPortGetMultiPortThroughputPrologue( zes_device_handle_t hDevice, uint32_t numPorts, zes_fabric_port_handle_t* phPort, zes_fabric_port_throughput_t** pThroughput ) override; ze_result_t zesDeviceEnumFansPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_fan_handle_t* phFan ) override; ze_result_t zesFanGetPropertiesPrologue( zes_fan_handle_t hFan, zes_fan_properties_t* pProperties ) override; ze_result_t zesFanGetConfigPrologue( zes_fan_handle_t hFan, zes_fan_config_t* pConfig ) override; ze_result_t zesFanSetDefaultModePrologue( zes_fan_handle_t hFan ) override; ze_result_t zesFanSetFixedSpeedModePrologue( zes_fan_handle_t hFan, const zes_fan_speed_t* speed ) override; ze_result_t zesFanSetSpeedTableModePrologue( zes_fan_handle_t hFan, const zes_fan_speed_table_t* speedTable ) override; ze_result_t zesFanGetStatePrologue( zes_fan_handle_t hFan, zes_fan_speed_units_t units, int32_t* pSpeed ) override; ze_result_t zesDeviceEnumFirmwaresPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_firmware_handle_t* phFirmware ) override; ze_result_t zesFirmwareGetPropertiesPrologue( zes_firmware_handle_t hFirmware, zes_firmware_properties_t* pProperties ) override; ze_result_t zesFirmwareFlashPrologue( zes_firmware_handle_t hFirmware, void* pImage, uint32_t size ) override; ze_result_t zesFirmwareGetFlashProgressPrologue( zes_firmware_handle_t hFirmware, uint32_t* pCompletionPercent ) override; ze_result_t zesFirmwareGetConsoleLogsPrologue( zes_firmware_handle_t hFirmware, size_t* pSize, char* pFirmwareLog ) override; ze_result_t zesDeviceEnumFrequencyDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_freq_handle_t* phFrequency ) override; ze_result_t zesFrequencyGetPropertiesPrologue( zes_freq_handle_t hFrequency, zes_freq_properties_t* pProperties ) override; ze_result_t zesFrequencyGetAvailableClocksPrologue( zes_freq_handle_t hFrequency, uint32_t* pCount, double* phFrequency ) override; ze_result_t zesFrequencyGetRangePrologue( zes_freq_handle_t hFrequency, zes_freq_range_t* pLimits ) override; ze_result_t zesFrequencySetRangePrologue( zes_freq_handle_t hFrequency, const zes_freq_range_t* pLimits ) override; ze_result_t zesFrequencyGetStatePrologue( zes_freq_handle_t hFrequency, zes_freq_state_t* pState ) override; ze_result_t zesFrequencyGetThrottleTimePrologue( zes_freq_handle_t hFrequency, zes_freq_throttle_time_t* pThrottleTime ) override; ze_result_t zesFrequencyOcGetCapabilitiesPrologue( zes_freq_handle_t hFrequency, zes_oc_capabilities_t* pOcCapabilities ) override; ze_result_t zesFrequencyOcGetFrequencyTargetPrologue( zes_freq_handle_t hFrequency, double* pCurrentOcFrequency ) override; ze_result_t zesFrequencyOcSetFrequencyTargetPrologue( zes_freq_handle_t hFrequency, double CurrentOcFrequency ) override; ze_result_t zesFrequencyOcGetVoltageTargetPrologue( zes_freq_handle_t hFrequency, double* pCurrentVoltageTarget, double* pCurrentVoltageOffset ) override; ze_result_t zesFrequencyOcSetVoltageTargetPrologue( zes_freq_handle_t hFrequency, double CurrentVoltageTarget, double CurrentVoltageOffset ) override; ze_result_t zesFrequencyOcSetModePrologue( zes_freq_handle_t hFrequency, zes_oc_mode_t CurrentOcMode ) override; ze_result_t zesFrequencyOcGetModePrologue( zes_freq_handle_t hFrequency, zes_oc_mode_t* pCurrentOcMode ) override; ze_result_t zesFrequencyOcGetIccMaxPrologue( zes_freq_handle_t hFrequency, double* pOcIccMax ) override; ze_result_t zesFrequencyOcSetIccMaxPrologue( zes_freq_handle_t hFrequency, double ocIccMax ) override; ze_result_t zesFrequencyOcGetTjMaxPrologue( zes_freq_handle_t hFrequency, double* pOcTjMax ) override; ze_result_t zesFrequencyOcSetTjMaxPrologue( zes_freq_handle_t hFrequency, double ocTjMax ) override; ze_result_t zesDeviceEnumLedsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_led_handle_t* phLed ) override; ze_result_t zesLedGetPropertiesPrologue( zes_led_handle_t hLed, zes_led_properties_t* pProperties ) override; ze_result_t zesLedGetStatePrologue( zes_led_handle_t hLed, zes_led_state_t* pState ) override; ze_result_t zesLedSetStatePrologue( zes_led_handle_t hLed, ze_bool_t enable ) override; ze_result_t zesLedSetColorPrologue( zes_led_handle_t hLed, const zes_led_color_t* pColor ) override; ze_result_t zesDeviceEnumMemoryModulesPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_mem_handle_t* phMemory ) override; ze_result_t zesMemoryGetPropertiesPrologue( zes_mem_handle_t hMemory, zes_mem_properties_t* pProperties ) override; ze_result_t zesMemoryGetStatePrologue( zes_mem_handle_t hMemory, zes_mem_state_t* pState ) override; ze_result_t zesMemoryGetBandwidthPrologue( zes_mem_handle_t hMemory, zes_mem_bandwidth_t* pBandwidth ) override; ze_result_t zesDeviceEnumPerformanceFactorDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_perf_handle_t* phPerf ) override; ze_result_t zesPerformanceFactorGetPropertiesPrologue( zes_perf_handle_t hPerf, zes_perf_properties_t* pProperties ) override; ze_result_t zesPerformanceFactorGetConfigPrologue( zes_perf_handle_t hPerf, double* pFactor ) override; ze_result_t zesPerformanceFactorSetConfigPrologue( zes_perf_handle_t hPerf, double factor ) override; ze_result_t zesDeviceEnumPowerDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_pwr_handle_t* phPower ) override; ze_result_t zesDeviceGetCardPowerDomainPrologue( zes_device_handle_t hDevice, zes_pwr_handle_t* phPower ) override; ze_result_t zesPowerGetPropertiesPrologue( zes_pwr_handle_t hPower, zes_power_properties_t* pProperties ) override; ze_result_t zesPowerGetEnergyCounterPrologue( zes_pwr_handle_t hPower, zes_power_energy_counter_t* pEnergy ) override; ze_result_t zesPowerGetLimitsPrologue( zes_pwr_handle_t hPower, zes_power_sustained_limit_t* pSustained, zes_power_burst_limit_t* pBurst, zes_power_peak_limit_t* pPeak ) override; ze_result_t zesPowerSetLimitsPrologue( zes_pwr_handle_t hPower, const zes_power_sustained_limit_t* pSustained, const zes_power_burst_limit_t* pBurst, const zes_power_peak_limit_t* pPeak ) override; ze_result_t zesPowerGetEnergyThresholdPrologue( zes_pwr_handle_t hPower, zes_energy_threshold_t* pThreshold ) override; ze_result_t zesPowerSetEnergyThresholdPrologue( zes_pwr_handle_t hPower, double threshold ) override; ze_result_t zesDeviceEnumPsusPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_psu_handle_t* phPsu ) override; ze_result_t zesPsuGetPropertiesPrologue( zes_psu_handle_t hPsu, zes_psu_properties_t* pProperties ) override; ze_result_t zesPsuGetStatePrologue( zes_psu_handle_t hPsu, zes_psu_state_t* pState ) override; ze_result_t zesDeviceEnumRasErrorSetsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_ras_handle_t* phRas ) override; ze_result_t zesRasGetPropertiesPrologue( zes_ras_handle_t hRas, zes_ras_properties_t* pProperties ) override; ze_result_t zesRasGetConfigPrologue( zes_ras_handle_t hRas, zes_ras_config_t* pConfig ) override; ze_result_t zesRasSetConfigPrologue( zes_ras_handle_t hRas, const zes_ras_config_t* pConfig ) override; ze_result_t zesRasGetStatePrologue( zes_ras_handle_t hRas, ze_bool_t clear, zes_ras_state_t* pState ) override; ze_result_t zesDeviceEnumSchedulersPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_sched_handle_t* phScheduler ) override; ze_result_t zesSchedulerGetPropertiesPrologue( zes_sched_handle_t hScheduler, zes_sched_properties_t* pProperties ) override; ze_result_t zesSchedulerGetCurrentModePrologue( zes_sched_handle_t hScheduler, zes_sched_mode_t* pMode ) override; ze_result_t zesSchedulerGetTimeoutModePropertiesPrologue( zes_sched_handle_t hScheduler, ze_bool_t getDefaults, zes_sched_timeout_properties_t* pConfig ) override; ze_result_t zesSchedulerGetTimesliceModePropertiesPrologue( zes_sched_handle_t hScheduler, ze_bool_t getDefaults, zes_sched_timeslice_properties_t* pConfig ) override; ze_result_t zesSchedulerSetTimeoutModePrologue( zes_sched_handle_t hScheduler, zes_sched_timeout_properties_t* pProperties, ze_bool_t* pNeedReload ) override; ze_result_t zesSchedulerSetTimesliceModePrologue( zes_sched_handle_t hScheduler, zes_sched_timeslice_properties_t* pProperties, ze_bool_t* pNeedReload ) override; ze_result_t zesSchedulerSetExclusiveModePrologue( zes_sched_handle_t hScheduler, ze_bool_t* pNeedReload ) override; ze_result_t zesSchedulerSetComputeUnitDebugModePrologue( zes_sched_handle_t hScheduler, ze_bool_t* pNeedReload ) override; ze_result_t zesDeviceEnumStandbyDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_standby_handle_t* phStandby ) override; ze_result_t zesStandbyGetPropertiesPrologue( zes_standby_handle_t hStandby, zes_standby_properties_t* pProperties ) override; ze_result_t zesStandbyGetModePrologue( zes_standby_handle_t hStandby, zes_standby_promo_mode_t* pMode ) override; ze_result_t zesStandbySetModePrologue( zes_standby_handle_t hStandby, zes_standby_promo_mode_t mode ) override; ze_result_t zesDeviceEnumTemperatureSensorsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_temp_handle_t* phTemperature ) override; ze_result_t zesTemperatureGetPropertiesPrologue( zes_temp_handle_t hTemperature, zes_temp_properties_t* pProperties ) override; ze_result_t zesTemperatureGetConfigPrologue( zes_temp_handle_t hTemperature, zes_temp_config_t* pConfig ) override; ze_result_t zesTemperatureSetConfigPrologue( zes_temp_handle_t hTemperature, const zes_temp_config_t* pConfig ) override; ze_result_t zesTemperatureGetStatePrologue( zes_temp_handle_t hTemperature, double* pTemperature ) override; ze_result_t zesPowerGetLimitsExtPrologue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) override; ze_result_t zesPowerSetLimitsExtPrologue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) override; ze_result_t zesEngineGetActivityExtPrologue( zes_engine_handle_t hEngine, uint32_t* pCount, zes_engine_stats_t* pStats ) override; ze_result_t zesRasGetStateExpPrologue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_state_exp_t* pState ) override; ze_result_t zesRasClearStateExpPrologue( zes_ras_handle_t hRas, zes_ras_error_category_exp_t category ) override; ze_result_t zesFirmwareGetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware, char* pVersion ) override; ze_result_t zesFirmwareSetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware ) override; ze_result_t zesDeviceGetSubDevicePropertiesExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_subdevice_exp_properties_t* pSubdeviceProps ) override; ze_result_t zesDriverGetDeviceByUuidExpPrologue( zes_driver_handle_t hDriver, zes_uuid_t uuid, zes_device_handle_t* phDevice, ze_bool_t* onSubdevice, uint32_t* subdeviceId ) override; ze_result_t zesDeviceEnumActiveVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) override; ze_result_t zesVFManagementGetVFPropertiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_properties_t* pProperties ) override; ze_result_t zesVFManagementGetVFMemoryUtilizationExpPrologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp_t* pMemUtil ) override; ze_result_t zesVFManagementGetVFEngineUtilizationExpPrologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp_t* pEngineUtil ) override; ze_result_t zesVFManagementSetVFTelemetryModeExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flags, ze_bool_t enable ) override; ze_result_t zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flag, uint64_t samplingInterval ) override; ze_result_t zesDeviceEnumEnabledVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) override; ze_result_t zesVFManagementGetVFCapabilitiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_capabilities_t* pCapability ) override; ze_result_t zesVFManagementGetVFMemoryUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp2_t* pMemUtil ) override; ze_result_t zesVFManagementGetVFEngineUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp2_t* pEngineUtil ) override; ze_result_t zesVFManagementGetVFCapabilitiesExp2Prologue( zes_vf_handle_t hVFhandle, zes_vf_exp2_capabilities_t* pCapability ) override; }; }zet_parameter_validation.cpp000066400000000000000000002221041475521542100343060ustar00rootroot00000000000000level-zero-1.20.6/source/layers/validation/checkers/parameter_validation/* * ***THIS FILE IS GENERATED. *** * See valddi.cpp.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_parameter_validation.cpp * */ #include "ze_validation_layer.h" #include "param_validation.h" namespace validation_layer { ze_result_t ZETParameterValidation::zetModuleGetDebugInfoPrologue( zet_module_handle_t hModule, ///< [in] handle of the module zet_module_debug_info_format_t format, ///< [in] debug info format requested size_t* pSize, ///< [in,out] size of debug info in bytes uint8_t* pDebugInfo ///< [in,out][optional] byte pointer to debug info ) { if( nullptr == hModule ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZET_MODULE_DEBUG_INFO_FORMAT_ELF_DWARF < format ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == pSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetDeviceGetDebugPropertiesPrologue( zet_device_handle_t hDevice, ///< [in] device handle zet_device_debug_properties_t* pDebugProperties ///< [in,out] query result for debug properties ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pDebugProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pDebugProperties); } ze_result_t ZETParameterValidation::zetDebugAttachPrologue( zet_device_handle_t hDevice, ///< [in] device handle const zet_debug_config_t* config, ///< [in] the debug configuration zet_debug_session_handle_t* phDebug ///< [out] debug session handle ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == config ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phDebug ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetDebugDetachPrologue( zet_debug_session_handle_t hDebug ///< [in][release] debug session handle ) { if( nullptr == hDebug ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetDebugReadEventPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the event; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. zet_debug_event_t* event ///< [in,out] a pointer to a ::zet_debug_event_t. ) { if( nullptr == hDebug ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == event ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetDebugAcknowledgeEventPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle const zet_debug_event_t* event ///< [in] a pointer to a ::zet_debug_event_t. ) { if( nullptr == hDebug ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == event ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetDebugInterruptPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to interrupt ) { if( nullptr == hDebug ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetDebugResumePrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to resume ) { if( nullptr == hDebug ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetDebugReadMemoryPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to read void* buffer ///< [in,out] a buffer to hold a copy of the memory ) { if( nullptr == hDebug ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == buffer ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZET_DEBUG_MEMORY_SPACE_TYPE_ELF < desc->type ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZETParameterValidation::zetDebugWriteMemoryPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to write const void* buffer ///< [in] a buffer holding the pattern to write ) { if( nullptr == hDebug ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == buffer ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZET_DEBUG_MEMORY_SPACE_TYPE_ELF < desc->type ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZETParameterValidation::zetDebugGetRegisterSetPropertiesPrologue( zet_device_handle_t hDevice, ///< [in] device handle uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pRegisterSetProperties); } ze_result_t ZETParameterValidation::zetDebugGetThreadRegisterSetPropertiesPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier specifying a single stopped thread uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ) { if( nullptr == hDebug ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pRegisterSetProperties); } ze_result_t ZETParameterValidation::zetDebugReadRegistersPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or ///< equal to the `count` member of ::zet_debug_register_group_properties_t ///< for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { if( nullptr == hDebug ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetDebugWriteRegistersPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than ///< or equal to the `count` member of ///< ::zet_debug_register_group_properties_t for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { if( nullptr == hDebug ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGroupGetPrologue( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric groups. ///< if count is zero, then the driver shall update the value with the ///< total number of metric groups available. ///< if count is greater than the number of metric groups available, then ///< the driver shall update the value with the correct number of metric ///< groups available. zet_metric_group_handle_t* phMetricGroups ///< [in,out][optional][range(0, *pCount)] array of handle of metric groups. ///< if count is less than the number of metric groups available, then ///< driver shall only retrieve that number of metric groups. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGroupGetPropertiesPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_properties_t* pProperties ///< [in,out] metric group properties ) { if( nullptr == hMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZETParameterValidation::zetMetricGroupCalculateMetricValuesPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pMetricValueCount, ///< [in,out] pointer to number of metric values calculated. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pMetricValueCount)] buffer of calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { if( nullptr == hMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == pRawData ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pMetricValueCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGetPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group uint32_t* pCount, ///< [in,out] pointer to the number of metrics. ///< if count is zero, then the driver shall update the value with the ///< total number of metrics available. ///< if count is greater than the number of metrics available, then the ///< driver shall update the value with the correct number of metrics available. zet_metric_handle_t* phMetrics ///< [in,out][optional][range(0, *pCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metrics. ) { if( nullptr == hMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGetPropertiesPrologue( zet_metric_handle_t hMetric, ///< [in] handle of the metric zet_metric_properties_t* pProperties ///< [in,out] metric properties ) { if( nullptr == hMetric ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZETParameterValidation::zetContextActivateMetricGroupsPrologue( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t count, ///< [in] metric group count to activate; must be 0 if `nullptr == ///< phMetricGroups` zet_metric_group_handle_t* phMetricGroups ///< [in][optional][range(0, count)] handles of the metric groups to activate. ///< nullptr deactivates all previously used metric groups. ///< all metrics groups must come from a different domains. ///< metric query and metric stream must use activated metric groups. ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( (nullptr == phMetricGroups) && (0 < count) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricStreamerOpenPrologue( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_streamer_desc_t* desc, ///< [in,out] metric streamer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification zet_metric_streamer_handle_t* phMetricStreamer ///< [out] handle of metric streamer ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phMetricStreamer ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(desc); } ze_result_t ZETParameterValidation::zetCommandListAppendMetricStreamerMarkerPrologue( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t value ///< [in] streamer marker value ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hMetricStreamer ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricStreamerClosePrologue( zet_metric_streamer_handle_t hMetricStreamer ///< [in][release] handle of the metric streamer ) { if( nullptr == hMetricStreamer ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricStreamerReadDataPrologue( zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) { if( nullptr == hMetricStreamer ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pRawDataSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricQueryPoolCreatePrologue( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] metric group associated with the query object. const zet_metric_query_pool_desc_t* desc, ///< [in] metric query pool descriptor zet_metric_query_pool_handle_t* phMetricQueryPool ///< [out] handle of metric query pool ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phMetricQueryPool ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( ZET_METRIC_QUERY_POOL_TYPE_EXECUTION < desc->type ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ParameterValidation::validateExtensions(desc); } ze_result_t ZETParameterValidation::zetMetricQueryPoolDestroyPrologue( zet_metric_query_pool_handle_t hMetricQueryPool ///< [in][release] handle of the metric query pool ) { if( nullptr == hMetricQueryPool ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricQueryCreatePrologue( zet_metric_query_pool_handle_t hMetricQueryPool,///< [in] handle of the metric query pool uint32_t index, ///< [in] index of the query within the pool zet_metric_query_handle_t* phMetricQuery ///< [out] handle of metric query ) { if( nullptr == hMetricQueryPool ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phMetricQuery ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricQueryDestroyPrologue( zet_metric_query_handle_t hMetricQuery ///< [in][release] handle of metric query ) { if( nullptr == hMetricQuery ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricQueryResetPrologue( zet_metric_query_handle_t hMetricQuery ///< [in] handle of metric query ) { if( nullptr == hMetricQuery ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetCommandListAppendMetricQueryBeginPrologue( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery ///< [in] handle of the metric query ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hMetricQuery ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetCommandListAppendMetricQueryEndPrologue( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in] must be zero ze_event_handle_t* phWaitEvents ///< [in][mbz] must be nullptr ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hMetricQuery ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( (nullptr == phWaitEvents) && (0 < numWaitEvents) ) return ZE_RESULT_ERROR_INVALID_SIZE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetCommandListAppendMetricMemoryBarrierPrologue( zet_command_list_handle_t hCommandList ///< [in] handle of the command list ) { if( nullptr == hCommandList ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricQueryGetDataPrologue( zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing query ///< reports in raw format ) { if( nullptr == hMetricQuery ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pRawDataSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetKernelGetProfileInfoPrologue( zet_kernel_handle_t hKernel, ///< [in] handle to kernel zet_profile_properties_t* pProfileProperties ///< [out] pointer to profile properties ) { if( nullptr == hKernel ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProfileProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProfileProperties); } ze_result_t ZETParameterValidation::zetTracerExpCreatePrologue( zet_context_handle_t hContext, ///< [in] handle of the context object const zet_tracer_exp_desc_t* desc, ///< [in] pointer to tracer descriptor zet_tracer_exp_handle_t* phTracer ///< [out] pointer to handle of tracer object created ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == desc->pUserData ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phTracer ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(desc); } ze_result_t ZETParameterValidation::zetTracerExpDestroyPrologue( zet_tracer_exp_handle_t hTracer ///< [in][release] handle of tracer object to destroy ) { if( nullptr == hTracer ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetTracerExpSetProloguesPrologue( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { if( nullptr == hTracer ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCoreCbs ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetTracerExpSetEpiloguesPrologue( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { if( nullptr == hTracer ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCoreCbs ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetTracerExpSetEnabledPrologue( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer ze_bool_t enable ///< [in] enable the tracer if true; disable if false ) { if( nullptr == hTracer ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetDeviceGetConcurrentMetricGroupsExpPrologue( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t * phMetricGroups, ///< [in,out] metrics groups to be re-arranged to be sets of concurrent ///< groups uint32_t * pMetricGroupsCountPerConcurrentGroup,///< [in,out][optional][*pConcurrentGroupCount] count of metric groups per ///< concurrent group. uint32_t * pConcurrentGroupCount ///< [out] number of concurrent groups. ///< The value of this parameter could be used to determine the number of ///< replays necessary. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phMetricGroups ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricTracerCreateExpPrologue( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t* phMetricGroups, ///< [in][range(0, metricGroupCount )] handles of the metric groups to ///< trace zet_metric_tracer_exp_desc_t* desc, ///< [in,out] metric tracer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification. Note: ///< If buffer is not drained when the event it flagged, there is a risk of ///< HW event buffer being overrun zet_metric_tracer_exp_handle_t* phMetricTracer ///< [out] handle of the metric tracer ) { if( nullptr == hContext ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phMetricGroups ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == desc ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phMetricTracer ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(desc); } ze_result_t ZETParameterValidation::zetMetricTracerDestroyExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer ///< [in] handle of the metric tracer ) { if( nullptr == hMetricTracer ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricTracerEnableExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_NOT_READY will be returned ///< when the tracer is inactive. ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active. ) { if( nullptr == hMetricTracer ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricTracerDisableExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active or when it is inactive but still has data. ///< ::ZE_RESULT_NOT_READY will be returned when the tracer is inactive and ///< has no more data to be retrieved. ) { if( nullptr == hMetricTracer ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricTracerReadDataExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all data available. ///< if size is non-zero, then driver will only retrieve that amount of ///< data. ///< if size is larger than size needed for all data, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) { if( nullptr == hMetricTracer ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pRawDataSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricDecoderCreateExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer zet_metric_decoder_exp_handle_t* phMetricDecoder///< [out] handle of the metric decoder object ) { if( nullptr == hMetricTracer ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phMetricDecoder ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricDecoderDestroyExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder ///< [in] handle of the metric decoder object ) { if( nullptr == phMetricDecoder ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricDecoderGetDecodableMetricsExpPrologue( zet_metric_decoder_exp_handle_t hMetricDecoder, ///< [in] handle of the metric decoder object uint32_t* pCount, ///< [in,out] pointer to number of decodable metric in the hMetricDecoder ///< handle. If count is zero, then the driver shall ///< update the value with the total number of decodable metrics available ///< in the decoder. if count is greater than zero ///< but less than the total number of decodable metrics available in the ///< decoder, then only that number will be returned. ///< if count is greater than the number of decodable metrics available in ///< the decoder, then the driver shall update the ///< value with the actual number of decodable metrics available. zet_metric_handle_t* phMetrics ///< [in,out] [range(0, *pCount)] array of handles of decodable metrics in ///< the hMetricDecoder handle provided. ) { if( nullptr == hMetricDecoder ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phMetrics ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricTracerDecodeExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder,///< [in] handle of the metric decoder object size_t* pRawDataSize, ///< [in,out] size in bytes of raw data buffer. If pMetricEntriesCount is ///< greater than zero but less than total number of ///< decodable metrics available in the raw data buffer, then driver shall ///< update this value with actual number of raw ///< data bytes processed. uint8_t* pRawData, ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format uint32_t metricsCount, ///< [in] number of decodable metrics in the tracer for which the ///< hMetricDecoder handle was provided. See ///< ::zetMetricDecoderGetDecodableMetricsExp(). If metricCount is greater ///< than zero but less than the number decodable ///< metrics available in the raw data buffer, then driver shall only ///< decode those. zet_metric_handle_t* phMetrics, ///< [in] [range(0, metricsCount)] array of handles of decodable metrics in ///< the decoder for which the hMetricDecoder handle was ///< provided. Metrics handles are expected to be for decodable metrics, ///< see ::zetMetricDecoderGetDecodableMetricsExp() uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. If count is zero, then the ///< driver shall update the value with the total ///< number of metric sets to be decoded. If count is greater than the ///< number available in the raw data buffer, then the ///< driver shall update the value with the actual number of metric sets to ///< be decoded. There is a 1:1 relation between ///< the number of sets and sub-devices returned in the decoded entries. uint32_t* pMetricEntriesCountPerSet, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric entries ///< counts per metric set, one value per set. uint32_t* pMetricEntriesCount, ///< [in,out] pointer to the total number of metric entries decoded, for ///< all metric sets. If count is zero, then the ///< driver shall update the value with the total number of metric entries ///< to be decoded. If count is greater than zero ///< but less than the total number of metric entries available in the raw ///< data, then user provided number will be decoded. ///< If count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with ///< the actual number of decodable metric entries decoded. If set to null, ///< then driver will only update the value of ///< pSetCount. zet_metric_entry_exp_t* pMetricEntries ///< [in,out][optional][range(0, *pMetricEntriesCount)] buffer containing ///< decoded metric entries ) { if( nullptr == phMetricDecoder ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pRawDataSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phMetrics ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pSetCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pMetricEntriesCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGroupCalculateMultipleMetricValuesExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { if( nullptr == hMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == pRawData ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pSetCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pTotalMetricValueCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGroupGetGlobalTimestampsExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group ze_bool_t synchronizedWithHost, ///< [in] Returns the timestamps synchronized to the host or the device. uint64_t* globalTimestamp, ///< [out] Device timestamp. uint64_t* metricTimestamp ///< [out] Metric timestamp. ) { if( nullptr == hMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == globalTimestamp ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == metricTimestamp ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGroupGetExportDataExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group const uint8_t* pRawData, ///< [in] buffer of raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer size_t* pExportDataSize, ///< [in,out] size in bytes of export data buffer ///< if size is zero, then the driver shall update the value with the ///< number of bytes necessary to store the exported data. ///< if size is greater than required, then the driver shall update the ///< value with the actual number of bytes necessary to store the exported data. uint8_t * pExportData ///< [in,out][optional][range(0, *pExportDataSize)] buffer of exported data. ) { if( nullptr == hMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pRawData ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pExportDataSize ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGroupCalculateMetricExportDataExpPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t exportDataSize, ///< [in] size in bytes of exported data buffer const uint8_t* pExportData, ///< [in][range(0, exportDataSize)] buffer of exported data to calculate zet_metric_calculate_exp_desc_t* pCalculateDescriptor, ///< [in] descriptor specifying calculation specific parameters uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { if( nullptr == hDriver ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; if( nullptr == pExportData ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pCalculateDescriptor ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pSetCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pTotalMetricValueCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pCalculateDescriptor); } ze_result_t ZETParameterValidation::zetMetricProgrammableGetExpPrologue( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric programmable handles. ///< if count is zero, then the driver shall update the value with the ///< total number of metric programmable handles available. ///< if count is greater than the number of metric programmable handles ///< available, then the driver shall update the value with the correct ///< number of metric programmable handles available. zet_metric_programmable_exp_handle_t* phMetricProgrammables ///< [in,out][optional][range(0, *pCount)] array of handle of metric programmables. ///< if count is less than the number of metric programmables available, ///< then driver shall only retrieve that number of metric programmables. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricProgrammableGetPropertiesExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_exp_properties_t* pProperties ///< [in,out] properties of the metric programmable ) { if( nullptr == hMetricProgrammable ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pProperties ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ParameterValidation::validateExtensions(pProperties); } ze_result_t ZETParameterValidation::zetMetricProgrammableGetParamInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t* pParameterCount, ///< [in,out] count of the parameters to retrieve parameter info. ///< if value pParameterCount is greater than count of parameters ///< available, then pParameterCount will be updated with count of ///< parameters available. ///< The count of parameters available can be queried using ::zetMetricProgrammableGetPropertiesExp. zet_metric_programmable_param_info_exp_t* pParameterInfo///< [in,out][range(1, *pParameterCount)] array of parameter info. ///< if parameterCount is less than the number of parameters available, ///< then driver shall only retrieve that number of parameter info. ) { if( nullptr == hMetricProgrammable ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pParameterCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pParameterInfo ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricProgrammableGetParamValueInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterOrdinal, ///< [in] ordinal of the parameter in the metric programmable uint32_t* pValueInfoCount, ///< [in,out] count of parameter value information to retrieve. ///< if value at pValueInfoCount is greater than count of value info ///< available, then pValueInfoCount will be updated with count of value ///< info available. ///< The count of parameter value info available can be queried using ::zetMetricProgrammableGetParamInfoExp. zet_metric_programmable_param_value_info_exp_t* pValueInfo ///< [in,out][range(1, *pValueInfoCount)] array of parameter value info. ///< if pValueInfoCount is less than the number of value info available, ///< then driver shall only retrieve that number of value info. ) { if( nullptr == hMetricProgrammable ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pValueInfoCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pValueInfo ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricCreateFromProgrammableExp2Prologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ) { if( nullptr == hMetricProgrammable ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pParameterValues ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pName ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pDescription ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pMetricHandleCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricCreateFromProgrammableExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. uint32_t parameterCount, ///< [in] Count of parameters to set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ) { if( nullptr == hMetricProgrammable ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pParameterValues ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pName ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pDescription ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pMetricHandleCount ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetDeviceCreateMetricGroupsFromMetricsExpPrologue( zet_device_handle_t hDevice, ///< [in] handle of the device. uint32_t metricCount, ///< [in] number of metric handles. zet_metric_handle_t * phMetrics, ///< [in] metric handles to be added to the metric groups. const char * pMetricGroupNamePrefix, ///< [in] prefix to the name created for the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP. const char * pDescription, ///< [in] pointer to description of the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. uint32_t * pMetricGroupCount, ///< [in,out] pointer to the number of metric group handles to be created. ///< if pMetricGroupCount is zero, then the driver shall update the value ///< with the maximum possible number of metric group handles that could be created. ///< if pMetricGroupCount is greater than the number of metric group ///< handles that could be created, then the driver shall update the value ///< with the correct number of metric group handles generated. ///< if pMetricGroupCount is lesser than the number of metric group handles ///< that could be created, then ::ZE_RESULT_ERROR_INVALID_ARGUMENT is returned. zet_metric_group_handle_t* phMetricGroup ///< [in,out][optional][range(0, *pMetricGroupCount)] array of handle of ///< metric group handles. ///< Created Metric group handles. ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == phMetrics ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGroupCreateExpPrologue( zet_device_handle_t hDevice, ///< [in] handle of the device const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. const char* pDescription, ///< [in] pointer to metric group description. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. zet_metric_group_sampling_type_flags_t samplingType,///< [in] Sampling type for the metric group. zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle ) { if( nullptr == hDevice ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == pName ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == pDescription ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( nullptr == phMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( 0x7 < samplingType ) return ZE_RESULT_ERROR_INVALID_ENUMERATION; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGroupAddMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric, ///< [in] Metric to be added to the group. size_t * pErrorStringSize, ///< [in,out][optional] Size of the error string to query, if an error was ///< reported during adding the metric handle. ///< if *pErrorStringSize is zero, then the driver shall update the value ///< with the size of the error string in bytes. char* pErrorString ///< [in,out][optional][range(0, *pErrorStringSize)] Error string. ///< if *pErrorStringSize is less than the length of the error string ///< available, then driver shall only retrieve that length of error string. ) { if( nullptr == hMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hMetric ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGroupRemoveMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric ///< [in] Metric handle to be removed from the metric group. ) { if( nullptr == hMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; if( nullptr == hMetric ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGroupCloseExpPrologue( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group ) { if( nullptr == hMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricGroupDestroyExpPrologue( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group to destroy ) { if( nullptr == hMetricGroup ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } ze_result_t ZETParameterValidation::zetMetricDestroyExpPrologue( zet_metric_handle_t hMetric ///< [in] Handle of the metric to destroy ) { if( nullptr == hMetric ) return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; return ZE_RESULT_SUCCESS; } }level-zero-1.20.6/source/layers/validation/checkers/parameter_validation/zet_parameter_validation.h000066400000000000000000000277451475521542100340500ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See param.h.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_parameter_validation.h * */ #pragma once #include "ze_validation_layer.h" #include "zet_entry_points.h" namespace validation_layer { class ZETParameterValidation : public ZETValidationEntryPoints { public: ze_result_t zetModuleGetDebugInfoPrologue( zet_module_handle_t hModule, zet_module_debug_info_format_t format, size_t* pSize, uint8_t* pDebugInfo ) override; ze_result_t zetDeviceGetDebugPropertiesPrologue( zet_device_handle_t hDevice, zet_device_debug_properties_t* pDebugProperties ) override; ze_result_t zetDebugAttachPrologue( zet_device_handle_t hDevice, const zet_debug_config_t* config, zet_debug_session_handle_t* phDebug ) override; ze_result_t zetDebugDetachPrologue( zet_debug_session_handle_t hDebug ) override; ze_result_t zetDebugReadEventPrologue( zet_debug_session_handle_t hDebug, uint64_t timeout, zet_debug_event_t* event ) override; ze_result_t zetDebugAcknowledgeEventPrologue( zet_debug_session_handle_t hDebug, const zet_debug_event_t* event ) override; ze_result_t zetDebugInterruptPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread ) override; ze_result_t zetDebugResumePrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread ) override; ze_result_t zetDebugReadMemoryPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, const zet_debug_memory_space_desc_t* desc, size_t size, void* buffer ) override; ze_result_t zetDebugWriteMemoryPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, const zet_debug_memory_space_desc_t* desc, size_t size, const void* buffer ) override; ze_result_t zetDebugGetRegisterSetPropertiesPrologue( zet_device_handle_t hDevice, uint32_t* pCount, zet_debug_regset_properties_t* pRegisterSetProperties ) override; ze_result_t zetDebugGetThreadRegisterSetPropertiesPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t* pCount, zet_debug_regset_properties_t* pRegisterSetProperties ) override; ze_result_t zetDebugReadRegistersPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void* pRegisterValues ) override; ze_result_t zetDebugWriteRegistersPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void* pRegisterValues ) override; ze_result_t zetMetricGroupGetPrologue( zet_device_handle_t hDevice, uint32_t* pCount, zet_metric_group_handle_t* phMetricGroups ) override; ze_result_t zetMetricGroupGetPropertiesPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_properties_t* pProperties ) override; ze_result_t zetMetricGroupCalculateMetricValuesPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t* pRawData, uint32_t* pMetricValueCount, zet_typed_value_t* pMetricValues ) override; ze_result_t zetMetricGetPrologue( zet_metric_group_handle_t hMetricGroup, uint32_t* pCount, zet_metric_handle_t* phMetrics ) override; ze_result_t zetMetricGetPropertiesPrologue( zet_metric_handle_t hMetric, zet_metric_properties_t* pProperties ) override; ze_result_t zetContextActivateMetricGroupsPrologue( zet_context_handle_t hContext, zet_device_handle_t hDevice, uint32_t count, zet_metric_group_handle_t* phMetricGroups ) override; ze_result_t zetMetricStreamerOpenPrologue( zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, zet_metric_streamer_desc_t* desc, ze_event_handle_t hNotificationEvent, zet_metric_streamer_handle_t* phMetricStreamer ) override; ze_result_t zetCommandListAppendMetricStreamerMarkerPrologue( zet_command_list_handle_t hCommandList, zet_metric_streamer_handle_t hMetricStreamer, uint32_t value ) override; ze_result_t zetMetricStreamerClosePrologue( zet_metric_streamer_handle_t hMetricStreamer ) override; ze_result_t zetMetricStreamerReadDataPrologue( zet_metric_streamer_handle_t hMetricStreamer, uint32_t maxReportCount, size_t* pRawDataSize, uint8_t* pRawData ) override; ze_result_t zetMetricQueryPoolCreatePrologue( zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, const zet_metric_query_pool_desc_t* desc, zet_metric_query_pool_handle_t* phMetricQueryPool ) override; ze_result_t zetMetricQueryPoolDestroyPrologue( zet_metric_query_pool_handle_t hMetricQueryPool ) override; ze_result_t zetMetricQueryCreatePrologue( zet_metric_query_pool_handle_t hMetricQueryPool, uint32_t index, zet_metric_query_handle_t* phMetricQuery ) override; ze_result_t zetMetricQueryDestroyPrologue( zet_metric_query_handle_t hMetricQuery ) override; ze_result_t zetMetricQueryResetPrologue( zet_metric_query_handle_t hMetricQuery ) override; ze_result_t zetCommandListAppendMetricQueryBeginPrologue( zet_command_list_handle_t hCommandList, zet_metric_query_handle_t hMetricQuery ) override; ze_result_t zetCommandListAppendMetricQueryEndPrologue( zet_command_list_handle_t hCommandList, zet_metric_query_handle_t hMetricQuery, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zetCommandListAppendMetricMemoryBarrierPrologue( zet_command_list_handle_t hCommandList ) override; ze_result_t zetMetricQueryGetDataPrologue( zet_metric_query_handle_t hMetricQuery, size_t* pRawDataSize, uint8_t* pRawData ) override; ze_result_t zetKernelGetProfileInfoPrologue( zet_kernel_handle_t hKernel, zet_profile_properties_t* pProfileProperties ) override; ze_result_t zetTracerExpCreatePrologue( zet_context_handle_t hContext, const zet_tracer_exp_desc_t* desc, zet_tracer_exp_handle_t* phTracer ) override; ze_result_t zetTracerExpDestroyPrologue( zet_tracer_exp_handle_t hTracer ) override; ze_result_t zetTracerExpSetProloguesPrologue( zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t* pCoreCbs ) override; ze_result_t zetTracerExpSetEpiloguesPrologue( zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t* pCoreCbs ) override; ze_result_t zetTracerExpSetEnabledPrologue( zet_tracer_exp_handle_t hTracer, ze_bool_t enable ) override; ze_result_t zetDeviceGetConcurrentMetricGroupsExpPrologue( zet_device_handle_t hDevice, uint32_t metricGroupCount, zet_metric_group_handle_t * phMetricGroups, uint32_t * pMetricGroupsCountPerConcurrentGroup, uint32_t * pConcurrentGroupCount ) override; ze_result_t zetMetricTracerCreateExpPrologue( zet_context_handle_t hContext, zet_device_handle_t hDevice, uint32_t metricGroupCount, zet_metric_group_handle_t* phMetricGroups, zet_metric_tracer_exp_desc_t* desc, ze_event_handle_t hNotificationEvent, zet_metric_tracer_exp_handle_t* phMetricTracer ) override; ze_result_t zetMetricTracerDestroyExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer ) override; ze_result_t zetMetricTracerEnableExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ze_bool_t synchronous ) override; ze_result_t zetMetricTracerDisableExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ze_bool_t synchronous ) override; ze_result_t zetMetricTracerReadDataExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, size_t* pRawDataSize, uint8_t* pRawData ) override; ze_result_t zetMetricDecoderCreateExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, zet_metric_decoder_exp_handle_t* phMetricDecoder ) override; ze_result_t zetMetricDecoderDestroyExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder ) override; ze_result_t zetMetricDecoderGetDecodableMetricsExpPrologue( zet_metric_decoder_exp_handle_t hMetricDecoder, uint32_t* pCount, zet_metric_handle_t* phMetrics ) override; ze_result_t zetMetricTracerDecodeExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder, size_t* pRawDataSize, uint8_t* pRawData, uint32_t metricsCount, zet_metric_handle_t* phMetrics, uint32_t* pSetCount, uint32_t* pMetricEntriesCountPerSet, uint32_t* pMetricEntriesCount, zet_metric_entry_exp_t* pMetricEntries ) override; ze_result_t zetMetricGroupCalculateMultipleMetricValuesExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t* pRawData, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues ) override; ze_result_t zetMetricGroupGetGlobalTimestampsExpPrologue( zet_metric_group_handle_t hMetricGroup, ze_bool_t synchronizedWithHost, uint64_t* globalTimestamp, uint64_t* metricTimestamp ) override; ze_result_t zetMetricGroupGetExportDataExpPrologue( zet_metric_group_handle_t hMetricGroup, const uint8_t* pRawData, size_t rawDataSize, size_t* pExportDataSize, uint8_t * pExportData ) override; ze_result_t zetMetricGroupCalculateMetricExportDataExpPrologue( ze_driver_handle_t hDriver, zet_metric_group_calculation_type_t type, size_t exportDataSize, const uint8_t* pExportData, zet_metric_calculate_exp_desc_t* pCalculateDescriptor, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues ) override; ze_result_t zetMetricProgrammableGetExpPrologue( zet_device_handle_t hDevice, uint32_t* pCount, zet_metric_programmable_exp_handle_t* phMetricProgrammables ) override; ze_result_t zetMetricProgrammableGetPropertiesExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_exp_properties_t* pProperties ) override; ze_result_t zetMetricProgrammableGetParamInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t* pParameterCount, zet_metric_programmable_param_info_exp_t* pParameterInfo ) override; ze_result_t zetMetricProgrammableGetParamValueInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterOrdinal, uint32_t* pValueInfoCount, zet_metric_programmable_param_value_info_exp_t* pValueInfo ) override; ze_result_t zetMetricCreateFromProgrammableExp2Prologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterCount, zet_metric_programmable_param_value_exp_t* pParameterValues, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) override; ze_result_t zetMetricCreateFromProgrammableExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_param_value_exp_t* pParameterValues, uint32_t parameterCount, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) override; ze_result_t zetDeviceCreateMetricGroupsFromMetricsExpPrologue( zet_device_handle_t hDevice, uint32_t metricCount, zet_metric_handle_t * phMetrics, const char * pMetricGroupNamePrefix, const char * pDescription, uint32_t * pMetricGroupCount, zet_metric_group_handle_t* phMetricGroup ) override; ze_result_t zetMetricGroupCreateExpPrologue( zet_device_handle_t hDevice, const char* pName, const char* pDescription, zet_metric_group_sampling_type_flags_t samplingType, zet_metric_group_handle_t* phMetricGroup ) override; ze_result_t zetMetricGroupAddMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric, size_t * pErrorStringSize, char* pErrorString ) override; ze_result_t zetMetricGroupRemoveMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric ) override; ze_result_t zetMetricGroupCloseExpPrologue( zet_metric_group_handle_t hMetricGroup ) override; ze_result_t zetMetricGroupDestroyExpPrologue( zet_metric_group_handle_t hMetricGroup ) override; ze_result_t zetMetricDestroyExpPrologue( zet_metric_handle_t hMetric ) override; }; }level-zero-1.20.6/source/layers/validation/checkers/template/000077500000000000000000000000001475521542100242255ustar00rootroot00000000000000level-zero-1.20.6/source/layers/validation/checkers/template/CMakeLists.txt000066400000000000000000000002421475521542100267630ustar00rootroot00000000000000target_sources(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/zel_template_checker.h ${CMAKE_CURRENT_LIST_DIR}/zel_template_checker.cpp ) level-zero-1.20.6/source/layers/validation/checkers/template/zel_template_checker.cpp000066400000000000000000000040331475521542100311020ustar00rootroot00000000000000/* * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_template_checker.cpp * */ #include "zel_template_checker.h" namespace validation_layer { class validationCheckerTemplate templateChecker; validationCheckerTemplate::validationCheckerTemplate() { enableValidationCheckerTemplate = getenv_tobool( "ZEL_ENABLE_VALIDATION_CHECKER_TEMPLATE" ); if(enableValidationCheckerTemplate) { validationCheckerTemplate::ZEvalidationCheckerTemplate *zeChecker = new validationCheckerTemplate::ZEvalidationCheckerTemplate; validationCheckerTemplate::ZESvalidationCheckerTemplate *zesChecker = new validationCheckerTemplate::ZESvalidationCheckerTemplate; validationCheckerTemplate::ZETvalidationCheckerTemplate *zetChecker = new validationCheckerTemplate::ZETvalidationCheckerTemplate; templateChecker.zeValidation = zeChecker; templateChecker.zetValidation = zetChecker; templateChecker.zesValidation = zesChecker; validation_layer::context.getInstance().validationHandlers.push_back(&templateChecker); } } validationCheckerTemplate::~validationCheckerTemplate() { if(enableValidationCheckerTemplate) { delete templateChecker.zeValidation; delete templateChecker.zetValidation; delete templateChecker.zesValidation; } } ze_result_t validationCheckerTemplate::ZEvalidationCheckerTemplate::zeInitPrologue( ze_init_flags_t flags) { return ZE_RESULT_SUCCESS; } ze_result_t validationCheckerTemplate::ZESvalidationCheckerTemplate::zesInitPrologue( zes_init_flags_t flags) { return ZE_RESULT_SUCCESS; } ze_result_t validationCheckerTemplate::ZETvalidationCheckerTemplate::zetModuleGetDebugInfoPrologue( zet_module_handle_t hModule, zet_module_debug_info_format_t format, size_t* pSize, uint8_t* pDebugInfo ) { return ZE_RESULT_SUCCESS; } }level-zero-1.20.6/source/layers/validation/checkers/template/zel_template_checker.h000066400000000000000000000023071475521542100305510ustar00rootroot00000000000000/* * * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_template_checker.h * */ #pragma once #include #include "ze_api.h" #include "ze_validation_layer.h" namespace validation_layer { class __zedlllocal validationCheckerTemplate : public validationChecker{ public: validationCheckerTemplate(); ~validationCheckerTemplate(); class ZEvalidationCheckerTemplate : public ZEValidationEntryPoints { public: ze_result_t zeInitPrologue( ze_init_flags_t flags ) override; }; class ZESvalidationCheckerTemplate : public ZESValidationEntryPoints { public: ze_result_t zesInitPrologue( zes_init_flags_t flags ) override; }; class ZETvalidationCheckerTemplate : public ZETValidationEntryPoints { public: ze_result_t zetModuleGetDebugInfoPrologue( zet_module_handle_t hModule, zet_module_debug_info_format_t format, size_t* pSize, uint8_t* pDebugInfo ) override; }; bool enableValidationCheckerTemplate = false; }; extern class validationCheckerTemplate templateChecker; }level-zero-1.20.6/source/layers/validation/common/000077500000000000000000000000001475521542100221135ustar00rootroot00000000000000level-zero-1.20.6/source/layers/validation/common/ze_entry_points.h000066400000000000000000002234441475521542100255300ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See entry_points.h.mako for modifications * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_entry_points.h * */ #pragma once #include "ze_api.h" namespace validation_layer { class ZEValidationEntryPoints { public: virtual ze_result_t zeInitPrologue( ze_init_flags_t flags ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeInitEpilogue( ze_init_flags_t flags , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetPrologue( uint32_t* pCount, ze_driver_handle_t* phDrivers ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetEpilogue( uint32_t* pCount, ze_driver_handle_t* phDrivers , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeInitDriversPrologue( uint32_t* pCount, ze_driver_handle_t* phDrivers, ze_init_driver_type_desc_t* desc ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeInitDriversEpilogue( uint32_t* pCount, ze_driver_handle_t* phDrivers, ze_init_driver_type_desc_t* desc , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetApiVersionPrologue( ze_driver_handle_t hDriver, ze_api_version_t* version ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetApiVersionEpilogue( ze_driver_handle_t hDriver, ze_api_version_t* version , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetPropertiesPrologue( ze_driver_handle_t hDriver, ze_driver_properties_t* pDriverProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetPropertiesEpilogue( ze_driver_handle_t hDriver, ze_driver_properties_t* pDriverProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetIpcPropertiesPrologue( ze_driver_handle_t hDriver, ze_driver_ipc_properties_t* pIpcProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetIpcPropertiesEpilogue( ze_driver_handle_t hDriver, ze_driver_ipc_properties_t* pIpcProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetExtensionPropertiesPrologue( ze_driver_handle_t hDriver, uint32_t* pCount, ze_driver_extension_properties_t* pExtensionProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetExtensionPropertiesEpilogue( ze_driver_handle_t hDriver, uint32_t* pCount, ze_driver_extension_properties_t* pExtensionProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetExtensionFunctionAddressPrologue( ze_driver_handle_t hDriver, const char* name, void** ppFunctionAddress ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetExtensionFunctionAddressEpilogue( ze_driver_handle_t hDriver, const char* name, void** ppFunctionAddress , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetLastErrorDescriptionPrologue( ze_driver_handle_t hDriver, const char** ppString ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverGetLastErrorDescriptionEpilogue( ze_driver_handle_t hDriver, const char** ppString , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetPrologue( ze_driver_handle_t hDriver, uint32_t* pCount, ze_device_handle_t* phDevices ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetEpilogue( ze_driver_handle_t hDriver, uint32_t* pCount, ze_device_handle_t* phDevices , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetRootDevicePrologue( ze_device_handle_t hDevice, ze_device_handle_t* phRootDevice ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetRootDeviceEpilogue( ze_device_handle_t hDevice, ze_device_handle_t* phRootDevice , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetSubDevicesPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_handle_t* phSubdevices ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetSubDevicesEpilogue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_handle_t* phSubdevices , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetPropertiesPrologue( ze_device_handle_t hDevice, ze_device_properties_t* pDeviceProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetPropertiesEpilogue( ze_device_handle_t hDevice, ze_device_properties_t* pDeviceProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetComputePropertiesPrologue( ze_device_handle_t hDevice, ze_device_compute_properties_t* pComputeProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetComputePropertiesEpilogue( ze_device_handle_t hDevice, ze_device_compute_properties_t* pComputeProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetModulePropertiesPrologue( ze_device_handle_t hDevice, ze_device_module_properties_t* pModuleProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetModulePropertiesEpilogue( ze_device_handle_t hDevice, ze_device_module_properties_t* pModuleProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetCommandQueueGroupPropertiesPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_command_queue_group_properties_t* pCommandQueueGroupProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetCommandQueueGroupPropertiesEpilogue( ze_device_handle_t hDevice, uint32_t* pCount, ze_command_queue_group_properties_t* pCommandQueueGroupProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetMemoryPropertiesPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_memory_properties_t* pMemProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetMemoryPropertiesEpilogue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_memory_properties_t* pMemProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetMemoryAccessPropertiesPrologue( ze_device_handle_t hDevice, ze_device_memory_access_properties_t* pMemAccessProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetMemoryAccessPropertiesEpilogue( ze_device_handle_t hDevice, ze_device_memory_access_properties_t* pMemAccessProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetCachePropertiesPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_cache_properties_t* pCacheProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetCachePropertiesEpilogue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_cache_properties_t* pCacheProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetImagePropertiesPrologue( ze_device_handle_t hDevice, ze_device_image_properties_t* pImageProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetImagePropertiesEpilogue( ze_device_handle_t hDevice, ze_device_image_properties_t* pImageProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetExternalMemoryPropertiesPrologue( ze_device_handle_t hDevice, ze_device_external_memory_properties_t* pExternalMemoryProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetExternalMemoryPropertiesEpilogue( ze_device_handle_t hDevice, ze_device_external_memory_properties_t* pExternalMemoryProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetP2PPropertiesPrologue( ze_device_handle_t hDevice, ze_device_handle_t hPeerDevice, ze_device_p2p_properties_t* pP2PProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetP2PPropertiesEpilogue( ze_device_handle_t hDevice, ze_device_handle_t hPeerDevice, ze_device_p2p_properties_t* pP2PProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceCanAccessPeerPrologue( ze_device_handle_t hDevice, ze_device_handle_t hPeerDevice, ze_bool_t* value ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceCanAccessPeerEpilogue( ze_device_handle_t hDevice, ze_device_handle_t hPeerDevice, ze_bool_t* value , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetStatusPrologue( ze_device_handle_t hDevice ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetStatusEpilogue( ze_device_handle_t hDevice , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetGlobalTimestampsPrologue( ze_device_handle_t hDevice, uint64_t* hostTimestamp, uint64_t* deviceTimestamp ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetGlobalTimestampsEpilogue( ze_device_handle_t hDevice, uint64_t* hostTimestamp, uint64_t* deviceTimestamp , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextCreatePrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, ze_context_handle_t* phContext ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextCreateEpilogue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, ze_context_handle_t* phContext , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextCreateExPrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, uint32_t numDevices, ze_device_handle_t* phDevices, ze_context_handle_t* phContext ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextCreateExEpilogue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, uint32_t numDevices, ze_device_handle_t* phDevices, ze_context_handle_t* phContext , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextDestroyPrologue( ze_context_handle_t hContext ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextDestroyEpilogue( ze_context_handle_t hContext , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextGetStatusPrologue( ze_context_handle_t hContext ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextGetStatusEpilogue( ze_context_handle_t hContext , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandQueueCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_queue_desc_t* desc, ze_command_queue_handle_t* phCommandQueue ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandQueueCreateEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_queue_desc_t* desc, ze_command_queue_handle_t* phCommandQueue , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandQueueDestroyPrologue( ze_command_queue_handle_t hCommandQueue ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandQueueDestroyEpilogue( ze_command_queue_handle_t hCommandQueue , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandQueueExecuteCommandListsPrologue( ze_command_queue_handle_t hCommandQueue, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, ze_fence_handle_t hFence ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandQueueExecuteCommandListsEpilogue( ze_command_queue_handle_t hCommandQueue, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, ze_fence_handle_t hFence , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandQueueSynchronizePrologue( ze_command_queue_handle_t hCommandQueue, uint64_t timeout ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandQueueSynchronizeEpilogue( ze_command_queue_handle_t hCommandQueue, uint64_t timeout , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandQueueGetOrdinalPrologue( ze_command_queue_handle_t hCommandQueue, uint32_t* pOrdinal ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandQueueGetOrdinalEpilogue( ze_command_queue_handle_t hCommandQueue, uint32_t* pOrdinal , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandQueueGetIndexPrologue( ze_command_queue_handle_t hCommandQueue, uint32_t* pIndex ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandQueueGetIndexEpilogue( ze_command_queue_handle_t hCommandQueue, uint32_t* pIndex , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_list_desc_t* desc, ze_command_list_handle_t* phCommandList ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListCreateEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_list_desc_t* desc, ze_command_list_handle_t* phCommandList , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListCreateImmediatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_queue_desc_t* altdesc, ze_command_list_handle_t* phCommandList ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListCreateImmediateEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_queue_desc_t* altdesc, ze_command_list_handle_t* phCommandList , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListDestroyPrologue( ze_command_list_handle_t hCommandList ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListDestroyEpilogue( ze_command_list_handle_t hCommandList , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListClosePrologue( ze_command_list_handle_t hCommandList ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListCloseEpilogue( ze_command_list_handle_t hCommandList , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListResetPrologue( ze_command_list_handle_t hCommandList ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListResetEpilogue( ze_command_list_handle_t hCommandList , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendWriteGlobalTimestampPrologue( ze_command_list_handle_t hCommandList, uint64_t* dstptr, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendWriteGlobalTimestampEpilogue( ze_command_list_handle_t hCommandList, uint64_t* dstptr, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListHostSynchronizePrologue( ze_command_list_handle_t hCommandList, uint64_t timeout ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListHostSynchronizeEpilogue( ze_command_list_handle_t hCommandList, uint64_t timeout , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetDeviceHandlePrologue( ze_command_list_handle_t hCommandList, ze_device_handle_t* phDevice ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetDeviceHandleEpilogue( ze_command_list_handle_t hCommandList, ze_device_handle_t* phDevice , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetContextHandlePrologue( ze_command_list_handle_t hCommandList, ze_context_handle_t* phContext ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetContextHandleEpilogue( ze_command_list_handle_t hCommandList, ze_context_handle_t* phContext , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetOrdinalPrologue( ze_command_list_handle_t hCommandList, uint32_t* pOrdinal ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetOrdinalEpilogue( ze_command_list_handle_t hCommandList, uint32_t* pOrdinal , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListImmediateGetIndexPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t* pIndex ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListImmediateGetIndexEpilogue( ze_command_list_handle_t hCommandListImmediate, uint32_t* pIndex , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListIsImmediatePrologue( ze_command_list_handle_t hCommandList, ze_bool_t* pIsImmediate ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListIsImmediateEpilogue( ze_command_list_handle_t hCommandList, ze_bool_t* pIsImmediate , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendBarrierPrologue( ze_command_list_handle_t hCommandList, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendBarrierEpilogue( ze_command_list_handle_t hCommandList, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryRangesBarrierPrologue( ze_command_list_handle_t hCommandList, uint32_t numRanges, const size_t* pRangeSizes, const void** pRanges, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryRangesBarrierEpilogue( ze_command_list_handle_t hCommandList, uint32_t numRanges, const size_t* pRangeSizes, const void** pRanges, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextSystemBarrierPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextSystemBarrierEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryCopyPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryCopyEpilogue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryFillPrologue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryFillEpilogue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryCopyRegionPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const ze_copy_region_t* dstRegion, uint32_t dstPitch, uint32_t dstSlicePitch, const void* srcptr, const ze_copy_region_t* srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryCopyRegionEpilogue( ze_command_list_handle_t hCommandList, void* dstptr, const ze_copy_region_t* dstRegion, uint32_t dstPitch, uint32_t dstSlicePitch, const void* srcptr, const ze_copy_region_t* srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryCopyFromContextPrologue( ze_command_list_handle_t hCommandList, void* dstptr, ze_context_handle_t hContextSrc, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryCopyFromContextEpilogue( ze_command_list_handle_t hCommandList, void* dstptr, ze_context_handle_t hContextSrc, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendImageCopyPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendImageCopyEpilogue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendImageCopyRegionPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, const ze_image_region_t* pDstRegion, const ze_image_region_t* pSrcRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendImageCopyRegionEpilogue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, const ze_image_region_t* pDstRegion, const ze_image_region_t* pSrcRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendImageCopyToMemoryPrologue( ze_command_list_handle_t hCommandList, void* dstptr, ze_image_handle_t hSrcImage, const ze_image_region_t* pSrcRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendImageCopyToMemoryEpilogue( ze_command_list_handle_t hCommandList, void* dstptr, ze_image_handle_t hSrcImage, const ze_image_region_t* pSrcRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendImageCopyFromMemoryPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, const void* srcptr, const ze_image_region_t* pDstRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendImageCopyFromMemoryEpilogue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, const void* srcptr, const ze_image_region_t* pDstRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryPrefetchPrologue( ze_command_list_handle_t hCommandList, const void* ptr, size_t size ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemoryPrefetchEpilogue( ze_command_list_handle_t hCommandList, const void* ptr, size_t size , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemAdvisePrologue( ze_command_list_handle_t hCommandList, ze_device_handle_t hDevice, const void* ptr, size_t size, ze_memory_advice_t advice ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendMemAdviseEpilogue( ze_command_list_handle_t hCommandList, ze_device_handle_t hDevice, const void* ptr, size_t size, ze_memory_advice_t advice , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolCreatePrologue( ze_context_handle_t hContext, const ze_event_pool_desc_t* desc, uint32_t numDevices, ze_device_handle_t* phDevices, ze_event_pool_handle_t* phEventPool ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolCreateEpilogue( ze_context_handle_t hContext, const ze_event_pool_desc_t* desc, uint32_t numDevices, ze_device_handle_t* phDevices, ze_event_pool_handle_t* phEventPool , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolDestroyPrologue( ze_event_pool_handle_t hEventPool ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolDestroyEpilogue( ze_event_pool_handle_t hEventPool , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventCreatePrologue( ze_event_pool_handle_t hEventPool, const ze_event_desc_t* desc, ze_event_handle_t* phEvent ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventCreateEpilogue( ze_event_pool_handle_t hEventPool, const ze_event_desc_t* desc, ze_event_handle_t* phEvent , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventDestroyPrologue( ze_event_handle_t hEvent ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventDestroyEpilogue( ze_event_handle_t hEvent , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolGetIpcHandlePrologue( ze_event_pool_handle_t hEventPool, ze_ipc_event_pool_handle_t* phIpc ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolGetIpcHandleEpilogue( ze_event_pool_handle_t hEventPool, ze_ipc_event_pool_handle_t* phIpc , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolPutIpcHandlePrologue( ze_context_handle_t hContext, ze_ipc_event_pool_handle_t hIpc ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolPutIpcHandleEpilogue( ze_context_handle_t hContext, ze_ipc_event_pool_handle_t hIpc , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolOpenIpcHandlePrologue( ze_context_handle_t hContext, ze_ipc_event_pool_handle_t hIpc, ze_event_pool_handle_t* phEventPool ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolOpenIpcHandleEpilogue( ze_context_handle_t hContext, ze_ipc_event_pool_handle_t hIpc, ze_event_pool_handle_t* phEventPool , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolCloseIpcHandlePrologue( ze_event_pool_handle_t hEventPool ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolCloseIpcHandleEpilogue( ze_event_pool_handle_t hEventPool , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendSignalEventPrologue( ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendSignalEventEpilogue( ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendWaitOnEventsPrologue( ze_command_list_handle_t hCommandList, uint32_t numEvents, ze_event_handle_t* phEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendWaitOnEventsEpilogue( ze_command_list_handle_t hCommandList, uint32_t numEvents, ze_event_handle_t* phEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventHostSignalPrologue( ze_event_handle_t hEvent ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventHostSignalEpilogue( ze_event_handle_t hEvent , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventHostSynchronizePrologue( ze_event_handle_t hEvent, uint64_t timeout ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventHostSynchronizeEpilogue( ze_event_handle_t hEvent, uint64_t timeout , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventQueryStatusPrologue( ze_event_handle_t hEvent ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventQueryStatusEpilogue( ze_event_handle_t hEvent , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendEventResetPrologue( ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendEventResetEpilogue( ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventHostResetPrologue( ze_event_handle_t hEvent ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventHostResetEpilogue( ze_event_handle_t hEvent , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventQueryKernelTimestampPrologue( ze_event_handle_t hEvent, ze_kernel_timestamp_result_t* dstptr ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventQueryKernelTimestampEpilogue( ze_event_handle_t hEvent, ze_kernel_timestamp_result_t* dstptr , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendQueryKernelTimestampsPrologue( ze_command_list_handle_t hCommandList, uint32_t numEvents, ze_event_handle_t* phEvents, void* dstptr, const size_t* pOffsets, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendQueryKernelTimestampsEpilogue( ze_command_list_handle_t hCommandList, uint32_t numEvents, ze_event_handle_t* phEvents, void* dstptr, const size_t* pOffsets, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventGetEventPoolPrologue( ze_event_handle_t hEvent, ze_event_pool_handle_t* phEventPool ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventGetEventPoolEpilogue( ze_event_handle_t hEvent, ze_event_pool_handle_t* phEventPool , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventGetSignalScopePrologue( ze_event_handle_t hEvent, ze_event_scope_flags_t* pSignalScope ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventGetSignalScopeEpilogue( ze_event_handle_t hEvent, ze_event_scope_flags_t* pSignalScope , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventGetWaitScopePrologue( ze_event_handle_t hEvent, ze_event_scope_flags_t* pWaitScope ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventGetWaitScopeEpilogue( ze_event_handle_t hEvent, ze_event_scope_flags_t* pWaitScope , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolGetContextHandlePrologue( ze_event_pool_handle_t hEventPool, ze_context_handle_t* phContext ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolGetContextHandleEpilogue( ze_event_pool_handle_t hEventPool, ze_context_handle_t* phContext , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolGetFlagsPrologue( ze_event_pool_handle_t hEventPool, ze_event_pool_flags_t* pFlags ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventPoolGetFlagsEpilogue( ze_event_pool_handle_t hEventPool, ze_event_pool_flags_t* pFlags , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFenceCreatePrologue( ze_command_queue_handle_t hCommandQueue, const ze_fence_desc_t* desc, ze_fence_handle_t* phFence ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFenceCreateEpilogue( ze_command_queue_handle_t hCommandQueue, const ze_fence_desc_t* desc, ze_fence_handle_t* phFence , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFenceDestroyPrologue( ze_fence_handle_t hFence ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFenceDestroyEpilogue( ze_fence_handle_t hFence , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFenceHostSynchronizePrologue( ze_fence_handle_t hFence, uint64_t timeout ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFenceHostSynchronizeEpilogue( ze_fence_handle_t hFence, uint64_t timeout , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFenceQueryStatusPrologue( ze_fence_handle_t hFence ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFenceQueryStatusEpilogue( ze_fence_handle_t hFence , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFenceResetPrologue( ze_fence_handle_t hFence ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFenceResetEpilogue( ze_fence_handle_t hFence , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageGetPropertiesPrologue( ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_properties_t* pImageProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageGetPropertiesEpilogue( ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_properties_t* pImageProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t* phImage ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageCreateEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t* phImage , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageDestroyPrologue( ze_image_handle_t hImage ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageDestroyEpilogue( ze_image_handle_t hImage , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemAllocSharedPrologue( ze_context_handle_t hContext, const ze_device_mem_alloc_desc_t* device_desc, const ze_host_mem_alloc_desc_t* host_desc, size_t size, size_t alignment, ze_device_handle_t hDevice, void** pptr ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemAllocSharedEpilogue( ze_context_handle_t hContext, const ze_device_mem_alloc_desc_t* device_desc, const ze_host_mem_alloc_desc_t* host_desc, size_t size, size_t alignment, ze_device_handle_t hDevice, void** pptr , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemAllocDevicePrologue( ze_context_handle_t hContext, const ze_device_mem_alloc_desc_t* device_desc, size_t size, size_t alignment, ze_device_handle_t hDevice, void** pptr ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemAllocDeviceEpilogue( ze_context_handle_t hContext, const ze_device_mem_alloc_desc_t* device_desc, size_t size, size_t alignment, ze_device_handle_t hDevice, void** pptr , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemAllocHostPrologue( ze_context_handle_t hContext, const ze_host_mem_alloc_desc_t* host_desc, size_t size, size_t alignment, void** pptr ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemAllocHostEpilogue( ze_context_handle_t hContext, const ze_host_mem_alloc_desc_t* host_desc, size_t size, size_t alignment, void** pptr , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemFreePrologue( ze_context_handle_t hContext, void* ptr ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemFreeEpilogue( ze_context_handle_t hContext, void* ptr , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetAllocPropertiesPrologue( ze_context_handle_t hContext, const void* ptr, ze_memory_allocation_properties_t* pMemAllocProperties, ze_device_handle_t* phDevice ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetAllocPropertiesEpilogue( ze_context_handle_t hContext, const void* ptr, ze_memory_allocation_properties_t* pMemAllocProperties, ze_device_handle_t* phDevice , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetAddressRangePrologue( ze_context_handle_t hContext, const void* ptr, void** pBase, size_t* pSize ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetAddressRangeEpilogue( ze_context_handle_t hContext, const void* ptr, void** pBase, size_t* pSize , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetIpcHandlePrologue( ze_context_handle_t hContext, const void* ptr, ze_ipc_mem_handle_t* pIpcHandle ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetIpcHandleEpilogue( ze_context_handle_t hContext, const void* ptr, ze_ipc_mem_handle_t* pIpcHandle , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetIpcHandleFromFileDescriptorExpPrologue( ze_context_handle_t hContext, uint64_t handle, ze_ipc_mem_handle_t* pIpcHandle ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetIpcHandleFromFileDescriptorExpEpilogue( ze_context_handle_t hContext, uint64_t handle, ze_ipc_mem_handle_t* pIpcHandle , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetFileDescriptorFromIpcHandleExpPrologue( ze_context_handle_t hContext, ze_ipc_mem_handle_t ipcHandle, uint64_t* pHandle ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetFileDescriptorFromIpcHandleExpEpilogue( ze_context_handle_t hContext, ze_ipc_mem_handle_t ipcHandle, uint64_t* pHandle , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemPutIpcHandlePrologue( ze_context_handle_t hContext, ze_ipc_mem_handle_t handle ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemPutIpcHandleEpilogue( ze_context_handle_t hContext, ze_ipc_mem_handle_t handle , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemOpenIpcHandlePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_ipc_mem_handle_t handle, ze_ipc_memory_flags_t flags, void** pptr ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemOpenIpcHandleEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_ipc_mem_handle_t handle, ze_ipc_memory_flags_t flags, void** pptr , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemCloseIpcHandlePrologue( ze_context_handle_t hContext, const void* ptr ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemCloseIpcHandleEpilogue( ze_context_handle_t hContext, const void* ptr , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemSetAtomicAccessAttributeExpPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const void* ptr, size_t size, ze_memory_atomic_attr_exp_flags_t attr ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemSetAtomicAccessAttributeExpEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const void* ptr, size_t size, ze_memory_atomic_attr_exp_flags_t attr , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetAtomicAccessAttributeExpPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const void* ptr, size_t size, ze_memory_atomic_attr_exp_flags_t* pAttr ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetAtomicAccessAttributeExpEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const void* ptr, size_t size, ze_memory_atomic_attr_exp_flags_t* pAttr , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_module_desc_t* desc, ze_module_handle_t* phModule, ze_module_build_log_handle_t* phBuildLog ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleCreateEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_module_desc_t* desc, ze_module_handle_t* phModule, ze_module_build_log_handle_t* phBuildLog , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleDestroyPrologue( ze_module_handle_t hModule ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleDestroyEpilogue( ze_module_handle_t hModule , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleDynamicLinkPrologue( uint32_t numModules, ze_module_handle_t* phModules, ze_module_build_log_handle_t* phLinkLog ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleDynamicLinkEpilogue( uint32_t numModules, ze_module_handle_t* phModules, ze_module_build_log_handle_t* phLinkLog , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleBuildLogDestroyPrologue( ze_module_build_log_handle_t hModuleBuildLog ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleBuildLogDestroyEpilogue( ze_module_build_log_handle_t hModuleBuildLog , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleBuildLogGetStringPrologue( ze_module_build_log_handle_t hModuleBuildLog, size_t* pSize, char* pBuildLog ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleBuildLogGetStringEpilogue( ze_module_build_log_handle_t hModuleBuildLog, size_t* pSize, char* pBuildLog , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleGetNativeBinaryPrologue( ze_module_handle_t hModule, size_t* pSize, uint8_t* pModuleNativeBinary ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleGetNativeBinaryEpilogue( ze_module_handle_t hModule, size_t* pSize, uint8_t* pModuleNativeBinary , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleGetGlobalPointerPrologue( ze_module_handle_t hModule, const char* pGlobalName, size_t* pSize, void** pptr ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleGetGlobalPointerEpilogue( ze_module_handle_t hModule, const char* pGlobalName, size_t* pSize, void** pptr , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleGetKernelNamesPrologue( ze_module_handle_t hModule, uint32_t* pCount, const char** pNames ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleGetKernelNamesEpilogue( ze_module_handle_t hModule, uint32_t* pCount, const char** pNames , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleGetPropertiesPrologue( ze_module_handle_t hModule, ze_module_properties_t* pModuleProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleGetPropertiesEpilogue( ze_module_handle_t hModule, ze_module_properties_t* pModuleProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelCreatePrologue( ze_module_handle_t hModule, const ze_kernel_desc_t* desc, ze_kernel_handle_t* phKernel ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelCreateEpilogue( ze_module_handle_t hModule, const ze_kernel_desc_t* desc, ze_kernel_handle_t* phKernel , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelDestroyPrologue( ze_kernel_handle_t hKernel ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelDestroyEpilogue( ze_kernel_handle_t hKernel , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleGetFunctionPointerPrologue( ze_module_handle_t hModule, const char* pFunctionName, void** pfnFunction ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleGetFunctionPointerEpilogue( ze_module_handle_t hModule, const char* pFunctionName, void** pfnFunction , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSetGroupSizePrologue( ze_kernel_handle_t hKernel, uint32_t groupSizeX, uint32_t groupSizeY, uint32_t groupSizeZ ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSetGroupSizeEpilogue( ze_kernel_handle_t hKernel, uint32_t groupSizeX, uint32_t groupSizeY, uint32_t groupSizeZ , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSuggestGroupSizePrologue( ze_kernel_handle_t hKernel, uint32_t globalSizeX, uint32_t globalSizeY, uint32_t globalSizeZ, uint32_t* groupSizeX, uint32_t* groupSizeY, uint32_t* groupSizeZ ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSuggestGroupSizeEpilogue( ze_kernel_handle_t hKernel, uint32_t globalSizeX, uint32_t globalSizeY, uint32_t globalSizeZ, uint32_t* groupSizeX, uint32_t* groupSizeY, uint32_t* groupSizeZ , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSuggestMaxCooperativeGroupCountPrologue( ze_kernel_handle_t hKernel, uint32_t* totalGroupCount ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSuggestMaxCooperativeGroupCountEpilogue( ze_kernel_handle_t hKernel, uint32_t* totalGroupCount , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSetArgumentValuePrologue( ze_kernel_handle_t hKernel, uint32_t argIndex, size_t argSize, const void* pArgValue ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSetArgumentValueEpilogue( ze_kernel_handle_t hKernel, uint32_t argIndex, size_t argSize, const void* pArgValue , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSetIndirectAccessPrologue( ze_kernel_handle_t hKernel, ze_kernel_indirect_access_flags_t flags ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSetIndirectAccessEpilogue( ze_kernel_handle_t hKernel, ze_kernel_indirect_access_flags_t flags , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelGetIndirectAccessPrologue( ze_kernel_handle_t hKernel, ze_kernel_indirect_access_flags_t* pFlags ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelGetIndirectAccessEpilogue( ze_kernel_handle_t hKernel, ze_kernel_indirect_access_flags_t* pFlags , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelGetSourceAttributesPrologue( ze_kernel_handle_t hKernel, uint32_t* pSize, char** pString ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelGetSourceAttributesEpilogue( ze_kernel_handle_t hKernel, uint32_t* pSize, char** pString , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSetCacheConfigPrologue( ze_kernel_handle_t hKernel, ze_cache_config_flags_t flags ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSetCacheConfigEpilogue( ze_kernel_handle_t hKernel, ze_cache_config_flags_t flags , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelGetPropertiesPrologue( ze_kernel_handle_t hKernel, ze_kernel_properties_t* pKernelProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelGetPropertiesEpilogue( ze_kernel_handle_t hKernel, ze_kernel_properties_t* pKernelProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelGetNamePrologue( ze_kernel_handle_t hKernel, size_t* pSize, char* pName ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelGetNameEpilogue( ze_kernel_handle_t hKernel, size_t* pSize, char* pName , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendLaunchKernelPrologue( ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t* pLaunchFuncArgs, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendLaunchKernelEpilogue( ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t* pLaunchFuncArgs, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendLaunchCooperativeKernelPrologue( ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t* pLaunchFuncArgs, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendLaunchCooperativeKernelEpilogue( ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t* pLaunchFuncArgs, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendLaunchKernelIndirectPrologue( ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t* pLaunchArgumentsBuffer, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendLaunchKernelIndirectEpilogue( ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t* pLaunchArgumentsBuffer, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendLaunchMultipleKernelsIndirectPrologue( ze_command_list_handle_t hCommandList, uint32_t numKernels, ze_kernel_handle_t* phKernels, const uint32_t* pCountBuffer, const ze_group_count_t* pLaunchArgumentsBuffer, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendLaunchMultipleKernelsIndirectEpilogue( ze_command_list_handle_t hCommandList, uint32_t numKernels, ze_kernel_handle_t* phKernels, const uint32_t* pCountBuffer, const ze_group_count_t* pLaunchArgumentsBuffer, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextMakeMemoryResidentPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, void* ptr, size_t size ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextMakeMemoryResidentEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, void* ptr, size_t size , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextEvictMemoryPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, void* ptr, size_t size ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextEvictMemoryEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, void* ptr, size_t size , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextMakeImageResidentPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_image_handle_t hImage ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextMakeImageResidentEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_image_handle_t hImage , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextEvictImagePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_image_handle_t hImage ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeContextEvictImageEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_image_handle_t hImage , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeSamplerCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_sampler_desc_t* desc, ze_sampler_handle_t* phSampler ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeSamplerCreateEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_sampler_desc_t* desc, ze_sampler_handle_t* phSampler , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeSamplerDestroyPrologue( ze_sampler_handle_t hSampler ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeSamplerDestroyEpilogue( ze_sampler_handle_t hSampler , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemReservePrologue( ze_context_handle_t hContext, const void* pStart, size_t size, void** pptr ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemReserveEpilogue( ze_context_handle_t hContext, const void* pStart, size_t size, void** pptr , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemFreePrologue( ze_context_handle_t hContext, const void* ptr, size_t size ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemFreeEpilogue( ze_context_handle_t hContext, const void* ptr, size_t size , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemQueryPageSizePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, size_t size, size_t* pagesize ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemQueryPageSizeEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, size_t size, size_t* pagesize , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zePhysicalMemCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_physical_mem_desc_t* desc, ze_physical_mem_handle_t* phPhysicalMemory ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zePhysicalMemCreateEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_physical_mem_desc_t* desc, ze_physical_mem_handle_t* phPhysicalMemory , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zePhysicalMemDestroyPrologue( ze_context_handle_t hContext, ze_physical_mem_handle_t hPhysicalMemory ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zePhysicalMemDestroyEpilogue( ze_context_handle_t hContext, ze_physical_mem_handle_t hPhysicalMemory , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemMapPrologue( ze_context_handle_t hContext, const void* ptr, size_t size, ze_physical_mem_handle_t hPhysicalMemory, size_t offset, ze_memory_access_attribute_t access ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemMapEpilogue( ze_context_handle_t hContext, const void* ptr, size_t size, ze_physical_mem_handle_t hPhysicalMemory, size_t offset, ze_memory_access_attribute_t access , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemUnmapPrologue( ze_context_handle_t hContext, const void* ptr, size_t size ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemUnmapEpilogue( ze_context_handle_t hContext, const void* ptr, size_t size , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemSetAccessAttributePrologue( ze_context_handle_t hContext, const void* ptr, size_t size, ze_memory_access_attribute_t access ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemSetAccessAttributeEpilogue( ze_context_handle_t hContext, const void* ptr, size_t size, ze_memory_access_attribute_t access , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemGetAccessAttributePrologue( ze_context_handle_t hContext, const void* ptr, size_t size, ze_memory_access_attribute_t* access, size_t* outSize ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeVirtualMemGetAccessAttributeEpilogue( ze_context_handle_t hContext, const void* ptr, size_t size, ze_memory_access_attribute_t* access, size_t* outSize , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSetGlobalOffsetExpPrologue( ze_kernel_handle_t hKernel, uint32_t offsetX, uint32_t offsetY, uint32_t offsetZ ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSetGlobalOffsetExpEpilogue( ze_kernel_handle_t hKernel, uint32_t offsetX, uint32_t offsetY, uint32_t offsetZ , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelGetBinaryExpPrologue( ze_kernel_handle_t hKernel, size_t* pSize, uint8_t* pKernelBinary ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelGetBinaryExpEpilogue( ze_kernel_handle_t hKernel, size_t* pSize, uint8_t* pKernelBinary , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceImportExternalSemaphoreExtPrologue( ze_device_handle_t hDevice, const ze_external_semaphore_ext_desc_t* desc, ze_external_semaphore_ext_handle_t* phSemaphore ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceImportExternalSemaphoreExtEpilogue( ze_device_handle_t hDevice, const ze_external_semaphore_ext_desc_t* desc, ze_external_semaphore_ext_handle_t* phSemaphore , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceReleaseExternalSemaphoreExtPrologue( ze_external_semaphore_ext_handle_t hSemaphore ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceReleaseExternalSemaphoreExtEpilogue( ze_external_semaphore_ext_handle_t hSemaphore , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendSignalExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_signal_params_ext_t* signalParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendSignalExternalSemaphoreExtEpilogue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_signal_params_ext_t* signalParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendWaitExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_wait_params_ext_t* waitParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendWaitExternalSemaphoreExtEpilogue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_wait_params_ext_t* waitParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceReserveCacheExtPrologue( ze_device_handle_t hDevice, size_t cacheLevel, size_t cacheReservationSize ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceReserveCacheExtEpilogue( ze_device_handle_t hDevice, size_t cacheLevel, size_t cacheReservationSize , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceSetCacheAdviceExtPrologue( ze_device_handle_t hDevice, void* ptr, size_t regionSize, ze_cache_ext_region_t cacheRegion ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceSetCacheAdviceExtEpilogue( ze_device_handle_t hDevice, void* ptr, size_t regionSize, ze_cache_ext_region_t cacheRegion , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventQueryTimestampsExpPrologue( ze_event_handle_t hEvent, ze_device_handle_t hDevice, uint32_t* pCount, ze_kernel_timestamp_result_t* pTimestamps ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventQueryTimestampsExpEpilogue( ze_event_handle_t hEvent, ze_device_handle_t hDevice, uint32_t* pCount, ze_kernel_timestamp_result_t* pTimestamps , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageGetMemoryPropertiesExpPrologue( ze_image_handle_t hImage, ze_image_memory_properties_exp_t* pMemoryProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageGetMemoryPropertiesExpEpilogue( ze_image_handle_t hImage, ze_image_memory_properties_exp_t* pMemoryProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageViewCreateExtPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t hImage, ze_image_handle_t* phImageView ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageViewCreateExtEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t hImage, ze_image_handle_t* phImageView , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageViewCreateExpPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t hImage, ze_image_handle_t* phImageView ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageViewCreateExpEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t hImage, ze_image_handle_t* phImageView , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSchedulingHintExpPrologue( ze_kernel_handle_t hKernel, ze_scheduling_hint_exp_desc_t* pHint ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeKernelSchedulingHintExpEpilogue( ze_kernel_handle_t hKernel, ze_scheduling_hint_exp_desc_t* pHint , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDevicePciGetPropertiesExtPrologue( ze_device_handle_t hDevice, ze_pci_ext_properties_t* pPciProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDevicePciGetPropertiesExtEpilogue( ze_device_handle_t hDevice, ze_pci_ext_properties_t* pPciProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendImageCopyToMemoryExtPrologue( ze_command_list_handle_t hCommandList, void* dstptr, ze_image_handle_t hSrcImage, const ze_image_region_t* pSrcRegion, uint32_t destRowPitch, uint32_t destSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendImageCopyToMemoryExtEpilogue( ze_command_list_handle_t hCommandList, void* dstptr, ze_image_handle_t hSrcImage, const ze_image_region_t* pSrcRegion, uint32_t destRowPitch, uint32_t destSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendImageCopyFromMemoryExtPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, const void* srcptr, const ze_image_region_t* pDstRegion, uint32_t srcRowPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListAppendImageCopyFromMemoryExtEpilogue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, const void* srcptr, const ze_image_region_t* pDstRegion, uint32_t srcRowPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageGetAllocPropertiesExtPrologue( ze_context_handle_t hContext, ze_image_handle_t hImage, ze_image_allocation_ext_properties_t* pImageAllocProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageGetAllocPropertiesExtEpilogue( ze_context_handle_t hContext, ze_image_handle_t hImage, ze_image_allocation_ext_properties_t* pImageAllocProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleInspectLinkageExtPrologue( ze_linkage_inspection_ext_desc_t* pInspectDesc, uint32_t numModules, ze_module_handle_t* phModules, ze_module_build_log_handle_t* phLog ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeModuleInspectLinkageExtEpilogue( ze_linkage_inspection_ext_desc_t* pInspectDesc, uint32_t numModules, ze_module_handle_t* phModules, ze_module_build_log_handle_t* phLog , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemFreeExtPrologue( ze_context_handle_t hContext, const ze_memory_free_ext_desc_t* pMemFreeDesc, void* ptr ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemFreeExtEpilogue( ze_context_handle_t hContext, const ze_memory_free_ext_desc_t* pMemFreeDesc, void* ptr , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricVertexGetExpPrologue( ze_driver_handle_t hDriver, uint32_t* pCount, ze_fabric_vertex_handle_t* phVertices ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricVertexGetExpEpilogue( ze_driver_handle_t hDriver, uint32_t* pCount, ze_fabric_vertex_handle_t* phVertices , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricVertexGetSubVerticesExpPrologue( ze_fabric_vertex_handle_t hVertex, uint32_t* pCount, ze_fabric_vertex_handle_t* phSubvertices ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricVertexGetSubVerticesExpEpilogue( ze_fabric_vertex_handle_t hVertex, uint32_t* pCount, ze_fabric_vertex_handle_t* phSubvertices , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricVertexGetPropertiesExpPrologue( ze_fabric_vertex_handle_t hVertex, ze_fabric_vertex_exp_properties_t* pVertexProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricVertexGetPropertiesExpEpilogue( ze_fabric_vertex_handle_t hVertex, ze_fabric_vertex_exp_properties_t* pVertexProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricVertexGetDeviceExpPrologue( ze_fabric_vertex_handle_t hVertex, ze_device_handle_t* phDevice ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricVertexGetDeviceExpEpilogue( ze_fabric_vertex_handle_t hVertex, ze_device_handle_t* phDevice , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetFabricVertexExpPrologue( ze_device_handle_t hDevice, ze_fabric_vertex_handle_t* phVertex ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDeviceGetFabricVertexExpEpilogue( ze_device_handle_t hDevice, ze_fabric_vertex_handle_t* phVertex , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricEdgeGetExpPrologue( ze_fabric_vertex_handle_t hVertexA, ze_fabric_vertex_handle_t hVertexB, uint32_t* pCount, ze_fabric_edge_handle_t* phEdges ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricEdgeGetExpEpilogue( ze_fabric_vertex_handle_t hVertexA, ze_fabric_vertex_handle_t hVertexB, uint32_t* pCount, ze_fabric_edge_handle_t* phEdges , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricEdgeGetVerticesExpPrologue( ze_fabric_edge_handle_t hEdge, ze_fabric_vertex_handle_t* phVertexA, ze_fabric_vertex_handle_t* phVertexB ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricEdgeGetVerticesExpEpilogue( ze_fabric_edge_handle_t hEdge, ze_fabric_vertex_handle_t* phVertexA, ze_fabric_vertex_handle_t* phVertexB , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricEdgeGetPropertiesExpPrologue( ze_fabric_edge_handle_t hEdge, ze_fabric_edge_exp_properties_t* pEdgeProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeFabricEdgeGetPropertiesExpEpilogue( ze_fabric_edge_handle_t hEdge, ze_fabric_edge_exp_properties_t* pEdgeProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventQueryKernelTimestampsExtPrologue( ze_event_handle_t hEvent, ze_device_handle_t hDevice, uint32_t* pCount, ze_event_query_kernel_timestamps_results_ext_properties_t* pResults ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeEventQueryKernelTimestampsExtEpilogue( ze_event_handle_t hEvent, ze_device_handle_t hDevice, uint32_t* pCount, ze_event_query_kernel_timestamps_results_ext_properties_t* pResults , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASBuilderCreateExpPrologue( ze_driver_handle_t hDriver, const ze_rtas_builder_exp_desc_t* pDescriptor, ze_rtas_builder_exp_handle_t* phBuilder ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASBuilderCreateExpEpilogue( ze_driver_handle_t hDriver, const ze_rtas_builder_exp_desc_t* pDescriptor, ze_rtas_builder_exp_handle_t* phBuilder , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASBuilderGetBuildPropertiesExpPrologue( ze_rtas_builder_exp_handle_t hBuilder, const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ze_rtas_builder_exp_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASBuilderGetBuildPropertiesExpEpilogue( ze_rtas_builder_exp_handle_t hBuilder, const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ze_rtas_builder_exp_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverRTASFormatCompatibilityCheckExpPrologue( ze_driver_handle_t hDriver, ze_rtas_format_exp_t rtasFormatA, ze_rtas_format_exp_t rtasFormatB ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeDriverRTASFormatCompatibilityCheckExpEpilogue( ze_driver_handle_t hDriver, ze_rtas_format_exp_t rtasFormatA, ze_rtas_format_exp_t rtasFormatB , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASBuilderBuildExpPrologue( ze_rtas_builder_exp_handle_t hBuilder, const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, void* pScratchBuffer, size_t scratchBufferSizeBytes, void* pRtasBuffer, size_t rtasBufferSizeBytes, ze_rtas_parallel_operation_exp_handle_t hParallelOperation, void* pBuildUserPtr, ze_rtas_aabb_exp_t* pBounds, size_t* pRtasBufferSizeBytes ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASBuilderBuildExpEpilogue( ze_rtas_builder_exp_handle_t hBuilder, const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, void* pScratchBuffer, size_t scratchBufferSizeBytes, void* pRtasBuffer, size_t rtasBufferSizeBytes, ze_rtas_parallel_operation_exp_handle_t hParallelOperation, void* pBuildUserPtr, ze_rtas_aabb_exp_t* pBounds, size_t* pRtasBufferSizeBytes , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASBuilderDestroyExpPrologue( ze_rtas_builder_exp_handle_t hBuilder ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASBuilderDestroyExpEpilogue( ze_rtas_builder_exp_handle_t hBuilder , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASParallelOperationCreateExpPrologue( ze_driver_handle_t hDriver, ze_rtas_parallel_operation_exp_handle_t* phParallelOperation ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASParallelOperationCreateExpEpilogue( ze_driver_handle_t hDriver, ze_rtas_parallel_operation_exp_handle_t* phParallelOperation , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASParallelOperationGetPropertiesExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ze_rtas_parallel_operation_exp_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASParallelOperationGetPropertiesExpEpilogue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ze_rtas_parallel_operation_exp_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASParallelOperationJoinExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASParallelOperationJoinExpEpilogue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASParallelOperationDestroyExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeRTASParallelOperationDestroyExpEpilogue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetPitchFor2dImagePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, size_t imageWidth, size_t imageHeight, unsigned int elementSizeInBytes, size_t * rowPitch ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeMemGetPitchFor2dImageEpilogue( ze_context_handle_t hContext, ze_device_handle_t hDevice, size_t imageWidth, size_t imageHeight, unsigned int elementSizeInBytes, size_t * rowPitch , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageGetDeviceOffsetExpPrologue( ze_image_handle_t hImage, uint64_t* pDeviceOffset ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeImageGetDeviceOffsetExpEpilogue( ze_image_handle_t hImage, uint64_t* pDeviceOffset , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListCreateCloneExpPrologue( ze_command_list_handle_t hCommandList, ze_command_list_handle_t* phClonedCommandList ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListCreateCloneExpEpilogue( ze_command_list_handle_t hCommandList, ze_command_list_handle_t* phClonedCommandList , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListImmediateAppendCommandListsExpPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListImmediateAppendCommandListsExpEpilogue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetNextCommandIdExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint64_t* pCommandId ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetNextCommandIdExpEpilogue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint64_t* pCommandId , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetNextCommandIdWithKernelsExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint32_t numKernels, ze_kernel_handle_t* phKernels, uint64_t* pCommandId ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListGetNextCommandIdWithKernelsExpEpilogue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint32_t numKernels, ze_kernel_handle_t* phKernels, uint64_t* pCommandId , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListUpdateMutableCommandsExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_commands_exp_desc_t* desc ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListUpdateMutableCommandsExpEpilogue( ze_command_list_handle_t hCommandList, const ze_mutable_commands_exp_desc_t* desc , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListUpdateMutableCommandSignalEventExpPrologue( ze_command_list_handle_t hCommandList, uint64_t commandId, ze_event_handle_t hSignalEvent ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListUpdateMutableCommandSignalEventExpEpilogue( ze_command_list_handle_t hCommandList, uint64_t commandId, ze_event_handle_t hSignalEvent , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListUpdateMutableCommandWaitEventsExpPrologue( ze_command_list_handle_t hCommandList, uint64_t commandId, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListUpdateMutableCommandWaitEventsExpEpilogue( ze_command_list_handle_t hCommandList, uint64_t commandId, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListUpdateMutableCommandKernelsExpPrologue( ze_command_list_handle_t hCommandList, uint32_t numKernels, uint64_t* pCommandId, ze_kernel_handle_t* phKernels ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zeCommandListUpdateMutableCommandKernelsExpEpilogue( ze_command_list_handle_t hCommandList, uint32_t numKernels, uint64_t* pCommandId, ze_kernel_handle_t* phKernels , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ~ZEValidationEntryPoints() {} }; }level-zero-1.20.6/source/layers/validation/common/zes_entry_points.h000066400000000000000000001437541475521542100257200ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See entry_points.h.mako for modifications * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_entry_points.h * */ #pragma once #include "zes_api.h" namespace validation_layer { class ZESValidationEntryPoints { public: virtual ze_result_t zesInitPrologue( zes_init_flags_t flags ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesInitEpilogue( zes_init_flags_t flags , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverGetPrologue( uint32_t* pCount, zes_driver_handle_t* phDrivers ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverGetEpilogue( uint32_t* pCount, zes_driver_handle_t* phDrivers , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverGetExtensionPropertiesPrologue( zes_driver_handle_t hDriver, uint32_t* pCount, zes_driver_extension_properties_t* pExtensionProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverGetExtensionPropertiesEpilogue( zes_driver_handle_t hDriver, uint32_t* pCount, zes_driver_extension_properties_t* pExtensionProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverGetExtensionFunctionAddressPrologue( zes_driver_handle_t hDriver, const char* name, void** ppFunctionAddress ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverGetExtensionFunctionAddressEpilogue( zes_driver_handle_t hDriver, const char* name, void** ppFunctionAddress , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetPrologue( zes_driver_handle_t hDriver, uint32_t* pCount, zes_device_handle_t* phDevices ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetEpilogue( zes_driver_handle_t hDriver, uint32_t* pCount, zes_device_handle_t* phDevices , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetPropertiesPrologue( zes_device_handle_t hDevice, zes_device_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetPropertiesEpilogue( zes_device_handle_t hDevice, zes_device_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetStatePrologue( zes_device_handle_t hDevice, zes_device_state_t* pState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetStateEpilogue( zes_device_handle_t hDevice, zes_device_state_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceResetPrologue( zes_device_handle_t hDevice, ze_bool_t force ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceResetEpilogue( zes_device_handle_t hDevice, ze_bool_t force , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceResetExtPrologue( zes_device_handle_t hDevice, zes_reset_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceResetExtEpilogue( zes_device_handle_t hDevice, zes_reset_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceProcessesGetStatePrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_process_state_t* pProcesses ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceProcessesGetStateEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_process_state_t* pProcesses , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDevicePciGetPropertiesPrologue( zes_device_handle_t hDevice, zes_pci_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDevicePciGetPropertiesEpilogue( zes_device_handle_t hDevice, zes_pci_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDevicePciGetStatePrologue( zes_device_handle_t hDevice, zes_pci_state_t* pState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDevicePciGetStateEpilogue( zes_device_handle_t hDevice, zes_pci_state_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDevicePciGetBarsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_pci_bar_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDevicePciGetBarsEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_pci_bar_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDevicePciGetStatsPrologue( zes_device_handle_t hDevice, zes_pci_stats_t* pStats ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDevicePciGetStatsEpilogue( zes_device_handle_t hDevice, zes_pci_stats_t* pStats , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceSetOverclockWaiverPrologue( zes_device_handle_t hDevice ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceSetOverclockWaiverEpilogue( zes_device_handle_t hDevice , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetOverclockDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pOverclockDomains ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetOverclockDomainsEpilogue( zes_device_handle_t hDevice, uint32_t* pOverclockDomains , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetOverclockControlsPrologue( zes_device_handle_t hDevice, zes_overclock_domain_t domainType, uint32_t* pAvailableControls ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetOverclockControlsEpilogue( zes_device_handle_t hDevice, zes_overclock_domain_t domainType, uint32_t* pAvailableControls , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceResetOverclockSettingsPrologue( zes_device_handle_t hDevice, ze_bool_t onShippedState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceResetOverclockSettingsEpilogue( zes_device_handle_t hDevice, ze_bool_t onShippedState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceReadOverclockStatePrologue( zes_device_handle_t hDevice, zes_overclock_mode_t* pOverclockMode, ze_bool_t* pWaiverSetting, ze_bool_t* pOverclockState, zes_pending_action_t* pPendingAction, ze_bool_t* pPendingReset ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceReadOverclockStateEpilogue( zes_device_handle_t hDevice, zes_overclock_mode_t* pOverclockMode, ze_bool_t* pWaiverSetting, ze_bool_t* pOverclockState, zes_pending_action_t* pPendingAction, ze_bool_t* pPendingReset , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumOverclockDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_overclock_handle_t* phDomainHandle ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumOverclockDomainsEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_overclock_handle_t* phDomainHandle , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetDomainPropertiesPrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_properties_t* pDomainProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetDomainPropertiesEpilogue( zes_overclock_handle_t hDomainHandle, zes_overclock_properties_t* pDomainProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetDomainVFPropertiesPrologue( zes_overclock_handle_t hDomainHandle, zes_vf_property_t* pVFProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetDomainVFPropertiesEpilogue( zes_overclock_handle_t hDomainHandle, zes_vf_property_t* pVFProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetDomainControlPropertiesPrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, zes_control_property_t* pControlProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetDomainControlPropertiesEpilogue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, zes_control_property_t* pControlProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetControlCurrentValuePrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, double* pValue ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetControlCurrentValueEpilogue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, double* pValue , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetControlPendingValuePrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, double* pValue ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetControlPendingValueEpilogue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, double* pValue , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockSetControlUserValuePrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, double pValue, zes_pending_action_t* pPendingAction ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockSetControlUserValueEpilogue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, double pValue, zes_pending_action_t* pPendingAction , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetControlStatePrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, zes_control_state_t* pControlState, zes_pending_action_t* pPendingAction ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetControlStateEpilogue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, zes_control_state_t* pControlState, zes_pending_action_t* pPendingAction , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetVFPointValuesPrologue( zes_overclock_handle_t hDomainHandle, zes_vf_type_t VFType, zes_vf_array_type_t VFArrayType, uint32_t PointIndex, uint32_t* PointValue ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockGetVFPointValuesEpilogue( zes_overclock_handle_t hDomainHandle, zes_vf_type_t VFType, zes_vf_array_type_t VFArrayType, uint32_t PointIndex, uint32_t* PointValue , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockSetVFPointValuesPrologue( zes_overclock_handle_t hDomainHandle, zes_vf_type_t VFType, uint32_t PointIndex, uint32_t PointValue ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesOverclockSetVFPointValuesEpilogue( zes_overclock_handle_t hDomainHandle, zes_vf_type_t VFType, uint32_t PointIndex, uint32_t PointValue , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumDiagnosticTestSuitesPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_diag_handle_t* phDiagnostics ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumDiagnosticTestSuitesEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_diag_handle_t* phDiagnostics , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDiagnosticsGetPropertiesPrologue( zes_diag_handle_t hDiagnostics, zes_diag_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDiagnosticsGetPropertiesEpilogue( zes_diag_handle_t hDiagnostics, zes_diag_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDiagnosticsGetTestsPrologue( zes_diag_handle_t hDiagnostics, uint32_t* pCount, zes_diag_test_t* pTests ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDiagnosticsGetTestsEpilogue( zes_diag_handle_t hDiagnostics, uint32_t* pCount, zes_diag_test_t* pTests , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDiagnosticsRunTestsPrologue( zes_diag_handle_t hDiagnostics, uint32_t startIndex, uint32_t endIndex, zes_diag_result_t* pResult ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDiagnosticsRunTestsEpilogue( zes_diag_handle_t hDiagnostics, uint32_t startIndex, uint32_t endIndex, zes_diag_result_t* pResult , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEccAvailablePrologue( zes_device_handle_t hDevice, ze_bool_t* pAvailable ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEccAvailableEpilogue( zes_device_handle_t hDevice, ze_bool_t* pAvailable , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEccConfigurablePrologue( zes_device_handle_t hDevice, ze_bool_t* pConfigurable ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEccConfigurableEpilogue( zes_device_handle_t hDevice, ze_bool_t* pConfigurable , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetEccStatePrologue( zes_device_handle_t hDevice, zes_device_ecc_properties_t* pState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetEccStateEpilogue( zes_device_handle_t hDevice, zes_device_ecc_properties_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceSetEccStatePrologue( zes_device_handle_t hDevice, const zes_device_ecc_desc_t* newState, zes_device_ecc_properties_t* pState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceSetEccStateEpilogue( zes_device_handle_t hDevice, const zes_device_ecc_desc_t* newState, zes_device_ecc_properties_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumEngineGroupsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_engine_handle_t* phEngine ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumEngineGroupsEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_engine_handle_t* phEngine , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesEngineGetPropertiesPrologue( zes_engine_handle_t hEngine, zes_engine_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesEngineGetPropertiesEpilogue( zes_engine_handle_t hEngine, zes_engine_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesEngineGetActivityPrologue( zes_engine_handle_t hEngine, zes_engine_stats_t* pStats ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesEngineGetActivityEpilogue( zes_engine_handle_t hEngine, zes_engine_stats_t* pStats , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEventRegisterPrologue( zes_device_handle_t hDevice, zes_event_type_flags_t events ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEventRegisterEpilogue( zes_device_handle_t hDevice, zes_event_type_flags_t events , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverEventListenPrologue( ze_driver_handle_t hDriver, uint32_t timeout, uint32_t count, zes_device_handle_t* phDevices, uint32_t* pNumDeviceEvents, zes_event_type_flags_t* pEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverEventListenEpilogue( ze_driver_handle_t hDriver, uint32_t timeout, uint32_t count, zes_device_handle_t* phDevices, uint32_t* pNumDeviceEvents, zes_event_type_flags_t* pEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverEventListenExPrologue( ze_driver_handle_t hDriver, uint64_t timeout, uint32_t count, zes_device_handle_t* phDevices, uint32_t* pNumDeviceEvents, zes_event_type_flags_t* pEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverEventListenExEpilogue( ze_driver_handle_t hDriver, uint64_t timeout, uint32_t count, zes_device_handle_t* phDevices, uint32_t* pNumDeviceEvents, zes_event_type_flags_t* pEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumFabricPortsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_fabric_port_handle_t* phPort ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumFabricPortsEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_fabric_port_handle_t* phPort , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetPropertiesPrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetPropertiesEpilogue( zes_fabric_port_handle_t hPort, zes_fabric_port_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetLinkTypePrologue( zes_fabric_port_handle_t hPort, zes_fabric_link_type_t* pLinkType ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetLinkTypeEpilogue( zes_fabric_port_handle_t hPort, zes_fabric_link_type_t* pLinkType , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetConfigPrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_config_t* pConfig ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetConfigEpilogue( zes_fabric_port_handle_t hPort, zes_fabric_port_config_t* pConfig , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortSetConfigPrologue( zes_fabric_port_handle_t hPort, const zes_fabric_port_config_t* pConfig ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortSetConfigEpilogue( zes_fabric_port_handle_t hPort, const zes_fabric_port_config_t* pConfig , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetStatePrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_state_t* pState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetStateEpilogue( zes_fabric_port_handle_t hPort, zes_fabric_port_state_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetThroughputPrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_throughput_t* pThroughput ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetThroughputEpilogue( zes_fabric_port_handle_t hPort, zes_fabric_port_throughput_t* pThroughput , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetFabricErrorCountersPrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_error_counters_t* pErrors ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetFabricErrorCountersEpilogue( zes_fabric_port_handle_t hPort, zes_fabric_port_error_counters_t* pErrors , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetMultiPortThroughputPrologue( zes_device_handle_t hDevice, uint32_t numPorts, zes_fabric_port_handle_t* phPort, zes_fabric_port_throughput_t** pThroughput ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFabricPortGetMultiPortThroughputEpilogue( zes_device_handle_t hDevice, uint32_t numPorts, zes_fabric_port_handle_t* phPort, zes_fabric_port_throughput_t** pThroughput , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumFansPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_fan_handle_t* phFan ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumFansEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_fan_handle_t* phFan , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFanGetPropertiesPrologue( zes_fan_handle_t hFan, zes_fan_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFanGetPropertiesEpilogue( zes_fan_handle_t hFan, zes_fan_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFanGetConfigPrologue( zes_fan_handle_t hFan, zes_fan_config_t* pConfig ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFanGetConfigEpilogue( zes_fan_handle_t hFan, zes_fan_config_t* pConfig , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFanSetDefaultModePrologue( zes_fan_handle_t hFan ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFanSetDefaultModeEpilogue( zes_fan_handle_t hFan , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFanSetFixedSpeedModePrologue( zes_fan_handle_t hFan, const zes_fan_speed_t* speed ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFanSetFixedSpeedModeEpilogue( zes_fan_handle_t hFan, const zes_fan_speed_t* speed , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFanSetSpeedTableModePrologue( zes_fan_handle_t hFan, const zes_fan_speed_table_t* speedTable ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFanSetSpeedTableModeEpilogue( zes_fan_handle_t hFan, const zes_fan_speed_table_t* speedTable , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFanGetStatePrologue( zes_fan_handle_t hFan, zes_fan_speed_units_t units, int32_t* pSpeed ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFanGetStateEpilogue( zes_fan_handle_t hFan, zes_fan_speed_units_t units, int32_t* pSpeed , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumFirmwaresPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_firmware_handle_t* phFirmware ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumFirmwaresEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_firmware_handle_t* phFirmware , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareGetPropertiesPrologue( zes_firmware_handle_t hFirmware, zes_firmware_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareGetPropertiesEpilogue( zes_firmware_handle_t hFirmware, zes_firmware_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareFlashPrologue( zes_firmware_handle_t hFirmware, void* pImage, uint32_t size ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareFlashEpilogue( zes_firmware_handle_t hFirmware, void* pImage, uint32_t size , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareGetFlashProgressPrologue( zes_firmware_handle_t hFirmware, uint32_t* pCompletionPercent ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareGetFlashProgressEpilogue( zes_firmware_handle_t hFirmware, uint32_t* pCompletionPercent , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareGetConsoleLogsPrologue( zes_firmware_handle_t hFirmware, size_t* pSize, char* pFirmwareLog ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareGetConsoleLogsEpilogue( zes_firmware_handle_t hFirmware, size_t* pSize, char* pFirmwareLog , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumFrequencyDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_freq_handle_t* phFrequency ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumFrequencyDomainsEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_freq_handle_t* phFrequency , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyGetPropertiesPrologue( zes_freq_handle_t hFrequency, zes_freq_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyGetPropertiesEpilogue( zes_freq_handle_t hFrequency, zes_freq_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyGetAvailableClocksPrologue( zes_freq_handle_t hFrequency, uint32_t* pCount, double* phFrequency ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyGetAvailableClocksEpilogue( zes_freq_handle_t hFrequency, uint32_t* pCount, double* phFrequency , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyGetRangePrologue( zes_freq_handle_t hFrequency, zes_freq_range_t* pLimits ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyGetRangeEpilogue( zes_freq_handle_t hFrequency, zes_freq_range_t* pLimits , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencySetRangePrologue( zes_freq_handle_t hFrequency, const zes_freq_range_t* pLimits ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencySetRangeEpilogue( zes_freq_handle_t hFrequency, const zes_freq_range_t* pLimits , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyGetStatePrologue( zes_freq_handle_t hFrequency, zes_freq_state_t* pState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyGetStateEpilogue( zes_freq_handle_t hFrequency, zes_freq_state_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyGetThrottleTimePrologue( zes_freq_handle_t hFrequency, zes_freq_throttle_time_t* pThrottleTime ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyGetThrottleTimeEpilogue( zes_freq_handle_t hFrequency, zes_freq_throttle_time_t* pThrottleTime , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcGetCapabilitiesPrologue( zes_freq_handle_t hFrequency, zes_oc_capabilities_t* pOcCapabilities ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcGetCapabilitiesEpilogue( zes_freq_handle_t hFrequency, zes_oc_capabilities_t* pOcCapabilities , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcGetFrequencyTargetPrologue( zes_freq_handle_t hFrequency, double* pCurrentOcFrequency ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcGetFrequencyTargetEpilogue( zes_freq_handle_t hFrequency, double* pCurrentOcFrequency , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcSetFrequencyTargetPrologue( zes_freq_handle_t hFrequency, double CurrentOcFrequency ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcSetFrequencyTargetEpilogue( zes_freq_handle_t hFrequency, double CurrentOcFrequency , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcGetVoltageTargetPrologue( zes_freq_handle_t hFrequency, double* pCurrentVoltageTarget, double* pCurrentVoltageOffset ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcGetVoltageTargetEpilogue( zes_freq_handle_t hFrequency, double* pCurrentVoltageTarget, double* pCurrentVoltageOffset , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcSetVoltageTargetPrologue( zes_freq_handle_t hFrequency, double CurrentVoltageTarget, double CurrentVoltageOffset ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcSetVoltageTargetEpilogue( zes_freq_handle_t hFrequency, double CurrentVoltageTarget, double CurrentVoltageOffset , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcSetModePrologue( zes_freq_handle_t hFrequency, zes_oc_mode_t CurrentOcMode ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcSetModeEpilogue( zes_freq_handle_t hFrequency, zes_oc_mode_t CurrentOcMode , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcGetModePrologue( zes_freq_handle_t hFrequency, zes_oc_mode_t* pCurrentOcMode ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcGetModeEpilogue( zes_freq_handle_t hFrequency, zes_oc_mode_t* pCurrentOcMode , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcGetIccMaxPrologue( zes_freq_handle_t hFrequency, double* pOcIccMax ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcGetIccMaxEpilogue( zes_freq_handle_t hFrequency, double* pOcIccMax , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcSetIccMaxPrologue( zes_freq_handle_t hFrequency, double ocIccMax ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcSetIccMaxEpilogue( zes_freq_handle_t hFrequency, double ocIccMax , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcGetTjMaxPrologue( zes_freq_handle_t hFrequency, double* pOcTjMax ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcGetTjMaxEpilogue( zes_freq_handle_t hFrequency, double* pOcTjMax , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcSetTjMaxPrologue( zes_freq_handle_t hFrequency, double ocTjMax ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFrequencyOcSetTjMaxEpilogue( zes_freq_handle_t hFrequency, double ocTjMax , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumLedsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_led_handle_t* phLed ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumLedsEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_led_handle_t* phLed , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesLedGetPropertiesPrologue( zes_led_handle_t hLed, zes_led_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesLedGetPropertiesEpilogue( zes_led_handle_t hLed, zes_led_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesLedGetStatePrologue( zes_led_handle_t hLed, zes_led_state_t* pState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesLedGetStateEpilogue( zes_led_handle_t hLed, zes_led_state_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesLedSetStatePrologue( zes_led_handle_t hLed, ze_bool_t enable ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesLedSetStateEpilogue( zes_led_handle_t hLed, ze_bool_t enable , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesLedSetColorPrologue( zes_led_handle_t hLed, const zes_led_color_t* pColor ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesLedSetColorEpilogue( zes_led_handle_t hLed, const zes_led_color_t* pColor , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumMemoryModulesPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_mem_handle_t* phMemory ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumMemoryModulesEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_mem_handle_t* phMemory , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesMemoryGetPropertiesPrologue( zes_mem_handle_t hMemory, zes_mem_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesMemoryGetPropertiesEpilogue( zes_mem_handle_t hMemory, zes_mem_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesMemoryGetStatePrologue( zes_mem_handle_t hMemory, zes_mem_state_t* pState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesMemoryGetStateEpilogue( zes_mem_handle_t hMemory, zes_mem_state_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesMemoryGetBandwidthPrologue( zes_mem_handle_t hMemory, zes_mem_bandwidth_t* pBandwidth ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesMemoryGetBandwidthEpilogue( zes_mem_handle_t hMemory, zes_mem_bandwidth_t* pBandwidth , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumPerformanceFactorDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_perf_handle_t* phPerf ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumPerformanceFactorDomainsEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_perf_handle_t* phPerf , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPerformanceFactorGetPropertiesPrologue( zes_perf_handle_t hPerf, zes_perf_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPerformanceFactorGetPropertiesEpilogue( zes_perf_handle_t hPerf, zes_perf_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPerformanceFactorGetConfigPrologue( zes_perf_handle_t hPerf, double* pFactor ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPerformanceFactorGetConfigEpilogue( zes_perf_handle_t hPerf, double* pFactor , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPerformanceFactorSetConfigPrologue( zes_perf_handle_t hPerf, double factor ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPerformanceFactorSetConfigEpilogue( zes_perf_handle_t hPerf, double factor , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumPowerDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_pwr_handle_t* phPower ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumPowerDomainsEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_pwr_handle_t* phPower , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetCardPowerDomainPrologue( zes_device_handle_t hDevice, zes_pwr_handle_t* phPower ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetCardPowerDomainEpilogue( zes_device_handle_t hDevice, zes_pwr_handle_t* phPower , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerGetPropertiesPrologue( zes_pwr_handle_t hPower, zes_power_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerGetPropertiesEpilogue( zes_pwr_handle_t hPower, zes_power_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerGetEnergyCounterPrologue( zes_pwr_handle_t hPower, zes_power_energy_counter_t* pEnergy ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerGetEnergyCounterEpilogue( zes_pwr_handle_t hPower, zes_power_energy_counter_t* pEnergy , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerGetLimitsPrologue( zes_pwr_handle_t hPower, zes_power_sustained_limit_t* pSustained, zes_power_burst_limit_t* pBurst, zes_power_peak_limit_t* pPeak ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerGetLimitsEpilogue( zes_pwr_handle_t hPower, zes_power_sustained_limit_t* pSustained, zes_power_burst_limit_t* pBurst, zes_power_peak_limit_t* pPeak , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerSetLimitsPrologue( zes_pwr_handle_t hPower, const zes_power_sustained_limit_t* pSustained, const zes_power_burst_limit_t* pBurst, const zes_power_peak_limit_t* pPeak ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerSetLimitsEpilogue( zes_pwr_handle_t hPower, const zes_power_sustained_limit_t* pSustained, const zes_power_burst_limit_t* pBurst, const zes_power_peak_limit_t* pPeak , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerGetEnergyThresholdPrologue( zes_pwr_handle_t hPower, zes_energy_threshold_t* pThreshold ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerGetEnergyThresholdEpilogue( zes_pwr_handle_t hPower, zes_energy_threshold_t* pThreshold , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerSetEnergyThresholdPrologue( zes_pwr_handle_t hPower, double threshold ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerSetEnergyThresholdEpilogue( zes_pwr_handle_t hPower, double threshold , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumPsusPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_psu_handle_t* phPsu ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumPsusEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_psu_handle_t* phPsu , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPsuGetPropertiesPrologue( zes_psu_handle_t hPsu, zes_psu_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPsuGetPropertiesEpilogue( zes_psu_handle_t hPsu, zes_psu_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPsuGetStatePrologue( zes_psu_handle_t hPsu, zes_psu_state_t* pState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPsuGetStateEpilogue( zes_psu_handle_t hPsu, zes_psu_state_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumRasErrorSetsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_ras_handle_t* phRas ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumRasErrorSetsEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_ras_handle_t* phRas , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasGetPropertiesPrologue( zes_ras_handle_t hRas, zes_ras_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasGetPropertiesEpilogue( zes_ras_handle_t hRas, zes_ras_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasGetConfigPrologue( zes_ras_handle_t hRas, zes_ras_config_t* pConfig ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasGetConfigEpilogue( zes_ras_handle_t hRas, zes_ras_config_t* pConfig , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasSetConfigPrologue( zes_ras_handle_t hRas, const zes_ras_config_t* pConfig ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasSetConfigEpilogue( zes_ras_handle_t hRas, const zes_ras_config_t* pConfig , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasGetStatePrologue( zes_ras_handle_t hRas, ze_bool_t clear, zes_ras_state_t* pState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasGetStateEpilogue( zes_ras_handle_t hRas, ze_bool_t clear, zes_ras_state_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumSchedulersPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_sched_handle_t* phScheduler ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumSchedulersEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_sched_handle_t* phScheduler , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerGetPropertiesPrologue( zes_sched_handle_t hScheduler, zes_sched_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerGetPropertiesEpilogue( zes_sched_handle_t hScheduler, zes_sched_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerGetCurrentModePrologue( zes_sched_handle_t hScheduler, zes_sched_mode_t* pMode ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerGetCurrentModeEpilogue( zes_sched_handle_t hScheduler, zes_sched_mode_t* pMode , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerGetTimeoutModePropertiesPrologue( zes_sched_handle_t hScheduler, ze_bool_t getDefaults, zes_sched_timeout_properties_t* pConfig ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerGetTimeoutModePropertiesEpilogue( zes_sched_handle_t hScheduler, ze_bool_t getDefaults, zes_sched_timeout_properties_t* pConfig , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerGetTimesliceModePropertiesPrologue( zes_sched_handle_t hScheduler, ze_bool_t getDefaults, zes_sched_timeslice_properties_t* pConfig ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerGetTimesliceModePropertiesEpilogue( zes_sched_handle_t hScheduler, ze_bool_t getDefaults, zes_sched_timeslice_properties_t* pConfig , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerSetTimeoutModePrologue( zes_sched_handle_t hScheduler, zes_sched_timeout_properties_t* pProperties, ze_bool_t* pNeedReload ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerSetTimeoutModeEpilogue( zes_sched_handle_t hScheduler, zes_sched_timeout_properties_t* pProperties, ze_bool_t* pNeedReload , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerSetTimesliceModePrologue( zes_sched_handle_t hScheduler, zes_sched_timeslice_properties_t* pProperties, ze_bool_t* pNeedReload ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerSetTimesliceModeEpilogue( zes_sched_handle_t hScheduler, zes_sched_timeslice_properties_t* pProperties, ze_bool_t* pNeedReload , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerSetExclusiveModePrologue( zes_sched_handle_t hScheduler, ze_bool_t* pNeedReload ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerSetExclusiveModeEpilogue( zes_sched_handle_t hScheduler, ze_bool_t* pNeedReload , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerSetComputeUnitDebugModePrologue( zes_sched_handle_t hScheduler, ze_bool_t* pNeedReload ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesSchedulerSetComputeUnitDebugModeEpilogue( zes_sched_handle_t hScheduler, ze_bool_t* pNeedReload , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumStandbyDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_standby_handle_t* phStandby ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumStandbyDomainsEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_standby_handle_t* phStandby , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesStandbyGetPropertiesPrologue( zes_standby_handle_t hStandby, zes_standby_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesStandbyGetPropertiesEpilogue( zes_standby_handle_t hStandby, zes_standby_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesStandbyGetModePrologue( zes_standby_handle_t hStandby, zes_standby_promo_mode_t* pMode ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesStandbyGetModeEpilogue( zes_standby_handle_t hStandby, zes_standby_promo_mode_t* pMode , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesStandbySetModePrologue( zes_standby_handle_t hStandby, zes_standby_promo_mode_t mode ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesStandbySetModeEpilogue( zes_standby_handle_t hStandby, zes_standby_promo_mode_t mode , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumTemperatureSensorsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_temp_handle_t* phTemperature ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumTemperatureSensorsEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_temp_handle_t* phTemperature , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesTemperatureGetPropertiesPrologue( zes_temp_handle_t hTemperature, zes_temp_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesTemperatureGetPropertiesEpilogue( zes_temp_handle_t hTemperature, zes_temp_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesTemperatureGetConfigPrologue( zes_temp_handle_t hTemperature, zes_temp_config_t* pConfig ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesTemperatureGetConfigEpilogue( zes_temp_handle_t hTemperature, zes_temp_config_t* pConfig , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesTemperatureSetConfigPrologue( zes_temp_handle_t hTemperature, const zes_temp_config_t* pConfig ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesTemperatureSetConfigEpilogue( zes_temp_handle_t hTemperature, const zes_temp_config_t* pConfig , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesTemperatureGetStatePrologue( zes_temp_handle_t hTemperature, double* pTemperature ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesTemperatureGetStateEpilogue( zes_temp_handle_t hTemperature, double* pTemperature , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerGetLimitsExtPrologue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerGetLimitsExtEpilogue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerSetLimitsExtPrologue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesPowerSetLimitsExtEpilogue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesEngineGetActivityExtPrologue( zes_engine_handle_t hEngine, uint32_t* pCount, zes_engine_stats_t* pStats ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesEngineGetActivityExtEpilogue( zes_engine_handle_t hEngine, uint32_t* pCount, zes_engine_stats_t* pStats , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasGetStateExpPrologue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_state_exp_t* pState ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasGetStateExpEpilogue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_state_exp_t* pState , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasClearStateExpPrologue( zes_ras_handle_t hRas, zes_ras_error_category_exp_t category ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesRasClearStateExpEpilogue( zes_ras_handle_t hRas, zes_ras_error_category_exp_t category , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareGetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware, char* pVersion ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareGetSecurityVersionExpEpilogue( zes_firmware_handle_t hFirmware, char* pVersion , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareSetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesFirmwareSetSecurityVersionExpEpilogue( zes_firmware_handle_t hFirmware , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetSubDevicePropertiesExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_subdevice_exp_properties_t* pSubdeviceProps ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceGetSubDevicePropertiesExpEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_subdevice_exp_properties_t* pSubdeviceProps , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverGetDeviceByUuidExpPrologue( zes_driver_handle_t hDriver, zes_uuid_t uuid, zes_device_handle_t* phDevice, ze_bool_t* onSubdevice, uint32_t* subdeviceId ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDriverGetDeviceByUuidExpEpilogue( zes_driver_handle_t hDriver, zes_uuid_t uuid, zes_device_handle_t* phDevice, ze_bool_t* onSubdevice, uint32_t* subdeviceId , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumActiveVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumActiveVFExpEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFPropertiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFPropertiesExpEpilogue( zes_vf_handle_t hVFhandle, zes_vf_exp_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFMemoryUtilizationExpPrologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp_t* pMemUtil ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFMemoryUtilizationExpEpilogue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp_t* pMemUtil , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFEngineUtilizationExpPrologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp_t* pEngineUtil ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFEngineUtilizationExpEpilogue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp_t* pEngineUtil , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementSetVFTelemetryModeExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flags, ze_bool_t enable ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementSetVFTelemetryModeExpEpilogue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flags, ze_bool_t enable , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flag, uint64_t samplingInterval ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementSetVFTelemetrySamplingIntervalExpEpilogue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flag, uint64_t samplingInterval , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumEnabledVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesDeviceEnumEnabledVFExpEpilogue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFCapabilitiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_capabilities_t* pCapability ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFCapabilitiesExpEpilogue( zes_vf_handle_t hVFhandle, zes_vf_exp_capabilities_t* pCapability , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFMemoryUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp2_t* pMemUtil ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFMemoryUtilizationExp2Epilogue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp2_t* pMemUtil , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFEngineUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp2_t* pEngineUtil ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFEngineUtilizationExp2Epilogue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp2_t* pEngineUtil , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFCapabilitiesExp2Prologue( zes_vf_handle_t hVFhandle, zes_vf_exp2_capabilities_t* pCapability ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zesVFManagementGetVFCapabilitiesExp2Epilogue( zes_vf_handle_t hVFhandle, zes_vf_exp2_capabilities_t* pCapability , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ~ZESValidationEntryPoints() {} }; }level-zero-1.20.6/source/layers/validation/common/zet_entry_points.h000066400000000000000000000672121475521542100257130ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See entry_points.h.mako for modifications * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_entry_points.h * */ #pragma once #include "zet_api.h" namespace validation_layer { class ZETValidationEntryPoints { public: virtual ze_result_t zetModuleGetDebugInfoPrologue( zet_module_handle_t hModule, zet_module_debug_info_format_t format, size_t* pSize, uint8_t* pDebugInfo ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetModuleGetDebugInfoEpilogue( zet_module_handle_t hModule, zet_module_debug_info_format_t format, size_t* pSize, uint8_t* pDebugInfo , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDeviceGetDebugPropertiesPrologue( zet_device_handle_t hDevice, zet_device_debug_properties_t* pDebugProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDeviceGetDebugPropertiesEpilogue( zet_device_handle_t hDevice, zet_device_debug_properties_t* pDebugProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugAttachPrologue( zet_device_handle_t hDevice, const zet_debug_config_t* config, zet_debug_session_handle_t* phDebug ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugAttachEpilogue( zet_device_handle_t hDevice, const zet_debug_config_t* config, zet_debug_session_handle_t* phDebug , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugDetachPrologue( zet_debug_session_handle_t hDebug ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugDetachEpilogue( zet_debug_session_handle_t hDebug , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugReadEventPrologue( zet_debug_session_handle_t hDebug, uint64_t timeout, zet_debug_event_t* event ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugReadEventEpilogue( zet_debug_session_handle_t hDebug, uint64_t timeout, zet_debug_event_t* event , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugAcknowledgeEventPrologue( zet_debug_session_handle_t hDebug, const zet_debug_event_t* event ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugAcknowledgeEventEpilogue( zet_debug_session_handle_t hDebug, const zet_debug_event_t* event , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugInterruptPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugInterruptEpilogue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugResumePrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugResumeEpilogue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugReadMemoryPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, const zet_debug_memory_space_desc_t* desc, size_t size, void* buffer ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugReadMemoryEpilogue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, const zet_debug_memory_space_desc_t* desc, size_t size, void* buffer , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugWriteMemoryPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, const zet_debug_memory_space_desc_t* desc, size_t size, const void* buffer ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugWriteMemoryEpilogue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, const zet_debug_memory_space_desc_t* desc, size_t size, const void* buffer , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugGetRegisterSetPropertiesPrologue( zet_device_handle_t hDevice, uint32_t* pCount, zet_debug_regset_properties_t* pRegisterSetProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugGetRegisterSetPropertiesEpilogue( zet_device_handle_t hDevice, uint32_t* pCount, zet_debug_regset_properties_t* pRegisterSetProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugGetThreadRegisterSetPropertiesPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t* pCount, zet_debug_regset_properties_t* pRegisterSetProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugGetThreadRegisterSetPropertiesEpilogue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t* pCount, zet_debug_regset_properties_t* pRegisterSetProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugReadRegistersPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void* pRegisterValues ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugReadRegistersEpilogue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void* pRegisterValues , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugWriteRegistersPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void* pRegisterValues ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDebugWriteRegistersEpilogue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void* pRegisterValues , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupGetPrologue( zet_device_handle_t hDevice, uint32_t* pCount, zet_metric_group_handle_t* phMetricGroups ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupGetEpilogue( zet_device_handle_t hDevice, uint32_t* pCount, zet_metric_group_handle_t* phMetricGroups , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupGetPropertiesPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupGetPropertiesEpilogue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupCalculateMetricValuesPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t* pRawData, uint32_t* pMetricValueCount, zet_typed_value_t* pMetricValues ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupCalculateMetricValuesEpilogue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t* pRawData, uint32_t* pMetricValueCount, zet_typed_value_t* pMetricValues , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGetPrologue( zet_metric_group_handle_t hMetricGroup, uint32_t* pCount, zet_metric_handle_t* phMetrics ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGetEpilogue( zet_metric_group_handle_t hMetricGroup, uint32_t* pCount, zet_metric_handle_t* phMetrics , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGetPropertiesPrologue( zet_metric_handle_t hMetric, zet_metric_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGetPropertiesEpilogue( zet_metric_handle_t hMetric, zet_metric_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetContextActivateMetricGroupsPrologue( zet_context_handle_t hContext, zet_device_handle_t hDevice, uint32_t count, zet_metric_group_handle_t* phMetricGroups ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetContextActivateMetricGroupsEpilogue( zet_context_handle_t hContext, zet_device_handle_t hDevice, uint32_t count, zet_metric_group_handle_t* phMetricGroups , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricStreamerOpenPrologue( zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, zet_metric_streamer_desc_t* desc, ze_event_handle_t hNotificationEvent, zet_metric_streamer_handle_t* phMetricStreamer ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricStreamerOpenEpilogue( zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, zet_metric_streamer_desc_t* desc, ze_event_handle_t hNotificationEvent, zet_metric_streamer_handle_t* phMetricStreamer , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetCommandListAppendMetricStreamerMarkerPrologue( zet_command_list_handle_t hCommandList, zet_metric_streamer_handle_t hMetricStreamer, uint32_t value ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetCommandListAppendMetricStreamerMarkerEpilogue( zet_command_list_handle_t hCommandList, zet_metric_streamer_handle_t hMetricStreamer, uint32_t value , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricStreamerClosePrologue( zet_metric_streamer_handle_t hMetricStreamer ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricStreamerCloseEpilogue( zet_metric_streamer_handle_t hMetricStreamer , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricStreamerReadDataPrologue( zet_metric_streamer_handle_t hMetricStreamer, uint32_t maxReportCount, size_t* pRawDataSize, uint8_t* pRawData ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricStreamerReadDataEpilogue( zet_metric_streamer_handle_t hMetricStreamer, uint32_t maxReportCount, size_t* pRawDataSize, uint8_t* pRawData , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricQueryPoolCreatePrologue( zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, const zet_metric_query_pool_desc_t* desc, zet_metric_query_pool_handle_t* phMetricQueryPool ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricQueryPoolCreateEpilogue( zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, const zet_metric_query_pool_desc_t* desc, zet_metric_query_pool_handle_t* phMetricQueryPool , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricQueryPoolDestroyPrologue( zet_metric_query_pool_handle_t hMetricQueryPool ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricQueryPoolDestroyEpilogue( zet_metric_query_pool_handle_t hMetricQueryPool , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricQueryCreatePrologue( zet_metric_query_pool_handle_t hMetricQueryPool, uint32_t index, zet_metric_query_handle_t* phMetricQuery ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricQueryCreateEpilogue( zet_metric_query_pool_handle_t hMetricQueryPool, uint32_t index, zet_metric_query_handle_t* phMetricQuery , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricQueryDestroyPrologue( zet_metric_query_handle_t hMetricQuery ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricQueryDestroyEpilogue( zet_metric_query_handle_t hMetricQuery , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricQueryResetPrologue( zet_metric_query_handle_t hMetricQuery ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricQueryResetEpilogue( zet_metric_query_handle_t hMetricQuery , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetCommandListAppendMetricQueryBeginPrologue( zet_command_list_handle_t hCommandList, zet_metric_query_handle_t hMetricQuery ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetCommandListAppendMetricQueryBeginEpilogue( zet_command_list_handle_t hCommandList, zet_metric_query_handle_t hMetricQuery , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetCommandListAppendMetricQueryEndPrologue( zet_command_list_handle_t hCommandList, zet_metric_query_handle_t hMetricQuery, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetCommandListAppendMetricQueryEndEpilogue( zet_command_list_handle_t hCommandList, zet_metric_query_handle_t hMetricQuery, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetCommandListAppendMetricMemoryBarrierPrologue( zet_command_list_handle_t hCommandList ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetCommandListAppendMetricMemoryBarrierEpilogue( zet_command_list_handle_t hCommandList , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricQueryGetDataPrologue( zet_metric_query_handle_t hMetricQuery, size_t* pRawDataSize, uint8_t* pRawData ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricQueryGetDataEpilogue( zet_metric_query_handle_t hMetricQuery, size_t* pRawDataSize, uint8_t* pRawData , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetKernelGetProfileInfoPrologue( zet_kernel_handle_t hKernel, zet_profile_properties_t* pProfileProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetKernelGetProfileInfoEpilogue( zet_kernel_handle_t hKernel, zet_profile_properties_t* pProfileProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetTracerExpCreatePrologue( zet_context_handle_t hContext, const zet_tracer_exp_desc_t* desc, zet_tracer_exp_handle_t* phTracer ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetTracerExpCreateEpilogue( zet_context_handle_t hContext, const zet_tracer_exp_desc_t* desc, zet_tracer_exp_handle_t* phTracer , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetTracerExpDestroyPrologue( zet_tracer_exp_handle_t hTracer ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetTracerExpDestroyEpilogue( zet_tracer_exp_handle_t hTracer , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetTracerExpSetProloguesPrologue( zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t* pCoreCbs ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetTracerExpSetProloguesEpilogue( zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t* pCoreCbs , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetTracerExpSetEpiloguesPrologue( zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t* pCoreCbs ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetTracerExpSetEpiloguesEpilogue( zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t* pCoreCbs , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetTracerExpSetEnabledPrologue( zet_tracer_exp_handle_t hTracer, ze_bool_t enable ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetTracerExpSetEnabledEpilogue( zet_tracer_exp_handle_t hTracer, ze_bool_t enable , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDeviceGetConcurrentMetricGroupsExpPrologue( zet_device_handle_t hDevice, uint32_t metricGroupCount, zet_metric_group_handle_t * phMetricGroups, uint32_t * pMetricGroupsCountPerConcurrentGroup, uint32_t * pConcurrentGroupCount ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDeviceGetConcurrentMetricGroupsExpEpilogue( zet_device_handle_t hDevice, uint32_t metricGroupCount, zet_metric_group_handle_t * phMetricGroups, uint32_t * pMetricGroupsCountPerConcurrentGroup, uint32_t * pConcurrentGroupCount , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerCreateExpPrologue( zet_context_handle_t hContext, zet_device_handle_t hDevice, uint32_t metricGroupCount, zet_metric_group_handle_t* phMetricGroups, zet_metric_tracer_exp_desc_t* desc, ze_event_handle_t hNotificationEvent, zet_metric_tracer_exp_handle_t* phMetricTracer ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerCreateExpEpilogue( zet_context_handle_t hContext, zet_device_handle_t hDevice, uint32_t metricGroupCount, zet_metric_group_handle_t* phMetricGroups, zet_metric_tracer_exp_desc_t* desc, ze_event_handle_t hNotificationEvent, zet_metric_tracer_exp_handle_t* phMetricTracer , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerDestroyExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerDestroyExpEpilogue( zet_metric_tracer_exp_handle_t hMetricTracer , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerEnableExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ze_bool_t synchronous ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerEnableExpEpilogue( zet_metric_tracer_exp_handle_t hMetricTracer, ze_bool_t synchronous , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerDisableExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ze_bool_t synchronous ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerDisableExpEpilogue( zet_metric_tracer_exp_handle_t hMetricTracer, ze_bool_t synchronous , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerReadDataExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, size_t* pRawDataSize, uint8_t* pRawData ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerReadDataExpEpilogue( zet_metric_tracer_exp_handle_t hMetricTracer, size_t* pRawDataSize, uint8_t* pRawData , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricDecoderCreateExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, zet_metric_decoder_exp_handle_t* phMetricDecoder ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricDecoderCreateExpEpilogue( zet_metric_tracer_exp_handle_t hMetricTracer, zet_metric_decoder_exp_handle_t* phMetricDecoder , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricDecoderDestroyExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricDecoderDestroyExpEpilogue( zet_metric_decoder_exp_handle_t phMetricDecoder , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricDecoderGetDecodableMetricsExpPrologue( zet_metric_decoder_exp_handle_t hMetricDecoder, uint32_t* pCount, zet_metric_handle_t* phMetrics ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricDecoderGetDecodableMetricsExpEpilogue( zet_metric_decoder_exp_handle_t hMetricDecoder, uint32_t* pCount, zet_metric_handle_t* phMetrics , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerDecodeExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder, size_t* pRawDataSize, uint8_t* pRawData, uint32_t metricsCount, zet_metric_handle_t* phMetrics, uint32_t* pSetCount, uint32_t* pMetricEntriesCountPerSet, uint32_t* pMetricEntriesCount, zet_metric_entry_exp_t* pMetricEntries ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricTracerDecodeExpEpilogue( zet_metric_decoder_exp_handle_t phMetricDecoder, size_t* pRawDataSize, uint8_t* pRawData, uint32_t metricsCount, zet_metric_handle_t* phMetrics, uint32_t* pSetCount, uint32_t* pMetricEntriesCountPerSet, uint32_t* pMetricEntriesCount, zet_metric_entry_exp_t* pMetricEntries , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupCalculateMultipleMetricValuesExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t* pRawData, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupCalculateMultipleMetricValuesExpEpilogue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t* pRawData, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupGetGlobalTimestampsExpPrologue( zet_metric_group_handle_t hMetricGroup, ze_bool_t synchronizedWithHost, uint64_t* globalTimestamp, uint64_t* metricTimestamp ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupGetGlobalTimestampsExpEpilogue( zet_metric_group_handle_t hMetricGroup, ze_bool_t synchronizedWithHost, uint64_t* globalTimestamp, uint64_t* metricTimestamp , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupGetExportDataExpPrologue( zet_metric_group_handle_t hMetricGroup, const uint8_t* pRawData, size_t rawDataSize, size_t* pExportDataSize, uint8_t * pExportData ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupGetExportDataExpEpilogue( zet_metric_group_handle_t hMetricGroup, const uint8_t* pRawData, size_t rawDataSize, size_t* pExportDataSize, uint8_t * pExportData , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupCalculateMetricExportDataExpPrologue( ze_driver_handle_t hDriver, zet_metric_group_calculation_type_t type, size_t exportDataSize, const uint8_t* pExportData, zet_metric_calculate_exp_desc_t* pCalculateDescriptor, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupCalculateMetricExportDataExpEpilogue( ze_driver_handle_t hDriver, zet_metric_group_calculation_type_t type, size_t exportDataSize, const uint8_t* pExportData, zet_metric_calculate_exp_desc_t* pCalculateDescriptor, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricProgrammableGetExpPrologue( zet_device_handle_t hDevice, uint32_t* pCount, zet_metric_programmable_exp_handle_t* phMetricProgrammables ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricProgrammableGetExpEpilogue( zet_device_handle_t hDevice, uint32_t* pCount, zet_metric_programmable_exp_handle_t* phMetricProgrammables , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricProgrammableGetPropertiesExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_exp_properties_t* pProperties ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricProgrammableGetPropertiesExpEpilogue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_exp_properties_t* pProperties , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricProgrammableGetParamInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t* pParameterCount, zet_metric_programmable_param_info_exp_t* pParameterInfo ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricProgrammableGetParamInfoExpEpilogue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t* pParameterCount, zet_metric_programmable_param_info_exp_t* pParameterInfo , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricProgrammableGetParamValueInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterOrdinal, uint32_t* pValueInfoCount, zet_metric_programmable_param_value_info_exp_t* pValueInfo ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricProgrammableGetParamValueInfoExpEpilogue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterOrdinal, uint32_t* pValueInfoCount, zet_metric_programmable_param_value_info_exp_t* pValueInfo , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricCreateFromProgrammableExp2Prologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterCount, zet_metric_programmable_param_value_exp_t* pParameterValues, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricCreateFromProgrammableExp2Epilogue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterCount, zet_metric_programmable_param_value_exp_t* pParameterValues, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricCreateFromProgrammableExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_param_value_exp_t* pParameterValues, uint32_t parameterCount, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricCreateFromProgrammableExpEpilogue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_param_value_exp_t* pParameterValues, uint32_t parameterCount, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDeviceCreateMetricGroupsFromMetricsExpPrologue( zet_device_handle_t hDevice, uint32_t metricCount, zet_metric_handle_t * phMetrics, const char * pMetricGroupNamePrefix, const char * pDescription, uint32_t * pMetricGroupCount, zet_metric_group_handle_t* phMetricGroup ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetDeviceCreateMetricGroupsFromMetricsExpEpilogue( zet_device_handle_t hDevice, uint32_t metricCount, zet_metric_handle_t * phMetrics, const char * pMetricGroupNamePrefix, const char * pDescription, uint32_t * pMetricGroupCount, zet_metric_group_handle_t* phMetricGroup , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupCreateExpPrologue( zet_device_handle_t hDevice, const char* pName, const char* pDescription, zet_metric_group_sampling_type_flags_t samplingType, zet_metric_group_handle_t* phMetricGroup ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupCreateExpEpilogue( zet_device_handle_t hDevice, const char* pName, const char* pDescription, zet_metric_group_sampling_type_flags_t samplingType, zet_metric_group_handle_t* phMetricGroup , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupAddMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric, size_t * pErrorStringSize, char* pErrorString ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupAddMetricExpEpilogue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric, size_t * pErrorStringSize, char* pErrorString , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupRemoveMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupRemoveMetricExpEpilogue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupCloseExpPrologue( zet_metric_group_handle_t hMetricGroup ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupCloseExpEpilogue( zet_metric_group_handle_t hMetricGroup , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupDestroyExpPrologue( zet_metric_group_handle_t hMetricGroup ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricGroupDestroyExpEpilogue( zet_metric_group_handle_t hMetricGroup , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricDestroyExpPrologue( zet_metric_handle_t hMetric ) {return ZE_RESULT_SUCCESS;} virtual ze_result_t zetMetricDestroyExpEpilogue( zet_metric_handle_t hMetric , ze_result_t result) {return ZE_RESULT_SUCCESS;} virtual ~ZETValidationEntryPoints() {} }; }level-zero-1.20.6/source/layers/validation/handle_lifetime_tracking/000077500000000000000000000000001475521542100256165ustar00rootroot00000000000000level-zero-1.20.6/source/layers/validation/handle_lifetime_tracking/CMakeLists.txt000066400000000000000000000006301475521542100303550ustar00rootroot00000000000000target_sources(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/handle_lifetime.h ${CMAKE_CURRENT_LIST_DIR}/ze_handle_lifetime.cpp ${CMAKE_CURRENT_LIST_DIR}/ze_handle_lifetime.h ${CMAKE_CURRENT_LIST_DIR}/zes_handle_lifetime.cpp ${CMAKE_CURRENT_LIST_DIR}/zes_handle_lifetime.h ${CMAKE_CURRENT_LIST_DIR}/zet_handle_lifetime.cpp ${CMAKE_CURRENT_LIST_DIR}/zet_handle_lifetime.h ) level-zero-1.20.6/source/layers/validation/handle_lifetime_tracking/handle_lifetime.h000066400000000000000000000621361475521542100311100ustar00rootroot00000000000000/* * Copyright (C) 2023 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include "ze_handle_lifetime.h" #include "zes_handle_lifetime.h" #include "zet_handle_lifetime.h" #include #include #include #include namespace validation_layer { typedef struct _zel_handle_state_t { bool is_open; } zel_handle_state_t; class HandleLifetimeValidation { public: ZEHandleLifetimeValidation zeHandleLifetime; ZESHandleLifetimeValidation zesHandleLifetime; ZETHandleLifetimeValidation zetHandleLifetime; // default methods template void addHandle(T handle) { // TODO : Log warning untrackedHandles++; defaultHandleStateMap.insert({static_cast(handle), nullptr}); } template void removeHandle(T handle) { // TODO: Log warning untrackedHandles--; defaultHandleStateMap.erase(static_cast(handle)); } template bool isHandleValid(T handle) { return defaultHandleStateMap.find(static_cast(handle)) != defaultHandleStateMap.end(); } template S get_handle_map(T handle) { if (std::is_same::value) { return contextHandleStateMap; } else if (std::is_same::value) { return driverHandleStateMap; } else { return defaultHandleStateMap; } } void addHandle(ze_context_handle_t handle) { contextHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_driver_handle_t handle) { driverHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_device_handle_t handle) { deviceHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_command_queue_handle_t handle) { commandQueueHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_command_list_handle_t handle, bool is_open = true) { commandListHandleStateMap.insert( {handle, std::make_unique()}); commandListHandleStateMap[handle]->is_open = is_open; } void addHandle(ze_fence_handle_t handle) { fenceHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_event_pool_handle_t handle) { eventPoolHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_event_handle_t handle) { eventHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_image_handle_t handle) { imageHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_module_handle_t handle) { moduleHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_module_build_log_handle_t handle) { moduleBuildLogHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_kernel_handle_t handle) { kernelHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_sampler_handle_t handle) { samplerHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_fabric_vertex_handle_t handle) { fabricVertexHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_fabric_edge_handle_t handle) { fabricEdgeHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_physical_mem_handle_t handle) { physicalMemHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_ipc_event_pool_handle_t handle) { ipcEventPoolHandleStateMap.insert({&handle, nullptr}); } void addHandle(ze_ipc_mem_handle_t handle) { ipcMemHandleStateMap.insert({&handle, nullptr}); } void addHandle(ze_external_memory_import_win32_handle_t &handle) { externalMemoryImportWin32HandleStateMap.insert({&handle, nullptr}); } void addHandle(ze_external_memory_export_win32_handle_t &handle) { externalMemoryExportWin32HandleStateMap.insert({&handle, nullptr}); } void addHandle(zet_metric_group_handle_t handle) { metricGroupHandleStateMap.insert({handle, nullptr}); } void addHandle(zet_metric_handle_t handle) { metricHandleStateMap.insert({handle, nullptr}); } void addHandle(zet_metric_streamer_handle_t handle) { metricStreamerHandleStateMap.insert({handle, nullptr}); } void addHandle(zet_metric_query_pool_handle_t handle) { metricQueryPoolHandleStateMap.insert({handle, nullptr}); } void addHandle(zet_metric_query_handle_t handle) { metricQueryHandleStateMap.insert({handle, nullptr}); } void addHandle(zet_tracer_exp_handle_t handle) { tracerExpHandleStateMap.insert({handle, nullptr}); } void addHandle(zet_debug_session_handle_t handle) { debugSessionHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_sched_handle_t handle) { schedHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_perf_handle_t handle) { perfHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_pwr_handle_t handle) { pwrHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_freq_handle_t handle) { freqHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_engine_handle_t handle) { engineHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_standby_handle_t handle) { standbyHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_firmware_handle_t handle) { firmwareHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_mem_handle_t handle) { memHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_fabric_port_handle_t handle) { fabricPortHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_temp_handle_t handle) { tempHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_psu_handle_t handle) { psuHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_fan_handle_t handle) { fanHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_led_handle_t handle) { ledHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_ras_handle_t handle) { rasHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_diag_handle_t handle) { diagHandleStateMap.insert({handle, nullptr}); } void addHandle(zes_overclock_handle_t handle) { overclockHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_rtas_parallel_operation_exp_handle_t handle) { rtasParallelOperationHandleStateMap.insert({handle, nullptr}); } void addHandle(ze_rtas_builder_exp_handle_t handle) { rtasBuilderHandleStateMap.insert({handle, nullptr}); } void removeHandle(ze_context_handle_t handle) { contextHandleStateMap.erase(handle); } void removeHandle(ze_driver_handle_t handle) { driverHandleStateMap.erase(handle); } void removeHandle(ze_device_handle_t handle) { deviceHandleStateMap.erase(handle); } void removeHandle(ze_command_queue_handle_t handle) { commandQueueHandleStateMap.erase(handle); } void removeHandle(ze_command_list_handle_t handle) { commandListHandleStateMap.erase(handle); } void removeHandle(ze_fence_handle_t handle) { fenceHandleStateMap.erase(handle); } void removeHandle(ze_event_pool_handle_t handle) { eventPoolHandleStateMap.erase(handle); } void removeHandle(ze_event_handle_t handle) { eventHandleStateMap.erase(handle); } void removeHandle(ze_image_handle_t handle) { imageHandleStateMap.erase(handle); } void removeHandle(ze_module_handle_t handle) { moduleHandleStateMap.erase(handle); } void removeHandle(ze_module_build_log_handle_t handle) { moduleBuildLogHandleStateMap.erase(handle); } void removeHandle(ze_kernel_handle_t handle) { kernelHandleStateMap.erase(handle); } void removeHandle(ze_sampler_handle_t handle) { samplerHandleStateMap.erase(handle); } void removeHandle(ze_physical_mem_handle_t handle) { physicalMemHandleStateMap.erase(handle); } void removeHandle(ze_fabric_vertex_handle_t handle) { fabricVertexHandleStateMap.erase(handle); } void removeHandle(ze_fabric_edge_handle_t handle) { fabricEdgeHandleStateMap.erase(handle); } void removeHandle(ze_ipc_mem_handle_t &handle) { ipcMemHandleStateMap.erase(&handle); } void removeHandle(ze_ipc_event_pool_handle_t &handle) { ipcEventPoolHandleStateMap.erase(&handle); } void removeHandle(ze_external_memory_export_win32_handle_t &handle) { externalMemoryExportWin32HandleStateMap.erase(&handle); } void removeHandle(ze_external_memory_import_win32_handle_t &handle) { externalMemoryImportWin32HandleStateMap.erase(&handle); } void removeHandle(zet_metric_group_handle_t handle) { metricGroupHandleStateMap.erase(handle); } void removeHandle(zet_metric_handle_t handle) { metricHandleStateMap.erase(handle); } void removeHandle(zet_metric_streamer_handle_t handle) { metricStreamerHandleStateMap.erase(handle); } void removeHandle(zet_metric_query_pool_handle_t handle) { metricQueryPoolHandleStateMap.erase(handle); } void removeHandle(zet_metric_query_handle_t handle) { metricQueryHandleStateMap.erase(handle); } void removeHandle(zet_tracer_exp_handle_t handle) { tracerExpHandleStateMap.erase(handle); } void removeHandle(zet_debug_session_handle_t handle) { debugSessionHandleStateMap.erase(handle); } void removeHandle(zes_sched_handle_t handle) { schedHandleStateMap.erase(handle); } void removeHandle(zes_perf_handle_t handle) { perfHandleStateMap.erase(handle); } void removeHandle(zes_pwr_handle_t handle) { pwrHandleStateMap.erase(handle); } void removeHandle(zes_freq_handle_t handle) { freqHandleStateMap.erase(handle); } void removeHandle(zes_engine_handle_t handle) { engineHandleStateMap.erase(handle); } void removeHandle(zes_standby_handle_t handle) { standbyHandleStateMap.erase(handle); } void removeHandle(zes_firmware_handle_t handle) { firmwareHandleStateMap.erase(handle); } void removeHandle(zes_mem_handle_t handle) { memHandleStateMap.erase(handle); } void removeHandle(zes_fabric_port_handle_t handle) { fabricPortHandleStateMap.erase(handle); } void removeHandle(zes_temp_handle_t handle) { tempHandleStateMap.erase(handle); } void removeHandle(zes_psu_handle_t handle) { psuHandleStateMap.erase(handle); } void removeHandle(zes_fan_handle_t handle) { fanHandleStateMap.erase(handle); } void removeHandle(zes_led_handle_t handle) { ledHandleStateMap.erase(handle); } void removeHandle(zes_ras_handle_t handle) { rasHandleStateMap.erase(handle); } void removeHandle(zes_diag_handle_t handle) { diagHandleStateMap.erase(handle); } void removeHandle(zes_overclock_handle_t handle) { overclockHandleStateMap.erase(handle); } void removeHandle(ze_rtas_parallel_operation_exp_handle_t handle) { rtasParallelOperationHandleStateMap.erase(handle); } void removeHandle(ze_rtas_builder_exp_handle_t handle) { rtasBuilderHandleStateMap.erase(handle); } bool isHandleValid(ze_context_handle_t handle) { return contextHandleStateMap.find(handle) != contextHandleStateMap.end(); } bool isHandleValid(ze_driver_handle_t handle) { return driverHandleStateMap.find(handle) != driverHandleStateMap.end(); } bool isHandleValid(ze_device_handle_t handle) { return deviceHandleStateMap.find(handle) != deviceHandleStateMap.end(); } bool isHandleValid(ze_command_queue_handle_t handle) { return commandQueueHandleStateMap.find(handle) != commandQueueHandleStateMap.end(); } bool isHandleValid(ze_command_list_handle_t handle) { return commandListHandleStateMap.find(handle) != commandListHandleStateMap.end(); } bool isHandleValid(ze_fence_handle_t handle) { return fenceHandleStateMap.find(handle) != fenceHandleStateMap.end(); } bool isHandleValid(ze_event_pool_handle_t handle) { return eventPoolHandleStateMap.find(handle) != eventPoolHandleStateMap.end(); } bool isHandleValid(ze_event_handle_t handle) { return eventHandleStateMap.find(handle) != eventHandleStateMap.end(); } bool isHandleValid(ze_image_handle_t handle) { return imageHandleStateMap.find(handle) != imageHandleStateMap.end(); } bool isHandleValid(ze_module_handle_t handle) { return moduleHandleStateMap.find(handle) != moduleHandleStateMap.end(); } bool isHandleValid(ze_module_build_log_handle_t handle) { return moduleBuildLogHandleStateMap.find(handle) != moduleBuildLogHandleStateMap.end(); } bool isHandleValid(ze_kernel_handle_t handle) { return kernelHandleStateMap.find(handle) != kernelHandleStateMap.end(); } bool isHandleValid(ze_sampler_handle_t handle) { return samplerHandleStateMap.find(handle) != samplerHandleStateMap.end(); } bool isHandleValid(ze_physical_mem_handle_t handle) { return physicalMemHandleStateMap.find(handle) != physicalMemHandleStateMap.end(); } bool isHandleValid(ze_fabric_vertex_handle_t handle) { return fabricVertexHandleStateMap.find(handle) != fabricVertexHandleStateMap.end(); } bool isHandleValid(ze_fabric_edge_handle_t handle) { return fabricEdgeHandleStateMap.find(handle) != fabricEdgeHandleStateMap.end(); } bool isHandleValid(ze_ipc_mem_handle_t &handle) { return ipcMemHandleStateMap.find(&handle) != ipcMemHandleStateMap.end(); } bool isHandleValid(ze_ipc_event_pool_handle_t &handle) { return ipcEventPoolHandleStateMap.find(&handle) != ipcEventPoolHandleStateMap.end(); } bool isHandleValid(ze_external_memory_import_win32_handle_t &handle) { return externalMemoryImportWin32HandleStateMap.find(&handle) != externalMemoryImportWin32HandleStateMap.end(); } bool isHandleValid(ze_external_memory_export_win32_handle_t &handle) { return externalMemoryExportWin32HandleStateMap.find(&handle) != externalMemoryExportWin32HandleStateMap.end(); } bool isHandleValid(zet_metric_group_handle_t handle) { return metricGroupHandleStateMap.find(handle) != metricGroupHandleStateMap.end(); } bool isHandleValid(zet_metric_handle_t handle) { return metricHandleStateMap.find(handle) != metricHandleStateMap.end(); } bool isHandleValid(zet_metric_streamer_handle_t handle) { return metricStreamerHandleStateMap.find(handle) != metricStreamerHandleStateMap.end(); } bool isHandleValid(zet_metric_query_pool_handle_t handle) { return metricQueryPoolHandleStateMap.find(handle) != metricQueryPoolHandleStateMap.end(); } bool isHandleValid(zet_metric_query_handle_t handle) { return metricQueryHandleStateMap.find(handle) != metricQueryHandleStateMap.end(); } bool isHandleValid(zet_tracer_exp_handle_t handle) { return tracerExpHandleStateMap.find(handle) != tracerExpHandleStateMap.end(); } bool isHandleValid(zet_debug_session_handle_t handle) { return debugSessionHandleStateMap.find(handle) != debugSessionHandleStateMap.end(); } bool isHandleValid(zes_sched_handle_t handle) { return schedHandleStateMap.find(handle) != schedHandleStateMap.end(); } bool isHandleValid(zes_perf_handle_t handle) { return perfHandleStateMap.find(handle) != perfHandleStateMap.end(); } bool isHandleValid(zes_pwr_handle_t handle) { return pwrHandleStateMap.find(handle) != pwrHandleStateMap.end(); } bool isHandleValid(zes_freq_handle_t handle) { return freqHandleStateMap.find(handle) != freqHandleStateMap.end(); } bool isHandleValid(zes_engine_handle_t handle) { return engineHandleStateMap.find(handle) != engineHandleStateMap.end(); } bool isHandleValid(zes_standby_handle_t handle) { return standbyHandleStateMap.find(handle) != standbyHandleStateMap.end(); } bool isHandleValid(zes_firmware_handle_t handle) { return firmwareHandleStateMap.find(handle) != firmwareHandleStateMap.end(); } bool isHandleValid(zes_mem_handle_t handle) { return memHandleStateMap.find(handle) != memHandleStateMap.end(); } bool isHandleValid(zes_fabric_port_handle_t handle) { return fabricPortHandleStateMap.find(handle) != fabricPortHandleStateMap.end(); } bool isHandleValid(zes_temp_handle_t handle) { return tempHandleStateMap.find(handle) != tempHandleStateMap.end(); } bool isHandleValid(zes_psu_handle_t handle) { return psuHandleStateMap.find(handle) != psuHandleStateMap.end(); } bool isHandleValid(zes_fan_handle_t handle) { return fanHandleStateMap.find(handle) != fanHandleStateMap.end(); } bool isHandleValid(zes_led_handle_t handle) { return ledHandleStateMap.find(handle) != ledHandleStateMap.end(); } bool isHandleValid(zes_ras_handle_t handle) { return rasHandleStateMap.find(handle) != rasHandleStateMap.end(); } bool isHandleValid(zes_diag_handle_t handle) { return diagHandleStateMap.find(handle) != diagHandleStateMap.end(); } bool isHandleValid(zes_overclock_handle_t handle) { return overclockHandleStateMap.find(handle) != overclockHandleStateMap.end(); } bool isHandleValid(ze_rtas_parallel_operation_exp_handle_t handle) { return rtasParallelOperationHandleStateMap.find(handle) != rtasParallelOperationHandleStateMap.end(); } bool isHandleValid(ze_rtas_builder_exp_handle_t handle) { return rtasBuilderHandleStateMap.find(handle) != rtasBuilderHandleStateMap.end(); } bool isOpen(ze_command_list_handle_t handle) { return commandListHandleStateMap[handle]->is_open; } void close(ze_command_list_handle_t handle) { commandListHandleStateMap[handle]->is_open = false; } void reset(ze_command_list_handle_t handle) { commandListHandleStateMap[handle]->is_open = true; } void printDependentMap() { printf("\n--------------------------------------------\n"); for (auto &handle : dependentMap) { printf("Handle: %p Dependents: {", handle.first); for (auto dependent : handle.second) { printf(" %p ", dependent); } printf("}\n"); } printf("--------------------------------------------\n"); } void addDependent(const void *handle, const void *dependent) { // No need to track driver dependents for (auto &driverHandle : driverHandleStateMap){ if (handle == (void*)driverHandle.first){ return; } } if (dependentMap.count(handle) == 0) { dependentMap[handle] = std::unordered_set(); } dependentMap[handle].insert(dependent); } void removeDependent(const void *dependent) { for (auto &handle : dependentMap) { handle.second.erase(dependent); } } void removeDependent(const void *handle, const void *dependent) { if (dependentMap.count(handle) == 0) { return; } dependentMap[handle].erase(dependent); } bool hasDependents(const void *handle) { return dependentMap.count(handle) && !dependentMap[handle].empty(); } private: std::unordered_map> defaultHandleStateMap; std::unordered_map> contextHandleStateMap; std::unordered_map> driverHandleStateMap; std::unordered_map> deviceHandleStateMap; std::unordered_map> commandQueueHandleStateMap; std::unordered_map> commandListHandleStateMap; std::unordered_map> fenceHandleStateMap; std::unordered_map> eventPoolHandleStateMap; std::unordered_map> eventHandleStateMap; std::unordered_map> imageHandleStateMap; std::unordered_map> moduleHandleStateMap; std::unordered_map> moduleBuildLogHandleStateMap; std::unordered_map> kernelHandleStateMap; std::unordered_map> samplerHandleStateMap; std::unordered_map> physicalMemHandleStateMap; std::unordered_map> fabricVertexHandleStateMap; std::unordered_map> fabricEdgeHandleStateMap; std::unordered_map> ipcEventPoolHandleStateMap; std::unordered_map> ipcMemHandleStateMap; std::unordered_map> externalMemoryImportWin32HandleStateMap; std::unordered_map> externalMemoryExportWin32HandleStateMap; // tools std::unordered_map> zetDriverHandleStateMap; std::unordered_map> zetDeviceHandleStateMap; std::unordered_map> zetContextHandleStateMap; std::unordered_map> zetCommandListHandleStateMap; std::unordered_map> zetModuleHandleStateMap; std::unordered_map> zetKernelHandleStateMap; std::unordered_map> metricGroupHandleStateMap; std::unordered_map> metricHandleStateMap; std::unordered_map> metricStreamerHandleStateMap; std::unordered_map> metricQueryPoolHandleStateMap; std::unordered_map> metricQueryHandleStateMap; std::unordered_map> tracerExpHandleStateMap; std::unordered_map> debugSessionHandleStateMap; // sysman std::unordered_map> zesDriverHandleStateMap; std::unordered_map> zesDeviceHandleStateMap; std::unordered_map> schedHandleStateMap; std::unordered_map> perfHandleStateMap; std::unordered_map> pwrHandleStateMap; std::unordered_map> freqHandleStateMap; std::unordered_map> engineHandleStateMap; std::unordered_map> standbyHandleStateMap; std::unordered_map> firmwareHandleStateMap; std::unordered_map> memHandleStateMap; std::unordered_map> fabricPortHandleStateMap; std::unordered_map> tempHandleStateMap; std::unordered_map> psuHandleStateMap; std::unordered_map> fanHandleStateMap; std::unordered_map> ledHandleStateMap; std::unordered_map> rasHandleStateMap; std::unordered_map> diagHandleStateMap; std::unordered_map> overclockHandleStateMap; std::unordered_map> rtasParallelOperationHandleStateMap; std::unordered_map> rtasBuilderHandleStateMap; std::unordered_map> dependentMap; int untrackedHandles = 0; }; // class HandleLifetimeValidation } // namespace validation_layer level-zero-1.20.6/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.cpp000066400000000000000000005220011475521542100321310ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See handle_lifetime.cpp.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_handle_lifetime.cpp * */ #include "ze_validation_layer.h" #include "ze_handle_lifetime.h" namespace validation_layer { ze_result_t ZEHandleLifetimeValidation::zeDriverGetApiVersionPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_api_version_t* version ///< [out] api version ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDriverGetPropertiesPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_properties_t* pDriverProperties ///< [in,out] query result for driver properties ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDriverGetIpcPropertiesPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_ipc_properties_t* pIpcProperties ///< [in,out] query result for IPC properties ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDriverGetExtensionPropertiesPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. ze_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDriverGetExtensionFunctionAddressPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDriverGetLastErrorDescriptionPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char** ppString ///< [in,out] pointer to a null-terminated array of characters describing ///< cause of error. ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of devices. ///< if count is zero, then the driver shall update the value with the ///< total number of devices available. ///< if count is greater than the number of devices available, then the ///< driver shall update the value with the correct number of devices available. ze_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of devices. ///< if count is less than the number of devices available, then driver ///< shall only retrieve that number of devices. ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetRootDevicePrologue( ze_device_handle_t hDevice, ///< [in] handle of the device object ze_device_handle_t* phRootDevice ///< [in,out] parent root device. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetSubDevicesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device object uint32_t* pCount, ///< [in,out] pointer to the number of sub-devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-devices available. ///< if count is greater than the number of sub-devices available, then the ///< driver shall update the value with the correct number of sub-devices available. ze_device_handle_t* phSubdevices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-devices. ///< if count is less than the number of sub-devices available, then driver ///< shall only retrieve that number of sub-devices. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_properties_t* pDeviceProperties ///< [in,out] query result for device properties ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetComputePropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_compute_properties_t* pComputeProperties ///< [in,out] query result for compute properties ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetModulePropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_module_properties_t* pModuleProperties///< [in,out] query result for module properties ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetCommandQueueGroupPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of command queue group properties. ///< if count is zero, then the driver shall update the value with the ///< total number of command queue group properties available. ///< if count is greater than the number of command queue group properties ///< available, then the driver shall update the value with the correct ///< number of command queue group properties available. ze_command_queue_group_properties_t* pCommandQueueGroupProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< command queue group properties. ///< if count is less than the number of command queue group properties ///< available, then driver shall only retrieve that number of command ///< queue group properties. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetMemoryPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of memory properties. ///< if count is zero, then the driver shall update the value with the ///< total number of memory properties available. ///< if count is greater than the number of memory properties available, ///< then the driver shall update the value with the correct number of ///< memory properties available. ze_device_memory_properties_t* pMemProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< memory properties. ///< if count is less than the number of memory properties available, then ///< driver shall only retrieve that number of memory properties. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetMemoryAccessPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_memory_access_properties_t* pMemAccessProperties ///< [in,out] query result for memory access properties ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetCachePropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of cache properties. ///< if count is zero, then the driver shall update the value with the ///< total number of cache properties available. ///< if count is greater than the number of cache properties available, ///< then the driver shall update the value with the correct number of ///< cache properties available. ze_device_cache_properties_t* pCacheProperties ///< [in,out][optional][range(0, *pCount)] array of query results for cache properties. ///< if count is less than the number of cache properties available, then ///< driver shall only retrieve that number of cache properties. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetImagePropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_image_properties_t* pImageProperties ///< [in,out] query result for image properties ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetExternalMemoryPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_external_memory_properties_t* pExternalMemoryProperties ///< [in,out] query result for external memory properties ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetP2PPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_device_p2p_properties_t* pP2PProperties ///< [in,out] Peer-to-Peer properties between source and peer device ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hPeerDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceCanAccessPeerPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_bool_t* value ///< [out] returned access capability ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hPeerDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetStatusPrologue( ze_device_handle_t hDevice ///< [in] handle of the device ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetGlobalTimestampsPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the ///< Host's global timestamp value. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeContextCreatePrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeContextCreateExPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< context has visibility. ///< if nullptr, then all devices and any sub-devices supported by the ///< driver instance are ///< visible to the context. ///< otherwise, the context only has visibility to the devices and any ///< sub-devices of the ///< devices in this array. ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phDevices) && (i < numDevices); ++i){ if (!context.handleLifetime->isHandleValid( phDevices[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeContextDestroyPrologue( ze_context_handle_t hContext ///< [in][release] handle of context object to destroy ) { if (hContext && context.handleLifetime->isHandleValid( hContext )){ if (context.handleLifetime->hasDependents( hContext )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hContext); context.handleLifetime->removeHandle( hContext ); } else if (!context.handleLifetime->isHandleValid( hContext )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeContextGetStatusPrologue( ze_context_handle_t hContext ///< [in] handle of context object ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandQueueCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* desc, ///< [in] pointer to command queue descriptor ze_command_queue_handle_t* phCommandQueue ///< [out] pointer to handle of command queue object created ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandQueueDestroyPrologue( ze_command_queue_handle_t hCommandQueue ///< [in][release] handle of command queue object to destroy ) { if (hCommandQueue && context.handleLifetime->isHandleValid( hCommandQueue )){ if (context.handleLifetime->hasDependents( hCommandQueue )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hCommandQueue); context.handleLifetime->removeHandle( hCommandQueue ); } else if (!context.handleLifetime->isHandleValid( hCommandQueue )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandQueueExecuteCommandListsPrologue( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t numCommandLists, ///< [in] number of command lists to execute ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] list of handles of the command lists ///< to execute ze_fence_handle_t hFence ///< [in][optional] handle of the fence to signal on completion ) { if ( !context.handleLifetime->isHandleValid( hCommandQueue )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phCommandLists) && (i < numCommandLists); ++i){ if (!context.handleLifetime->isHandleValid( phCommandLists[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } for (size_t i = 0; ( nullptr != phCommandLists) && (i < numCommandLists); ++i){ if (context.handleLifetime->isOpen( phCommandLists[i] )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } } if (hFence && !context.handleLifetime->isHandleValid( hFence )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandQueueSynchronizePrologue( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the command queue; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { if ( !context.handleLifetime->isHandleValid( hCommandQueue )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandQueueGetOrdinalPrologue( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pOrdinal ///< [out] command queue group ordinal ) { if ( !context.handleLifetime->isHandleValid( hCommandQueue )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandQueueGetIndexPrologue( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pIndex ///< [out] command queue index within the group ) { if ( !context.handleLifetime->isHandleValid( hCommandQueue )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_list_desc_t* desc, ///< [in] pointer to command list descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListCreateImmediatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* altdesc, ///< [in] pointer to command queue descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListDestroyPrologue( ze_command_list_handle_t hCommandList ///< [in][release] handle of command list object to destroy ) { if (hCommandList && context.handleLifetime->isHandleValid( hCommandList )){ if (context.handleLifetime->hasDependents( hCommandList )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hCommandList); context.handleLifetime->removeHandle( hCommandList ); } else if (!context.handleLifetime->isHandleValid( hCommandList )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListClosePrologue( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to close ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } context.handleLifetime->close( hCommandList ); return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListResetPrologue( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to reset ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } context.handleLifetime->reset( hCommandList ); return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendWriteGlobalTimestampPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t* dstptr, ///< [in,out] pointer to memory where timestamp value will be written; must ///< be 8byte-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListHostSynchronizePrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the immediate command list uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the immediate command list; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListGetDeviceHandlePrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_device_handle_t* phDevice ///< [out] handle of the device on which the command list was created ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListGetContextHandlePrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_context_handle_t* phContext ///< [out] handle of the context on which the command list was created ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListGetOrdinalPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t* pOrdinal ///< [out] command queue group ordinal to which command list is submitted ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListImmediateGetIndexPrologue( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t* pIndex ///< [out] command queue index within the group to which the immediate ///< command list is submitted ) { if ( !context.handleLifetime->isHandleValid( hCommandListImmediate )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListIsImmediatePrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_bool_t* pIsImmediate ///< [out] Boolean indicating whether the command list is an immediate ///< command list (true) or not (false) ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendBarrierPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendMemoryRangesBarrierPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numRanges, ///< [in] number of memory ranges const size_t* pRangeSizes, ///< [in][range(0, numRanges)] array of sizes of memory range const void** pRanges, ///< [in][range(0, numRanges)] array of memory ranges ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeContextSystemBarrierPrologue( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice ///< [in] handle of the device ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendMemoryCopyPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendMemoryFillPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* ptr, ///< [in] pointer to memory to initialize const void* pattern, ///< [in] pointer to value to initialize memory to size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to size_t size, ///< [in] size in bytes to initialize ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendMemoryCopyRegionPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const ze_copy_region_t* dstRegion, ///< [in] pointer to destination region to copy to uint32_t dstPitch, ///< [in] destination pitch in bytes uint32_t dstSlicePitch, ///< [in] destination slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. const void* srcptr, ///< [in] pointer to source memory to copy from const ze_copy_region_t* srcRegion, ///< [in] pointer to source region to copy from uint32_t srcPitch, ///< [in] source pitch in bytes uint32_t srcSlicePitch, ///< [in] source slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendMemoryCopyFromContextPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_context_handle_t hContextSrc, ///< [in] handle of source context object const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hContextSrc )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendImageCopyPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hDstImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hSrcImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendImageCopyRegionPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hDstImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hSrcImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendImageCopyToMemoryPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hSrcImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendImageCopyFromMemoryPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hDstImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendMemoryPrefetchPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list const void* ptr, ///< [in] pointer to start of the memory range to prefetch size_t size ///< [in] size in bytes of the memory range to prefetch ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendMemAdvisePrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_advice_t advice ///< [in] Memory advice for the memory range ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventPoolCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_event_pool_desc_t* desc, ///< [in] pointer to event pool descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< have visibility to the event pool. ///< if nullptr, then event pool is visible to all devices supported by the ///< driver instance. ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phDevices) && (i < numDevices); ++i){ if (!context.handleLifetime->isHandleValid( phDevices[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventPoolDestroyPrologue( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object to destroy ) { if (hEventPool && context.handleLifetime->isHandleValid( hEventPool )){ if (context.handleLifetime->hasDependents( hEventPool )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hEventPool); context.handleLifetime->removeHandle( hEventPool ); } else if (!context.handleLifetime->isHandleValid( hEventPool )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventCreatePrologue( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool const ze_event_desc_t* desc, ///< [in] pointer to event descriptor ze_event_handle_t* phEvent ///< [out] pointer to handle of event object created ) { if ( !context.handleLifetime->isHandleValid( hEventPool )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventDestroyPrologue( ze_event_handle_t hEvent ///< [in][release] handle of event object to destroy ) { if (hEvent && context.handleLifetime->isHandleValid( hEvent )){ if (context.handleLifetime->hasDependents( hEvent )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hEvent); context.handleLifetime->removeHandle( hEvent ); } else if (!context.handleLifetime->isHandleValid( hEvent )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventPoolGetIpcHandlePrologue( ze_event_pool_handle_t hEventPool, ///< [in] handle of event pool object ze_ipc_event_pool_handle_t* phIpc ///< [out] Returned IPC event handle ) { if ( !context.handleLifetime->isHandleValid( hEventPool )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventPoolPutIpcHandlePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object associated with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc ///< [in] IPC event pool handle ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventPoolOpenIpcHandlePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object to associate with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc, ///< [in] IPC event pool handle ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventPoolCloseIpcHandlePrologue( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object ) { if ( !context.handleLifetime->isHandleValid( hEventPool )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendSignalEventPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendWaitOnEventsPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] number of events to wait on before continuing ze_event_handle_t* phEvents ///< [in][range(0, numEvents)] handles of the events to wait on before ///< continuing ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } for (size_t i = 0; ( nullptr != phEvents) && (i < numEvents); ++i){ if (!context.handleLifetime->isHandleValid( phEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventHostSignalPrologue( ze_event_handle_t hEvent ///< [in] handle of the event ) { if ( !context.handleLifetime->isHandleValid( hEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventHostSynchronizePrologue( ze_event_handle_t hEvent, ///< [in] handle of the event uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeEventQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { if ( !context.handleLifetime->isHandleValid( hEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventQueryStatusPrologue( ze_event_handle_t hEvent ///< [in] handle of the event ) { if ( !context.handleLifetime->isHandleValid( hEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendEventResetPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventHostResetPrologue( ze_event_handle_t hEvent ///< [in] handle of the event ) { if ( !context.handleLifetime->isHandleValid( hEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventQueryKernelTimestampPrologue( ze_event_handle_t hEvent, ///< [in] handle of the event ze_kernel_timestamp_result_t* dstptr ///< [in,out] pointer to memory for where timestamp result will be written. ) { if ( !context.handleLifetime->isHandleValid( hEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendQueryKernelTimestampsPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] the number of timestamp events to query ze_event_handle_t* phEvents, ///< [in][range(0, numEvents)] handles of timestamp events to query void* dstptr, ///< [in,out] pointer to memory where ::ze_kernel_timestamp_result_t will ///< be written; must be size-aligned. const size_t* pOffsets, ///< [in][optional][range(0, numEvents)] offset, in bytes, to write ///< results; address must be 4byte-aligned and offsets must be ///< size-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } for (size_t i = 0; ( nullptr != phEvents) && (i < numEvents); ++i){ if (!context.handleLifetime->isHandleValid( phEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventGetEventPoolPrologue( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_pool_handle_t* phEventPool ///< [out] handle of the event pool for the event ) { if ( !context.handleLifetime->isHandleValid( hEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventGetSignalScopePrologue( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pSignalScope ///< [out] signal event scope. This is the scope of relevant cache ///< hierarchies that are flushed on a signal action before the event is ///< triggered. May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { if ( !context.handleLifetime->isHandleValid( hEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventGetWaitScopePrologue( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pWaitScope ///< [out] wait event scope. This is the scope of relevant cache ///< hierarchies invalidated on a wait action after the event is complete. ///< May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { if ( !context.handleLifetime->isHandleValid( hEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventPoolGetContextHandlePrologue( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_context_handle_t* phContext ///< [out] handle of the context on which the event pool was created ) { if ( !context.handleLifetime->isHandleValid( hEventPool )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventPoolGetFlagsPrologue( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_event_pool_flags_t* pFlags ///< [out] creation flags used to create the event pool; may be 0 or a ///< valid combination of ::ze_event_pool_flag_t ) { if ( !context.handleLifetime->isHandleValid( hEventPool )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeFenceCreatePrologue( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of command queue const ze_fence_desc_t* desc, ///< [in] pointer to fence descriptor ze_fence_handle_t* phFence ///< [out] pointer to handle of fence object created ) { if ( !context.handleLifetime->isHandleValid( hCommandQueue )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeFenceDestroyPrologue( ze_fence_handle_t hFence ///< [in][release] handle of fence object to destroy ) { if (hFence && context.handleLifetime->isHandleValid( hFence )){ if (context.handleLifetime->hasDependents( hFence )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hFence); context.handleLifetime->removeHandle( hFence ); } else if (!context.handleLifetime->isHandleValid( hFence )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeFenceHostSynchronizePrologue( ze_fence_handle_t hFence, ///< [in] handle of the fence uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeFenceQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { if ( !context.handleLifetime->isHandleValid( hFence )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeFenceQueryStatusPrologue( ze_fence_handle_t hFence ///< [in] handle of the fence ) { if ( !context.handleLifetime->isHandleValid( hFence )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeFenceResetPrologue( ze_fence_handle_t hFence ///< [in] handle of the fence ) { if ( !context.handleLifetime->isHandleValid( hFence )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeImageGetPropertiesPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_properties_t* pImageProperties ///< [out] pointer to image properties ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeImageCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t* phImage ///< [out] pointer to handle of image object created ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeImageDestroyPrologue( ze_image_handle_t hImage ///< [in][release] handle of image object to destroy ) { if (hImage && context.handleLifetime->isHandleValid( hImage )){ if (context.handleLifetime->hasDependents( hImage )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hImage); context.handleLifetime->removeHandle( hImage ); } else if (!context.handleLifetime->isHandleValid( hImage )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemAllocSharedPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in][optional] device handle to associate with void** pptr ///< [out] pointer to shared allocation ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hDevice && !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemAllocDevicePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in] handle of the device void** pptr ///< [out] pointer to device allocation ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemAllocHostPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two void** pptr ///< [out] pointer to host allocation ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemFreePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object void* ptr ///< [in][release] pointer to memory to free ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemGetAllocPropertiesPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query ze_memory_allocation_properties_t* pMemAllocProperties, ///< [in,out] query result for memory allocation properties ze_device_handle_t* phDevice ///< [out][optional] device associated with this allocation ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemGetAddressRangePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query void** pBase, ///< [in,out][optional] base address of the allocation size_t* pSize ///< [in,out][optional] size of the allocation ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemGetIpcHandlePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to the device memory allocation ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemGetIpcHandleFromFileDescriptorExpPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object uint64_t handle, ///< [in] file descriptor ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemGetFileDescriptorFromIpcHandleExpPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t ipcHandle, ///< [in] IPC memory handle uint64_t* pHandle ///< [out] Returned file descriptor ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemPutIpcHandlePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t handle ///< [in] IPC memory handle ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemOpenIpcHandlePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device to associate with the IPC memory handle ze_ipc_mem_handle_t handle, ///< [in] IPC memory handle ze_ipc_memory_flags_t flags, ///< [in] flags controlling the operation. ///< must be 0 (default) or a valid combination of ::ze_ipc_memory_flag_t. void** pptr ///< [out] pointer to device allocation in this process ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemCloseIpcHandlePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr ///< [in][release] pointer to device allocation in this process ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemSetAtomicAccessAttributeExpPrologue( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t attr ///< [in] Atomic access attributes to set for the specified range. ///< Must be 0 (default) or a valid combination of ::ze_memory_atomic_attr_exp_flag_t. ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemGetAtomicAccessAttributeExpPrologue( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t* pAttr ///< [out] Atomic access attributes for the specified range ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeModuleCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_module_desc_t* desc, ///< [in] pointer to module descriptor ze_module_handle_t* phModule, ///< [out] pointer to handle of module object created ze_module_build_log_handle_t* phBuildLog ///< [out][optional] pointer to handle of module's build log. ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeModuleDestroyPrologue( ze_module_handle_t hModule ///< [in][release] handle of the module ) { if (hModule && context.handleLifetime->isHandleValid( hModule )){ if (context.handleLifetime->hasDependents( hModule )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hModule); context.handleLifetime->removeHandle( hModule ); } else if (!context.handleLifetime->isHandleValid( hModule )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeModuleDynamicLinkPrologue( uint32_t numModules, ///< [in] number of modules to be linked pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to ///< dynamically link together. ze_module_build_log_handle_t* phLinkLog ///< [out][optional] pointer to handle of dynamic link log. ) { for (size_t i = 0; ( nullptr != phModules) && (i < numModules); ++i){ if (!context.handleLifetime->isHandleValid( phModules[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeModuleBuildLogDestroyPrologue( ze_module_build_log_handle_t hModuleBuildLog ///< [in][release] handle of the module build log object. ) { if (hModuleBuildLog && context.handleLifetime->isHandleValid( hModuleBuildLog )){ if (context.handleLifetime->hasDependents( hModuleBuildLog )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hModuleBuildLog); context.handleLifetime->removeHandle( hModuleBuildLog ); } else if (!context.handleLifetime->isHandleValid( hModuleBuildLog )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeModuleBuildLogGetStringPrologue( ze_module_build_log_handle_t hModuleBuildLog, ///< [in] handle of the module build log object. size_t* pSize, ///< [in,out] size of build log string. char* pBuildLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { if ( !context.handleLifetime->isHandleValid( hModuleBuildLog )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeModuleGetNativeBinaryPrologue( ze_module_handle_t hModule, ///< [in] handle of the module size_t* pSize, ///< [in,out] size of native binary in bytes. uint8_t* pModuleNativeBinary ///< [in,out][optional] byte pointer to native binary ) { if ( !context.handleLifetime->isHandleValid( hModule )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeModuleGetGlobalPointerPrologue( ze_module_handle_t hModule, ///< [in] handle of the module const char* pGlobalName, ///< [in] name of global variable in module size_t* pSize, ///< [in,out][optional] size of global variable void** pptr ///< [in,out][optional] device visible pointer ) { if ( !context.handleLifetime->isHandleValid( hModule )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeModuleGetKernelNamesPrologue( ze_module_handle_t hModule, ///< [in] handle of the module uint32_t* pCount, ///< [in,out] pointer to the number of names. ///< if count is zero, then the driver shall update the value with the ///< total number of names available. ///< if count is greater than the number of names available, then the ///< driver shall update the value with the correct number of names available. const char** pNames ///< [in,out][optional][range(0, *pCount)] array of names of functions. ///< if count is less than the number of names available, then driver shall ///< only retrieve that number of names. ) { if ( !context.handleLifetime->isHandleValid( hModule )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeModuleGetPropertiesPrologue( ze_module_handle_t hModule, ///< [in] handle of the module ze_module_properties_t* pModuleProperties ///< [in,out] query result for module properties. ) { if ( !context.handleLifetime->isHandleValid( hModule )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelCreatePrologue( ze_module_handle_t hModule, ///< [in] handle of the module const ze_kernel_desc_t* desc, ///< [in] pointer to kernel descriptor ze_kernel_handle_t* phKernel ///< [out] handle of the Function object ) { if ( !context.handleLifetime->isHandleValid( hModule )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelDestroyPrologue( ze_kernel_handle_t hKernel ///< [in][release] handle of the kernel object ) { if (hKernel && context.handleLifetime->isHandleValid( hKernel )){ if (context.handleLifetime->hasDependents( hKernel )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hKernel); context.handleLifetime->removeHandle( hKernel ); } else if (!context.handleLifetime->isHandleValid( hKernel )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeModuleGetFunctionPointerPrologue( ze_module_handle_t hModule, ///< [in] handle of the module const char* pFunctionName, ///< [in] Name of function to retrieve function pointer for. void** pfnFunction ///< [out] pointer to function. ) { if ( !context.handleLifetime->isHandleValid( hModule )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelSetGroupSizePrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t groupSizeX, ///< [in] group size for X dimension to use for this kernel uint32_t groupSizeY, ///< [in] group size for Y dimension to use for this kernel uint32_t groupSizeZ ///< [in] group size for Z dimension to use for this kernel ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelSuggestGroupSizePrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t globalSizeX, ///< [in] global width for X dimension uint32_t globalSizeY, ///< [in] global width for Y dimension uint32_t globalSizeZ, ///< [in] global width for Z dimension uint32_t* groupSizeX, ///< [out] recommended size of group for X dimension uint32_t* groupSizeY, ///< [out] recommended size of group for Y dimension uint32_t* groupSizeZ ///< [out] recommended size of group for Z dimension ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelSuggestMaxCooperativeGroupCountPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* totalGroupCount ///< [out] recommended total group count. ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelSetArgumentValuePrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t argIndex, ///< [in] argument index in range [0, num args - 1] size_t argSize, ///< [in] size of argument type const void* pArgValue ///< [in][optional] argument value represented as matching arg type. If ///< null then argument value is considered null. ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelSetIndirectAccessPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t flags ///< [in] kernel indirect access flags ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelGetIndirectAccessPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t* pFlags ///< [out] query result for kernel indirect access flags. ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelGetSourceAttributesPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* pSize, ///< [in,out] pointer to size of string in bytes, including ///< null-terminating character. char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including ///< a null-terminating character, is returned in pSize. ///< Otherwise, pString must point to valid application memory that is ///< greater than or equal to *pSize bytes in length, and on return the ///< pointed-to string will contain a space-separated list of kernel source attributes. ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelSetCacheConfigPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_cache_config_flags_t flags ///< [in] cache configuration. ///< must be 0 (default configuration) or a valid combination of ::ze_cache_config_flag_t. ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelGetPropertiesPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_properties_t* pKernelProperties ///< [in,out] query result for kernel properties. ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelGetNamePrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object size_t* pSize, ///< [in,out] size of kernel name string, including null terminator, in ///< bytes. char* pName ///< [in,out][optional] char pointer to kernel name. ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendLaunchKernelPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendLaunchCooperativeKernelPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendLaunchKernelIndirectPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in] pointer to device buffer that will contain thread group launch ///< arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendLaunchMultipleKernelsIndirectPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] maximum number of kernels to launch ze_kernel_handle_t* phKernels, ///< [in][range(0, numKernels)] handles of the kernel objects const uint32_t* pCountBuffer, ///< [in] pointer to device memory location that will contain the actual ///< number of kernels to launch; value must be less than or equal to ///< numKernels const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in][range(0, numKernels)] pointer to device buffer that will contain ///< a contiguous array of thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } for (size_t i = 0; ( nullptr != phKernels) && (i < numKernels); ++i){ if (!context.handleLifetime->isHandleValid( phKernels[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeContextMakeMemoryResidentPrologue( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to make resident size_t size ///< [in] size in bytes to make resident ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeContextEvictMemoryPrologue( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to evict size_t size ///< [in] size in bytes to evict ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeContextMakeImageResidentPrologue( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make resident ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeContextEvictImagePrologue( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make evict ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeSamplerCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_sampler_desc_t* desc, ///< [in] pointer to sampler descriptor ze_sampler_handle_t* phSampler ///< [out] handle of the sampler ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeSamplerDestroyPrologue( ze_sampler_handle_t hSampler ///< [in][release] handle of the sampler ) { if (hSampler && context.handleLifetime->isHandleValid( hSampler )){ if (context.handleLifetime->hasDependents( hSampler )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hSampler); context.handleLifetime->removeHandle( hSampler ); } else if (!context.handleLifetime->isHandleValid( hSampler )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeVirtualMemReservePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* pStart, ///< [in][optional] pointer to start of region to reserve. If nullptr then ///< implementation will choose a start address. size_t size, ///< [in] size in bytes to reserve; must be page aligned. void** pptr ///< [out] pointer to virtual reservation. ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeVirtualMemFreePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to free. size_t size ///< [in] size in bytes to free; must be page aligned. ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeVirtualMemQueryPageSizePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] unaligned allocation size in bytes size_t* pagesize ///< [out] pointer to page size to use for start address and size ///< alignments. ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zePhysicalMemCreatePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zePhysicalMemDestroyPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_physical_mem_handle_t hPhysicalMemory ///< [in][release] handle of physical memory object to destroy ) { if (hContext && context.handleLifetime->isHandleValid( hContext )){ if (context.handleLifetime->hasDependents( hContext )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hContext); context.handleLifetime->removeHandle( hContext ); } else if (!context.handleLifetime->isHandleValid( hContext )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hPhysicalMemory && context.handleLifetime->isHandleValid( hPhysicalMemory )){ if (context.handleLifetime->hasDependents( hPhysicalMemory )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hPhysicalMemory); context.handleLifetime->removeHandle( hPhysicalMemory ); } else if (!context.handleLifetime->isHandleValid( hPhysicalMemory )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeVirtualMemMapPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address range to map. size_t size, ///< [in] size in bytes of virtual address range to map; must be page ///< aligned. ze_physical_mem_handle_t hPhysicalMemory, ///< [in] handle to physical memory object. size_t offset, ///< [in] offset into physical memory allocation object; must be page ///< aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hPhysicalMemory )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeVirtualMemUnmapPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to unmap. size_t size ///< [in] size in bytes to unmap; must be page aligned. ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeVirtualMemSetAccessAttributePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of reserved virtual address region. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeVirtualMemGetAccessAttributePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address region for query. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t* access, ///< [out] query result for page access attribute. size_t* outSize ///< [out] query result for size of virtual address range, starting at ptr, ///< that shares same access attribute. ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelSetGlobalOffsetExpPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t offsetX, ///< [in] global offset for X dimension to use for this kernel uint32_t offsetY, ///< [in] global offset for Y dimension to use for this kernel uint32_t offsetZ ///< [in] global offset for Z dimension to use for this kernel ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelGetBinaryExpPrologue( ze_kernel_handle_t hKernel, ///< [in] Kernel handle. size_t* pSize, ///< [in,out] pointer to variable with size of GEN ISA binary. uint8_t* pKernelBinary ///< [in,out] pointer to storage area for GEN ISA binary function. ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceImportExternalSemaphoreExtPrologue( ze_device_handle_t hDevice, ///< [in] The device handle. const ze_external_semaphore_ext_desc_t* desc, ///< [in] The pointer to external semaphore descriptor. ze_external_semaphore_ext_handle_t* phSemaphore ///< [out] The handle of the external semaphore imported. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceReleaseExternalSemaphoreExtPrologue( ze_external_semaphore_ext_handle_t hSemaphore ///< [in] The handle of the external semaphore. ) { if ( !context.handleLifetime->isHandleValid( hSemaphore )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendSignalExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in][range(0, numSemaphores)] The vector of external semaphore handles ///< to be appended into command list. ze_external_semaphore_signal_params_ext_t* signalParams,///< [in] Signal parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } for (size_t i = 0; ( nullptr != phSemaphores) && (i < numSemaphores); ++i){ if (!context.handleLifetime->isHandleValid( phSemaphores[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendWaitExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in] [range(0,numSemaphores)] The vector of external semaphore handles ///< to append into command list. ze_external_semaphore_wait_params_ext_t* waitParams,///< [in] Wait parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } for (size_t i = 0; ( nullptr != phSemaphores) && (i < numSemaphores); ++i){ if (!context.handleLifetime->isHandleValid( phSemaphores[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceReserveCacheExtPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device object size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the ///< driver shall default to last level of cache and attempt to reserve in ///< that cache. size_t cacheReservationSize ///< [in] value for reserving size, in bytes. If zero, then the driver ///< shall remove prior reservation ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceSetCacheAdviceExtPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device object void* ptr, ///< [in] memory pointer to query size_t regionSize, ///< [in] region size, in pages ze_cache_ext_region_t cacheRegion ///< [in] reservation region ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventQueryTimestampsExpPrologue( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of timestamp results. ///< if count is zero, then the driver shall update the value with the ///< total number of timestamps available. ///< if count is greater than the number of timestamps available, then the ///< driver shall update the value with the correct number of timestamps available. ze_kernel_timestamp_result_t* pTimestamps ///< [in,out][optional][range(0, *pCount)] array of timestamp results. ///< if count is less than the number of timestamps available, then driver ///< shall only retrieve that number of timestamps. ) { if ( !context.handleLifetime->isHandleValid( hEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeImageGetMemoryPropertiesExpPrologue( ze_image_handle_t hImage, ///< [in] handle of image object ze_image_memory_properties_exp_t* pMemoryProperties ///< [in,out] query result for image memory properties. ) { if ( !context.handleLifetime->isHandleValid( hImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeImageViewCreateExtPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeImageViewCreateExpPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeKernelSchedulingHintExpPrologue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_scheduling_hint_exp_desc_t* pHint ///< [in] pointer to kernel scheduling hint descriptor ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDevicePciGetPropertiesExtPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device object. ze_pci_ext_properties_t* pPciProperties ///< [in,out] returns the PCI properties of the device. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendImageCopyToMemoryExtPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor uint32_t destRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being written uint32_t destSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being written ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hSrcImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListAppendImageCopyFromMemoryExtPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor uint32_t srcRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being read uint32_t srcSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being read ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hDstImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeImageGetAllocPropertiesExtPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_image_handle_t hImage, ///< [in] handle of image object to query ze_image_allocation_ext_properties_t* pImageAllocProperties ///< [in,out] query result for image allocation properties ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeModuleInspectLinkageExtPrologue( ze_linkage_inspection_ext_desc_t* pInspectDesc, ///< [in] pointer to linkage inspection descriptor structure. uint32_t numModules, ///< [in] number of modules to be inspected pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to be ///< inspected for import dependencies. ze_module_build_log_handle_t* phLog ///< [out] pointer to handle of linkage inspection log. Log object will ///< contain separate lists of imports, un-resolvable imports, and exports. ) { for (size_t i = 0; ( nullptr != phModules) && (i < numModules); ++i){ if (!context.handleLifetime->isHandleValid( phModules[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemFreeExtPrologue( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_memory_free_ext_desc_t* pMemFreeDesc, ///< [in] pointer to memory free descriptor void* ptr ///< [in][release] pointer to memory to free ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeFabricVertexGetExpPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric vertices available. ///< if count is greater than the number of fabric vertices available, then ///< the driver shall update the value with the correct number of fabric ///< vertices available. ze_fabric_vertex_handle_t* phVertices ///< [in,out][optional][range(0, *pCount)] array of handle of fabric vertices. ///< if count is less than the number of fabric vertices available, then ///< driver shall only retrieve that number of fabric vertices. ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeFabricVertexGetSubVerticesExpPrologue( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex object uint32_t* pCount, ///< [in,out] pointer to the number of sub-vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-vertices available. ///< if count is greater than the number of sub-vertices available, then ///< the driver shall update the value with the correct number of ///< sub-vertices available. ze_fabric_vertex_handle_t* phSubvertices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-vertices. ///< if count is less than the number of sub-vertices available, then ///< driver shall only retrieve that number of sub-vertices. ) { if ( !context.handleLifetime->isHandleValid( hVertex )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeFabricVertexGetPropertiesExpPrologue( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_fabric_vertex_exp_properties_t* pVertexProperties///< [in,out] query result for fabric vertex properties ) { if ( !context.handleLifetime->isHandleValid( hVertex )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeFabricVertexGetDeviceExpPrologue( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_device_handle_t* phDevice ///< [out] device handle corresponding to fabric vertex ) { if ( !context.handleLifetime->isHandleValid( hVertex )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDeviceGetFabricVertexExpPrologue( ze_device_handle_t hDevice, ///< [in] handle of the device ze_fabric_vertex_handle_t* phVertex ///< [out] fabric vertex handle corresponding to device ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeFabricEdgeGetExpPrologue( ze_fabric_vertex_handle_t hVertexA, ///< [in] handle of first fabric vertex instance ze_fabric_vertex_handle_t hVertexB, ///< [in] handle of second fabric vertex instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric edges. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric edges available. ///< if count is greater than the number of fabric edges available, then ///< the driver shall update the value with the correct number of fabric ///< edges available. ze_fabric_edge_handle_t* phEdges ///< [in,out][optional][range(0, *pCount)] array of handle of fabric edges. ///< if count is less than the number of fabric edges available, then ///< driver shall only retrieve that number of fabric edges. ) { if ( !context.handleLifetime->isHandleValid( hVertexA )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hVertexB )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeFabricEdgeGetVerticesExpPrologue( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge instance ze_fabric_vertex_handle_t* phVertexA, ///< [out] fabric vertex connected to one end of the given fabric edge. ze_fabric_vertex_handle_t* phVertexB ///< [out] fabric vertex connected to other end of the given fabric edge. ) { if ( !context.handleLifetime->isHandleValid( hEdge )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeFabricEdgeGetPropertiesExpPrologue( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge ze_fabric_edge_exp_properties_t* pEdgeProperties///< [in,out] query result for fabric edge properties ) { if ( !context.handleLifetime->isHandleValid( hEdge )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeEventQueryKernelTimestampsExtPrologue( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of event packets available. ///< - This value is implementation specific. ///< - if `*pCount` is zero, then the driver shall update the value with ///< the total number of event packets available. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver shall update the value with the correct value. ///< - Buffer(s) for query results must be sized by the application to ///< accommodate a minimum of `*pCount` elements. ze_event_query_kernel_timestamps_results_ext_properties_t* pResults ///< [in,out][optional][range(0, *pCount)] pointer to event query ///< properties structure(s). ///< - This parameter may be null when `*pCount` is zero. ///< - if `*pCount` is less than the number of event packets available, ///< the driver may only update `*pCount` elements, starting at element zero. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver may only update the valid elements. ) { if ( !context.handleLifetime->isHandleValid( hEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeRTASBuilderCreateExpPrologue( ze_driver_handle_t hDriver, ///< [in] handle of driver object const ze_rtas_builder_exp_desc_t* pDescriptor, ///< [in] pointer to builder descriptor ze_rtas_builder_exp_handle_t* phBuilder ///< [out] handle of builder object ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeRTASBuilderGetBuildPropertiesExpPrologue( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor ze_rtas_builder_exp_properties_t* pProperties ///< [in,out] query result for builder properties ) { if ( !context.handleLifetime->isHandleValid( hBuilder )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeDriverRTASFormatCompatibilityCheckExpPrologue( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_format_exp_t rtasFormatA, ///< [in] operand A ze_rtas_format_exp_t rtasFormatB ///< [in] operand B ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeRTASBuilderBuildExpPrologue( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used ///< during acceleration structure construction size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes void* pRtasBuffer, ///< [in] pointer to destination buffer size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks ze_rtas_aabb_exp_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration ///< structure bounds size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in ///< bytes ) { if ( !context.handleLifetime->isHandleValid( hBuilder )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hParallelOperation && !context.handleLifetime->isHandleValid( hParallelOperation )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeRTASBuilderDestroyExpPrologue( ze_rtas_builder_exp_handle_t hBuilder ///< [in][release] handle of builder object to destroy ) { if ( !context.handleLifetime->isHandleValid( hBuilder )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeRTASParallelOperationCreateExpPrologue( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_parallel_operation_exp_handle_t* phParallelOperation///< [out] handle of parallel operation object ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeRTASParallelOperationGetPropertiesExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in] handle of parallel operation object ze_rtas_parallel_operation_exp_properties_t* pProperties///< [in,out] query result for parallel operation properties ) { if ( !context.handleLifetime->isHandleValid( hParallelOperation )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeRTASParallelOperationJoinExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in] handle of parallel operation object ) { if ( !context.handleLifetime->isHandleValid( hParallelOperation )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeRTASParallelOperationDestroyExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy ) { if ( !context.handleLifetime->isHandleValid( hParallelOperation )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeMemGetPitchFor2dImagePrologue( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device size_t imageWidth, ///< [in] imageWidth size_t imageHeight, ///< [in] imageHeight unsigned int elementSizeInBytes, ///< [in] Element size in bytes size_t * rowPitch ///< [out] rowPitch ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeImageGetDeviceOffsetExpPrologue( ze_image_handle_t hImage, ///< [in] handle of the image uint64_t* pDeviceOffset ///< [out] bindless device offset for image ) { if ( !context.handleLifetime->isHandleValid( hImage )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListCreateCloneExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle to source command list (the command list to clone) ze_command_list_handle_t* phClonedCommandList ///< [out] pointer to handle of the cloned command list ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListImmediateAppendCommandListsExpPrologue( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t numCommandLists, ///< [in] number of command lists ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion ///< - if not null, this event is signaled after the completion of all ///< appended command lists uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended ///< command lists; must be 0 if nullptr == phWaitEvents ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing appended command lists. ///< - if not null, all wait events must be satisfied prior to the start ///< of any appended command list(s) ) { if ( !context.handleLifetime->isHandleValid( hCommandListImmediate )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phCommandLists) && (i < numCommandLists); ++i){ if (!context.handleLifetime->isHandleValid( phCommandLists[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListGetNextCommandIdExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in] pointer to mutable command identifier descriptor uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListGetNextCommandIdWithKernelsExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in][out] pointer to mutable command identifier descriptor uint32_t numKernels, ///< [in][optional] number of entries on phKernels list ze_kernel_handle_t* phKernels, ///< [in][optional][range(0, numKernels)] list of kernels that user can ///< switch between using ::zeCommandListUpdateMutableCommandKernelsExp ///< call uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phKernels) && (i < numKernels); ++i){ if (!context.handleLifetime->isHandleValid( phKernels[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListUpdateMutableCommandsExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_commands_exp_desc_t* desc ///< [in] pointer to mutable commands descriptor; multiple descriptors may ///< be chained via `pNext` member ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListUpdateMutableCommandSignalEventExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier ze_event_handle_t hSignalEvent ///< [in][optional] handle of the event to signal on completion ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListUpdateMutableCommandWaitEventsExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier uint32_t numWaitEvents, ///< [in][optional] the number of wait events ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phWaitEvents) && (i < numWaitEvents); ++i){ if (!context.handleLifetime->isHandleValid( phWaitEvents[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZEHandleLifetimeValidation::zeCommandListUpdateMutableCommandKernelsExpPrologue( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] the number of kernels to update uint64_t* pCommandId, ///< [in][range(0, numKernels)] command identifier ze_kernel_handle_t* phKernels ///< [in][range(0, numKernels)] handle of the kernel for a command ///< identifier to switch to ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phKernels) && (i < numKernels); ++i){ if (!context.handleLifetime->isHandleValid( phKernels[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } }level-zero-1.20.6/source/layers/validation/handle_lifetime_tracking/ze_handle_lifetime.h000066400000000000000000000754771475521542100316220ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See handle_lifetime.h.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_handle_lifetime.h * */ #pragma once #include "ze_entry_points.h" namespace validation_layer { class ZEHandleLifetimeValidation : public ZEValidationEntryPoints { public: ze_result_t zeDriverGetApiVersionPrologue( ze_driver_handle_t hDriver, ze_api_version_t* version ) override; ze_result_t zeDriverGetPropertiesPrologue( ze_driver_handle_t hDriver, ze_driver_properties_t* pDriverProperties ) override; ze_result_t zeDriverGetIpcPropertiesPrologue( ze_driver_handle_t hDriver, ze_driver_ipc_properties_t* pIpcProperties ) override; ze_result_t zeDriverGetExtensionPropertiesPrologue( ze_driver_handle_t hDriver, uint32_t* pCount, ze_driver_extension_properties_t* pExtensionProperties ) override; ze_result_t zeDriverGetExtensionFunctionAddressPrologue( ze_driver_handle_t hDriver, const char* name, void** ppFunctionAddress ) override; ze_result_t zeDriverGetLastErrorDescriptionPrologue( ze_driver_handle_t hDriver, const char** ppString ) override; ze_result_t zeDeviceGetPrologue( ze_driver_handle_t hDriver, uint32_t* pCount, ze_device_handle_t* phDevices ) override; ze_result_t zeDeviceGetRootDevicePrologue( ze_device_handle_t hDevice, ze_device_handle_t* phRootDevice ) override; ze_result_t zeDeviceGetSubDevicesPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_handle_t* phSubdevices ) override; ze_result_t zeDeviceGetPropertiesPrologue( ze_device_handle_t hDevice, ze_device_properties_t* pDeviceProperties ) override; ze_result_t zeDeviceGetComputePropertiesPrologue( ze_device_handle_t hDevice, ze_device_compute_properties_t* pComputeProperties ) override; ze_result_t zeDeviceGetModulePropertiesPrologue( ze_device_handle_t hDevice, ze_device_module_properties_t* pModuleProperties ) override; ze_result_t zeDeviceGetCommandQueueGroupPropertiesPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_command_queue_group_properties_t* pCommandQueueGroupProperties ) override; ze_result_t zeDeviceGetMemoryPropertiesPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_memory_properties_t* pMemProperties ) override; ze_result_t zeDeviceGetMemoryAccessPropertiesPrologue( ze_device_handle_t hDevice, ze_device_memory_access_properties_t* pMemAccessProperties ) override; ze_result_t zeDeviceGetCachePropertiesPrologue( ze_device_handle_t hDevice, uint32_t* pCount, ze_device_cache_properties_t* pCacheProperties ) override; ze_result_t zeDeviceGetImagePropertiesPrologue( ze_device_handle_t hDevice, ze_device_image_properties_t* pImageProperties ) override; ze_result_t zeDeviceGetExternalMemoryPropertiesPrologue( ze_device_handle_t hDevice, ze_device_external_memory_properties_t* pExternalMemoryProperties ) override; ze_result_t zeDeviceGetP2PPropertiesPrologue( ze_device_handle_t hDevice, ze_device_handle_t hPeerDevice, ze_device_p2p_properties_t* pP2PProperties ) override; ze_result_t zeDeviceCanAccessPeerPrologue( ze_device_handle_t hDevice, ze_device_handle_t hPeerDevice, ze_bool_t* value ) override; ze_result_t zeDeviceGetStatusPrologue( ze_device_handle_t hDevice ) override; ze_result_t zeDeviceGetGlobalTimestampsPrologue( ze_device_handle_t hDevice, uint64_t* hostTimestamp, uint64_t* deviceTimestamp ) override; ze_result_t zeContextCreatePrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, ze_context_handle_t* phContext ) override; ze_result_t zeContextCreateExPrologue( ze_driver_handle_t hDriver, const ze_context_desc_t* desc, uint32_t numDevices, ze_device_handle_t* phDevices, ze_context_handle_t* phContext ) override; ze_result_t zeContextDestroyPrologue( ze_context_handle_t hContext ) override; ze_result_t zeContextGetStatusPrologue( ze_context_handle_t hContext ) override; ze_result_t zeCommandQueueCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_queue_desc_t* desc, ze_command_queue_handle_t* phCommandQueue ) override; ze_result_t zeCommandQueueDestroyPrologue( ze_command_queue_handle_t hCommandQueue ) override; ze_result_t zeCommandQueueExecuteCommandListsPrologue( ze_command_queue_handle_t hCommandQueue, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, ze_fence_handle_t hFence ) override; ze_result_t zeCommandQueueSynchronizePrologue( ze_command_queue_handle_t hCommandQueue, uint64_t timeout ) override; ze_result_t zeCommandQueueGetOrdinalPrologue( ze_command_queue_handle_t hCommandQueue, uint32_t* pOrdinal ) override; ze_result_t zeCommandQueueGetIndexPrologue( ze_command_queue_handle_t hCommandQueue, uint32_t* pIndex ) override; ze_result_t zeCommandListCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_list_desc_t* desc, ze_command_list_handle_t* phCommandList ) override; ze_result_t zeCommandListCreateImmediatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_command_queue_desc_t* altdesc, ze_command_list_handle_t* phCommandList ) override; ze_result_t zeCommandListDestroyPrologue( ze_command_list_handle_t hCommandList ) override; ze_result_t zeCommandListClosePrologue( ze_command_list_handle_t hCommandList ) override; ze_result_t zeCommandListResetPrologue( ze_command_list_handle_t hCommandList ) override; ze_result_t zeCommandListAppendWriteGlobalTimestampPrologue( ze_command_list_handle_t hCommandList, uint64_t* dstptr, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListHostSynchronizePrologue( ze_command_list_handle_t hCommandList, uint64_t timeout ) override; ze_result_t zeCommandListGetDeviceHandlePrologue( ze_command_list_handle_t hCommandList, ze_device_handle_t* phDevice ) override; ze_result_t zeCommandListGetContextHandlePrologue( ze_command_list_handle_t hCommandList, ze_context_handle_t* phContext ) override; ze_result_t zeCommandListGetOrdinalPrologue( ze_command_list_handle_t hCommandList, uint32_t* pOrdinal ) override; ze_result_t zeCommandListImmediateGetIndexPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t* pIndex ) override; ze_result_t zeCommandListIsImmediatePrologue( ze_command_list_handle_t hCommandList, ze_bool_t* pIsImmediate ) override; ze_result_t zeCommandListAppendBarrierPrologue( ze_command_list_handle_t hCommandList, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryRangesBarrierPrologue( ze_command_list_handle_t hCommandList, uint32_t numRanges, const size_t* pRangeSizes, const void** pRanges, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeContextSystemBarrierPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice ) override; ze_result_t zeCommandListAppendMemoryCopyPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryFillPrologue( ze_command_list_handle_t hCommandList, void* ptr, const void* pattern, size_t pattern_size, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryCopyRegionPrologue( ze_command_list_handle_t hCommandList, void* dstptr, const ze_copy_region_t* dstRegion, uint32_t dstPitch, uint32_t dstSlicePitch, const void* srcptr, const ze_copy_region_t* srcRegion, uint32_t srcPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryCopyFromContextPrologue( ze_command_list_handle_t hCommandList, void* dstptr, ze_context_handle_t hContextSrc, const void* srcptr, size_t size, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendImageCopyPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendImageCopyRegionPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage, const ze_image_region_t* pDstRegion, const ze_image_region_t* pSrcRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendImageCopyToMemoryPrologue( ze_command_list_handle_t hCommandList, void* dstptr, ze_image_handle_t hSrcImage, const ze_image_region_t* pSrcRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendImageCopyFromMemoryPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, const void* srcptr, const ze_image_region_t* pDstRegion, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendMemoryPrefetchPrologue( ze_command_list_handle_t hCommandList, const void* ptr, size_t size ) override; ze_result_t zeCommandListAppendMemAdvisePrologue( ze_command_list_handle_t hCommandList, ze_device_handle_t hDevice, const void* ptr, size_t size, ze_memory_advice_t advice ) override; ze_result_t zeEventPoolCreatePrologue( ze_context_handle_t hContext, const ze_event_pool_desc_t* desc, uint32_t numDevices, ze_device_handle_t* phDevices, ze_event_pool_handle_t* phEventPool ) override; ze_result_t zeEventPoolDestroyPrologue( ze_event_pool_handle_t hEventPool ) override; ze_result_t zeEventCreatePrologue( ze_event_pool_handle_t hEventPool, const ze_event_desc_t* desc, ze_event_handle_t* phEvent ) override; ze_result_t zeEventDestroyPrologue( ze_event_handle_t hEvent ) override; ze_result_t zeEventPoolGetIpcHandlePrologue( ze_event_pool_handle_t hEventPool, ze_ipc_event_pool_handle_t* phIpc ) override; ze_result_t zeEventPoolPutIpcHandlePrologue( ze_context_handle_t hContext, ze_ipc_event_pool_handle_t hIpc ) override; ze_result_t zeEventPoolOpenIpcHandlePrologue( ze_context_handle_t hContext, ze_ipc_event_pool_handle_t hIpc, ze_event_pool_handle_t* phEventPool ) override; ze_result_t zeEventPoolCloseIpcHandlePrologue( ze_event_pool_handle_t hEventPool ) override; ze_result_t zeCommandListAppendSignalEventPrologue( ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent ) override; ze_result_t zeCommandListAppendWaitOnEventsPrologue( ze_command_list_handle_t hCommandList, uint32_t numEvents, ze_event_handle_t* phEvents ) override; ze_result_t zeEventHostSignalPrologue( ze_event_handle_t hEvent ) override; ze_result_t zeEventHostSynchronizePrologue( ze_event_handle_t hEvent, uint64_t timeout ) override; ze_result_t zeEventQueryStatusPrologue( ze_event_handle_t hEvent ) override; ze_result_t zeCommandListAppendEventResetPrologue( ze_command_list_handle_t hCommandList, ze_event_handle_t hEvent ) override; ze_result_t zeEventHostResetPrologue( ze_event_handle_t hEvent ) override; ze_result_t zeEventQueryKernelTimestampPrologue( ze_event_handle_t hEvent, ze_kernel_timestamp_result_t* dstptr ) override; ze_result_t zeCommandListAppendQueryKernelTimestampsPrologue( ze_command_list_handle_t hCommandList, uint32_t numEvents, ze_event_handle_t* phEvents, void* dstptr, const size_t* pOffsets, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeEventGetEventPoolPrologue( ze_event_handle_t hEvent, ze_event_pool_handle_t* phEventPool ) override; ze_result_t zeEventGetSignalScopePrologue( ze_event_handle_t hEvent, ze_event_scope_flags_t* pSignalScope ) override; ze_result_t zeEventGetWaitScopePrologue( ze_event_handle_t hEvent, ze_event_scope_flags_t* pWaitScope ) override; ze_result_t zeEventPoolGetContextHandlePrologue( ze_event_pool_handle_t hEventPool, ze_context_handle_t* phContext ) override; ze_result_t zeEventPoolGetFlagsPrologue( ze_event_pool_handle_t hEventPool, ze_event_pool_flags_t* pFlags ) override; ze_result_t zeFenceCreatePrologue( ze_command_queue_handle_t hCommandQueue, const ze_fence_desc_t* desc, ze_fence_handle_t* phFence ) override; ze_result_t zeFenceDestroyPrologue( ze_fence_handle_t hFence ) override; ze_result_t zeFenceHostSynchronizePrologue( ze_fence_handle_t hFence, uint64_t timeout ) override; ze_result_t zeFenceQueryStatusPrologue( ze_fence_handle_t hFence ) override; ze_result_t zeFenceResetPrologue( ze_fence_handle_t hFence ) override; ze_result_t zeImageGetPropertiesPrologue( ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_properties_t* pImageProperties ) override; ze_result_t zeImageCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t* phImage ) override; ze_result_t zeImageDestroyPrologue( ze_image_handle_t hImage ) override; ze_result_t zeMemAllocSharedPrologue( ze_context_handle_t hContext, const ze_device_mem_alloc_desc_t* device_desc, const ze_host_mem_alloc_desc_t* host_desc, size_t size, size_t alignment, ze_device_handle_t hDevice, void** pptr ) override; ze_result_t zeMemAllocDevicePrologue( ze_context_handle_t hContext, const ze_device_mem_alloc_desc_t* device_desc, size_t size, size_t alignment, ze_device_handle_t hDevice, void** pptr ) override; ze_result_t zeMemAllocHostPrologue( ze_context_handle_t hContext, const ze_host_mem_alloc_desc_t* host_desc, size_t size, size_t alignment, void** pptr ) override; ze_result_t zeMemFreePrologue( ze_context_handle_t hContext, void* ptr ) override; ze_result_t zeMemGetAllocPropertiesPrologue( ze_context_handle_t hContext, const void* ptr, ze_memory_allocation_properties_t* pMemAllocProperties, ze_device_handle_t* phDevice ) override; ze_result_t zeMemGetAddressRangePrologue( ze_context_handle_t hContext, const void* ptr, void** pBase, size_t* pSize ) override; ze_result_t zeMemGetIpcHandlePrologue( ze_context_handle_t hContext, const void* ptr, ze_ipc_mem_handle_t* pIpcHandle ) override; ze_result_t zeMemGetIpcHandleFromFileDescriptorExpPrologue( ze_context_handle_t hContext, uint64_t handle, ze_ipc_mem_handle_t* pIpcHandle ) override; ze_result_t zeMemGetFileDescriptorFromIpcHandleExpPrologue( ze_context_handle_t hContext, ze_ipc_mem_handle_t ipcHandle, uint64_t* pHandle ) override; ze_result_t zeMemPutIpcHandlePrologue( ze_context_handle_t hContext, ze_ipc_mem_handle_t handle ) override; ze_result_t zeMemOpenIpcHandlePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_ipc_mem_handle_t handle, ze_ipc_memory_flags_t flags, void** pptr ) override; ze_result_t zeMemCloseIpcHandlePrologue( ze_context_handle_t hContext, const void* ptr ) override; ze_result_t zeMemSetAtomicAccessAttributeExpPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const void* ptr, size_t size, ze_memory_atomic_attr_exp_flags_t attr ) override; ze_result_t zeMemGetAtomicAccessAttributeExpPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const void* ptr, size_t size, ze_memory_atomic_attr_exp_flags_t* pAttr ) override; ze_result_t zeModuleCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_module_desc_t* desc, ze_module_handle_t* phModule, ze_module_build_log_handle_t* phBuildLog ) override; ze_result_t zeModuleDestroyPrologue( ze_module_handle_t hModule ) override; ze_result_t zeModuleDynamicLinkPrologue( uint32_t numModules, ze_module_handle_t* phModules, ze_module_build_log_handle_t* phLinkLog ) override; ze_result_t zeModuleBuildLogDestroyPrologue( ze_module_build_log_handle_t hModuleBuildLog ) override; ze_result_t zeModuleBuildLogGetStringPrologue( ze_module_build_log_handle_t hModuleBuildLog, size_t* pSize, char* pBuildLog ) override; ze_result_t zeModuleGetNativeBinaryPrologue( ze_module_handle_t hModule, size_t* pSize, uint8_t* pModuleNativeBinary ) override; ze_result_t zeModuleGetGlobalPointerPrologue( ze_module_handle_t hModule, const char* pGlobalName, size_t* pSize, void** pptr ) override; ze_result_t zeModuleGetKernelNamesPrologue( ze_module_handle_t hModule, uint32_t* pCount, const char** pNames ) override; ze_result_t zeModuleGetPropertiesPrologue( ze_module_handle_t hModule, ze_module_properties_t* pModuleProperties ) override; ze_result_t zeKernelCreatePrologue( ze_module_handle_t hModule, const ze_kernel_desc_t* desc, ze_kernel_handle_t* phKernel ) override; ze_result_t zeKernelDestroyPrologue( ze_kernel_handle_t hKernel ) override; ze_result_t zeModuleGetFunctionPointerPrologue( ze_module_handle_t hModule, const char* pFunctionName, void** pfnFunction ) override; ze_result_t zeKernelSetGroupSizePrologue( ze_kernel_handle_t hKernel, uint32_t groupSizeX, uint32_t groupSizeY, uint32_t groupSizeZ ) override; ze_result_t zeKernelSuggestGroupSizePrologue( ze_kernel_handle_t hKernel, uint32_t globalSizeX, uint32_t globalSizeY, uint32_t globalSizeZ, uint32_t* groupSizeX, uint32_t* groupSizeY, uint32_t* groupSizeZ ) override; ze_result_t zeKernelSuggestMaxCooperativeGroupCountPrologue( ze_kernel_handle_t hKernel, uint32_t* totalGroupCount ) override; ze_result_t zeKernelSetArgumentValuePrologue( ze_kernel_handle_t hKernel, uint32_t argIndex, size_t argSize, const void* pArgValue ) override; ze_result_t zeKernelSetIndirectAccessPrologue( ze_kernel_handle_t hKernel, ze_kernel_indirect_access_flags_t flags ) override; ze_result_t zeKernelGetIndirectAccessPrologue( ze_kernel_handle_t hKernel, ze_kernel_indirect_access_flags_t* pFlags ) override; ze_result_t zeKernelGetSourceAttributesPrologue( ze_kernel_handle_t hKernel, uint32_t* pSize, char** pString ) override; ze_result_t zeKernelSetCacheConfigPrologue( ze_kernel_handle_t hKernel, ze_cache_config_flags_t flags ) override; ze_result_t zeKernelGetPropertiesPrologue( ze_kernel_handle_t hKernel, ze_kernel_properties_t* pKernelProperties ) override; ze_result_t zeKernelGetNamePrologue( ze_kernel_handle_t hKernel, size_t* pSize, char* pName ) override; ze_result_t zeCommandListAppendLaunchKernelPrologue( ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t* pLaunchFuncArgs, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendLaunchCooperativeKernelPrologue( ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t* pLaunchFuncArgs, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendLaunchKernelIndirectPrologue( ze_command_list_handle_t hCommandList, ze_kernel_handle_t hKernel, const ze_group_count_t* pLaunchArgumentsBuffer, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendLaunchMultipleKernelsIndirectPrologue( ze_command_list_handle_t hCommandList, uint32_t numKernels, ze_kernel_handle_t* phKernels, const uint32_t* pCountBuffer, const ze_group_count_t* pLaunchArgumentsBuffer, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeContextMakeMemoryResidentPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, void* ptr, size_t size ) override; ze_result_t zeContextEvictMemoryPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, void* ptr, size_t size ) override; ze_result_t zeContextMakeImageResidentPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_image_handle_t hImage ) override; ze_result_t zeContextEvictImagePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_image_handle_t hImage ) override; ze_result_t zeSamplerCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_sampler_desc_t* desc, ze_sampler_handle_t* phSampler ) override; ze_result_t zeSamplerDestroyPrologue( ze_sampler_handle_t hSampler ) override; ze_result_t zeVirtualMemReservePrologue( ze_context_handle_t hContext, const void* pStart, size_t size, void** pptr ) override; ze_result_t zeVirtualMemFreePrologue( ze_context_handle_t hContext, const void* ptr, size_t size ) override; ze_result_t zeVirtualMemQueryPageSizePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, size_t size, size_t* pagesize ) override; ze_result_t zePhysicalMemCreatePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, ze_physical_mem_desc_t* desc, ze_physical_mem_handle_t* phPhysicalMemory ) override; ze_result_t zePhysicalMemDestroyPrologue( ze_context_handle_t hContext, ze_physical_mem_handle_t hPhysicalMemory ) override; ze_result_t zeVirtualMemMapPrologue( ze_context_handle_t hContext, const void* ptr, size_t size, ze_physical_mem_handle_t hPhysicalMemory, size_t offset, ze_memory_access_attribute_t access ) override; ze_result_t zeVirtualMemUnmapPrologue( ze_context_handle_t hContext, const void* ptr, size_t size ) override; ze_result_t zeVirtualMemSetAccessAttributePrologue( ze_context_handle_t hContext, const void* ptr, size_t size, ze_memory_access_attribute_t access ) override; ze_result_t zeVirtualMemGetAccessAttributePrologue( ze_context_handle_t hContext, const void* ptr, size_t size, ze_memory_access_attribute_t* access, size_t* outSize ) override; ze_result_t zeKernelSetGlobalOffsetExpPrologue( ze_kernel_handle_t hKernel, uint32_t offsetX, uint32_t offsetY, uint32_t offsetZ ) override; ze_result_t zeKernelGetBinaryExpPrologue( ze_kernel_handle_t hKernel, size_t* pSize, uint8_t* pKernelBinary ) override; ze_result_t zeDeviceImportExternalSemaphoreExtPrologue( ze_device_handle_t hDevice, const ze_external_semaphore_ext_desc_t* desc, ze_external_semaphore_ext_handle_t* phSemaphore ) override; ze_result_t zeDeviceReleaseExternalSemaphoreExtPrologue( ze_external_semaphore_ext_handle_t hSemaphore ) override; ze_result_t zeCommandListAppendSignalExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_signal_params_ext_t* signalParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendWaitExternalSemaphoreExtPrologue( ze_command_list_handle_t hCommandList, uint32_t numSemaphores, ze_external_semaphore_ext_handle_t* phSemaphores, ze_external_semaphore_wait_params_ext_t* waitParams, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeDeviceReserveCacheExtPrologue( ze_device_handle_t hDevice, size_t cacheLevel, size_t cacheReservationSize ) override; ze_result_t zeDeviceSetCacheAdviceExtPrologue( ze_device_handle_t hDevice, void* ptr, size_t regionSize, ze_cache_ext_region_t cacheRegion ) override; ze_result_t zeEventQueryTimestampsExpPrologue( ze_event_handle_t hEvent, ze_device_handle_t hDevice, uint32_t* pCount, ze_kernel_timestamp_result_t* pTimestamps ) override; ze_result_t zeImageGetMemoryPropertiesExpPrologue( ze_image_handle_t hImage, ze_image_memory_properties_exp_t* pMemoryProperties ) override; ze_result_t zeImageViewCreateExtPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t hImage, ze_image_handle_t* phImageView ) override; ze_result_t zeImageViewCreateExpPrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, const ze_image_desc_t* desc, ze_image_handle_t hImage, ze_image_handle_t* phImageView ) override; ze_result_t zeKernelSchedulingHintExpPrologue( ze_kernel_handle_t hKernel, ze_scheduling_hint_exp_desc_t* pHint ) override; ze_result_t zeDevicePciGetPropertiesExtPrologue( ze_device_handle_t hDevice, ze_pci_ext_properties_t* pPciProperties ) override; ze_result_t zeCommandListAppendImageCopyToMemoryExtPrologue( ze_command_list_handle_t hCommandList, void* dstptr, ze_image_handle_t hSrcImage, const ze_image_region_t* pSrcRegion, uint32_t destRowPitch, uint32_t destSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListAppendImageCopyFromMemoryExtPrologue( ze_command_list_handle_t hCommandList, ze_image_handle_t hDstImage, const void* srcptr, const ze_image_region_t* pDstRegion, uint32_t srcRowPitch, uint32_t srcSlicePitch, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeImageGetAllocPropertiesExtPrologue( ze_context_handle_t hContext, ze_image_handle_t hImage, ze_image_allocation_ext_properties_t* pImageAllocProperties ) override; ze_result_t zeModuleInspectLinkageExtPrologue( ze_linkage_inspection_ext_desc_t* pInspectDesc, uint32_t numModules, ze_module_handle_t* phModules, ze_module_build_log_handle_t* phLog ) override; ze_result_t zeMemFreeExtPrologue( ze_context_handle_t hContext, const ze_memory_free_ext_desc_t* pMemFreeDesc, void* ptr ) override; ze_result_t zeFabricVertexGetExpPrologue( ze_driver_handle_t hDriver, uint32_t* pCount, ze_fabric_vertex_handle_t* phVertices ) override; ze_result_t zeFabricVertexGetSubVerticesExpPrologue( ze_fabric_vertex_handle_t hVertex, uint32_t* pCount, ze_fabric_vertex_handle_t* phSubvertices ) override; ze_result_t zeFabricVertexGetPropertiesExpPrologue( ze_fabric_vertex_handle_t hVertex, ze_fabric_vertex_exp_properties_t* pVertexProperties ) override; ze_result_t zeFabricVertexGetDeviceExpPrologue( ze_fabric_vertex_handle_t hVertex, ze_device_handle_t* phDevice ) override; ze_result_t zeDeviceGetFabricVertexExpPrologue( ze_device_handle_t hDevice, ze_fabric_vertex_handle_t* phVertex ) override; ze_result_t zeFabricEdgeGetExpPrologue( ze_fabric_vertex_handle_t hVertexA, ze_fabric_vertex_handle_t hVertexB, uint32_t* pCount, ze_fabric_edge_handle_t* phEdges ) override; ze_result_t zeFabricEdgeGetVerticesExpPrologue( ze_fabric_edge_handle_t hEdge, ze_fabric_vertex_handle_t* phVertexA, ze_fabric_vertex_handle_t* phVertexB ) override; ze_result_t zeFabricEdgeGetPropertiesExpPrologue( ze_fabric_edge_handle_t hEdge, ze_fabric_edge_exp_properties_t* pEdgeProperties ) override; ze_result_t zeEventQueryKernelTimestampsExtPrologue( ze_event_handle_t hEvent, ze_device_handle_t hDevice, uint32_t* pCount, ze_event_query_kernel_timestamps_results_ext_properties_t* pResults ) override; ze_result_t zeRTASBuilderCreateExpPrologue( ze_driver_handle_t hDriver, const ze_rtas_builder_exp_desc_t* pDescriptor, ze_rtas_builder_exp_handle_t* phBuilder ) override; ze_result_t zeRTASBuilderGetBuildPropertiesExpPrologue( ze_rtas_builder_exp_handle_t hBuilder, const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ze_rtas_builder_exp_properties_t* pProperties ) override; ze_result_t zeDriverRTASFormatCompatibilityCheckExpPrologue( ze_driver_handle_t hDriver, ze_rtas_format_exp_t rtasFormatA, ze_rtas_format_exp_t rtasFormatB ) override; ze_result_t zeRTASBuilderBuildExpPrologue( ze_rtas_builder_exp_handle_t hBuilder, const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, void* pScratchBuffer, size_t scratchBufferSizeBytes, void* pRtasBuffer, size_t rtasBufferSizeBytes, ze_rtas_parallel_operation_exp_handle_t hParallelOperation, void* pBuildUserPtr, ze_rtas_aabb_exp_t* pBounds, size_t* pRtasBufferSizeBytes ) override; ze_result_t zeRTASBuilderDestroyExpPrologue( ze_rtas_builder_exp_handle_t hBuilder ) override; ze_result_t zeRTASParallelOperationCreateExpPrologue( ze_driver_handle_t hDriver, ze_rtas_parallel_operation_exp_handle_t* phParallelOperation ) override; ze_result_t zeRTASParallelOperationGetPropertiesExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ze_rtas_parallel_operation_exp_properties_t* pProperties ) override; ze_result_t zeRTASParallelOperationJoinExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ) override; ze_result_t zeRTASParallelOperationDestroyExpPrologue( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ) override; ze_result_t zeMemGetPitchFor2dImagePrologue( ze_context_handle_t hContext, ze_device_handle_t hDevice, size_t imageWidth, size_t imageHeight, unsigned int elementSizeInBytes, size_t * rowPitch ) override; ze_result_t zeImageGetDeviceOffsetExpPrologue( ze_image_handle_t hImage, uint64_t* pDeviceOffset ) override; ze_result_t zeCommandListCreateCloneExpPrologue( ze_command_list_handle_t hCommandList, ze_command_list_handle_t* phClonedCommandList ) override; ze_result_t zeCommandListImmediateAppendCommandListsExpPrologue( ze_command_list_handle_t hCommandListImmediate, uint32_t numCommandLists, ze_command_list_handle_t* phCommandLists, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListGetNextCommandIdExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint64_t* pCommandId ) override; ze_result_t zeCommandListGetNextCommandIdWithKernelsExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_command_id_exp_desc_t* desc, uint32_t numKernels, ze_kernel_handle_t* phKernels, uint64_t* pCommandId ) override; ze_result_t zeCommandListUpdateMutableCommandsExpPrologue( ze_command_list_handle_t hCommandList, const ze_mutable_commands_exp_desc_t* desc ) override; ze_result_t zeCommandListUpdateMutableCommandSignalEventExpPrologue( ze_command_list_handle_t hCommandList, uint64_t commandId, ze_event_handle_t hSignalEvent ) override; ze_result_t zeCommandListUpdateMutableCommandWaitEventsExpPrologue( ze_command_list_handle_t hCommandList, uint64_t commandId, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zeCommandListUpdateMutableCommandKernelsExpPrologue( ze_command_list_handle_t hCommandList, uint32_t numKernels, uint64_t* pCommandId, ze_kernel_handle_t* phKernels ) override; }; } level-zero-1.20.6/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.cpp000066400000000000000000003636201475521542100323260ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See handle_lifetime.cpp.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_handle_lifetime.cpp * */ #include "ze_validation_layer.h" #include "ze_handle_lifetime.h" namespace validation_layer { ze_result_t ZESHandleLifetimeValidation::zesDriverGetExtensionPropertiesPrologue( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. zes_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDriverGetExtensionFunctionAddressPrologue( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceGetPrologue( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance uint32_t* pCount, ///< [in,out] pointer to the number of sysman devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sysman devices available. ///< if count is greater than the number of sysman devices available, then ///< the driver shall update the value with the correct number of sysman ///< devices available. zes_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of sysman devices. ///< if count is less than the number of sysman devices available, then ///< driver shall only retrieve that number of sysman devices. ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceGetPropertiesPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_properties_t* pProperties ///< [in,out] Structure that will contain information about the device. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceGetStatePrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_state_t* pState ///< [in,out] Structure that will contain information about the device. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceResetPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device ze_bool_t force ///< [in] If set to true, all applications that are currently using the ///< device will be forcibly killed. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceResetExtPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device zes_reset_properties_t* pProperties ///< [in] Device reset properties to apply ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceProcessesGetStatePrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device uint32_t* pCount, ///< [in,out] pointer to the number of processes. ///< if count is zero, then the driver shall update the value with the ///< total number of processes currently attached to the device. ///< if count is greater than the number of processes currently attached to ///< the device, then the driver shall update the value with the correct ///< number of processes. zes_process_state_t* pProcesses ///< [in,out][optional][range(0, *pCount)] array of process information. ///< if count is less than the number of processes currently attached to ///< the device, then the driver shall only retrieve information about that ///< number of processes. In this case, the return code will ::ZE_RESULT_ERROR_INVALID_SIZE. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDevicePciGetPropertiesPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_properties_t* pProperties ///< [in,out] Will contain the PCI properties. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDevicePciGetStatePrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_state_t* pState ///< [in,out] Will contain the PCI properties. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDevicePciGetBarsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of PCI bars. ///< if count is zero, then the driver shall update the value with the ///< total number of PCI bars that are setup. ///< if count is greater than the number of PCI bars that are setup, then ///< the driver shall update the value with the correct number of PCI bars. zes_pci_bar_properties_t* pProperties ///< [in,out][optional][range(0, *pCount)] array of information about setup ///< PCI bars. ///< if count is less than the number of PCI bars that are setup, then the ///< driver shall only retrieve information about that number of PCI bars. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDevicePciGetStatsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_stats_t* pStats ///< [in,out] Will contain a snapshot of the latest stats. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceSetOverclockWaiverPrologue( zes_device_handle_t hDevice ///< [in] Sysman handle of the device. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceGetOverclockDomainsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pOverclockDomains ///< [in,out] Returns the overclock domains that are supported (a bit for ///< each of enum ::zes_overclock_domain_t). If no bits are set, the device ///< doesn't support overclocking. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceGetOverclockControlsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_domain_t domainType, ///< [in] Domain type. uint32_t* pAvailableControls ///< [in,out] Returns the overclock controls that are supported for the ///< specified overclock domain (a bit for each of enum ///< ::zes_overclock_control_t). ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceResetOverclockSettingsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. ze_bool_t onShippedState ///< [in] True will reset to shipped state; false will reset to ///< manufacturing state ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceReadOverclockStatePrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_mode_t* pOverclockMode, ///< [out] One of overclock mode. ze_bool_t* pWaiverSetting, ///< [out] Waiver setting: 0 = Waiver not set, 1 = waiver has been set. ze_bool_t* pOverclockState, ///< [out] Current settings 0 =manufacturing state, 1= shipped state).. zes_pending_action_t* pPendingAction, ///< [out] This enum is returned when the driver attempts to set an ///< overclock control or reset overclock settings. ze_bool_t* pPendingReset ///< [out] Pending reset 0 =manufacturing state, 1= shipped state).. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumOverclockDomainsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_overclock_handle_t* phDomainHandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesOverclockGetDomainPropertiesPrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_properties_t* pDomainProperties ///< [in,out] The overclock properties for the specified domain. ) { if ( !context.handleLifetime->isHandleValid( hDomainHandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesOverclockGetDomainVFPropertiesPrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_property_t* pVFProperties ///< [in,out] The VF min,max,step for a specified domain. ) { if ( !context.handleLifetime->isHandleValid( hDomainHandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesOverclockGetDomainControlPropertiesPrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Handle for the component. zes_control_property_t* pControlProperties ///< [in,out] overclock control values. ) { if ( !context.handleLifetime->isHandleValid( hDomainHandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesOverclockGetControlCurrentValuePrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [in,out] Getting overclock control value for the specified control. ) { if ( !context.handleLifetime->isHandleValid( hDomainHandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesOverclockGetControlPendingValuePrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [out] Returns the pending value for a given control. The units and ///< format of the value depend on the control type. ) { if ( !context.handleLifetime->isHandleValid( hDomainHandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesOverclockSetControlUserValuePrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. double pValue, ///< [in] The new value of the control. The units and format of the value ///< depend on the control type. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ) { if ( !context.handleLifetime->isHandleValid( hDomainHandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesOverclockGetControlStatePrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. zes_control_state_t* pControlState, ///< [out] Current overclock control state. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ) { if ( !context.handleLifetime->isHandleValid( hDomainHandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesOverclockGetVFPointValuesPrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. zes_vf_array_type_t VFArrayType, ///< [in] User,Default or Live VF array to read from uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t* PointValue ///< [out] Returns the frequency in 1kHz units or voltage in millivolt ///< units from the custom V-F curve at the specified zero-based index ) { if ( !context.handleLifetime->isHandleValid( hDomainHandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesOverclockSetVFPointValuesPrologue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t PointValue ///< [in] Writes frequency in 1kHz units or voltage in millivolt units to ///< custom V-F curve at the specified zero-based index ) { if ( !context.handleLifetime->isHandleValid( hDomainHandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumDiagnosticTestSuitesPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_diag_handle_t* phDiagnostics ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDiagnosticsGetPropertiesPrologue( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. zes_diag_properties_t* pProperties ///< [in,out] Structure describing the properties of a diagnostics test ///< suite ) { if ( !context.handleLifetime->isHandleValid( hDiagnostics )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDiagnosticsGetTestsPrologue( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of tests. ///< if count is zero, then the driver shall update the value with the ///< total number of tests that are available. ///< if count is greater than the number of tests that are available, then ///< the driver shall update the value with the correct number of tests. zes_diag_test_t* pTests ///< [in,out][optional][range(0, *pCount)] array of information about ///< individual tests sorted by increasing value of the `index` member of ::zes_diag_test_t. ///< if count is less than the number of tests that are available, then the ///< driver shall only retrieve that number of tests. ) { if ( !context.handleLifetime->isHandleValid( hDiagnostics )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDiagnosticsRunTestsPrologue( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t startIndex, ///< [in] The index of the first test to run. Set to ///< ::ZES_DIAG_FIRST_TEST_INDEX to start from the beginning. uint32_t endIndex, ///< [in] The index of the last test to run. Set to ///< ::ZES_DIAG_LAST_TEST_INDEX to complete all tests after the start test. zes_diag_result_t* pResult ///< [in,out] The result of the diagnostics ) { if ( !context.handleLifetime->isHandleValid( hDiagnostics )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEccAvailablePrologue( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pAvailable ///< [out] ECC functionality is available (true)/unavailable (false). ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEccConfigurablePrologue( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pConfigurable ///< [out] ECC can be enabled/disabled (true)/enabled/disabled (false). ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceGetEccStatePrologue( zes_device_handle_t hDevice, ///< [in] Handle for the component. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceSetEccStatePrologue( zes_device_handle_t hDevice, ///< [in] Handle for the component. const zes_device_ecc_desc_t* newState, ///< [in] Pointer to desired ECC state. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumEngineGroupsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_engine_handle_t* phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesEngineGetPropertiesPrologue( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_properties_t* pProperties ///< [in,out] The properties for the specified engine group. ) { if ( !context.handleLifetime->isHandleValid( hEngine )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesEngineGetActivityPrologue( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_stats_t* pStats ///< [in,out] Will contain a snapshot of the engine group activity ///< counters. ) { if ( !context.handleLifetime->isHandleValid( hEngine )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEventRegisterPrologue( zes_device_handle_t hDevice, ///< [in] The device handle. zes_event_type_flags_t events ///< [in] List of events to listen to. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDriverEventListenPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT32_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phDevices) && (i < count); ++i){ if (!context.handleLifetime->isHandleValid( phDevices[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDriverEventListenExPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT64_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phDevices) && (i < count); ++i){ if (!context.handleLifetime->isHandleValid( phDevices[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumFabricPortsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fabric_port_handle_t* phPort ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFabricPortGetPropertiesPrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_properties_t* pProperties ///< [in,out] Will contain properties of the Fabric Port. ) { if ( !context.handleLifetime->isHandleValid( hPort )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFabricPortGetLinkTypePrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_link_type_t* pLinkType ///< [in,out] Will contain details about the link attached to the Fabric ///< port. ) { if ( !context.handleLifetime->isHandleValid( hPort )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFabricPortGetConfigPrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_config_t* pConfig ///< [in,out] Will contain configuration of the Fabric Port. ) { if ( !context.handleLifetime->isHandleValid( hPort )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFabricPortSetConfigPrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. const zes_fabric_port_config_t* pConfig ///< [in] Contains new configuration of the Fabric Port. ) { if ( !context.handleLifetime->isHandleValid( hPort )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFabricPortGetStatePrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_state_t* pState ///< [in,out] Will contain the current state of the Fabric Port ) { if ( !context.handleLifetime->isHandleValid( hPort )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFabricPortGetThroughputPrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_throughput_t* pThroughput ///< [in,out] Will contain the Fabric port throughput counters. ) { if ( !context.handleLifetime->isHandleValid( hPort )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFabricPortGetFabricErrorCountersPrologue( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_error_counters_t* pErrors ///< [in,out] Will contain the Fabric port Error counters. ) { if ( !context.handleLifetime->isHandleValid( hPort )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFabricPortGetMultiPortThroughputPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t numPorts, ///< [in] Number of ports enumerated in function ::zesDeviceEnumFabricPorts zes_fabric_port_handle_t* phPort, ///< [in][range(0, numPorts)] array of fabric port handles provided by user ///< to gather throughput values. zes_fabric_port_throughput_t** pThroughput ///< [out][range(0, numPorts)] array of fabric port throughput counters ///< from multiple ports of type ::zes_fabric_port_throughput_t. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phPort) && (i < numPorts); ++i){ if (!context.handleLifetime->isHandleValid( phPort[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumFansPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fan_handle_t* phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFanGetPropertiesPrologue( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_properties_t* pProperties ///< [in,out] Will contain the properties of the fan. ) { if ( !context.handleLifetime->isHandleValid( hFan )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFanGetConfigPrologue( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_config_t* pConfig ///< [in,out] Will contain the current configuration of the fan. ) { if ( !context.handleLifetime->isHandleValid( hFan )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFanSetDefaultModePrologue( zes_fan_handle_t hFan ///< [in] Handle for the component. ) { if ( !context.handleLifetime->isHandleValid( hFan )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFanSetFixedSpeedModePrologue( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_t* speed ///< [in] The fixed fan speed setting ) { if ( !context.handleLifetime->isHandleValid( hFan )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFanSetSpeedTableModePrologue( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_table_t* speedTable ///< [in] A table containing temperature/speed pairs. ) { if ( !context.handleLifetime->isHandleValid( hFan )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFanGetStatePrologue( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned. int32_t* pSpeed ///< [in,out] Will contain the current speed of the fan in the units ///< requested. A value of -1 indicates that the fan speed cannot be ///< measured. ) { if ( !context.handleLifetime->isHandleValid( hFan )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumFirmwaresPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_firmware_handle_t* phFirmware ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFirmwareGetPropertiesPrologue( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. zes_firmware_properties_t* pProperties ///< [in,out] Pointer to an array that will hold the properties of the ///< firmware ) { if ( !context.handleLifetime->isHandleValid( hFirmware )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFirmwareFlashPrologue( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. void* pImage, ///< [in] Image of the new firmware to flash. uint32_t size ///< [in] Size of the flash image. ) { if ( !context.handleLifetime->isHandleValid( hFirmware )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFirmwareGetFlashProgressPrologue( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. uint32_t* pCompletionPercent ///< [in,out] Pointer to the Completion Percentage of Firmware Update ) { if ( !context.handleLifetime->isHandleValid( hFirmware )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFirmwareGetConsoleLogsPrologue( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. size_t* pSize, ///< [in,out] size of firmware log char* pFirmwareLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { if ( !context.handleLifetime->isHandleValid( hFirmware )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumFrequencyDomainsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_freq_handle_t* phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyGetPropertiesPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_properties_t* pProperties ///< [in,out] The frequency properties for the specified domain. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyGetAvailableClocksPrologue( zes_freq_handle_t hFrequency, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of frequencies. ///< if count is zero, then the driver shall update the value with the ///< total number of frequencies that are available. ///< if count is greater than the number of frequencies that are available, ///< then the driver shall update the value with the correct number of frequencies. double* phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of ///< MHz and sorted from slowest to fastest. ///< if count is less than the number of frequencies that are available, ///< then the driver shall only retrieve that number of frequencies. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyGetRangePrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_range_t* pLimits ///< [in,out] The range between which the hardware can operate for the ///< specified domain. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencySetRangePrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. const zes_freq_range_t* pLimits ///< [in] The limits between which the hardware can operate for the ///< specified domain. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyGetStatePrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_state_t* pState ///< [in,out] Frequency state for the specified domain. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyGetThrottleTimePrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_throttle_time_t* pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the ///< specified domain. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyOcGetCapabilitiesPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_capabilities_t* pOcCapabilities ///< [in,out] Pointer to the capabilities structure. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyOcGetFrequencyTargetPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentOcFrequency ///< [out] Overclocking Frequency in MHz, if extended moded is supported, ///< will returned in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyOcSetFrequencyTargetPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentOcFrequency ///< [in] Overclocking Frequency in MHz, if extended moded is supported, it ///< could be set in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyOcGetVoltageTargetPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentVoltageTarget, ///< [out] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double* pCurrentVoltageOffset ///< [out] This voltage offset is applied to all points on the ///< voltage/frequency curve, including the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyOcSetVoltageTargetPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentVoltageTarget, ///< [in] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double CurrentVoltageOffset ///< [in] This voltage offset is applied to all points on the ///< voltage/frequency curve, include the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyOcSetModePrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t CurrentOcMode ///< [in] Current Overclocking Mode ::zes_oc_mode_t. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyOcGetModePrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t* pCurrentOcMode ///< [out] Current Overclocking Mode ::zes_oc_mode_t. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyOcGetIccMaxPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcIccMax ///< [in,out] Will contain the maximum current limit in Amperes on ///< successful return. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyOcSetIccMaxPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocIccMax ///< [in] The new maximum current limit in Amperes. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyOcGetTjMaxPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcTjMax ///< [in,out] Will contain the maximum temperature limit in degrees Celsius ///< on successful return. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFrequencyOcSetTjMaxPrologue( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocTjMax ///< [in] The new maximum temperature limit in degrees Celsius. ) { if ( !context.handleLifetime->isHandleValid( hFrequency )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumLedsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_led_handle_t* phLed ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesLedGetPropertiesPrologue( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_properties_t* pProperties ///< [in,out] Will contain the properties of the LED. ) { if ( !context.handleLifetime->isHandleValid( hLed )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesLedGetStatePrologue( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_state_t* pState ///< [in,out] Will contain the current state of the LED. ) { if ( !context.handleLifetime->isHandleValid( hLed )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesLedSetStatePrologue( zes_led_handle_t hLed, ///< [in] Handle for the component. ze_bool_t enable ///< [in] Set to TRUE to turn the LED on, FALSE to turn off. ) { if ( !context.handleLifetime->isHandleValid( hLed )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesLedSetColorPrologue( zes_led_handle_t hLed, ///< [in] Handle for the component. const zes_led_color_t* pColor ///< [in] New color of the LED. ) { if ( !context.handleLifetime->isHandleValid( hLed )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumMemoryModulesPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_mem_handle_t* phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesMemoryGetPropertiesPrologue( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_properties_t* pProperties ///< [in,out] Will contain memory properties. ) { if ( !context.handleLifetime->isHandleValid( hMemory )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesMemoryGetStatePrologue( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_state_t* pState ///< [in,out] Will contain the current health and allocated memory. ) { if ( !context.handleLifetime->isHandleValid( hMemory )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesMemoryGetBandwidthPrologue( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_bandwidth_t* pBandwidth ///< [in,out] Will contain the total number of bytes read from and written ///< to memory, as well as the current maximum bandwidth. ) { if ( !context.handleLifetime->isHandleValid( hMemory )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumPerformanceFactorDomainsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_perf_handle_t* phPerf ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPerformanceFactorGetPropertiesPrologue( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. zes_perf_properties_t* pProperties ///< [in,out] Will contain information about the specified Performance ///< Factor domain. ) { if ( !context.handleLifetime->isHandleValid( hPerf )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPerformanceFactorGetConfigPrologue( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double* pFactor ///< [in,out] Will contain the actual Performance Factor being used by the ///< hardware (may not be the same as the requested Performance Factor). ) { if ( !context.handleLifetime->isHandleValid( hPerf )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPerformanceFactorSetConfigPrologue( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double factor ///< [in] The new Performance Factor. ) { if ( !context.handleLifetime->isHandleValid( hPerf )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumPowerDomainsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_pwr_handle_t* phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceGetCardPowerDomainPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pwr_handle_t* phPower ///< [in,out] power domain handle for the entire PCIe card. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPowerGetPropertiesPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_properties_t* pProperties ///< [in,out] Structure that will contain property data. ) { if ( !context.handleLifetime->isHandleValid( hPower )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPowerGetEnergyCounterPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_energy_counter_t* pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and ///< timestamp when the last counter value was measured. ) { if ( !context.handleLifetime->isHandleValid( hPower )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPowerGetLimitsPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_sustained_limit_t* pSustained, ///< [in,out][optional] The sustained power limit. If this is null, the ///< current sustained power limits will not be returned. zes_power_burst_limit_t* pBurst, ///< [in,out][optional] The burst power limit. If this is null, the current ///< peak power limits will not be returned. zes_power_peak_limit_t* pPeak ///< [in,out][optional] The peak power limit. If this is null, the peak ///< power limits will not be returned. ) { if ( !context.handleLifetime->isHandleValid( hPower )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPowerSetLimitsPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. const zes_power_sustained_limit_t* pSustained, ///< [in][optional] The sustained power limit. If this is null, no changes ///< will be made to the sustained power limits. const zes_power_burst_limit_t* pBurst, ///< [in][optional] The burst power limit. If this is null, no changes will ///< be made to the burst power limits. const zes_power_peak_limit_t* pPeak ///< [in][optional] The peak power limit. If this is null, no changes will ///< be made to the peak power limits. ) { if ( !context.handleLifetime->isHandleValid( hPower )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPowerGetEnergyThresholdPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_energy_threshold_t* pThreshold ///< [in,out] Returns information about the energy threshold setting - ///< enabled/energy threshold/process ID. ) { if ( !context.handleLifetime->isHandleValid( hPower )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPowerSetEnergyThresholdPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. double threshold ///< [in] The energy threshold to be set in joules. ) { if ( !context.handleLifetime->isHandleValid( hPower )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumPsusPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_psu_handle_t* phPsu ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPsuGetPropertiesPrologue( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_properties_t* pProperties ///< [in,out] Will contain the properties of the power supply. ) { if ( !context.handleLifetime->isHandleValid( hPsu )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPsuGetStatePrologue( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_state_t* pState ///< [in,out] Will contain the current state of the power supply. ) { if ( !context.handleLifetime->isHandleValid( hPsu )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumRasErrorSetsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_ras_handle_t* phRas ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesRasGetPropertiesPrologue( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_properties_t* pProperties ///< [in,out] Structure describing RAS properties ) { if ( !context.handleLifetime->isHandleValid( hRas )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesRasGetConfigPrologue( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_config_t* pConfig ///< [in,out] Will be populed with the current RAS configuration - ///< thresholds used to trigger events ) { if ( !context.handleLifetime->isHandleValid( hRas )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesRasSetConfigPrologue( zes_ras_handle_t hRas, ///< [in] Handle for the component. const zes_ras_config_t* pConfig ///< [in] Change the RAS configuration - thresholds used to trigger events ) { if ( !context.handleLifetime->isHandleValid( hRas )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesRasGetStatePrologue( zes_ras_handle_t hRas, ///< [in] Handle for the component. ze_bool_t clear, ///< [in] Set to 1 to clear the counters of this type zes_ras_state_t* pState ///< [in,out] Breakdown of where errors have occurred ) { if ( !context.handleLifetime->isHandleValid( hRas )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumSchedulersPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_sched_handle_t* phScheduler ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesSchedulerGetPropertiesPrologue( zes_sched_handle_t hScheduler, ///< [in] Handle for the component. zes_sched_properties_t* pProperties ///< [in,out] Structure that will contain property data. ) { if ( !context.handleLifetime->isHandleValid( hScheduler )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesSchedulerGetCurrentModePrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_mode_t* pMode ///< [in,out] Will contain the current scheduler mode. ) { if ( !context.handleLifetime->isHandleValid( hScheduler )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesSchedulerGetTimeoutModePropertiesPrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeout_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ) { if ( !context.handleLifetime->isHandleValid( hScheduler )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesSchedulerGetTimesliceModePropertiesPrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeslice_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ) { if ( !context.handleLifetime->isHandleValid( hScheduler )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesSchedulerSetTimeoutModePrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeout_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { if ( !context.handleLifetime->isHandleValid( hScheduler )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesSchedulerSetTimesliceModePrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeslice_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { if ( !context.handleLifetime->isHandleValid( hScheduler )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesSchedulerSetExclusiveModePrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { if ( !context.handleLifetime->isHandleValid( hScheduler )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesSchedulerSetComputeUnitDebugModePrologue( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { if ( !context.handleLifetime->isHandleValid( hScheduler )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumStandbyDomainsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_standby_handle_t* phStandby ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesStandbyGetPropertiesPrologue( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_properties_t* pProperties ///< [in,out] Will contain the standby hardware properties. ) { if ( !context.handleLifetime->isHandleValid( hStandby )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesStandbyGetModePrologue( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t* pMode ///< [in,out] Will contain the current standby mode. ) { if ( !context.handleLifetime->isHandleValid( hStandby )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesStandbySetModePrologue( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t mode ///< [in] New standby mode. ) { if ( !context.handleLifetime->isHandleValid( hStandby )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumTemperatureSensorsPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_temp_handle_t* phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesTemperatureGetPropertiesPrologue( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_properties_t* pProperties ///< [in,out] Will contain the temperature sensor properties. ) { if ( !context.handleLifetime->isHandleValid( hTemperature )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesTemperatureGetConfigPrologue( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_config_t* pConfig ///< [in,out] Returns current configuration. ) { if ( !context.handleLifetime->isHandleValid( hTemperature )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesTemperatureSetConfigPrologue( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. const zes_temp_config_t* pConfig ///< [in] New configuration. ) { if ( !context.handleLifetime->isHandleValid( hTemperature )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesTemperatureGetStatePrologue( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. double* pTemperature ///< [in,out] Will contain the temperature read from the specified sensor ///< in degrees Celsius. ) { if ( !context.handleLifetime->isHandleValid( hTemperature )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPowerGetLimitsExtPrologue( zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. uint32_t* pCount, ///< [in,out] Pointer to the number of power limit descriptors. If count is ///< zero, then the driver shall update the value with the total number of ///< components of this type that are available. If count is greater than ///< the number of components of this type that are available, then the ///< driver shall update the value with the correct number of components. zes_power_limit_ext_desc_t* pSustained ///< [in,out][optional][range(0, *pCount)] Array of query results for power ///< limit descriptors. If count is less than the number of components of ///< this type that are available, then the driver shall only retrieve that ///< number of components. ) { if ( !context.handleLifetime->isHandleValid( hPower )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesPowerSetLimitsExtPrologue( zes_pwr_handle_t hPower, ///< [in] Handle for the component. uint32_t* pCount, ///< [in] Pointer to the number of power limit descriptors. zes_power_limit_ext_desc_t* pSustained ///< [in][optional][range(0, *pCount)] Array of power limit descriptors. ) { if ( !context.handleLifetime->isHandleValid( hPower )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesEngineGetActivityExtPrologue( zes_engine_handle_t hEngine, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_engine_stats_t* pStats ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector with engine stat for ///< PF at index 0 of the vector followed by user provided pCount-1 number ///< of VF engine stats. ) { if ( !context.handleLifetime->isHandleValid( hEngine )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesRasGetStateExpPrologue( zes_ras_handle_t hRas, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of RAS state structures that can be retrieved. ///< if count is zero, then the driver shall update the value with the ///< total number of error categories for which state can be retrieved. ///< if count is greater than the number of RAS states available, then the ///< driver shall update the value with the correct number of RAS states available. zes_ras_state_exp_t* pState ///< [in,out][optional][range(0, *pCount)] array of query results for RAS ///< error states for different categories. ///< if count is less than the number of RAS states available, then driver ///< shall only retrieve that number of RAS states. ) { if ( !context.handleLifetime->isHandleValid( hRas )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesRasClearStateExpPrologue( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_error_category_exp_t category ///< [in] category for which error counter is to be cleared. ) { if ( !context.handleLifetime->isHandleValid( hRas )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFirmwareGetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. char* pVersion ///< [in,out] NULL terminated string value. The string "unknown" will be ///< returned if this property cannot be determined. ) { if ( !context.handleLifetime->isHandleValid( hFirmware )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesFirmwareSetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware ///< [in] Handle for the component. ) { if ( !context.handleLifetime->isHandleValid( hFirmware )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceGetSubDevicePropertiesExpPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of sub devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub devices currently attached to the device. ///< if count is greater than the number of sub devices currently attached ///< to the device, then the driver shall update the value with the correct ///< number of sub devices. zes_subdevice_exp_properties_t* pSubdeviceProps ///< [in,out][optional][range(0, *pCount)] array of sub device property structures. ///< if count is less than the number of sysman sub devices available, then ///< the driver shall only retrieve that number of sub device property structures. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDriverGetDeviceByUuidExpPrologue( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance zes_uuid_t uuid, ///< [in] universal unique identifier. zes_device_handle_t* phDevice, ///< [out] Sysman handle of the device. ze_bool_t* onSubdevice, ///< [out] True if the UUID belongs to the sub-device; false means that ///< UUID belongs to the root device. uint32_t* subdeviceId ///< [out] If onSubdevice is true, this gives the ID of the sub-device ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumActiveVFExpPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesVFManagementGetVFPropertiesExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. ) { if ( !context.handleLifetime->isHandleValid( hVFhandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesVFManagementGetVFMemoryUtilizationExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ) { if ( !context.handleLifetime->isHandleValid( hVFhandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesVFManagementGetVFEngineUtilizationExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ) { if ( !context.handleLifetime->isHandleValid( hVFhandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesVFManagementSetVFTelemetryModeExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. ze_bool_t enable ///< [in] Enable utilization telemetry. ) { if ( !context.handleLifetime->isHandleValid( hVFhandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. uint64_t samplingInterval ///< [in] Sampling interval value. ) { if ( !context.handleLifetime->isHandleValid( hVFhandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesDeviceEnumEnabledVFExpPrologue( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesVFManagementGetVFCapabilitiesExpPrologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ) { if ( !context.handleLifetime->isHandleValid( hVFhandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesVFManagementGetVFMemoryUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ) { if ( !context.handleLifetime->isHandleValid( hVFhandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesVFManagementGetVFEngineUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ) { if ( !context.handleLifetime->isHandleValid( hVFhandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZESHandleLifetimeValidation::zesVFManagementGetVFCapabilitiesExp2Prologue( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp2_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ) { if ( !context.handleLifetime->isHandleValid( hVFhandle )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } }level-zero-1.20.6/source/layers/validation/handle_lifetime_tracking/zes_handle_lifetime.h000066400000000000000000000506021475521542100317640ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See handle_lifetime.h.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_handle_lifetime.h * */ #pragma once #include "zes_entry_points.h" namespace validation_layer { class ZESHandleLifetimeValidation : public ZESValidationEntryPoints { public: ze_result_t zesDriverGetExtensionPropertiesPrologue( zes_driver_handle_t hDriver, uint32_t* pCount, zes_driver_extension_properties_t* pExtensionProperties ) override; ze_result_t zesDriverGetExtensionFunctionAddressPrologue( zes_driver_handle_t hDriver, const char* name, void** ppFunctionAddress ) override; ze_result_t zesDeviceGetPrologue( zes_driver_handle_t hDriver, uint32_t* pCount, zes_device_handle_t* phDevices ) override; ze_result_t zesDeviceGetPropertiesPrologue( zes_device_handle_t hDevice, zes_device_properties_t* pProperties ) override; ze_result_t zesDeviceGetStatePrologue( zes_device_handle_t hDevice, zes_device_state_t* pState ) override; ze_result_t zesDeviceResetPrologue( zes_device_handle_t hDevice, ze_bool_t force ) override; ze_result_t zesDeviceResetExtPrologue( zes_device_handle_t hDevice, zes_reset_properties_t* pProperties ) override; ze_result_t zesDeviceProcessesGetStatePrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_process_state_t* pProcesses ) override; ze_result_t zesDevicePciGetPropertiesPrologue( zes_device_handle_t hDevice, zes_pci_properties_t* pProperties ) override; ze_result_t zesDevicePciGetStatePrologue( zes_device_handle_t hDevice, zes_pci_state_t* pState ) override; ze_result_t zesDevicePciGetBarsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_pci_bar_properties_t* pProperties ) override; ze_result_t zesDevicePciGetStatsPrologue( zes_device_handle_t hDevice, zes_pci_stats_t* pStats ) override; ze_result_t zesDeviceSetOverclockWaiverPrologue( zes_device_handle_t hDevice ) override; ze_result_t zesDeviceGetOverclockDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pOverclockDomains ) override; ze_result_t zesDeviceGetOverclockControlsPrologue( zes_device_handle_t hDevice, zes_overclock_domain_t domainType, uint32_t* pAvailableControls ) override; ze_result_t zesDeviceResetOverclockSettingsPrologue( zes_device_handle_t hDevice, ze_bool_t onShippedState ) override; ze_result_t zesDeviceReadOverclockStatePrologue( zes_device_handle_t hDevice, zes_overclock_mode_t* pOverclockMode, ze_bool_t* pWaiverSetting, ze_bool_t* pOverclockState, zes_pending_action_t* pPendingAction, ze_bool_t* pPendingReset ) override; ze_result_t zesDeviceEnumOverclockDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_overclock_handle_t* phDomainHandle ) override; ze_result_t zesOverclockGetDomainPropertiesPrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_properties_t* pDomainProperties ) override; ze_result_t zesOverclockGetDomainVFPropertiesPrologue( zes_overclock_handle_t hDomainHandle, zes_vf_property_t* pVFProperties ) override; ze_result_t zesOverclockGetDomainControlPropertiesPrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, zes_control_property_t* pControlProperties ) override; ze_result_t zesOverclockGetControlCurrentValuePrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, double* pValue ) override; ze_result_t zesOverclockGetControlPendingValuePrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, double* pValue ) override; ze_result_t zesOverclockSetControlUserValuePrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, double pValue, zes_pending_action_t* pPendingAction ) override; ze_result_t zesOverclockGetControlStatePrologue( zes_overclock_handle_t hDomainHandle, zes_overclock_control_t DomainControl, zes_control_state_t* pControlState, zes_pending_action_t* pPendingAction ) override; ze_result_t zesOverclockGetVFPointValuesPrologue( zes_overclock_handle_t hDomainHandle, zes_vf_type_t VFType, zes_vf_array_type_t VFArrayType, uint32_t PointIndex, uint32_t* PointValue ) override; ze_result_t zesOverclockSetVFPointValuesPrologue( zes_overclock_handle_t hDomainHandle, zes_vf_type_t VFType, uint32_t PointIndex, uint32_t PointValue ) override; ze_result_t zesDeviceEnumDiagnosticTestSuitesPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_diag_handle_t* phDiagnostics ) override; ze_result_t zesDiagnosticsGetPropertiesPrologue( zes_diag_handle_t hDiagnostics, zes_diag_properties_t* pProperties ) override; ze_result_t zesDiagnosticsGetTestsPrologue( zes_diag_handle_t hDiagnostics, uint32_t* pCount, zes_diag_test_t* pTests ) override; ze_result_t zesDiagnosticsRunTestsPrologue( zes_diag_handle_t hDiagnostics, uint32_t startIndex, uint32_t endIndex, zes_diag_result_t* pResult ) override; ze_result_t zesDeviceEccAvailablePrologue( zes_device_handle_t hDevice, ze_bool_t* pAvailable ) override; ze_result_t zesDeviceEccConfigurablePrologue( zes_device_handle_t hDevice, ze_bool_t* pConfigurable ) override; ze_result_t zesDeviceGetEccStatePrologue( zes_device_handle_t hDevice, zes_device_ecc_properties_t* pState ) override; ze_result_t zesDeviceSetEccStatePrologue( zes_device_handle_t hDevice, const zes_device_ecc_desc_t* newState, zes_device_ecc_properties_t* pState ) override; ze_result_t zesDeviceEnumEngineGroupsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_engine_handle_t* phEngine ) override; ze_result_t zesEngineGetPropertiesPrologue( zes_engine_handle_t hEngine, zes_engine_properties_t* pProperties ) override; ze_result_t zesEngineGetActivityPrologue( zes_engine_handle_t hEngine, zes_engine_stats_t* pStats ) override; ze_result_t zesDeviceEventRegisterPrologue( zes_device_handle_t hDevice, zes_event_type_flags_t events ) override; ze_result_t zesDriverEventListenPrologue( ze_driver_handle_t hDriver, uint32_t timeout, uint32_t count, zes_device_handle_t* phDevices, uint32_t* pNumDeviceEvents, zes_event_type_flags_t* pEvents ) override; ze_result_t zesDriverEventListenExPrologue( ze_driver_handle_t hDriver, uint64_t timeout, uint32_t count, zes_device_handle_t* phDevices, uint32_t* pNumDeviceEvents, zes_event_type_flags_t* pEvents ) override; ze_result_t zesDeviceEnumFabricPortsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_fabric_port_handle_t* phPort ) override; ze_result_t zesFabricPortGetPropertiesPrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_properties_t* pProperties ) override; ze_result_t zesFabricPortGetLinkTypePrologue( zes_fabric_port_handle_t hPort, zes_fabric_link_type_t* pLinkType ) override; ze_result_t zesFabricPortGetConfigPrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_config_t* pConfig ) override; ze_result_t zesFabricPortSetConfigPrologue( zes_fabric_port_handle_t hPort, const zes_fabric_port_config_t* pConfig ) override; ze_result_t zesFabricPortGetStatePrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_state_t* pState ) override; ze_result_t zesFabricPortGetThroughputPrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_throughput_t* pThroughput ) override; ze_result_t zesFabricPortGetFabricErrorCountersPrologue( zes_fabric_port_handle_t hPort, zes_fabric_port_error_counters_t* pErrors ) override; ze_result_t zesFabricPortGetMultiPortThroughputPrologue( zes_device_handle_t hDevice, uint32_t numPorts, zes_fabric_port_handle_t* phPort, zes_fabric_port_throughput_t** pThroughput ) override; ze_result_t zesDeviceEnumFansPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_fan_handle_t* phFan ) override; ze_result_t zesFanGetPropertiesPrologue( zes_fan_handle_t hFan, zes_fan_properties_t* pProperties ) override; ze_result_t zesFanGetConfigPrologue( zes_fan_handle_t hFan, zes_fan_config_t* pConfig ) override; ze_result_t zesFanSetDefaultModePrologue( zes_fan_handle_t hFan ) override; ze_result_t zesFanSetFixedSpeedModePrologue( zes_fan_handle_t hFan, const zes_fan_speed_t* speed ) override; ze_result_t zesFanSetSpeedTableModePrologue( zes_fan_handle_t hFan, const zes_fan_speed_table_t* speedTable ) override; ze_result_t zesFanGetStatePrologue( zes_fan_handle_t hFan, zes_fan_speed_units_t units, int32_t* pSpeed ) override; ze_result_t zesDeviceEnumFirmwaresPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_firmware_handle_t* phFirmware ) override; ze_result_t zesFirmwareGetPropertiesPrologue( zes_firmware_handle_t hFirmware, zes_firmware_properties_t* pProperties ) override; ze_result_t zesFirmwareFlashPrologue( zes_firmware_handle_t hFirmware, void* pImage, uint32_t size ) override; ze_result_t zesFirmwareGetFlashProgressPrologue( zes_firmware_handle_t hFirmware, uint32_t* pCompletionPercent ) override; ze_result_t zesFirmwareGetConsoleLogsPrologue( zes_firmware_handle_t hFirmware, size_t* pSize, char* pFirmwareLog ) override; ze_result_t zesDeviceEnumFrequencyDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_freq_handle_t* phFrequency ) override; ze_result_t zesFrequencyGetPropertiesPrologue( zes_freq_handle_t hFrequency, zes_freq_properties_t* pProperties ) override; ze_result_t zesFrequencyGetAvailableClocksPrologue( zes_freq_handle_t hFrequency, uint32_t* pCount, double* phFrequency ) override; ze_result_t zesFrequencyGetRangePrologue( zes_freq_handle_t hFrequency, zes_freq_range_t* pLimits ) override; ze_result_t zesFrequencySetRangePrologue( zes_freq_handle_t hFrequency, const zes_freq_range_t* pLimits ) override; ze_result_t zesFrequencyGetStatePrologue( zes_freq_handle_t hFrequency, zes_freq_state_t* pState ) override; ze_result_t zesFrequencyGetThrottleTimePrologue( zes_freq_handle_t hFrequency, zes_freq_throttle_time_t* pThrottleTime ) override; ze_result_t zesFrequencyOcGetCapabilitiesPrologue( zes_freq_handle_t hFrequency, zes_oc_capabilities_t* pOcCapabilities ) override; ze_result_t zesFrequencyOcGetFrequencyTargetPrologue( zes_freq_handle_t hFrequency, double* pCurrentOcFrequency ) override; ze_result_t zesFrequencyOcSetFrequencyTargetPrologue( zes_freq_handle_t hFrequency, double CurrentOcFrequency ) override; ze_result_t zesFrequencyOcGetVoltageTargetPrologue( zes_freq_handle_t hFrequency, double* pCurrentVoltageTarget, double* pCurrentVoltageOffset ) override; ze_result_t zesFrequencyOcSetVoltageTargetPrologue( zes_freq_handle_t hFrequency, double CurrentVoltageTarget, double CurrentVoltageOffset ) override; ze_result_t zesFrequencyOcSetModePrologue( zes_freq_handle_t hFrequency, zes_oc_mode_t CurrentOcMode ) override; ze_result_t zesFrequencyOcGetModePrologue( zes_freq_handle_t hFrequency, zes_oc_mode_t* pCurrentOcMode ) override; ze_result_t zesFrequencyOcGetIccMaxPrologue( zes_freq_handle_t hFrequency, double* pOcIccMax ) override; ze_result_t zesFrequencyOcSetIccMaxPrologue( zes_freq_handle_t hFrequency, double ocIccMax ) override; ze_result_t zesFrequencyOcGetTjMaxPrologue( zes_freq_handle_t hFrequency, double* pOcTjMax ) override; ze_result_t zesFrequencyOcSetTjMaxPrologue( zes_freq_handle_t hFrequency, double ocTjMax ) override; ze_result_t zesDeviceEnumLedsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_led_handle_t* phLed ) override; ze_result_t zesLedGetPropertiesPrologue( zes_led_handle_t hLed, zes_led_properties_t* pProperties ) override; ze_result_t zesLedGetStatePrologue( zes_led_handle_t hLed, zes_led_state_t* pState ) override; ze_result_t zesLedSetStatePrologue( zes_led_handle_t hLed, ze_bool_t enable ) override; ze_result_t zesLedSetColorPrologue( zes_led_handle_t hLed, const zes_led_color_t* pColor ) override; ze_result_t zesDeviceEnumMemoryModulesPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_mem_handle_t* phMemory ) override; ze_result_t zesMemoryGetPropertiesPrologue( zes_mem_handle_t hMemory, zes_mem_properties_t* pProperties ) override; ze_result_t zesMemoryGetStatePrologue( zes_mem_handle_t hMemory, zes_mem_state_t* pState ) override; ze_result_t zesMemoryGetBandwidthPrologue( zes_mem_handle_t hMemory, zes_mem_bandwidth_t* pBandwidth ) override; ze_result_t zesDeviceEnumPerformanceFactorDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_perf_handle_t* phPerf ) override; ze_result_t zesPerformanceFactorGetPropertiesPrologue( zes_perf_handle_t hPerf, zes_perf_properties_t* pProperties ) override; ze_result_t zesPerformanceFactorGetConfigPrologue( zes_perf_handle_t hPerf, double* pFactor ) override; ze_result_t zesPerformanceFactorSetConfigPrologue( zes_perf_handle_t hPerf, double factor ) override; ze_result_t zesDeviceEnumPowerDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_pwr_handle_t* phPower ) override; ze_result_t zesDeviceGetCardPowerDomainPrologue( zes_device_handle_t hDevice, zes_pwr_handle_t* phPower ) override; ze_result_t zesPowerGetPropertiesPrologue( zes_pwr_handle_t hPower, zes_power_properties_t* pProperties ) override; ze_result_t zesPowerGetEnergyCounterPrologue( zes_pwr_handle_t hPower, zes_power_energy_counter_t* pEnergy ) override; ze_result_t zesPowerGetLimitsPrologue( zes_pwr_handle_t hPower, zes_power_sustained_limit_t* pSustained, zes_power_burst_limit_t* pBurst, zes_power_peak_limit_t* pPeak ) override; ze_result_t zesPowerSetLimitsPrologue( zes_pwr_handle_t hPower, const zes_power_sustained_limit_t* pSustained, const zes_power_burst_limit_t* pBurst, const zes_power_peak_limit_t* pPeak ) override; ze_result_t zesPowerGetEnergyThresholdPrologue( zes_pwr_handle_t hPower, zes_energy_threshold_t* pThreshold ) override; ze_result_t zesPowerSetEnergyThresholdPrologue( zes_pwr_handle_t hPower, double threshold ) override; ze_result_t zesDeviceEnumPsusPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_psu_handle_t* phPsu ) override; ze_result_t zesPsuGetPropertiesPrologue( zes_psu_handle_t hPsu, zes_psu_properties_t* pProperties ) override; ze_result_t zesPsuGetStatePrologue( zes_psu_handle_t hPsu, zes_psu_state_t* pState ) override; ze_result_t zesDeviceEnumRasErrorSetsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_ras_handle_t* phRas ) override; ze_result_t zesRasGetPropertiesPrologue( zes_ras_handle_t hRas, zes_ras_properties_t* pProperties ) override; ze_result_t zesRasGetConfigPrologue( zes_ras_handle_t hRas, zes_ras_config_t* pConfig ) override; ze_result_t zesRasSetConfigPrologue( zes_ras_handle_t hRas, const zes_ras_config_t* pConfig ) override; ze_result_t zesRasGetStatePrologue( zes_ras_handle_t hRas, ze_bool_t clear, zes_ras_state_t* pState ) override; ze_result_t zesDeviceEnumSchedulersPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_sched_handle_t* phScheduler ) override; ze_result_t zesSchedulerGetPropertiesPrologue( zes_sched_handle_t hScheduler, zes_sched_properties_t* pProperties ) override; ze_result_t zesSchedulerGetCurrentModePrologue( zes_sched_handle_t hScheduler, zes_sched_mode_t* pMode ) override; ze_result_t zesSchedulerGetTimeoutModePropertiesPrologue( zes_sched_handle_t hScheduler, ze_bool_t getDefaults, zes_sched_timeout_properties_t* pConfig ) override; ze_result_t zesSchedulerGetTimesliceModePropertiesPrologue( zes_sched_handle_t hScheduler, ze_bool_t getDefaults, zes_sched_timeslice_properties_t* pConfig ) override; ze_result_t zesSchedulerSetTimeoutModePrologue( zes_sched_handle_t hScheduler, zes_sched_timeout_properties_t* pProperties, ze_bool_t* pNeedReload ) override; ze_result_t zesSchedulerSetTimesliceModePrologue( zes_sched_handle_t hScheduler, zes_sched_timeslice_properties_t* pProperties, ze_bool_t* pNeedReload ) override; ze_result_t zesSchedulerSetExclusiveModePrologue( zes_sched_handle_t hScheduler, ze_bool_t* pNeedReload ) override; ze_result_t zesSchedulerSetComputeUnitDebugModePrologue( zes_sched_handle_t hScheduler, ze_bool_t* pNeedReload ) override; ze_result_t zesDeviceEnumStandbyDomainsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_standby_handle_t* phStandby ) override; ze_result_t zesStandbyGetPropertiesPrologue( zes_standby_handle_t hStandby, zes_standby_properties_t* pProperties ) override; ze_result_t zesStandbyGetModePrologue( zes_standby_handle_t hStandby, zes_standby_promo_mode_t* pMode ) override; ze_result_t zesStandbySetModePrologue( zes_standby_handle_t hStandby, zes_standby_promo_mode_t mode ) override; ze_result_t zesDeviceEnumTemperatureSensorsPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_temp_handle_t* phTemperature ) override; ze_result_t zesTemperatureGetPropertiesPrologue( zes_temp_handle_t hTemperature, zes_temp_properties_t* pProperties ) override; ze_result_t zesTemperatureGetConfigPrologue( zes_temp_handle_t hTemperature, zes_temp_config_t* pConfig ) override; ze_result_t zesTemperatureSetConfigPrologue( zes_temp_handle_t hTemperature, const zes_temp_config_t* pConfig ) override; ze_result_t zesTemperatureGetStatePrologue( zes_temp_handle_t hTemperature, double* pTemperature ) override; ze_result_t zesPowerGetLimitsExtPrologue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) override; ze_result_t zesPowerSetLimitsExtPrologue( zes_pwr_handle_t hPower, uint32_t* pCount, zes_power_limit_ext_desc_t* pSustained ) override; ze_result_t zesEngineGetActivityExtPrologue( zes_engine_handle_t hEngine, uint32_t* pCount, zes_engine_stats_t* pStats ) override; ze_result_t zesRasGetStateExpPrologue( zes_ras_handle_t hRas, uint32_t* pCount, zes_ras_state_exp_t* pState ) override; ze_result_t zesRasClearStateExpPrologue( zes_ras_handle_t hRas, zes_ras_error_category_exp_t category ) override; ze_result_t zesFirmwareGetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware, char* pVersion ) override; ze_result_t zesFirmwareSetSecurityVersionExpPrologue( zes_firmware_handle_t hFirmware ) override; ze_result_t zesDeviceGetSubDevicePropertiesExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_subdevice_exp_properties_t* pSubdeviceProps ) override; ze_result_t zesDriverGetDeviceByUuidExpPrologue( zes_driver_handle_t hDriver, zes_uuid_t uuid, zes_device_handle_t* phDevice, ze_bool_t* onSubdevice, uint32_t* subdeviceId ) override; ze_result_t zesDeviceEnumActiveVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) override; ze_result_t zesVFManagementGetVFPropertiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_properties_t* pProperties ) override; ze_result_t zesVFManagementGetVFMemoryUtilizationExpPrologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp_t* pMemUtil ) override; ze_result_t zesVFManagementGetVFEngineUtilizationExpPrologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp_t* pEngineUtil ) override; ze_result_t zesVFManagementSetVFTelemetryModeExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flags, ze_bool_t enable ) override; ze_result_t zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_info_util_exp_flags_t flag, uint64_t samplingInterval ) override; ze_result_t zesDeviceEnumEnabledVFExpPrologue( zes_device_handle_t hDevice, uint32_t* pCount, zes_vf_handle_t* phVFhandle ) override; ze_result_t zesVFManagementGetVFCapabilitiesExpPrologue( zes_vf_handle_t hVFhandle, zes_vf_exp_capabilities_t* pCapability ) override; ze_result_t zesVFManagementGetVFMemoryUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_mem_exp2_t* pMemUtil ) override; ze_result_t zesVFManagementGetVFEngineUtilizationExp2Prologue( zes_vf_handle_t hVFhandle, uint32_t* pCount, zes_vf_util_engine_exp2_t* pEngineUtil ) override; ze_result_t zesVFManagementGetVFCapabilitiesExp2Prologue( zes_vf_handle_t hVFhandle, zes_vf_exp2_capabilities_t* pCapability ) override; }; } level-zero-1.20.6/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.cpp000066400000000000000000002174101475521542100323220ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See handle_lifetime.cpp.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_handle_lifetime.cpp * */ #include "ze_validation_layer.h" #include "ze_handle_lifetime.h" namespace validation_layer { ze_result_t ZETHandleLifetimeValidation::zetModuleGetDebugInfoPrologue( zet_module_handle_t hModule, ///< [in] handle of the module zet_module_debug_info_format_t format, ///< [in] debug info format requested size_t* pSize, ///< [in,out] size of debug info in bytes uint8_t* pDebugInfo ///< [in,out][optional] byte pointer to debug info ) { if ( !context.handleLifetime->isHandleValid( hModule )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDeviceGetDebugPropertiesPrologue( zet_device_handle_t hDevice, ///< [in] device handle zet_device_debug_properties_t* pDebugProperties ///< [in,out] query result for debug properties ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDebugAttachPrologue( zet_device_handle_t hDevice, ///< [in] device handle const zet_debug_config_t* config, ///< [in] the debug configuration zet_debug_session_handle_t* phDebug ///< [out] debug session handle ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDebugDetachPrologue( zet_debug_session_handle_t hDebug ///< [in][release] debug session handle ) { if ( !context.handleLifetime->isHandleValid( hDebug )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDebugReadEventPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the event; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. zet_debug_event_t* event ///< [in,out] a pointer to a ::zet_debug_event_t. ) { if ( !context.handleLifetime->isHandleValid( hDebug )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDebugAcknowledgeEventPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle const zet_debug_event_t* event ///< [in] a pointer to a ::zet_debug_event_t. ) { if ( !context.handleLifetime->isHandleValid( hDebug )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDebugInterruptPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to interrupt ) { if ( !context.handleLifetime->isHandleValid( hDebug )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDebugResumePrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to resume ) { if ( !context.handleLifetime->isHandleValid( hDebug )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDebugReadMemoryPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to read void* buffer ///< [in,out] a buffer to hold a copy of the memory ) { if ( !context.handleLifetime->isHandleValid( hDebug )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDebugWriteMemoryPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to write const void* buffer ///< [in] a buffer holding the pattern to write ) { if ( !context.handleLifetime->isHandleValid( hDebug )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDebugGetRegisterSetPropertiesPrologue( zet_device_handle_t hDevice, ///< [in] device handle uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDebugGetThreadRegisterSetPropertiesPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier specifying a single stopped thread uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ) { if ( !context.handleLifetime->isHandleValid( hDebug )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDebugReadRegistersPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or ///< equal to the `count` member of ::zet_debug_register_group_properties_t ///< for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { if ( !context.handleLifetime->isHandleValid( hDebug )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDebugWriteRegistersPrologue( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than ///< or equal to the `count` member of ///< ::zet_debug_register_group_properties_t for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { if ( !context.handleLifetime->isHandleValid( hDebug )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGroupGetPrologue( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric groups. ///< if count is zero, then the driver shall update the value with the ///< total number of metric groups available. ///< if count is greater than the number of metric groups available, then ///< the driver shall update the value with the correct number of metric ///< groups available. zet_metric_group_handle_t* phMetricGroups ///< [in,out][optional][range(0, *pCount)] array of handle of metric groups. ///< if count is less than the number of metric groups available, then ///< driver shall only retrieve that number of metric groups. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGroupGetPropertiesPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_properties_t* pProperties ///< [in,out] metric group properties ) { if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGroupCalculateMetricValuesPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pMetricValueCount, ///< [in,out] pointer to number of metric values calculated. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pMetricValueCount)] buffer of calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGetPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group uint32_t* pCount, ///< [in,out] pointer to the number of metrics. ///< if count is zero, then the driver shall update the value with the ///< total number of metrics available. ///< if count is greater than the number of metrics available, then the ///< driver shall update the value with the correct number of metrics available. zet_metric_handle_t* phMetrics ///< [in,out][optional][range(0, *pCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metrics. ) { if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGetPropertiesPrologue( zet_metric_handle_t hMetric, ///< [in] handle of the metric zet_metric_properties_t* pProperties ///< [in,out] metric properties ) { if ( !context.handleLifetime->isHandleValid( hMetric )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetContextActivateMetricGroupsPrologue( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t count, ///< [in] metric group count to activate; must be 0 if `nullptr == ///< phMetricGroups` zet_metric_group_handle_t* phMetricGroups ///< [in][optional][range(0, count)] handles of the metric groups to activate. ///< nullptr deactivates all previously used metric groups. ///< all metrics groups must come from a different domains. ///< metric query and metric stream must use activated metric groups. ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phMetricGroups) && (i < count); ++i){ if (!context.handleLifetime->isHandleValid( phMetricGroups[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricStreamerOpenPrologue( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_streamer_desc_t* desc, ///< [in,out] metric streamer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification zet_metric_streamer_handle_t* phMetricStreamer ///< [out] handle of metric streamer ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hNotificationEvent && !context.handleLifetime->isHandleValid( hNotificationEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetCommandListAppendMetricStreamerMarkerPrologue( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t value ///< [in] streamer marker value ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hMetricStreamer )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricStreamerClosePrologue( zet_metric_streamer_handle_t hMetricStreamer ///< [in][release] handle of the metric streamer ) { if ( !context.handleLifetime->isHandleValid( hMetricStreamer )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricStreamerReadDataPrologue( zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) { if ( !context.handleLifetime->isHandleValid( hMetricStreamer )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricQueryPoolCreatePrologue( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] metric group associated with the query object. const zet_metric_query_pool_desc_t* desc, ///< [in] metric query pool descriptor zet_metric_query_pool_handle_t* phMetricQueryPool ///< [out] handle of metric query pool ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricQueryPoolDestroyPrologue( zet_metric_query_pool_handle_t hMetricQueryPool ///< [in][release] handle of the metric query pool ) { if (hMetricQueryPool && context.handleLifetime->isHandleValid( hMetricQueryPool )){ if (context.handleLifetime->hasDependents( hMetricQueryPool )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hMetricQueryPool); context.handleLifetime->removeHandle( hMetricQueryPool ); } else if (!context.handleLifetime->isHandleValid( hMetricQueryPool )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricQueryCreatePrologue( zet_metric_query_pool_handle_t hMetricQueryPool,///< [in] handle of the metric query pool uint32_t index, ///< [in] index of the query within the pool zet_metric_query_handle_t* phMetricQuery ///< [out] handle of metric query ) { if ( !context.handleLifetime->isHandleValid( hMetricQueryPool )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricQueryDestroyPrologue( zet_metric_query_handle_t hMetricQuery ///< [in][release] handle of metric query ) { if (hMetricQuery && context.handleLifetime->isHandleValid( hMetricQuery )){ if (context.handleLifetime->hasDependents( hMetricQuery )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hMetricQuery); context.handleLifetime->removeHandle( hMetricQuery ); } else if (!context.handleLifetime->isHandleValid( hMetricQuery )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricQueryResetPrologue( zet_metric_query_handle_t hMetricQuery ///< [in] handle of metric query ) { if ( !context.handleLifetime->isHandleValid( hMetricQuery )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetCommandListAppendMetricQueryBeginPrologue( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery ///< [in] handle of the metric query ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hMetricQuery )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetCommandListAppendMetricQueryEndPrologue( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in] must be zero ze_event_handle_t* phWaitEvents ///< [in][mbz] must be nullptr ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } if ( !context.handleLifetime->isHandleValid( hMetricQuery )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (hSignalEvent && !context.handleLifetime->isHandleValid( hSignalEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetCommandListAppendMetricMemoryBarrierPrologue( zet_command_list_handle_t hCommandList ///< [in] handle of the command list ) { if ( !context.handleLifetime->isHandleValid( hCommandList )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if (!context.handleLifetime->isOpen( hCommandList )){ return ZE_RESULT_ERROR_INVALID_ARGUMENT; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricQueryGetDataPrologue( zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing query ///< reports in raw format ) { if ( !context.handleLifetime->isHandleValid( hMetricQuery )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetKernelGetProfileInfoPrologue( zet_kernel_handle_t hKernel, ///< [in] handle to kernel zet_profile_properties_t* pProfileProperties ///< [out] pointer to profile properties ) { if ( !context.handleLifetime->isHandleValid( hKernel )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetTracerExpCreatePrologue( zet_context_handle_t hContext, ///< [in] handle of the context object const zet_tracer_exp_desc_t* desc, ///< [in] pointer to tracer descriptor zet_tracer_exp_handle_t* phTracer ///< [out] pointer to handle of tracer object created ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetTracerExpDestroyPrologue( zet_tracer_exp_handle_t hTracer ///< [in][release] handle of tracer object to destroy ) { if (hTracer && context.handleLifetime->isHandleValid( hTracer )){ if (context.handleLifetime->hasDependents( hTracer )){ return ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE; } context.handleLifetime->removeDependent( hTracer); context.handleLifetime->removeHandle( hTracer ); } else if (!context.handleLifetime->isHandleValid( hTracer )) { return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetTracerExpSetProloguesPrologue( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { if ( !context.handleLifetime->isHandleValid( hTracer )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetTracerExpSetEpiloguesPrologue( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { if ( !context.handleLifetime->isHandleValid( hTracer )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetTracerExpSetEnabledPrologue( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer ze_bool_t enable ///< [in] enable the tracer if true; disable if false ) { if ( !context.handleLifetime->isHandleValid( hTracer )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDeviceGetConcurrentMetricGroupsExpPrologue( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t * phMetricGroups, ///< [in,out] metrics groups to be re-arranged to be sets of concurrent ///< groups uint32_t * pMetricGroupsCountPerConcurrentGroup,///< [in,out][optional][*pConcurrentGroupCount] count of metric groups per ///< concurrent group. uint32_t * pConcurrentGroupCount ///< [out] number of concurrent groups. ///< The value of this parameter could be used to determine the number of ///< replays necessary. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricTracerCreateExpPrologue( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t* phMetricGroups, ///< [in][range(0, metricGroupCount )] handles of the metric groups to ///< trace zet_metric_tracer_exp_desc_t* desc, ///< [in,out] metric tracer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification. Note: ///< If buffer is not drained when the event it flagged, there is a risk of ///< HW event buffer being overrun zet_metric_tracer_exp_handle_t* phMetricTracer ///< [out] handle of the metric tracer ) { if ( !context.handleLifetime->isHandleValid( hContext )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phMetricGroups) && (i < metricGroupCount ); ++i){ if (!context.handleLifetime->isHandleValid( phMetricGroups[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } if (hNotificationEvent && !context.handleLifetime->isHandleValid( hNotificationEvent )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricTracerDestroyExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer ///< [in] handle of the metric tracer ) { if ( !context.handleLifetime->isHandleValid( hMetricTracer )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricTracerEnableExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_NOT_READY will be returned ///< when the tracer is inactive. ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active. ) { if ( !context.handleLifetime->isHandleValid( hMetricTracer )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricTracerDisableExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active or when it is inactive but still has data. ///< ::ZE_RESULT_NOT_READY will be returned when the tracer is inactive and ///< has no more data to be retrieved. ) { if ( !context.handleLifetime->isHandleValid( hMetricTracer )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricTracerReadDataExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all data available. ///< if size is non-zero, then driver will only retrieve that amount of ///< data. ///< if size is larger than size needed for all data, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) { if ( !context.handleLifetime->isHandleValid( hMetricTracer )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricDecoderCreateExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer zet_metric_decoder_exp_handle_t* phMetricDecoder///< [out] handle of the metric decoder object ) { if ( !context.handleLifetime->isHandleValid( hMetricTracer )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricDecoderDestroyExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder ///< [in] handle of the metric decoder object ) { if ( !context.handleLifetime->isHandleValid( phMetricDecoder )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricDecoderGetDecodableMetricsExpPrologue( zet_metric_decoder_exp_handle_t hMetricDecoder, ///< [in] handle of the metric decoder object uint32_t* pCount, ///< [in,out] pointer to number of decodable metric in the hMetricDecoder ///< handle. If count is zero, then the driver shall ///< update the value with the total number of decodable metrics available ///< in the decoder. if count is greater than zero ///< but less than the total number of decodable metrics available in the ///< decoder, then only that number will be returned. ///< if count is greater than the number of decodable metrics available in ///< the decoder, then the driver shall update the ///< value with the actual number of decodable metrics available. zet_metric_handle_t* phMetrics ///< [in,out] [range(0, *pCount)] array of handles of decodable metrics in ///< the hMetricDecoder handle provided. ) { if ( !context.handleLifetime->isHandleValid( hMetricDecoder )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricTracerDecodeExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder,///< [in] handle of the metric decoder object size_t* pRawDataSize, ///< [in,out] size in bytes of raw data buffer. If pMetricEntriesCount is ///< greater than zero but less than total number of ///< decodable metrics available in the raw data buffer, then driver shall ///< update this value with actual number of raw ///< data bytes processed. uint8_t* pRawData, ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format uint32_t metricsCount, ///< [in] number of decodable metrics in the tracer for which the ///< hMetricDecoder handle was provided. See ///< ::zetMetricDecoderGetDecodableMetricsExp(). If metricCount is greater ///< than zero but less than the number decodable ///< metrics available in the raw data buffer, then driver shall only ///< decode those. zet_metric_handle_t* phMetrics, ///< [in] [range(0, metricsCount)] array of handles of decodable metrics in ///< the decoder for which the hMetricDecoder handle was ///< provided. Metrics handles are expected to be for decodable metrics, ///< see ::zetMetricDecoderGetDecodableMetricsExp() uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. If count is zero, then the ///< driver shall update the value with the total ///< number of metric sets to be decoded. If count is greater than the ///< number available in the raw data buffer, then the ///< driver shall update the value with the actual number of metric sets to ///< be decoded. There is a 1:1 relation between ///< the number of sets and sub-devices returned in the decoded entries. uint32_t* pMetricEntriesCountPerSet, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric entries ///< counts per metric set, one value per set. uint32_t* pMetricEntriesCount, ///< [in,out] pointer to the total number of metric entries decoded, for ///< all metric sets. If count is zero, then the ///< driver shall update the value with the total number of metric entries ///< to be decoded. If count is greater than zero ///< but less than the total number of metric entries available in the raw ///< data, then user provided number will be decoded. ///< If count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with ///< the actual number of decodable metric entries decoded. If set to null, ///< then driver will only update the value of ///< pSetCount. zet_metric_entry_exp_t* pMetricEntries ///< [in,out][optional][range(0, *pMetricEntriesCount)] buffer containing ///< decoded metric entries ) { if ( !context.handleLifetime->isHandleValid( phMetricDecoder )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } for (size_t i = 0; ( nullptr != phMetrics) && (i < metricsCount); ++i){ if (!context.handleLifetime->isHandleValid( phMetrics[i] )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGroupCalculateMultipleMetricValuesExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGroupGetGlobalTimestampsExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group ze_bool_t synchronizedWithHost, ///< [in] Returns the timestamps synchronized to the host or the device. uint64_t* globalTimestamp, ///< [out] Device timestamp. uint64_t* metricTimestamp ///< [out] Metric timestamp. ) { if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGroupGetExportDataExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group const uint8_t* pRawData, ///< [in] buffer of raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer size_t* pExportDataSize, ///< [in,out] size in bytes of export data buffer ///< if size is zero, then the driver shall update the value with the ///< number of bytes necessary to store the exported data. ///< if size is greater than required, then the driver shall update the ///< value with the actual number of bytes necessary to store the exported data. uint8_t * pExportData ///< [in,out][optional][range(0, *pExportDataSize)] buffer of exported data. ) { if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGroupCalculateMetricExportDataExpPrologue( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t exportDataSize, ///< [in] size in bytes of exported data buffer const uint8_t* pExportData, ///< [in][range(0, exportDataSize)] buffer of exported data to calculate zet_metric_calculate_exp_desc_t* pCalculateDescriptor, ///< [in] descriptor specifying calculation specific parameters uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { if ( !context.handleLifetime->isHandleValid( hDriver )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricProgrammableGetExpPrologue( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric programmable handles. ///< if count is zero, then the driver shall update the value with the ///< total number of metric programmable handles available. ///< if count is greater than the number of metric programmable handles ///< available, then the driver shall update the value with the correct ///< number of metric programmable handles available. zet_metric_programmable_exp_handle_t* phMetricProgrammables ///< [in,out][optional][range(0, *pCount)] array of handle of metric programmables. ///< if count is less than the number of metric programmables available, ///< then driver shall only retrieve that number of metric programmables. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricProgrammableGetPropertiesExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_exp_properties_t* pProperties ///< [in,out] properties of the metric programmable ) { if ( !context.handleLifetime->isHandleValid( hMetricProgrammable )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricProgrammableGetParamInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t* pParameterCount, ///< [in,out] count of the parameters to retrieve parameter info. ///< if value pParameterCount is greater than count of parameters ///< available, then pParameterCount will be updated with count of ///< parameters available. ///< The count of parameters available can be queried using ::zetMetricProgrammableGetPropertiesExp. zet_metric_programmable_param_info_exp_t* pParameterInfo///< [in,out][range(1, *pParameterCount)] array of parameter info. ///< if parameterCount is less than the number of parameters available, ///< then driver shall only retrieve that number of parameter info. ) { if ( !context.handleLifetime->isHandleValid( hMetricProgrammable )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricProgrammableGetParamValueInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterOrdinal, ///< [in] ordinal of the parameter in the metric programmable uint32_t* pValueInfoCount, ///< [in,out] count of parameter value information to retrieve. ///< if value at pValueInfoCount is greater than count of value info ///< available, then pValueInfoCount will be updated with count of value ///< info available. ///< The count of parameter value info available can be queried using ::zetMetricProgrammableGetParamInfoExp. zet_metric_programmable_param_value_info_exp_t* pValueInfo ///< [in,out][range(1, *pValueInfoCount)] array of parameter value info. ///< if pValueInfoCount is less than the number of value info available, ///< then driver shall only retrieve that number of value info. ) { if ( !context.handleLifetime->isHandleValid( hMetricProgrammable )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricCreateFromProgrammableExp2Prologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ) { if ( !context.handleLifetime->isHandleValid( hMetricProgrammable )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricCreateFromProgrammableExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. uint32_t parameterCount, ///< [in] Count of parameters to set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ) { if ( !context.handleLifetime->isHandleValid( hMetricProgrammable )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetDeviceCreateMetricGroupsFromMetricsExpPrologue( zet_device_handle_t hDevice, ///< [in] handle of the device. uint32_t metricCount, ///< [in] number of metric handles. zet_metric_handle_t * phMetrics, ///< [in] metric handles to be added to the metric groups. const char * pMetricGroupNamePrefix, ///< [in] prefix to the name created for the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP. const char * pDescription, ///< [in] pointer to description of the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. uint32_t * pMetricGroupCount, ///< [in,out] pointer to the number of metric group handles to be created. ///< if pMetricGroupCount is zero, then the driver shall update the value ///< with the maximum possible number of metric group handles that could be created. ///< if pMetricGroupCount is greater than the number of metric group ///< handles that could be created, then the driver shall update the value ///< with the correct number of metric group handles generated. ///< if pMetricGroupCount is lesser than the number of metric group handles ///< that could be created, then ::ZE_RESULT_ERROR_INVALID_ARGUMENT is returned. zet_metric_group_handle_t* phMetricGroup ///< [in,out][optional][range(0, *pMetricGroupCount)] array of handle of ///< metric group handles. ///< Created Metric group handles. ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGroupCreateExpPrologue( zet_device_handle_t hDevice, ///< [in] handle of the device const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. const char* pDescription, ///< [in] pointer to metric group description. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. zet_metric_group_sampling_type_flags_t samplingType,///< [in] Sampling type for the metric group. zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle ) { if ( !context.handleLifetime->isHandleValid( hDevice )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGroupAddMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric, ///< [in] Metric to be added to the group. size_t * pErrorStringSize, ///< [in,out][optional] Size of the error string to query, if an error was ///< reported during adding the metric handle. ///< if *pErrorStringSize is zero, then the driver shall update the value ///< with the size of the error string in bytes. char* pErrorString ///< [in,out][optional][range(0, *pErrorStringSize)] Error string. ///< if *pErrorStringSize is less than the length of the error string ///< available, then driver shall only retrieve that length of error string. ) { if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hMetric )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGroupRemoveMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric ///< [in] Metric handle to be removed from the metric group. ) { if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } if ( !context.handleLifetime->isHandleValid( hMetric )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGroupCloseExpPrologue( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group ) { if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricGroupDestroyExpPrologue( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group to destroy ) { if ( !context.handleLifetime->isHandleValid( hMetricGroup )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } ze_result_t ZETHandleLifetimeValidation::zetMetricDestroyExpPrologue( zet_metric_handle_t hMetric ///< [in] Handle of the metric to destroy ) { if ( !context.handleLifetime->isHandleValid( hMetric )){ return ZE_RESULT_ERROR_INVALID_NULL_HANDLE; } return ZE_RESULT_SUCCESS; } }level-zero-1.20.6/source/layers/validation/handle_lifetime_tracking/zet_handle_lifetime.h000066400000000000000000000277201475521542100317720ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See handle_lifetime.h.mako for modifications * * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_handle_lifetime.h * */ #pragma once #include "zet_entry_points.h" namespace validation_layer { class ZETHandleLifetimeValidation : public ZETValidationEntryPoints { public: ze_result_t zetModuleGetDebugInfoPrologue( zet_module_handle_t hModule, zet_module_debug_info_format_t format, size_t* pSize, uint8_t* pDebugInfo ) override; ze_result_t zetDeviceGetDebugPropertiesPrologue( zet_device_handle_t hDevice, zet_device_debug_properties_t* pDebugProperties ) override; ze_result_t zetDebugAttachPrologue( zet_device_handle_t hDevice, const zet_debug_config_t* config, zet_debug_session_handle_t* phDebug ) override; ze_result_t zetDebugDetachPrologue( zet_debug_session_handle_t hDebug ) override; ze_result_t zetDebugReadEventPrologue( zet_debug_session_handle_t hDebug, uint64_t timeout, zet_debug_event_t* event ) override; ze_result_t zetDebugAcknowledgeEventPrologue( zet_debug_session_handle_t hDebug, const zet_debug_event_t* event ) override; ze_result_t zetDebugInterruptPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread ) override; ze_result_t zetDebugResumePrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread ) override; ze_result_t zetDebugReadMemoryPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, const zet_debug_memory_space_desc_t* desc, size_t size, void* buffer ) override; ze_result_t zetDebugWriteMemoryPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, const zet_debug_memory_space_desc_t* desc, size_t size, const void* buffer ) override; ze_result_t zetDebugGetRegisterSetPropertiesPrologue( zet_device_handle_t hDevice, uint32_t* pCount, zet_debug_regset_properties_t* pRegisterSetProperties ) override; ze_result_t zetDebugGetThreadRegisterSetPropertiesPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t* pCount, zet_debug_regset_properties_t* pRegisterSetProperties ) override; ze_result_t zetDebugReadRegistersPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void* pRegisterValues ) override; ze_result_t zetDebugWriteRegistersPrologue( zet_debug_session_handle_t hDebug, ze_device_thread_t thread, uint32_t type, uint32_t start, uint32_t count, void* pRegisterValues ) override; ze_result_t zetMetricGroupGetPrologue( zet_device_handle_t hDevice, uint32_t* pCount, zet_metric_group_handle_t* phMetricGroups ) override; ze_result_t zetMetricGroupGetPropertiesPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_properties_t* pProperties ) override; ze_result_t zetMetricGroupCalculateMetricValuesPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t* pRawData, uint32_t* pMetricValueCount, zet_typed_value_t* pMetricValues ) override; ze_result_t zetMetricGetPrologue( zet_metric_group_handle_t hMetricGroup, uint32_t* pCount, zet_metric_handle_t* phMetrics ) override; ze_result_t zetMetricGetPropertiesPrologue( zet_metric_handle_t hMetric, zet_metric_properties_t* pProperties ) override; ze_result_t zetContextActivateMetricGroupsPrologue( zet_context_handle_t hContext, zet_device_handle_t hDevice, uint32_t count, zet_metric_group_handle_t* phMetricGroups ) override; ze_result_t zetMetricStreamerOpenPrologue( zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, zet_metric_streamer_desc_t* desc, ze_event_handle_t hNotificationEvent, zet_metric_streamer_handle_t* phMetricStreamer ) override; ze_result_t zetCommandListAppendMetricStreamerMarkerPrologue( zet_command_list_handle_t hCommandList, zet_metric_streamer_handle_t hMetricStreamer, uint32_t value ) override; ze_result_t zetMetricStreamerClosePrologue( zet_metric_streamer_handle_t hMetricStreamer ) override; ze_result_t zetMetricStreamerReadDataPrologue( zet_metric_streamer_handle_t hMetricStreamer, uint32_t maxReportCount, size_t* pRawDataSize, uint8_t* pRawData ) override; ze_result_t zetMetricQueryPoolCreatePrologue( zet_context_handle_t hContext, zet_device_handle_t hDevice, zet_metric_group_handle_t hMetricGroup, const zet_metric_query_pool_desc_t* desc, zet_metric_query_pool_handle_t* phMetricQueryPool ) override; ze_result_t zetMetricQueryPoolDestroyPrologue( zet_metric_query_pool_handle_t hMetricQueryPool ) override; ze_result_t zetMetricQueryCreatePrologue( zet_metric_query_pool_handle_t hMetricQueryPool, uint32_t index, zet_metric_query_handle_t* phMetricQuery ) override; ze_result_t zetMetricQueryDestroyPrologue( zet_metric_query_handle_t hMetricQuery ) override; ze_result_t zetMetricQueryResetPrologue( zet_metric_query_handle_t hMetricQuery ) override; ze_result_t zetCommandListAppendMetricQueryBeginPrologue( zet_command_list_handle_t hCommandList, zet_metric_query_handle_t hMetricQuery ) override; ze_result_t zetCommandListAppendMetricQueryEndPrologue( zet_command_list_handle_t hCommandList, zet_metric_query_handle_t hMetricQuery, ze_event_handle_t hSignalEvent, uint32_t numWaitEvents, ze_event_handle_t* phWaitEvents ) override; ze_result_t zetCommandListAppendMetricMemoryBarrierPrologue( zet_command_list_handle_t hCommandList ) override; ze_result_t zetMetricQueryGetDataPrologue( zet_metric_query_handle_t hMetricQuery, size_t* pRawDataSize, uint8_t* pRawData ) override; ze_result_t zetKernelGetProfileInfoPrologue( zet_kernel_handle_t hKernel, zet_profile_properties_t* pProfileProperties ) override; ze_result_t zetTracerExpCreatePrologue( zet_context_handle_t hContext, const zet_tracer_exp_desc_t* desc, zet_tracer_exp_handle_t* phTracer ) override; ze_result_t zetTracerExpDestroyPrologue( zet_tracer_exp_handle_t hTracer ) override; ze_result_t zetTracerExpSetProloguesPrologue( zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t* pCoreCbs ) override; ze_result_t zetTracerExpSetEpiloguesPrologue( zet_tracer_exp_handle_t hTracer, zet_core_callbacks_t* pCoreCbs ) override; ze_result_t zetTracerExpSetEnabledPrologue( zet_tracer_exp_handle_t hTracer, ze_bool_t enable ) override; ze_result_t zetDeviceGetConcurrentMetricGroupsExpPrologue( zet_device_handle_t hDevice, uint32_t metricGroupCount, zet_metric_group_handle_t * phMetricGroups, uint32_t * pMetricGroupsCountPerConcurrentGroup, uint32_t * pConcurrentGroupCount ) override; ze_result_t zetMetricTracerCreateExpPrologue( zet_context_handle_t hContext, zet_device_handle_t hDevice, uint32_t metricGroupCount, zet_metric_group_handle_t* phMetricGroups, zet_metric_tracer_exp_desc_t* desc, ze_event_handle_t hNotificationEvent, zet_metric_tracer_exp_handle_t* phMetricTracer ) override; ze_result_t zetMetricTracerDestroyExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer ) override; ze_result_t zetMetricTracerEnableExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ze_bool_t synchronous ) override; ze_result_t zetMetricTracerDisableExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, ze_bool_t synchronous ) override; ze_result_t zetMetricTracerReadDataExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, size_t* pRawDataSize, uint8_t* pRawData ) override; ze_result_t zetMetricDecoderCreateExpPrologue( zet_metric_tracer_exp_handle_t hMetricTracer, zet_metric_decoder_exp_handle_t* phMetricDecoder ) override; ze_result_t zetMetricDecoderDestroyExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder ) override; ze_result_t zetMetricDecoderGetDecodableMetricsExpPrologue( zet_metric_decoder_exp_handle_t hMetricDecoder, uint32_t* pCount, zet_metric_handle_t* phMetrics ) override; ze_result_t zetMetricTracerDecodeExpPrologue( zet_metric_decoder_exp_handle_t phMetricDecoder, size_t* pRawDataSize, uint8_t* pRawData, uint32_t metricsCount, zet_metric_handle_t* phMetrics, uint32_t* pSetCount, uint32_t* pMetricEntriesCountPerSet, uint32_t* pMetricEntriesCount, zet_metric_entry_exp_t* pMetricEntries ) override; ze_result_t zetMetricGroupCalculateMultipleMetricValuesExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_group_calculation_type_t type, size_t rawDataSize, const uint8_t* pRawData, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues ) override; ze_result_t zetMetricGroupGetGlobalTimestampsExpPrologue( zet_metric_group_handle_t hMetricGroup, ze_bool_t synchronizedWithHost, uint64_t* globalTimestamp, uint64_t* metricTimestamp ) override; ze_result_t zetMetricGroupGetExportDataExpPrologue( zet_metric_group_handle_t hMetricGroup, const uint8_t* pRawData, size_t rawDataSize, size_t* pExportDataSize, uint8_t * pExportData ) override; ze_result_t zetMetricGroupCalculateMetricExportDataExpPrologue( ze_driver_handle_t hDriver, zet_metric_group_calculation_type_t type, size_t exportDataSize, const uint8_t* pExportData, zet_metric_calculate_exp_desc_t* pCalculateDescriptor, uint32_t* pSetCount, uint32_t* pTotalMetricValueCount, uint32_t* pMetricCounts, zet_typed_value_t* pMetricValues ) override; ze_result_t zetMetricProgrammableGetExpPrologue( zet_device_handle_t hDevice, uint32_t* pCount, zet_metric_programmable_exp_handle_t* phMetricProgrammables ) override; ze_result_t zetMetricProgrammableGetPropertiesExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_exp_properties_t* pProperties ) override; ze_result_t zetMetricProgrammableGetParamInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t* pParameterCount, zet_metric_programmable_param_info_exp_t* pParameterInfo ) override; ze_result_t zetMetricProgrammableGetParamValueInfoExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterOrdinal, uint32_t* pValueInfoCount, zet_metric_programmable_param_value_info_exp_t* pValueInfo ) override; ze_result_t zetMetricCreateFromProgrammableExp2Prologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, uint32_t parameterCount, zet_metric_programmable_param_value_exp_t* pParameterValues, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) override; ze_result_t zetMetricCreateFromProgrammableExpPrologue( zet_metric_programmable_exp_handle_t hMetricProgrammable, zet_metric_programmable_param_value_exp_t* pParameterValues, uint32_t parameterCount, const char* pName, const char* pDescription, uint32_t* pMetricHandleCount, zet_metric_handle_t* phMetricHandles ) override; ze_result_t zetDeviceCreateMetricGroupsFromMetricsExpPrologue( zet_device_handle_t hDevice, uint32_t metricCount, zet_metric_handle_t * phMetrics, const char * pMetricGroupNamePrefix, const char * pDescription, uint32_t * pMetricGroupCount, zet_metric_group_handle_t* phMetricGroup ) override; ze_result_t zetMetricGroupCreateExpPrologue( zet_device_handle_t hDevice, const char* pName, const char* pDescription, zet_metric_group_sampling_type_flags_t samplingType, zet_metric_group_handle_t* phMetricGroup ) override; ze_result_t zetMetricGroupAddMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric, size_t * pErrorStringSize, char* pErrorString ) override; ze_result_t zetMetricGroupRemoveMetricExpPrologue( zet_metric_group_handle_t hMetricGroup, zet_metric_handle_t hMetric ) override; ze_result_t zetMetricGroupCloseExpPrologue( zet_metric_group_handle_t hMetricGroup ) override; ze_result_t zetMetricGroupDestroyExpPrologue( zet_metric_group_handle_t hMetricGroup ) override; ze_result_t zetMetricDestroyExpPrologue( zet_metric_handle_t hMetric ) override; }; } level-zero-1.20.6/source/layers/validation/ze_valddi.cpp000066400000000000000000020176161475521542100233050ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See valddi.cpp.mako for modifications * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_valddi.cpp * */ #include "ze_validation_layer.h" namespace validation_layer { static ze_result_t logAndPropagateResult(const char* fname, ze_result_t result) { if (result != ZE_RESULT_SUCCESS) { context.logger->log_trace("Error (" + loader::to_string(result) + ") in " + std::string(fname)); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeInit __zedlllocal ze_result_t ZE_APICALL zeInit( ze_init_flags_t flags ///< [in] initialization flags. ///< must be 0 (default) or a combination of ::ze_init_flag_t. ) { context.logger->log_trace("zeInit(flags)"); auto pfnInit = context.zeDdiTable.Global.pfnInit; if( nullptr == pfnInit ) return logAndPropagateResult("zeInit", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeInitPrologue( flags ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeInit", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeInitPrologue( flags ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeInit", result); } auto driver_result = pfnInit( flags ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeInitEpilogue( flags ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeInit", result); } return logAndPropagateResult("zeInit", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGet __zedlllocal ze_result_t ZE_APICALL zeDriverGet( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ) { context.logger->log_trace("zeDriverGet(pCount, phDrivers)"); auto pfnGet = context.zeDdiTable.Driver.pfnGet; if( nullptr == pfnGet ) return logAndPropagateResult("zeDriverGet", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetPrologue( pCount, phDrivers ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGet", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDriverGetPrologue( pCount, phDrivers ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGet", result); } auto driver_result = pfnGet( pCount, phDrivers ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetEpilogue( pCount, phDrivers ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGet", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phDrivers) && (i < *pCount); ++i){ if (phDrivers[i]){ context.handleLifetime->addHandle( phDrivers[i] ); context.handleLifetime->addDependent( pCount, phDrivers[i] ); } } } return logAndPropagateResult("zeDriverGet", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeInitDrivers __zedlllocal ze_result_t ZE_APICALL zeInitDrivers( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers, ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ze_init_driver_type_desc_t* desc ///< [in] descriptor containing the driver type initialization details ///< including ::ze_init_driver_type_flag_t combinations. ) { context.logger->log_trace("zeInitDrivers(pCount, phDrivers, desc)"); auto pfnInitDrivers = context.zeDdiTable.Global.pfnInitDrivers; if( nullptr == pfnInitDrivers ) return logAndPropagateResult("zeInitDrivers", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeInitDriversPrologue( pCount, phDrivers, desc ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeInitDrivers", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeInitDriversPrologue( pCount, phDrivers, desc ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeInitDrivers", result); } auto driver_result = pfnInitDrivers( pCount, phDrivers, desc ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeInitDriversEpilogue( pCount, phDrivers, desc ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeInitDrivers", result); } return logAndPropagateResult("zeInitDrivers", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetApiVersion __zedlllocal ze_result_t ZE_APICALL zeDriverGetApiVersion( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_api_version_t* version ///< [out] api version ) { context.logger->log_trace("zeDriverGetApiVersion(hDriver, version)"); auto pfnGetApiVersion = context.zeDdiTable.Driver.pfnGetApiVersion; if( nullptr == pfnGetApiVersion ) return logAndPropagateResult("zeDriverGetApiVersion", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetApiVersionPrologue( hDriver, version ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetApiVersion", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDriverGetApiVersionPrologue( hDriver, version ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetApiVersion", result); } auto driver_result = pfnGetApiVersion( hDriver, version ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetApiVersionEpilogue( hDriver, version ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetApiVersion", result); } return logAndPropagateResult("zeDriverGetApiVersion", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetProperties __zedlllocal ze_result_t ZE_APICALL zeDriverGetProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_properties_t* pDriverProperties ///< [in,out] query result for driver properties ) { context.logger->log_trace("zeDriverGetProperties(hDriver, pDriverProperties)"); auto pfnGetProperties = context.zeDdiTable.Driver.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zeDriverGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetPropertiesPrologue( hDriver, pDriverProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDriverGetPropertiesPrologue( hDriver, pDriverProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetProperties", result); } auto driver_result = pfnGetProperties( hDriver, pDriverProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetPropertiesEpilogue( hDriver, pDriverProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetProperties", result); } return logAndPropagateResult("zeDriverGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetIpcProperties __zedlllocal ze_result_t ZE_APICALL zeDriverGetIpcProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_ipc_properties_t* pIpcProperties ///< [in,out] query result for IPC properties ) { context.logger->log_trace("zeDriverGetIpcProperties(hDriver, pIpcProperties)"); auto pfnGetIpcProperties = context.zeDdiTable.Driver.pfnGetIpcProperties; if( nullptr == pfnGetIpcProperties ) return logAndPropagateResult("zeDriverGetIpcProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetIpcPropertiesPrologue( hDriver, pIpcProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetIpcProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDriverGetIpcPropertiesPrologue( hDriver, pIpcProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetIpcProperties", result); } auto driver_result = pfnGetIpcProperties( hDriver, pIpcProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetIpcPropertiesEpilogue( hDriver, pIpcProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetIpcProperties", result); } return logAndPropagateResult("zeDriverGetIpcProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetExtensionProperties __zedlllocal ze_result_t ZE_APICALL zeDriverGetExtensionProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. ze_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { context.logger->log_trace("zeDriverGetExtensionProperties(hDriver, pCount, pExtensionProperties)"); auto pfnGetExtensionProperties = context.zeDdiTable.Driver.pfnGetExtensionProperties; if( nullptr == pfnGetExtensionProperties ) return logAndPropagateResult("zeDriverGetExtensionProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetExtensionPropertiesPrologue( hDriver, pCount, pExtensionProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetExtensionProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDriverGetExtensionPropertiesPrologue( hDriver, pCount, pExtensionProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetExtensionProperties", result); } auto driver_result = pfnGetExtensionProperties( hDriver, pCount, pExtensionProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetExtensionPropertiesEpilogue( hDriver, pCount, pExtensionProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetExtensionProperties", result); } return logAndPropagateResult("zeDriverGetExtensionProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetExtensionFunctionAddress __zedlllocal ze_result_t ZE_APICALL zeDriverGetExtensionFunctionAddress( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { context.logger->log_trace("zeDriverGetExtensionFunctionAddress(hDriver, name, ppFunctionAddress)"); auto pfnGetExtensionFunctionAddress = context.zeDdiTable.Driver.pfnGetExtensionFunctionAddress; if( nullptr == pfnGetExtensionFunctionAddress ) return logAndPropagateResult("zeDriverGetExtensionFunctionAddress", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetExtensionFunctionAddressPrologue( hDriver, name, ppFunctionAddress ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetExtensionFunctionAddress", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDriverGetExtensionFunctionAddressPrologue( hDriver, name, ppFunctionAddress ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetExtensionFunctionAddress", result); } auto driver_result = pfnGetExtensionFunctionAddress( hDriver, name, ppFunctionAddress ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetExtensionFunctionAddressEpilogue( hDriver, name, ppFunctionAddress ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetExtensionFunctionAddress", result); } return logAndPropagateResult("zeDriverGetExtensionFunctionAddress", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetLastErrorDescription __zedlllocal ze_result_t ZE_APICALL zeDriverGetLastErrorDescription( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char** ppString ///< [in,out] pointer to a null-terminated array of characters describing ///< cause of error. ) { context.logger->log_trace("zeDriverGetLastErrorDescription(hDriver, ppString)"); auto pfnGetLastErrorDescription = context.zeDdiTable.Driver.pfnGetLastErrorDescription; if( nullptr == pfnGetLastErrorDescription ) return logAndPropagateResult("zeDriverGetLastErrorDescription", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetLastErrorDescriptionPrologue( hDriver, ppString ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetLastErrorDescription", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDriverGetLastErrorDescriptionPrologue( hDriver, ppString ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetLastErrorDescription", result); } auto driver_result = pfnGetLastErrorDescription( hDriver, ppString ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverGetLastErrorDescriptionEpilogue( hDriver, ppString ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverGetLastErrorDescription", result); } return logAndPropagateResult("zeDriverGetLastErrorDescription", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGet __zedlllocal ze_result_t ZE_APICALL zeDeviceGet( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of devices. ///< if count is zero, then the driver shall update the value with the ///< total number of devices available. ///< if count is greater than the number of devices available, then the ///< driver shall update the value with the correct number of devices available. ze_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of devices. ///< if count is less than the number of devices available, then driver ///< shall only retrieve that number of devices. ) { context.logger->log_trace("zeDeviceGet(hDriver, pCount, phDevices)"); auto pfnGet = context.zeDdiTable.Device.pfnGet; if( nullptr == pfnGet ) return logAndPropagateResult("zeDeviceGet", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetPrologue( hDriver, pCount, phDevices ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGet", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetPrologue( hDriver, pCount, phDevices ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGet", result); } auto driver_result = pfnGet( hDriver, pCount, phDevices ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetEpilogue( hDriver, pCount, phDevices ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGet", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phDevices) && (i < *pCount); ++i){ if (phDevices[i]){ context.handleLifetime->addHandle( phDevices[i] ); context.handleLifetime->addDependent( hDriver, phDevices[i] ); } } } return logAndPropagateResult("zeDeviceGet", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetRootDevice __zedlllocal ze_result_t ZE_APICALL zeDeviceGetRootDevice( ze_device_handle_t hDevice, ///< [in] handle of the device object ze_device_handle_t* phRootDevice ///< [in,out] parent root device. ) { context.logger->log_trace("zeDeviceGetRootDevice(hDevice, phRootDevice)"); auto pfnGetRootDevice = context.zeDdiTable.Device.pfnGetRootDevice; if( nullptr == pfnGetRootDevice ) return logAndPropagateResult("zeDeviceGetRootDevice", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetRootDevicePrologue( hDevice, phRootDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetRootDevice", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetRootDevicePrologue( hDevice, phRootDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetRootDevice", result); } auto driver_result = pfnGetRootDevice( hDevice, phRootDevice ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetRootDeviceEpilogue( hDevice, phRootDevice ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetRootDevice", result); } return logAndPropagateResult("zeDeviceGetRootDevice", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetSubDevices __zedlllocal ze_result_t ZE_APICALL zeDeviceGetSubDevices( ze_device_handle_t hDevice, ///< [in] handle of the device object uint32_t* pCount, ///< [in,out] pointer to the number of sub-devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-devices available. ///< if count is greater than the number of sub-devices available, then the ///< driver shall update the value with the correct number of sub-devices available. ze_device_handle_t* phSubdevices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-devices. ///< if count is less than the number of sub-devices available, then driver ///< shall only retrieve that number of sub-devices. ) { context.logger->log_trace("zeDeviceGetSubDevices(hDevice, pCount, phSubdevices)"); auto pfnGetSubDevices = context.zeDdiTable.Device.pfnGetSubDevices; if( nullptr == pfnGetSubDevices ) return logAndPropagateResult("zeDeviceGetSubDevices", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetSubDevicesPrologue( hDevice, pCount, phSubdevices ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetSubDevices", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetSubDevicesPrologue( hDevice, pCount, phSubdevices ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetSubDevices", result); } auto driver_result = pfnGetSubDevices( hDevice, pCount, phSubdevices ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetSubDevicesEpilogue( hDevice, pCount, phSubdevices ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetSubDevices", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phSubdevices) && (i < *pCount); ++i){ if (phSubdevices[i]){ context.handleLifetime->addHandle( phSubdevices[i] ); context.handleLifetime->addDependent( hDevice, phSubdevices[i] ); } } } return logAndPropagateResult("zeDeviceGetSubDevices", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_properties_t* pDeviceProperties ///< [in,out] query result for device properties ) { context.logger->log_trace("zeDeviceGetProperties(hDevice, pDeviceProperties)"); auto pfnGetProperties = context.zeDdiTable.Device.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zeDeviceGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetPropertiesPrologue( hDevice, pDeviceProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetPropertiesPrologue( hDevice, pDeviceProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetProperties", result); } auto driver_result = pfnGetProperties( hDevice, pDeviceProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetPropertiesEpilogue( hDevice, pDeviceProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetProperties", result); } return logAndPropagateResult("zeDeviceGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetComputeProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetComputeProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_compute_properties_t* pComputeProperties ///< [in,out] query result for compute properties ) { context.logger->log_trace("zeDeviceGetComputeProperties(hDevice, pComputeProperties)"); auto pfnGetComputeProperties = context.zeDdiTable.Device.pfnGetComputeProperties; if( nullptr == pfnGetComputeProperties ) return logAndPropagateResult("zeDeviceGetComputeProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetComputePropertiesPrologue( hDevice, pComputeProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetComputeProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetComputePropertiesPrologue( hDevice, pComputeProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetComputeProperties", result); } auto driver_result = pfnGetComputeProperties( hDevice, pComputeProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetComputePropertiesEpilogue( hDevice, pComputeProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetComputeProperties", result); } return logAndPropagateResult("zeDeviceGetComputeProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetModuleProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetModuleProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_module_properties_t* pModuleProperties///< [in,out] query result for module properties ) { context.logger->log_trace("zeDeviceGetModuleProperties(hDevice, pModuleProperties)"); auto pfnGetModuleProperties = context.zeDdiTable.Device.pfnGetModuleProperties; if( nullptr == pfnGetModuleProperties ) return logAndPropagateResult("zeDeviceGetModuleProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetModulePropertiesPrologue( hDevice, pModuleProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetModuleProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetModulePropertiesPrologue( hDevice, pModuleProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetModuleProperties", result); } auto driver_result = pfnGetModuleProperties( hDevice, pModuleProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetModulePropertiesEpilogue( hDevice, pModuleProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetModuleProperties", result); } return logAndPropagateResult("zeDeviceGetModuleProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetCommandQueueGroupProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetCommandQueueGroupProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of command queue group properties. ///< if count is zero, then the driver shall update the value with the ///< total number of command queue group properties available. ///< if count is greater than the number of command queue group properties ///< available, then the driver shall update the value with the correct ///< number of command queue group properties available. ze_command_queue_group_properties_t* pCommandQueueGroupProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< command queue group properties. ///< if count is less than the number of command queue group properties ///< available, then driver shall only retrieve that number of command ///< queue group properties. ) { context.logger->log_trace("zeDeviceGetCommandQueueGroupProperties(hDevice, pCount, pCommandQueueGroupProperties)"); auto pfnGetCommandQueueGroupProperties = context.zeDdiTable.Device.pfnGetCommandQueueGroupProperties; if( nullptr == pfnGetCommandQueueGroupProperties ) return logAndPropagateResult("zeDeviceGetCommandQueueGroupProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetCommandQueueGroupPropertiesPrologue( hDevice, pCount, pCommandQueueGroupProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetCommandQueueGroupProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetCommandQueueGroupPropertiesPrologue( hDevice, pCount, pCommandQueueGroupProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetCommandQueueGroupProperties", result); } auto driver_result = pfnGetCommandQueueGroupProperties( hDevice, pCount, pCommandQueueGroupProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetCommandQueueGroupPropertiesEpilogue( hDevice, pCount, pCommandQueueGroupProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetCommandQueueGroupProperties", result); } return logAndPropagateResult("zeDeviceGetCommandQueueGroupProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetMemoryProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetMemoryProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of memory properties. ///< if count is zero, then the driver shall update the value with the ///< total number of memory properties available. ///< if count is greater than the number of memory properties available, ///< then the driver shall update the value with the correct number of ///< memory properties available. ze_device_memory_properties_t* pMemProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< memory properties. ///< if count is less than the number of memory properties available, then ///< driver shall only retrieve that number of memory properties. ) { context.logger->log_trace("zeDeviceGetMemoryProperties(hDevice, pCount, pMemProperties)"); auto pfnGetMemoryProperties = context.zeDdiTable.Device.pfnGetMemoryProperties; if( nullptr == pfnGetMemoryProperties ) return logAndPropagateResult("zeDeviceGetMemoryProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetMemoryPropertiesPrologue( hDevice, pCount, pMemProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetMemoryProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetMemoryPropertiesPrologue( hDevice, pCount, pMemProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetMemoryProperties", result); } auto driver_result = pfnGetMemoryProperties( hDevice, pCount, pMemProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetMemoryPropertiesEpilogue( hDevice, pCount, pMemProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetMemoryProperties", result); } return logAndPropagateResult("zeDeviceGetMemoryProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetMemoryAccessProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetMemoryAccessProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_memory_access_properties_t* pMemAccessProperties ///< [in,out] query result for memory access properties ) { context.logger->log_trace("zeDeviceGetMemoryAccessProperties(hDevice, pMemAccessProperties)"); auto pfnGetMemoryAccessProperties = context.zeDdiTable.Device.pfnGetMemoryAccessProperties; if( nullptr == pfnGetMemoryAccessProperties ) return logAndPropagateResult("zeDeviceGetMemoryAccessProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetMemoryAccessPropertiesPrologue( hDevice, pMemAccessProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetMemoryAccessProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetMemoryAccessPropertiesPrologue( hDevice, pMemAccessProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetMemoryAccessProperties", result); } auto driver_result = pfnGetMemoryAccessProperties( hDevice, pMemAccessProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetMemoryAccessPropertiesEpilogue( hDevice, pMemAccessProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetMemoryAccessProperties", result); } return logAndPropagateResult("zeDeviceGetMemoryAccessProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetCacheProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetCacheProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of cache properties. ///< if count is zero, then the driver shall update the value with the ///< total number of cache properties available. ///< if count is greater than the number of cache properties available, ///< then the driver shall update the value with the correct number of ///< cache properties available. ze_device_cache_properties_t* pCacheProperties ///< [in,out][optional][range(0, *pCount)] array of query results for cache properties. ///< if count is less than the number of cache properties available, then ///< driver shall only retrieve that number of cache properties. ) { context.logger->log_trace("zeDeviceGetCacheProperties(hDevice, pCount, pCacheProperties)"); auto pfnGetCacheProperties = context.zeDdiTable.Device.pfnGetCacheProperties; if( nullptr == pfnGetCacheProperties ) return logAndPropagateResult("zeDeviceGetCacheProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetCachePropertiesPrologue( hDevice, pCount, pCacheProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetCacheProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetCachePropertiesPrologue( hDevice, pCount, pCacheProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetCacheProperties", result); } auto driver_result = pfnGetCacheProperties( hDevice, pCount, pCacheProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetCachePropertiesEpilogue( hDevice, pCount, pCacheProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetCacheProperties", result); } return logAndPropagateResult("zeDeviceGetCacheProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetImageProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetImageProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_image_properties_t* pImageProperties ///< [in,out] query result for image properties ) { context.logger->log_trace("zeDeviceGetImageProperties(hDevice, pImageProperties)"); auto pfnGetImageProperties = context.zeDdiTable.Device.pfnGetImageProperties; if( nullptr == pfnGetImageProperties ) return logAndPropagateResult("zeDeviceGetImageProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetImagePropertiesPrologue( hDevice, pImageProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetImageProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetImagePropertiesPrologue( hDevice, pImageProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetImageProperties", result); } auto driver_result = pfnGetImageProperties( hDevice, pImageProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetImagePropertiesEpilogue( hDevice, pImageProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetImageProperties", result); } return logAndPropagateResult("zeDeviceGetImageProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetExternalMemoryProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetExternalMemoryProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_external_memory_properties_t* pExternalMemoryProperties ///< [in,out] query result for external memory properties ) { context.logger->log_trace("zeDeviceGetExternalMemoryProperties(hDevice, pExternalMemoryProperties)"); auto pfnGetExternalMemoryProperties = context.zeDdiTable.Device.pfnGetExternalMemoryProperties; if( nullptr == pfnGetExternalMemoryProperties ) return logAndPropagateResult("zeDeviceGetExternalMemoryProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetExternalMemoryPropertiesPrologue( hDevice, pExternalMemoryProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetExternalMemoryProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetExternalMemoryPropertiesPrologue( hDevice, pExternalMemoryProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetExternalMemoryProperties", result); } auto driver_result = pfnGetExternalMemoryProperties( hDevice, pExternalMemoryProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetExternalMemoryPropertiesEpilogue( hDevice, pExternalMemoryProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetExternalMemoryProperties", result); } return logAndPropagateResult("zeDeviceGetExternalMemoryProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetP2PProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetP2PProperties( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_device_p2p_properties_t* pP2PProperties ///< [in,out] Peer-to-Peer properties between source and peer device ) { context.logger->log_trace("zeDeviceGetP2PProperties(hDevice, hPeerDevice, pP2PProperties)"); auto pfnGetP2PProperties = context.zeDdiTable.Device.pfnGetP2PProperties; if( nullptr == pfnGetP2PProperties ) return logAndPropagateResult("zeDeviceGetP2PProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetP2PPropertiesPrologue( hDevice, hPeerDevice, pP2PProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetP2PProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetP2PPropertiesPrologue( hDevice, hPeerDevice, pP2PProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetP2PProperties", result); } auto driver_result = pfnGetP2PProperties( hDevice, hPeerDevice, pP2PProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetP2PPropertiesEpilogue( hDevice, hPeerDevice, pP2PProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetP2PProperties", result); } return logAndPropagateResult("zeDeviceGetP2PProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceCanAccessPeer __zedlllocal ze_result_t ZE_APICALL zeDeviceCanAccessPeer( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_bool_t* value ///< [out] returned access capability ) { context.logger->log_trace("zeDeviceCanAccessPeer(hDevice, hPeerDevice, value)"); auto pfnCanAccessPeer = context.zeDdiTable.Device.pfnCanAccessPeer; if( nullptr == pfnCanAccessPeer ) return logAndPropagateResult("zeDeviceCanAccessPeer", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceCanAccessPeerPrologue( hDevice, hPeerDevice, value ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceCanAccessPeer", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceCanAccessPeerPrologue( hDevice, hPeerDevice, value ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceCanAccessPeer", result); } auto driver_result = pfnCanAccessPeer( hDevice, hPeerDevice, value ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceCanAccessPeerEpilogue( hDevice, hPeerDevice, value ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceCanAccessPeer", result); } return logAndPropagateResult("zeDeviceCanAccessPeer", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetStatus __zedlllocal ze_result_t ZE_APICALL zeDeviceGetStatus( ze_device_handle_t hDevice ///< [in] handle of the device ) { context.logger->log_trace("zeDeviceGetStatus(hDevice)"); auto pfnGetStatus = context.zeDdiTable.Device.pfnGetStatus; if( nullptr == pfnGetStatus ) return logAndPropagateResult("zeDeviceGetStatus", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetStatusPrologue( hDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetStatus", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetStatusPrologue( hDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetStatus", result); } auto driver_result = pfnGetStatus( hDevice ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetStatusEpilogue( hDevice ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetStatus", result); } return logAndPropagateResult("zeDeviceGetStatus", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetGlobalTimestamps __zedlllocal ze_result_t ZE_APICALL zeDeviceGetGlobalTimestamps( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the ///< Host's global timestamp value. ) { context.logger->log_trace("zeDeviceGetGlobalTimestamps(hDevice, hostTimestamp, deviceTimestamp)"); auto pfnGetGlobalTimestamps = context.zeDdiTable.Device.pfnGetGlobalTimestamps; if( nullptr == pfnGetGlobalTimestamps ) return logAndPropagateResult("zeDeviceGetGlobalTimestamps", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetGlobalTimestampsPrologue( hDevice, hostTimestamp, deviceTimestamp ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetGlobalTimestamps", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetGlobalTimestampsPrologue( hDevice, hostTimestamp, deviceTimestamp ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetGlobalTimestamps", result); } auto driver_result = pfnGetGlobalTimestamps( hDevice, hostTimestamp, deviceTimestamp ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetGlobalTimestampsEpilogue( hDevice, hostTimestamp, deviceTimestamp ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetGlobalTimestamps", result); } return logAndPropagateResult("zeDeviceGetGlobalTimestamps", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreate __zedlllocal ze_result_t ZE_APICALL zeContextCreate( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { context.logger->log_trace("zeContextCreate(hDriver, desc, phContext)"); auto pfnCreate = context.zeDdiTable.Context.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zeContextCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextCreatePrologue( hDriver, desc, phContext ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeContextCreatePrologue( hDriver, desc, phContext ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextCreate", result); } auto driver_result = pfnCreate( hDriver, desc, phContext ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextCreateEpilogue( hDriver, desc, phContext ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phContext){ context.handleLifetime->addHandle( *phContext ); context.handleLifetime->addDependent( hDriver, *phContext ); } } return logAndPropagateResult("zeContextCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreateEx __zedlllocal ze_result_t ZE_APICALL zeContextCreateEx( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< context has visibility. ///< if nullptr, then all devices and any sub-devices supported by the ///< driver instance are ///< visible to the context. ///< otherwise, the context only has visibility to the devices and any ///< sub-devices of the ///< devices in this array. ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { context.logger->log_trace("zeContextCreateEx(hDriver, desc, numDevices, phDevicesLocal, phContext)"); auto pfnCreateEx = context.zeDdiTable.Context.pfnCreateEx; if( nullptr == pfnCreateEx ) return logAndPropagateResult("zeContextCreateEx", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextCreateExPrologue( hDriver, desc, numDevices, phDevices, phContext ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextCreateEx", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeContextCreateExPrologue( hDriver, desc, numDevices, phDevices, phContext ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextCreateEx", result); } auto driver_result = pfnCreateEx( hDriver, desc, numDevices, phDevices, phContext ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextCreateExEpilogue( hDriver, desc, numDevices, phDevices, phContext ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextCreateEx", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phContext){ context.handleLifetime->addHandle( *phContext ); context.handleLifetime->addDependent( hDriver, *phContext ); } } return logAndPropagateResult("zeContextCreateEx", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextDestroy __zedlllocal ze_result_t ZE_APICALL zeContextDestroy( ze_context_handle_t hContext ///< [in][release] handle of context object to destroy ) { context.logger->log_trace("zeContextDestroy(hContext)"); auto pfnDestroy = context.zeDdiTable.Context.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zeContextDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextDestroyPrologue( hContext ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeContextDestroyPrologue( hContext ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextDestroy", result); } auto driver_result = pfnDestroy( hContext ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextDestroyEpilogue( hContext ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextDestroy", result); } return logAndPropagateResult("zeContextDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextGetStatus __zedlllocal ze_result_t ZE_APICALL zeContextGetStatus( ze_context_handle_t hContext ///< [in] handle of context object ) { context.logger->log_trace("zeContextGetStatus(hContext)"); auto pfnGetStatus = context.zeDdiTable.Context.pfnGetStatus; if( nullptr == pfnGetStatus ) return logAndPropagateResult("zeContextGetStatus", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextGetStatusPrologue( hContext ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextGetStatus", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeContextGetStatusPrologue( hContext ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextGetStatus", result); } auto driver_result = pfnGetStatus( hContext ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextGetStatusEpilogue( hContext ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextGetStatus", result); } return logAndPropagateResult("zeContextGetStatus", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueCreate __zedlllocal ze_result_t ZE_APICALL zeCommandQueueCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* desc, ///< [in] pointer to command queue descriptor ze_command_queue_handle_t* phCommandQueue ///< [out] pointer to handle of command queue object created ) { context.logger->log_trace("zeCommandQueueCreate(hContext, hDevice, desc, phCommandQueue)"); auto pfnCreate = context.zeDdiTable.CommandQueue.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zeCommandQueueCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandQueueCreatePrologue( hContext, hDevice, desc, phCommandQueue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandQueueCreatePrologue( hContext, hDevice, desc, phCommandQueue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueCreate", result); } auto driver_result = pfnCreate( hContext, hDevice, desc, phCommandQueue ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandQueueCreateEpilogue( hContext, hDevice, desc, phCommandQueue ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phCommandQueue){ context.handleLifetime->addHandle( *phCommandQueue ); context.handleLifetime->addDependent( hContext, *phCommandQueue ); } } return logAndPropagateResult("zeCommandQueueCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueDestroy __zedlllocal ze_result_t ZE_APICALL zeCommandQueueDestroy( ze_command_queue_handle_t hCommandQueue ///< [in][release] handle of command queue object to destroy ) { context.logger->log_trace("zeCommandQueueDestroy(hCommandQueue)"); auto pfnDestroy = context.zeDdiTable.CommandQueue.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zeCommandQueueDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandQueueDestroyPrologue( hCommandQueue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandQueueDestroyPrologue( hCommandQueue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueDestroy", result); } auto driver_result = pfnDestroy( hCommandQueue ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandQueueDestroyEpilogue( hCommandQueue ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueDestroy", result); } return logAndPropagateResult("zeCommandQueueDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueExecuteCommandLists __zedlllocal ze_result_t ZE_APICALL zeCommandQueueExecuteCommandLists( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t numCommandLists, ///< [in] number of command lists to execute ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] list of handles of the command lists ///< to execute ze_fence_handle_t hFence ///< [in][optional] handle of the fence to signal on completion ) { context.logger->log_trace("zeCommandQueueExecuteCommandLists(hCommandQueue, numCommandLists, phCommandListsLocal, hFence)"); auto pfnExecuteCommandLists = context.zeDdiTable.CommandQueue.pfnExecuteCommandLists; if( nullptr == pfnExecuteCommandLists ) return logAndPropagateResult("zeCommandQueueExecuteCommandLists", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandQueueExecuteCommandListsPrologue( hCommandQueue, numCommandLists, phCommandLists, hFence ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueExecuteCommandLists", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandQueueExecuteCommandListsPrologue( hCommandQueue, numCommandLists, phCommandLists, hFence ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueExecuteCommandLists", result); } auto driver_result = pfnExecuteCommandLists( hCommandQueue, numCommandLists, phCommandLists, hFence ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandQueueExecuteCommandListsEpilogue( hCommandQueue, numCommandLists, phCommandLists, hFence ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueExecuteCommandLists", result); } return logAndPropagateResult("zeCommandQueueExecuteCommandLists", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueSynchronize __zedlllocal ze_result_t ZE_APICALL zeCommandQueueSynchronize( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the command queue; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { context.logger->log_trace("zeCommandQueueSynchronize(hCommandQueue, timeout)"); auto pfnSynchronize = context.zeDdiTable.CommandQueue.pfnSynchronize; if( nullptr == pfnSynchronize ) return logAndPropagateResult("zeCommandQueueSynchronize", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandQueueSynchronizePrologue( hCommandQueue, timeout ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueSynchronize", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandQueueSynchronizePrologue( hCommandQueue, timeout ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueSynchronize", result); } auto driver_result = pfnSynchronize( hCommandQueue, timeout ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandQueueSynchronizeEpilogue( hCommandQueue, timeout ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueSynchronize", result); } return logAndPropagateResult("zeCommandQueueSynchronize", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueGetOrdinal __zedlllocal ze_result_t ZE_APICALL zeCommandQueueGetOrdinal( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pOrdinal ///< [out] command queue group ordinal ) { context.logger->log_trace("zeCommandQueueGetOrdinal(hCommandQueue, pOrdinal)"); auto pfnGetOrdinal = context.zeDdiTable.CommandQueue.pfnGetOrdinal; if( nullptr == pfnGetOrdinal ) return logAndPropagateResult("zeCommandQueueGetOrdinal", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandQueueGetOrdinalPrologue( hCommandQueue, pOrdinal ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueGetOrdinal", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandQueueGetOrdinalPrologue( hCommandQueue, pOrdinal ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueGetOrdinal", result); } auto driver_result = pfnGetOrdinal( hCommandQueue, pOrdinal ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandQueueGetOrdinalEpilogue( hCommandQueue, pOrdinal ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueGetOrdinal", result); } return logAndPropagateResult("zeCommandQueueGetOrdinal", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueGetIndex __zedlllocal ze_result_t ZE_APICALL zeCommandQueueGetIndex( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pIndex ///< [out] command queue index within the group ) { context.logger->log_trace("zeCommandQueueGetIndex(hCommandQueue, pIndex)"); auto pfnGetIndex = context.zeDdiTable.CommandQueue.pfnGetIndex; if( nullptr == pfnGetIndex ) return logAndPropagateResult("zeCommandQueueGetIndex", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandQueueGetIndexPrologue( hCommandQueue, pIndex ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueGetIndex", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandQueueGetIndexPrologue( hCommandQueue, pIndex ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueGetIndex", result); } auto driver_result = pfnGetIndex( hCommandQueue, pIndex ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandQueueGetIndexEpilogue( hCommandQueue, pIndex ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandQueueGetIndex", result); } return logAndPropagateResult("zeCommandQueueGetIndex", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListCreate __zedlllocal ze_result_t ZE_APICALL zeCommandListCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_list_desc_t* desc, ///< [in] pointer to command list descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { context.logger->log_trace("zeCommandListCreate(hContext, hDevice, desc, phCommandList)"); auto pfnCreate = context.zeDdiTable.CommandList.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zeCommandListCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListCreatePrologue( hContext, hDevice, desc, phCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListCreatePrologue( hContext, hDevice, desc, phCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListCreate", result); } auto driver_result = pfnCreate( hContext, hDevice, desc, phCommandList ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListCreateEpilogue( hContext, hDevice, desc, phCommandList ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phCommandList){ context.handleLifetime->addHandle( *phCommandList ); context.handleLifetime->addDependent( hContext, *phCommandList ); } } return logAndPropagateResult("zeCommandListCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListCreateImmediate __zedlllocal ze_result_t ZE_APICALL zeCommandListCreateImmediate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* altdesc, ///< [in] pointer to command queue descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { context.logger->log_trace("zeCommandListCreateImmediate(hContext, hDevice, altdesc, phCommandList)"); auto pfnCreateImmediate = context.zeDdiTable.CommandList.pfnCreateImmediate; if( nullptr == pfnCreateImmediate ) return logAndPropagateResult("zeCommandListCreateImmediate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListCreateImmediatePrologue( hContext, hDevice, altdesc, phCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListCreateImmediate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListCreateImmediatePrologue( hContext, hDevice, altdesc, phCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListCreateImmediate", result); } auto driver_result = pfnCreateImmediate( hContext, hDevice, altdesc, phCommandList ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListCreateImmediateEpilogue( hContext, hDevice, altdesc, phCommandList ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListCreateImmediate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phCommandList){ context.handleLifetime->addHandle( *phCommandList , false); } } return logAndPropagateResult("zeCommandListCreateImmediate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListDestroy __zedlllocal ze_result_t ZE_APICALL zeCommandListDestroy( ze_command_list_handle_t hCommandList ///< [in][release] handle of command list object to destroy ) { context.logger->log_trace("zeCommandListDestroy(hCommandList)"); auto pfnDestroy = context.zeDdiTable.CommandList.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zeCommandListDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListDestroyPrologue( hCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListDestroyPrologue( hCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListDestroy", result); } auto driver_result = pfnDestroy( hCommandList ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListDestroyEpilogue( hCommandList ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListDestroy", result); } return logAndPropagateResult("zeCommandListDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListClose __zedlllocal ze_result_t ZE_APICALL zeCommandListClose( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to close ) { context.logger->log_trace("zeCommandListClose(hCommandList)"); auto pfnClose = context.zeDdiTable.CommandList.pfnClose; if( nullptr == pfnClose ) return logAndPropagateResult("zeCommandListClose", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListClosePrologue( hCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListClose", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListClosePrologue( hCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListClose", result); } auto driver_result = pfnClose( hCommandList ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListCloseEpilogue( hCommandList ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListClose", result); } return logAndPropagateResult("zeCommandListClose", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListReset __zedlllocal ze_result_t ZE_APICALL zeCommandListReset( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to reset ) { context.logger->log_trace("zeCommandListReset(hCommandList)"); auto pfnReset = context.zeDdiTable.CommandList.pfnReset; if( nullptr == pfnReset ) return logAndPropagateResult("zeCommandListReset", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListResetPrologue( hCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListReset", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListResetPrologue( hCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListReset", result); } auto driver_result = pfnReset( hCommandList ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListResetEpilogue( hCommandList ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListReset", result); } return logAndPropagateResult("zeCommandListReset", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendWriteGlobalTimestamp __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendWriteGlobalTimestamp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t* dstptr, ///< [in,out] pointer to memory where timestamp value will be written; must ///< be 8byte-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { context.logger->log_trace("zeCommandListAppendWriteGlobalTimestamp(hCommandList, dstptr, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendWriteGlobalTimestamp = context.zeDdiTable.CommandList.pfnAppendWriteGlobalTimestamp; if( nullptr == pfnAppendWriteGlobalTimestamp ) return logAndPropagateResult("zeCommandListAppendWriteGlobalTimestamp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendWriteGlobalTimestampPrologue( hCommandList, dstptr, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendWriteGlobalTimestamp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendWriteGlobalTimestampPrologue( hCommandList, dstptr, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendWriteGlobalTimestamp", result); } auto driver_result = pfnAppendWriteGlobalTimestamp( hCommandList, dstptr, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendWriteGlobalTimestampEpilogue( hCommandList, dstptr, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendWriteGlobalTimestamp", result); } return logAndPropagateResult("zeCommandListAppendWriteGlobalTimestamp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListHostSynchronize __zedlllocal ze_result_t ZE_APICALL zeCommandListHostSynchronize( ze_command_list_handle_t hCommandList, ///< [in] handle of the immediate command list uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the immediate command list; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { context.logger->log_trace("zeCommandListHostSynchronize(hCommandList, timeout)"); auto pfnHostSynchronize = context.zeDdiTable.CommandList.pfnHostSynchronize; if( nullptr == pfnHostSynchronize ) return logAndPropagateResult("zeCommandListHostSynchronize", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListHostSynchronizePrologue( hCommandList, timeout ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListHostSynchronize", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListHostSynchronizePrologue( hCommandList, timeout ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListHostSynchronize", result); } auto driver_result = pfnHostSynchronize( hCommandList, timeout ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListHostSynchronizeEpilogue( hCommandList, timeout ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListHostSynchronize", result); } return logAndPropagateResult("zeCommandListHostSynchronize", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetDeviceHandle __zedlllocal ze_result_t ZE_APICALL zeCommandListGetDeviceHandle( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_device_handle_t* phDevice ///< [out] handle of the device on which the command list was created ) { context.logger->log_trace("zeCommandListGetDeviceHandle(hCommandList, phDevice)"); auto pfnGetDeviceHandle = context.zeDdiTable.CommandList.pfnGetDeviceHandle; if( nullptr == pfnGetDeviceHandle ) return logAndPropagateResult("zeCommandListGetDeviceHandle", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListGetDeviceHandlePrologue( hCommandList, phDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetDeviceHandle", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListGetDeviceHandlePrologue( hCommandList, phDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetDeviceHandle", result); } auto driver_result = pfnGetDeviceHandle( hCommandList, phDevice ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListGetDeviceHandleEpilogue( hCommandList, phDevice ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetDeviceHandle", result); } return logAndPropagateResult("zeCommandListGetDeviceHandle", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetContextHandle __zedlllocal ze_result_t ZE_APICALL zeCommandListGetContextHandle( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_context_handle_t* phContext ///< [out] handle of the context on which the command list was created ) { context.logger->log_trace("zeCommandListGetContextHandle(hCommandList, phContext)"); auto pfnGetContextHandle = context.zeDdiTable.CommandList.pfnGetContextHandle; if( nullptr == pfnGetContextHandle ) return logAndPropagateResult("zeCommandListGetContextHandle", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListGetContextHandlePrologue( hCommandList, phContext ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetContextHandle", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListGetContextHandlePrologue( hCommandList, phContext ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetContextHandle", result); } auto driver_result = pfnGetContextHandle( hCommandList, phContext ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListGetContextHandleEpilogue( hCommandList, phContext ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetContextHandle", result); } return logAndPropagateResult("zeCommandListGetContextHandle", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetOrdinal __zedlllocal ze_result_t ZE_APICALL zeCommandListGetOrdinal( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t* pOrdinal ///< [out] command queue group ordinal to which command list is submitted ) { context.logger->log_trace("zeCommandListGetOrdinal(hCommandList, pOrdinal)"); auto pfnGetOrdinal = context.zeDdiTable.CommandList.pfnGetOrdinal; if( nullptr == pfnGetOrdinal ) return logAndPropagateResult("zeCommandListGetOrdinal", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListGetOrdinalPrologue( hCommandList, pOrdinal ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetOrdinal", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListGetOrdinalPrologue( hCommandList, pOrdinal ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetOrdinal", result); } auto driver_result = pfnGetOrdinal( hCommandList, pOrdinal ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListGetOrdinalEpilogue( hCommandList, pOrdinal ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetOrdinal", result); } return logAndPropagateResult("zeCommandListGetOrdinal", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListImmediateGetIndex __zedlllocal ze_result_t ZE_APICALL zeCommandListImmediateGetIndex( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t* pIndex ///< [out] command queue index within the group to which the immediate ///< command list is submitted ) { context.logger->log_trace("zeCommandListImmediateGetIndex(hCommandListImmediate, pIndex)"); auto pfnImmediateGetIndex = context.zeDdiTable.CommandList.pfnImmediateGetIndex; if( nullptr == pfnImmediateGetIndex ) return logAndPropagateResult("zeCommandListImmediateGetIndex", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListImmediateGetIndexPrologue( hCommandListImmediate, pIndex ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListImmediateGetIndex", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListImmediateGetIndexPrologue( hCommandListImmediate, pIndex ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListImmediateGetIndex", result); } auto driver_result = pfnImmediateGetIndex( hCommandListImmediate, pIndex ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListImmediateGetIndexEpilogue( hCommandListImmediate, pIndex ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListImmediateGetIndex", result); } return logAndPropagateResult("zeCommandListImmediateGetIndex", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListIsImmediate __zedlllocal ze_result_t ZE_APICALL zeCommandListIsImmediate( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_bool_t* pIsImmediate ///< [out] Boolean indicating whether the command list is an immediate ///< command list (true) or not (false) ) { context.logger->log_trace("zeCommandListIsImmediate(hCommandList, pIsImmediate)"); auto pfnIsImmediate = context.zeDdiTable.CommandList.pfnIsImmediate; if( nullptr == pfnIsImmediate ) return logAndPropagateResult("zeCommandListIsImmediate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListIsImmediatePrologue( hCommandList, pIsImmediate ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListIsImmediate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListIsImmediatePrologue( hCommandList, pIsImmediate ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListIsImmediate", result); } auto driver_result = pfnIsImmediate( hCommandList, pIsImmediate ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListIsImmediateEpilogue( hCommandList, pIsImmediate ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListIsImmediate", result); } return logAndPropagateResult("zeCommandListIsImmediate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendBarrier __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendBarrier( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { context.logger->log_trace("zeCommandListAppendBarrier(hCommandList, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendBarrier = context.zeDdiTable.CommandList.pfnAppendBarrier; if( nullptr == pfnAppendBarrier ) return logAndPropagateResult("zeCommandListAppendBarrier", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendBarrierPrologue( hCommandList, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendBarrier", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendBarrierPrologue( hCommandList, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendBarrier", result); } auto driver_result = pfnAppendBarrier( hCommandList, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendBarrierEpilogue( hCommandList, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendBarrier", result); } return logAndPropagateResult("zeCommandListAppendBarrier", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryRangesBarrier __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryRangesBarrier( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numRanges, ///< [in] number of memory ranges const size_t* pRangeSizes, ///< [in][range(0, numRanges)] array of sizes of memory range const void** pRanges, ///< [in][range(0, numRanges)] array of memory ranges ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { context.logger->log_trace("zeCommandListAppendMemoryRangesBarrier(hCommandList, numRanges, pRangeSizes, pRanges, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendMemoryRangesBarrier = context.zeDdiTable.CommandList.pfnAppendMemoryRangesBarrier; if( nullptr == pfnAppendMemoryRangesBarrier ) return logAndPropagateResult("zeCommandListAppendMemoryRangesBarrier", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryRangesBarrierPrologue( hCommandList, numRanges, pRangeSizes, pRanges, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryRangesBarrier", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendMemoryRangesBarrierPrologue( hCommandList, numRanges, pRangeSizes, pRanges, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryRangesBarrier", result); } auto driver_result = pfnAppendMemoryRangesBarrier( hCommandList, numRanges, pRangeSizes, pRanges, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryRangesBarrierEpilogue( hCommandList, numRanges, pRangeSizes, pRanges, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryRangesBarrier", result); } return logAndPropagateResult("zeCommandListAppendMemoryRangesBarrier", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextSystemBarrier __zedlllocal ze_result_t ZE_APICALL zeContextSystemBarrier( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice ///< [in] handle of the device ) { context.logger->log_trace("zeContextSystemBarrier(hContext, hDevice)"); auto pfnSystemBarrier = context.zeDdiTable.Context.pfnSystemBarrier; if( nullptr == pfnSystemBarrier ) return logAndPropagateResult("zeContextSystemBarrier", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextSystemBarrierPrologue( hContext, hDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextSystemBarrier", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeContextSystemBarrierPrologue( hContext, hDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextSystemBarrier", result); } auto driver_result = pfnSystemBarrier( hContext, hDevice ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextSystemBarrierEpilogue( hContext, hDevice ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextSystemBarrier", result); } return logAndPropagateResult("zeContextSystemBarrier", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopy __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopy( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendMemoryCopy(hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendMemoryCopy = context.zeDdiTable.CommandList.pfnAppendMemoryCopy; if( nullptr == pfnAppendMemoryCopy ) return logAndPropagateResult("zeCommandListAppendMemoryCopy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryCopyPrologue( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryCopy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendMemoryCopyPrologue( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryCopy", result); } auto driver_result = pfnAppendMemoryCopy( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryCopyEpilogue( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryCopy", result); } return logAndPropagateResult("zeCommandListAppendMemoryCopy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryFill __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryFill( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* ptr, ///< [in] pointer to memory to initialize const void* pattern, ///< [in] pointer to value to initialize memory to size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to size_t size, ///< [in] size in bytes to initialize ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendMemoryFill(hCommandList, ptr, pattern, pattern_size, size, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendMemoryFill = context.zeDdiTable.CommandList.pfnAppendMemoryFill; if( nullptr == pfnAppendMemoryFill ) return logAndPropagateResult("zeCommandListAppendMemoryFill", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryFillPrologue( hCommandList, ptr, pattern, pattern_size, size, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryFill", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendMemoryFillPrologue( hCommandList, ptr, pattern, pattern_size, size, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryFill", result); } auto driver_result = pfnAppendMemoryFill( hCommandList, ptr, pattern, pattern_size, size, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryFillEpilogue( hCommandList, ptr, pattern, pattern_size, size, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryFill", result); } return logAndPropagateResult("zeCommandListAppendMemoryFill", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyRegion __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const ze_copy_region_t* dstRegion, ///< [in] pointer to destination region to copy to uint32_t dstPitch, ///< [in] destination pitch in bytes uint32_t dstSlicePitch, ///< [in] destination slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. const void* srcptr, ///< [in] pointer to source memory to copy from const ze_copy_region_t* srcRegion, ///< [in] pointer to source region to copy from uint32_t srcPitch, ///< [in] source pitch in bytes uint32_t srcSlicePitch, ///< [in] source slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendMemoryCopyRegion(hCommandList, dstptr, dstRegion, dstPitch, dstSlicePitch, srcptr, srcRegion, srcPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendMemoryCopyRegion = context.zeDdiTable.CommandList.pfnAppendMemoryCopyRegion; if( nullptr == pfnAppendMemoryCopyRegion ) return logAndPropagateResult("zeCommandListAppendMemoryCopyRegion", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryCopyRegionPrologue( hCommandList, dstptr, dstRegion, dstPitch, dstSlicePitch, srcptr, srcRegion, srcPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryCopyRegion", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendMemoryCopyRegionPrologue( hCommandList, dstptr, dstRegion, dstPitch, dstSlicePitch, srcptr, srcRegion, srcPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryCopyRegion", result); } auto driver_result = pfnAppendMemoryCopyRegion( hCommandList, dstptr, dstRegion, dstPitch, dstSlicePitch, srcptr, srcRegion, srcPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryCopyRegionEpilogue( hCommandList, dstptr, dstRegion, dstPitch, dstSlicePitch, srcptr, srcRegion, srcPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryCopyRegion", result); } return logAndPropagateResult("zeCommandListAppendMemoryCopyRegion", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyFromContext __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyFromContext( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_context_handle_t hContextSrc, ///< [in] handle of source context object const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendMemoryCopyFromContext(hCommandList, dstptr, hContextSrc, srcptr, size, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendMemoryCopyFromContext = context.zeDdiTable.CommandList.pfnAppendMemoryCopyFromContext; if( nullptr == pfnAppendMemoryCopyFromContext ) return logAndPropagateResult("zeCommandListAppendMemoryCopyFromContext", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryCopyFromContextPrologue( hCommandList, dstptr, hContextSrc, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryCopyFromContext", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendMemoryCopyFromContextPrologue( hCommandList, dstptr, hContextSrc, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryCopyFromContext", result); } auto driver_result = pfnAppendMemoryCopyFromContext( hCommandList, dstptr, hContextSrc, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryCopyFromContextEpilogue( hCommandList, dstptr, hContextSrc, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryCopyFromContext", result); } return logAndPropagateResult("zeCommandListAppendMemoryCopyFromContext", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopy __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopy( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendImageCopy(hCommandList, hDstImage, hSrcImage, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendImageCopy = context.zeDdiTable.CommandList.pfnAppendImageCopy; if( nullptr == pfnAppendImageCopy ) return logAndPropagateResult("zeCommandListAppendImageCopy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendImageCopyPrologue( hCommandList, hDstImage, hSrcImage, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendImageCopyPrologue( hCommandList, hDstImage, hSrcImage, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopy", result); } auto driver_result = pfnAppendImageCopy( hCommandList, hDstImage, hSrcImage, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendImageCopyEpilogue( hCommandList, hDstImage, hSrcImage, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopy", result); } return logAndPropagateResult("zeCommandListAppendImageCopy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyRegion __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendImageCopyRegion(hCommandList, hDstImage, hSrcImage, pDstRegion, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendImageCopyRegion = context.zeDdiTable.CommandList.pfnAppendImageCopyRegion; if( nullptr == pfnAppendImageCopyRegion ) return logAndPropagateResult("zeCommandListAppendImageCopyRegion", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendImageCopyRegionPrologue( hCommandList, hDstImage, hSrcImage, pDstRegion, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyRegion", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendImageCopyRegionPrologue( hCommandList, hDstImage, hSrcImage, pDstRegion, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyRegion", result); } auto driver_result = pfnAppendImageCopyRegion( hCommandList, hDstImage, hSrcImage, pDstRegion, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendImageCopyRegionEpilogue( hCommandList, hDstImage, hSrcImage, pDstRegion, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyRegion", result); } return logAndPropagateResult("zeCommandListAppendImageCopyRegion", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyToMemory __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemory( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendImageCopyToMemory(hCommandList, dstptr, hSrcImage, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendImageCopyToMemory = context.zeDdiTable.CommandList.pfnAppendImageCopyToMemory; if( nullptr == pfnAppendImageCopyToMemory ) return logAndPropagateResult("zeCommandListAppendImageCopyToMemory", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendImageCopyToMemoryPrologue( hCommandList, dstptr, hSrcImage, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyToMemory", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendImageCopyToMemoryPrologue( hCommandList, dstptr, hSrcImage, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyToMemory", result); } auto driver_result = pfnAppendImageCopyToMemory( hCommandList, dstptr, hSrcImage, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendImageCopyToMemoryEpilogue( hCommandList, dstptr, hSrcImage, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyToMemory", result); } return logAndPropagateResult("zeCommandListAppendImageCopyToMemory", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyFromMemory __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyFromMemory( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendImageCopyFromMemory(hCommandList, hDstImage, srcptr, pDstRegion, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendImageCopyFromMemory = context.zeDdiTable.CommandList.pfnAppendImageCopyFromMemory; if( nullptr == pfnAppendImageCopyFromMemory ) return logAndPropagateResult("zeCommandListAppendImageCopyFromMemory", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendImageCopyFromMemoryPrologue( hCommandList, hDstImage, srcptr, pDstRegion, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyFromMemory", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendImageCopyFromMemoryPrologue( hCommandList, hDstImage, srcptr, pDstRegion, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyFromMemory", result); } auto driver_result = pfnAppendImageCopyFromMemory( hCommandList, hDstImage, srcptr, pDstRegion, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendImageCopyFromMemoryEpilogue( hCommandList, hDstImage, srcptr, pDstRegion, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyFromMemory", result); } return logAndPropagateResult("zeCommandListAppendImageCopyFromMemory", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryPrefetch __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryPrefetch( ze_command_list_handle_t hCommandList, ///< [in] handle of command list const void* ptr, ///< [in] pointer to start of the memory range to prefetch size_t size ///< [in] size in bytes of the memory range to prefetch ) { context.logger->log_trace("zeCommandListAppendMemoryPrefetch(hCommandList, ptr, size)"); auto pfnAppendMemoryPrefetch = context.zeDdiTable.CommandList.pfnAppendMemoryPrefetch; if( nullptr == pfnAppendMemoryPrefetch ) return logAndPropagateResult("zeCommandListAppendMemoryPrefetch", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryPrefetchPrologue( hCommandList, ptr, size ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryPrefetch", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendMemoryPrefetchPrologue( hCommandList, ptr, size ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryPrefetch", result); } auto driver_result = pfnAppendMemoryPrefetch( hCommandList, ptr, size ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemoryPrefetchEpilogue( hCommandList, ptr, size ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemoryPrefetch", result); } return logAndPropagateResult("zeCommandListAppendMemoryPrefetch", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemAdvise __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemAdvise( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_advice_t advice ///< [in] Memory advice for the memory range ) { context.logger->log_trace("zeCommandListAppendMemAdvise(hCommandList, hDevice, ptr, size, advice)"); auto pfnAppendMemAdvise = context.zeDdiTable.CommandList.pfnAppendMemAdvise; if( nullptr == pfnAppendMemAdvise ) return logAndPropagateResult("zeCommandListAppendMemAdvise", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemAdvisePrologue( hCommandList, hDevice, ptr, size, advice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemAdvise", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendMemAdvisePrologue( hCommandList, hDevice, ptr, size, advice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemAdvise", result); } auto driver_result = pfnAppendMemAdvise( hCommandList, hDevice, ptr, size, advice ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendMemAdviseEpilogue( hCommandList, hDevice, ptr, size, advice ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendMemAdvise", result); } return logAndPropagateResult("zeCommandListAppendMemAdvise", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolCreate __zedlllocal ze_result_t ZE_APICALL zeEventPoolCreate( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_event_pool_desc_t* desc, ///< [in] pointer to event pool descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< have visibility to the event pool. ///< if nullptr, then event pool is visible to all devices supported by the ///< driver instance. ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { context.logger->log_trace("zeEventPoolCreate(hContext, desc, numDevices, phDevicesLocal, phEventPool)"); auto pfnCreate = context.zeDdiTable.EventPool.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zeEventPoolCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolCreatePrologue( hContext, desc, numDevices, phDevices, phEventPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventPoolCreatePrologue( hContext, desc, numDevices, phDevices, phEventPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolCreate", result); } auto driver_result = pfnCreate( hContext, desc, numDevices, phDevices, phEventPool ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolCreateEpilogue( hContext, desc, numDevices, phDevices, phEventPool ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phEventPool){ context.handleLifetime->addHandle( *phEventPool ); context.handleLifetime->addDependent( hContext, *phEventPool ); } } return logAndPropagateResult("zeEventPoolCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolDestroy __zedlllocal ze_result_t ZE_APICALL zeEventPoolDestroy( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object to destroy ) { context.logger->log_trace("zeEventPoolDestroy(hEventPool)"); auto pfnDestroy = context.zeDdiTable.EventPool.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zeEventPoolDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolDestroyPrologue( hEventPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventPoolDestroyPrologue( hEventPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolDestroy", result); } auto driver_result = pfnDestroy( hEventPool ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolDestroyEpilogue( hEventPool ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolDestroy", result); } return logAndPropagateResult("zeEventPoolDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventCreate __zedlllocal ze_result_t ZE_APICALL zeEventCreate( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool const ze_event_desc_t* desc, ///< [in] pointer to event descriptor ze_event_handle_t* phEvent ///< [out] pointer to handle of event object created ) { context.logger->log_trace("zeEventCreate(hEventPool, desc, phEvent)"); auto pfnCreate = context.zeDdiTable.Event.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zeEventCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventCreatePrologue( hEventPool, desc, phEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventCreatePrologue( hEventPool, desc, phEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventCreate", result); } auto driver_result = pfnCreate( hEventPool, desc, phEvent ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventCreateEpilogue( hEventPool, desc, phEvent ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phEvent){ context.handleLifetime->addHandle( *phEvent ); context.handleLifetime->addDependent( hEventPool, *phEvent ); } } return logAndPropagateResult("zeEventCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventDestroy __zedlllocal ze_result_t ZE_APICALL zeEventDestroy( ze_event_handle_t hEvent ///< [in][release] handle of event object to destroy ) { context.logger->log_trace("zeEventDestroy(hEvent)"); auto pfnDestroy = context.zeDdiTable.Event.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zeEventDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventDestroyPrologue( hEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventDestroyPrologue( hEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventDestroy", result); } auto driver_result = pfnDestroy( hEvent ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventDestroyEpilogue( hEvent ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventDestroy", result); } return logAndPropagateResult("zeEventDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolGetIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolGetIpcHandle( ze_event_pool_handle_t hEventPool, ///< [in] handle of event pool object ze_ipc_event_pool_handle_t* phIpc ///< [out] Returned IPC event handle ) { context.logger->log_trace("zeEventPoolGetIpcHandle(hEventPool, phIpc)"); auto pfnGetIpcHandle = context.zeDdiTable.EventPool.pfnGetIpcHandle; if( nullptr == pfnGetIpcHandle ) return logAndPropagateResult("zeEventPoolGetIpcHandle", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolGetIpcHandlePrologue( hEventPool, phIpc ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolGetIpcHandle", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventPoolGetIpcHandlePrologue( hEventPool, phIpc ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolGetIpcHandle", result); } auto driver_result = pfnGetIpcHandle( hEventPool, phIpc ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolGetIpcHandleEpilogue( hEventPool, phIpc ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolGetIpcHandle", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeEventPoolGetIpcHandle", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolPutIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolPutIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object associated with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc ///< [in] IPC event pool handle ) { context.logger->log_trace("zeEventPoolPutIpcHandle(hContext, hIpc)"); auto pfnPutIpcHandle = context.zeDdiTable.EventPool.pfnPutIpcHandle; if( nullptr == pfnPutIpcHandle ) return logAndPropagateResult("zeEventPoolPutIpcHandle", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolPutIpcHandlePrologue( hContext, hIpc ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolPutIpcHandle", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventPoolPutIpcHandlePrologue( hContext, hIpc ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolPutIpcHandle", result); } auto driver_result = pfnPutIpcHandle( hContext, hIpc ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolPutIpcHandleEpilogue( hContext, hIpc ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolPutIpcHandle", result); } return logAndPropagateResult("zeEventPoolPutIpcHandle", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolOpenIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolOpenIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object to associate with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc, ///< [in] IPC event pool handle ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { context.logger->log_trace("zeEventPoolOpenIpcHandle(hContext, hIpc, phEventPool)"); auto pfnOpenIpcHandle = context.zeDdiTable.EventPool.pfnOpenIpcHandle; if( nullptr == pfnOpenIpcHandle ) return logAndPropagateResult("zeEventPoolOpenIpcHandle", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolOpenIpcHandlePrologue( hContext, hIpc, phEventPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolOpenIpcHandle", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventPoolOpenIpcHandlePrologue( hContext, hIpc, phEventPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolOpenIpcHandle", result); } auto driver_result = pfnOpenIpcHandle( hContext, hIpc, phEventPool ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolOpenIpcHandleEpilogue( hContext, hIpc, phEventPool ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolOpenIpcHandle", result); } return logAndPropagateResult("zeEventPoolOpenIpcHandle", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolCloseIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolCloseIpcHandle( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object ) { context.logger->log_trace("zeEventPoolCloseIpcHandle(hEventPool)"); auto pfnCloseIpcHandle = context.zeDdiTable.EventPool.pfnCloseIpcHandle; if( nullptr == pfnCloseIpcHandle ) return logAndPropagateResult("zeEventPoolCloseIpcHandle", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolCloseIpcHandlePrologue( hEventPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolCloseIpcHandle", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventPoolCloseIpcHandlePrologue( hEventPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolCloseIpcHandle", result); } auto driver_result = pfnCloseIpcHandle( hEventPool ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolCloseIpcHandleEpilogue( hEventPool ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolCloseIpcHandle", result); } return logAndPropagateResult("zeEventPoolCloseIpcHandle", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendSignalEvent __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendSignalEvent( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { context.logger->log_trace("zeCommandListAppendSignalEvent(hCommandList, hEvent)"); auto pfnAppendSignalEvent = context.zeDdiTable.CommandList.pfnAppendSignalEvent; if( nullptr == pfnAppendSignalEvent ) return logAndPropagateResult("zeCommandListAppendSignalEvent", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendSignalEventPrologue( hCommandList, hEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendSignalEvent", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendSignalEventPrologue( hCommandList, hEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendSignalEvent", result); } auto driver_result = pfnAppendSignalEvent( hCommandList, hEvent ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendSignalEventEpilogue( hCommandList, hEvent ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendSignalEvent", result); } return logAndPropagateResult("zeCommandListAppendSignalEvent", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendWaitOnEvents __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendWaitOnEvents( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] number of events to wait on before continuing ze_event_handle_t* phEvents ///< [in][range(0, numEvents)] handles of the events to wait on before ///< continuing ) { context.logger->log_trace("zeCommandListAppendWaitOnEvents(hCommandList, numEvents, phEventsLocal)"); auto pfnAppendWaitOnEvents = context.zeDdiTable.CommandList.pfnAppendWaitOnEvents; if( nullptr == pfnAppendWaitOnEvents ) return logAndPropagateResult("zeCommandListAppendWaitOnEvents", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendWaitOnEventsPrologue( hCommandList, numEvents, phEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendWaitOnEvents", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendWaitOnEventsPrologue( hCommandList, numEvents, phEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendWaitOnEvents", result); } auto driver_result = pfnAppendWaitOnEvents( hCommandList, numEvents, phEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendWaitOnEventsEpilogue( hCommandList, numEvents, phEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendWaitOnEvents", result); } return logAndPropagateResult("zeCommandListAppendWaitOnEvents", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventHostSignal __zedlllocal ze_result_t ZE_APICALL zeEventHostSignal( ze_event_handle_t hEvent ///< [in] handle of the event ) { context.logger->log_trace("zeEventHostSignal(hEvent)"); auto pfnHostSignal = context.zeDdiTable.Event.pfnHostSignal; if( nullptr == pfnHostSignal ) return logAndPropagateResult("zeEventHostSignal", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventHostSignalPrologue( hEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventHostSignal", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventHostSignalPrologue( hEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventHostSignal", result); } auto driver_result = pfnHostSignal( hEvent ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventHostSignalEpilogue( hEvent ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventHostSignal", result); } return logAndPropagateResult("zeEventHostSignal", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventHostSynchronize __zedlllocal ze_result_t ZE_APICALL zeEventHostSynchronize( ze_event_handle_t hEvent, ///< [in] handle of the event uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeEventQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { context.logger->log_trace("zeEventHostSynchronize(hEvent, timeout)"); auto pfnHostSynchronize = context.zeDdiTable.Event.pfnHostSynchronize; if( nullptr == pfnHostSynchronize ) return logAndPropagateResult("zeEventHostSynchronize", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventHostSynchronizePrologue( hEvent, timeout ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventHostSynchronize", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventHostSynchronizePrologue( hEvent, timeout ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventHostSynchronize", result); } auto driver_result = pfnHostSynchronize( hEvent, timeout ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventHostSynchronizeEpilogue( hEvent, timeout ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventHostSynchronize", result); } return logAndPropagateResult("zeEventHostSynchronize", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryStatus __zedlllocal ze_result_t ZE_APICALL zeEventQueryStatus( ze_event_handle_t hEvent ///< [in] handle of the event ) { context.logger->log_trace("zeEventQueryStatus(hEvent)"); auto pfnQueryStatus = context.zeDdiTable.Event.pfnQueryStatus; if( nullptr == pfnQueryStatus ) return logAndPropagateResult("zeEventQueryStatus", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventQueryStatusPrologue( hEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventQueryStatus", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventQueryStatusPrologue( hEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventQueryStatus", result); } auto driver_result = pfnQueryStatus( hEvent ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventQueryStatusEpilogue( hEvent ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventQueryStatus", result); } return logAndPropagateResult("zeEventQueryStatus", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendEventReset __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendEventReset( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { context.logger->log_trace("zeCommandListAppendEventReset(hCommandList, hEvent)"); auto pfnAppendEventReset = context.zeDdiTable.CommandList.pfnAppendEventReset; if( nullptr == pfnAppendEventReset ) return logAndPropagateResult("zeCommandListAppendEventReset", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendEventResetPrologue( hCommandList, hEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendEventReset", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendEventResetPrologue( hCommandList, hEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendEventReset", result); } auto driver_result = pfnAppendEventReset( hCommandList, hEvent ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendEventResetEpilogue( hCommandList, hEvent ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendEventReset", result); } return logAndPropagateResult("zeCommandListAppendEventReset", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventHostReset __zedlllocal ze_result_t ZE_APICALL zeEventHostReset( ze_event_handle_t hEvent ///< [in] handle of the event ) { context.logger->log_trace("zeEventHostReset(hEvent)"); auto pfnHostReset = context.zeDdiTable.Event.pfnHostReset; if( nullptr == pfnHostReset ) return logAndPropagateResult("zeEventHostReset", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventHostResetPrologue( hEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventHostReset", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventHostResetPrologue( hEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventHostReset", result); } auto driver_result = pfnHostReset( hEvent ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventHostResetEpilogue( hEvent ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventHostReset", result); } return logAndPropagateResult("zeEventHostReset", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryKernelTimestamp __zedlllocal ze_result_t ZE_APICALL zeEventQueryKernelTimestamp( ze_event_handle_t hEvent, ///< [in] handle of the event ze_kernel_timestamp_result_t* dstptr ///< [in,out] pointer to memory for where timestamp result will be written. ) { context.logger->log_trace("zeEventQueryKernelTimestamp(hEvent, dstptr)"); auto pfnQueryKernelTimestamp = context.zeDdiTable.Event.pfnQueryKernelTimestamp; if( nullptr == pfnQueryKernelTimestamp ) return logAndPropagateResult("zeEventQueryKernelTimestamp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventQueryKernelTimestampPrologue( hEvent, dstptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventQueryKernelTimestamp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventQueryKernelTimestampPrologue( hEvent, dstptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventQueryKernelTimestamp", result); } auto driver_result = pfnQueryKernelTimestamp( hEvent, dstptr ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventQueryKernelTimestampEpilogue( hEvent, dstptr ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventQueryKernelTimestamp", result); } return logAndPropagateResult("zeEventQueryKernelTimestamp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendQueryKernelTimestamps __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendQueryKernelTimestamps( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] the number of timestamp events to query ze_event_handle_t* phEvents, ///< [in][range(0, numEvents)] handles of timestamp events to query void* dstptr, ///< [in,out] pointer to memory where ::ze_kernel_timestamp_result_t will ///< be written; must be size-aligned. const size_t* pOffsets, ///< [in][optional][range(0, numEvents)] offset, in bytes, to write ///< results; address must be 4byte-aligned and offsets must be ///< size-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { context.logger->log_trace("zeCommandListAppendQueryKernelTimestamps(hCommandList, numEvents, phEventsLocal, dstptr, pOffsets, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendQueryKernelTimestamps = context.zeDdiTable.CommandList.pfnAppendQueryKernelTimestamps; if( nullptr == pfnAppendQueryKernelTimestamps ) return logAndPropagateResult("zeCommandListAppendQueryKernelTimestamps", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendQueryKernelTimestampsPrologue( hCommandList, numEvents, phEvents, dstptr, pOffsets, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendQueryKernelTimestamps", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendQueryKernelTimestampsPrologue( hCommandList, numEvents, phEvents, dstptr, pOffsets, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendQueryKernelTimestamps", result); } auto driver_result = pfnAppendQueryKernelTimestamps( hCommandList, numEvents, phEvents, dstptr, pOffsets, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendQueryKernelTimestampsEpilogue( hCommandList, numEvents, phEvents, dstptr, pOffsets, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendQueryKernelTimestamps", result); } return logAndPropagateResult("zeCommandListAppendQueryKernelTimestamps", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventGetEventPool __zedlllocal ze_result_t ZE_APICALL zeEventGetEventPool( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_pool_handle_t* phEventPool ///< [out] handle of the event pool for the event ) { context.logger->log_trace("zeEventGetEventPool(hEvent, phEventPool)"); auto pfnGetEventPool = context.zeDdiTable.Event.pfnGetEventPool; if( nullptr == pfnGetEventPool ) return logAndPropagateResult("zeEventGetEventPool", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventGetEventPoolPrologue( hEvent, phEventPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventGetEventPool", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventGetEventPoolPrologue( hEvent, phEventPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventGetEventPool", result); } auto driver_result = pfnGetEventPool( hEvent, phEventPool ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventGetEventPoolEpilogue( hEvent, phEventPool ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventGetEventPool", result); } return logAndPropagateResult("zeEventGetEventPool", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventGetSignalScope __zedlllocal ze_result_t ZE_APICALL zeEventGetSignalScope( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pSignalScope ///< [out] signal event scope. This is the scope of relevant cache ///< hierarchies that are flushed on a signal action before the event is ///< triggered. May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { context.logger->log_trace("zeEventGetSignalScope(hEvent, pSignalScope)"); auto pfnGetSignalScope = context.zeDdiTable.Event.pfnGetSignalScope; if( nullptr == pfnGetSignalScope ) return logAndPropagateResult("zeEventGetSignalScope", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventGetSignalScopePrologue( hEvent, pSignalScope ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventGetSignalScope", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventGetSignalScopePrologue( hEvent, pSignalScope ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventGetSignalScope", result); } auto driver_result = pfnGetSignalScope( hEvent, pSignalScope ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventGetSignalScopeEpilogue( hEvent, pSignalScope ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventGetSignalScope", result); } return logAndPropagateResult("zeEventGetSignalScope", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventGetWaitScope __zedlllocal ze_result_t ZE_APICALL zeEventGetWaitScope( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pWaitScope ///< [out] wait event scope. This is the scope of relevant cache ///< hierarchies invalidated on a wait action after the event is complete. ///< May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { context.logger->log_trace("zeEventGetWaitScope(hEvent, pWaitScope)"); auto pfnGetWaitScope = context.zeDdiTable.Event.pfnGetWaitScope; if( nullptr == pfnGetWaitScope ) return logAndPropagateResult("zeEventGetWaitScope", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventGetWaitScopePrologue( hEvent, pWaitScope ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventGetWaitScope", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventGetWaitScopePrologue( hEvent, pWaitScope ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventGetWaitScope", result); } auto driver_result = pfnGetWaitScope( hEvent, pWaitScope ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventGetWaitScopeEpilogue( hEvent, pWaitScope ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventGetWaitScope", result); } return logAndPropagateResult("zeEventGetWaitScope", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolGetContextHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolGetContextHandle( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_context_handle_t* phContext ///< [out] handle of the context on which the event pool was created ) { context.logger->log_trace("zeEventPoolGetContextHandle(hEventPool, phContext)"); auto pfnGetContextHandle = context.zeDdiTable.EventPool.pfnGetContextHandle; if( nullptr == pfnGetContextHandle ) return logAndPropagateResult("zeEventPoolGetContextHandle", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolGetContextHandlePrologue( hEventPool, phContext ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolGetContextHandle", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventPoolGetContextHandlePrologue( hEventPool, phContext ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolGetContextHandle", result); } auto driver_result = pfnGetContextHandle( hEventPool, phContext ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolGetContextHandleEpilogue( hEventPool, phContext ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolGetContextHandle", result); } return logAndPropagateResult("zeEventPoolGetContextHandle", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolGetFlags __zedlllocal ze_result_t ZE_APICALL zeEventPoolGetFlags( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_event_pool_flags_t* pFlags ///< [out] creation flags used to create the event pool; may be 0 or a ///< valid combination of ::ze_event_pool_flag_t ) { context.logger->log_trace("zeEventPoolGetFlags(hEventPool, pFlags)"); auto pfnGetFlags = context.zeDdiTable.EventPool.pfnGetFlags; if( nullptr == pfnGetFlags ) return logAndPropagateResult("zeEventPoolGetFlags", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolGetFlagsPrologue( hEventPool, pFlags ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolGetFlags", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventPoolGetFlagsPrologue( hEventPool, pFlags ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolGetFlags", result); } auto driver_result = pfnGetFlags( hEventPool, pFlags ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventPoolGetFlagsEpilogue( hEventPool, pFlags ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventPoolGetFlags", result); } return logAndPropagateResult("zeEventPoolGetFlags", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceCreate __zedlllocal ze_result_t ZE_APICALL zeFenceCreate( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of command queue const ze_fence_desc_t* desc, ///< [in] pointer to fence descriptor ze_fence_handle_t* phFence ///< [out] pointer to handle of fence object created ) { context.logger->log_trace("zeFenceCreate(hCommandQueue, desc, phFence)"); auto pfnCreate = context.zeDdiTable.Fence.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zeFenceCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFenceCreatePrologue( hCommandQueue, desc, phFence ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeFenceCreatePrologue( hCommandQueue, desc, phFence ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceCreate", result); } auto driver_result = pfnCreate( hCommandQueue, desc, phFence ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFenceCreateEpilogue( hCommandQueue, desc, phFence ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phFence){ context.handleLifetime->addHandle( *phFence ); context.handleLifetime->addDependent( hCommandQueue, *phFence ); } } return logAndPropagateResult("zeFenceCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceDestroy __zedlllocal ze_result_t ZE_APICALL zeFenceDestroy( ze_fence_handle_t hFence ///< [in][release] handle of fence object to destroy ) { context.logger->log_trace("zeFenceDestroy(hFence)"); auto pfnDestroy = context.zeDdiTable.Fence.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zeFenceDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFenceDestroyPrologue( hFence ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeFenceDestroyPrologue( hFence ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceDestroy", result); } auto driver_result = pfnDestroy( hFence ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFenceDestroyEpilogue( hFence ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceDestroy", result); } return logAndPropagateResult("zeFenceDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceHostSynchronize __zedlllocal ze_result_t ZE_APICALL zeFenceHostSynchronize( ze_fence_handle_t hFence, ///< [in] handle of the fence uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeFenceQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { context.logger->log_trace("zeFenceHostSynchronize(hFence, timeout)"); auto pfnHostSynchronize = context.zeDdiTable.Fence.pfnHostSynchronize; if( nullptr == pfnHostSynchronize ) return logAndPropagateResult("zeFenceHostSynchronize", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFenceHostSynchronizePrologue( hFence, timeout ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceHostSynchronize", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeFenceHostSynchronizePrologue( hFence, timeout ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceHostSynchronize", result); } auto driver_result = pfnHostSynchronize( hFence, timeout ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFenceHostSynchronizeEpilogue( hFence, timeout ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceHostSynchronize", result); } return logAndPropagateResult("zeFenceHostSynchronize", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceQueryStatus __zedlllocal ze_result_t ZE_APICALL zeFenceQueryStatus( ze_fence_handle_t hFence ///< [in] handle of the fence ) { context.logger->log_trace("zeFenceQueryStatus(hFence)"); auto pfnQueryStatus = context.zeDdiTable.Fence.pfnQueryStatus; if( nullptr == pfnQueryStatus ) return logAndPropagateResult("zeFenceQueryStatus", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFenceQueryStatusPrologue( hFence ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceQueryStatus", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeFenceQueryStatusPrologue( hFence ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceQueryStatus", result); } auto driver_result = pfnQueryStatus( hFence ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFenceQueryStatusEpilogue( hFence ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceQueryStatus", result); } return logAndPropagateResult("zeFenceQueryStatus", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceReset __zedlllocal ze_result_t ZE_APICALL zeFenceReset( ze_fence_handle_t hFence ///< [in] handle of the fence ) { context.logger->log_trace("zeFenceReset(hFence)"); auto pfnReset = context.zeDdiTable.Fence.pfnReset; if( nullptr == pfnReset ) return logAndPropagateResult("zeFenceReset", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFenceResetPrologue( hFence ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceReset", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeFenceResetPrologue( hFence ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceReset", result); } auto driver_result = pfnReset( hFence ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFenceResetEpilogue( hFence ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFenceReset", result); } return logAndPropagateResult("zeFenceReset", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetProperties __zedlllocal ze_result_t ZE_APICALL zeImageGetProperties( ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_properties_t* pImageProperties ///< [out] pointer to image properties ) { context.logger->log_trace("zeImageGetProperties(hDevice, desc, pImageProperties)"); auto pfnGetProperties = context.zeDdiTable.Image.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zeImageGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageGetPropertiesPrologue( hDevice, desc, pImageProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeImageGetPropertiesPrologue( hDevice, desc, pImageProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageGetProperties", result); } auto driver_result = pfnGetProperties( hDevice, desc, pImageProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageGetPropertiesEpilogue( hDevice, desc, pImageProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageGetProperties", result); } return logAndPropagateResult("zeImageGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageCreate __zedlllocal ze_result_t ZE_APICALL zeImageCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t* phImage ///< [out] pointer to handle of image object created ) { context.logger->log_trace("zeImageCreate(hContext, hDevice, desc, phImage)"); auto pfnCreate = context.zeDdiTable.Image.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zeImageCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageCreatePrologue( hContext, hDevice, desc, phImage ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeImageCreatePrologue( hContext, hDevice, desc, phImage ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageCreate", result); } auto driver_result = pfnCreate( hContext, hDevice, desc, phImage ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageCreateEpilogue( hContext, hDevice, desc, phImage ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phImage){ context.handleLifetime->addHandle( *phImage ); context.handleLifetime->addDependent( hContext, *phImage ); } } return logAndPropagateResult("zeImageCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageDestroy __zedlllocal ze_result_t ZE_APICALL zeImageDestroy( ze_image_handle_t hImage ///< [in][release] handle of image object to destroy ) { context.logger->log_trace("zeImageDestroy(hImage)"); auto pfnDestroy = context.zeDdiTable.Image.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zeImageDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageDestroyPrologue( hImage ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeImageDestroyPrologue( hImage ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageDestroy", result); } auto driver_result = pfnDestroy( hImage ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageDestroyEpilogue( hImage ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageDestroy", result); } return logAndPropagateResult("zeImageDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemAllocShared __zedlllocal ze_result_t ZE_APICALL zeMemAllocShared( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in][optional] device handle to associate with void** pptr ///< [out] pointer to shared allocation ) { context.logger->log_trace("zeMemAllocShared(hContext, device_desc, host_desc, size, alignment, hDevice, pptr)"); auto pfnAllocShared = context.zeDdiTable.Mem.pfnAllocShared; if( nullptr == pfnAllocShared ) return logAndPropagateResult("zeMemAllocShared", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemAllocSharedPrologue( hContext, device_desc, host_desc, size, alignment, hDevice, pptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemAllocShared", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemAllocSharedPrologue( hContext, device_desc, host_desc, size, alignment, hDevice, pptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemAllocShared", result); } auto driver_result = pfnAllocShared( hContext, device_desc, host_desc, size, alignment, hDevice, pptr ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemAllocSharedEpilogue( hContext, device_desc, host_desc, size, alignment, hDevice, pptr ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemAllocShared", result); } return logAndPropagateResult("zeMemAllocShared", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemAllocDevice __zedlllocal ze_result_t ZE_APICALL zeMemAllocDevice( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in] handle of the device void** pptr ///< [out] pointer to device allocation ) { context.logger->log_trace("zeMemAllocDevice(hContext, device_desc, size, alignment, hDevice, pptr)"); auto pfnAllocDevice = context.zeDdiTable.Mem.pfnAllocDevice; if( nullptr == pfnAllocDevice ) return logAndPropagateResult("zeMemAllocDevice", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemAllocDevicePrologue( hContext, device_desc, size, alignment, hDevice, pptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemAllocDevice", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemAllocDevicePrologue( hContext, device_desc, size, alignment, hDevice, pptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemAllocDevice", result); } auto driver_result = pfnAllocDevice( hContext, device_desc, size, alignment, hDevice, pptr ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemAllocDeviceEpilogue( hContext, device_desc, size, alignment, hDevice, pptr ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemAllocDevice", result); } return logAndPropagateResult("zeMemAllocDevice", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemAllocHost __zedlllocal ze_result_t ZE_APICALL zeMemAllocHost( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two void** pptr ///< [out] pointer to host allocation ) { context.logger->log_trace("zeMemAllocHost(hContext, host_desc, size, alignment, pptr)"); auto pfnAllocHost = context.zeDdiTable.Mem.pfnAllocHost; if( nullptr == pfnAllocHost ) return logAndPropagateResult("zeMemAllocHost", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemAllocHostPrologue( hContext, host_desc, size, alignment, pptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemAllocHost", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemAllocHostPrologue( hContext, host_desc, size, alignment, pptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemAllocHost", result); } auto driver_result = pfnAllocHost( hContext, host_desc, size, alignment, pptr ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemAllocHostEpilogue( hContext, host_desc, size, alignment, pptr ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemAllocHost", result); } return logAndPropagateResult("zeMemAllocHost", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemFree __zedlllocal ze_result_t ZE_APICALL zeMemFree( ze_context_handle_t hContext, ///< [in] handle of the context object void* ptr ///< [in][release] pointer to memory to free ) { context.logger->log_trace("zeMemFree(hContext, ptr)"); auto pfnFree = context.zeDdiTable.Mem.pfnFree; if( nullptr == pfnFree ) return logAndPropagateResult("zeMemFree", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemFreePrologue( hContext, ptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemFree", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemFreePrologue( hContext, ptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemFree", result); } auto driver_result = pfnFree( hContext, ptr ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemFreeEpilogue( hContext, ptr ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemFree", result); } return logAndPropagateResult("zeMemFree", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetAllocProperties __zedlllocal ze_result_t ZE_APICALL zeMemGetAllocProperties( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query ze_memory_allocation_properties_t* pMemAllocProperties, ///< [in,out] query result for memory allocation properties ze_device_handle_t* phDevice ///< [out][optional] device associated with this allocation ) { context.logger->log_trace("zeMemGetAllocProperties(hContext, ptr, pMemAllocProperties, phDevice)"); auto pfnGetAllocProperties = context.zeDdiTable.Mem.pfnGetAllocProperties; if( nullptr == pfnGetAllocProperties ) return logAndPropagateResult("zeMemGetAllocProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetAllocPropertiesPrologue( hContext, ptr, pMemAllocProperties, phDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetAllocProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemGetAllocPropertiesPrologue( hContext, ptr, pMemAllocProperties, phDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetAllocProperties", result); } auto driver_result = pfnGetAllocProperties( hContext, ptr, pMemAllocProperties, phDevice ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetAllocPropertiesEpilogue( hContext, ptr, pMemAllocProperties, phDevice ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetAllocProperties", result); } return logAndPropagateResult("zeMemGetAllocProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetAddressRange __zedlllocal ze_result_t ZE_APICALL zeMemGetAddressRange( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query void** pBase, ///< [in,out][optional] base address of the allocation size_t* pSize ///< [in,out][optional] size of the allocation ) { context.logger->log_trace("zeMemGetAddressRange(hContext, ptr, pBase, pSize)"); auto pfnGetAddressRange = context.zeDdiTable.Mem.pfnGetAddressRange; if( nullptr == pfnGetAddressRange ) return logAndPropagateResult("zeMemGetAddressRange", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetAddressRangePrologue( hContext, ptr, pBase, pSize ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetAddressRange", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemGetAddressRangePrologue( hContext, ptr, pBase, pSize ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetAddressRange", result); } auto driver_result = pfnGetAddressRange( hContext, ptr, pBase, pSize ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetAddressRangeEpilogue( hContext, ptr, pBase, pSize ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetAddressRange", result); } return logAndPropagateResult("zeMemGetAddressRange", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemGetIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to the device memory allocation ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { context.logger->log_trace("zeMemGetIpcHandle(hContext, ptr, pIpcHandle)"); auto pfnGetIpcHandle = context.zeDdiTable.Mem.pfnGetIpcHandle; if( nullptr == pfnGetIpcHandle ) return logAndPropagateResult("zeMemGetIpcHandle", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetIpcHandlePrologue( hContext, ptr, pIpcHandle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetIpcHandle", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemGetIpcHandlePrologue( hContext, ptr, pIpcHandle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetIpcHandle", result); } auto driver_result = pfnGetIpcHandle( hContext, ptr, pIpcHandle ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetIpcHandleEpilogue( hContext, ptr, pIpcHandle ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetIpcHandle", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeMemGetIpcHandle", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetIpcHandleFromFileDescriptorExp __zedlllocal ze_result_t ZE_APICALL zeMemGetIpcHandleFromFileDescriptorExp( ze_context_handle_t hContext, ///< [in] handle of the context object uint64_t handle, ///< [in] file descriptor ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { context.logger->log_trace("zeMemGetIpcHandleFromFileDescriptorExp(hContext, handle, pIpcHandle)"); auto pfnGetIpcHandleFromFileDescriptorExp = context.zeDdiTable.MemExp.pfnGetIpcHandleFromFileDescriptorExp; if( nullptr == pfnGetIpcHandleFromFileDescriptorExp ) return logAndPropagateResult("zeMemGetIpcHandleFromFileDescriptorExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetIpcHandleFromFileDescriptorExpPrologue( hContext, handle, pIpcHandle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetIpcHandleFromFileDescriptorExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemGetIpcHandleFromFileDescriptorExpPrologue( hContext, handle, pIpcHandle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetIpcHandleFromFileDescriptorExp", result); } auto driver_result = pfnGetIpcHandleFromFileDescriptorExp( hContext, handle, pIpcHandle ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetIpcHandleFromFileDescriptorExpEpilogue( hContext, handle, pIpcHandle ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetIpcHandleFromFileDescriptorExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeMemGetIpcHandleFromFileDescriptorExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetFileDescriptorFromIpcHandleExp __zedlllocal ze_result_t ZE_APICALL zeMemGetFileDescriptorFromIpcHandleExp( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t ipcHandle, ///< [in] IPC memory handle uint64_t* pHandle ///< [out] Returned file descriptor ) { context.logger->log_trace("zeMemGetFileDescriptorFromIpcHandleExp(hContext, ipcHandle, pHandle)"); auto pfnGetFileDescriptorFromIpcHandleExp = context.zeDdiTable.MemExp.pfnGetFileDescriptorFromIpcHandleExp; if( nullptr == pfnGetFileDescriptorFromIpcHandleExp ) return logAndPropagateResult("zeMemGetFileDescriptorFromIpcHandleExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetFileDescriptorFromIpcHandleExpPrologue( hContext, ipcHandle, pHandle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetFileDescriptorFromIpcHandleExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemGetFileDescriptorFromIpcHandleExpPrologue( hContext, ipcHandle, pHandle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetFileDescriptorFromIpcHandleExp", result); } auto driver_result = pfnGetFileDescriptorFromIpcHandleExp( hContext, ipcHandle, pHandle ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetFileDescriptorFromIpcHandleExpEpilogue( hContext, ipcHandle, pHandle ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetFileDescriptorFromIpcHandleExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeMemGetFileDescriptorFromIpcHandleExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemPutIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemPutIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t handle ///< [in] IPC memory handle ) { context.logger->log_trace("zeMemPutIpcHandle(hContext, handle)"); auto pfnPutIpcHandle = context.zeDdiTable.Mem.pfnPutIpcHandle; if( nullptr == pfnPutIpcHandle ) return logAndPropagateResult("zeMemPutIpcHandle", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemPutIpcHandlePrologue( hContext, handle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemPutIpcHandle", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemPutIpcHandlePrologue( hContext, handle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemPutIpcHandle", result); } auto driver_result = pfnPutIpcHandle( hContext, handle ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemPutIpcHandleEpilogue( hContext, handle ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemPutIpcHandle", result); } return logAndPropagateResult("zeMemPutIpcHandle", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemOpenIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemOpenIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device to associate with the IPC memory handle ze_ipc_mem_handle_t handle, ///< [in] IPC memory handle ze_ipc_memory_flags_t flags, ///< [in] flags controlling the operation. ///< must be 0 (default) or a valid combination of ::ze_ipc_memory_flag_t. void** pptr ///< [out] pointer to device allocation in this process ) { context.logger->log_trace("zeMemOpenIpcHandle(hContext, hDevice, handle, flags, pptr)"); auto pfnOpenIpcHandle = context.zeDdiTable.Mem.pfnOpenIpcHandle; if( nullptr == pfnOpenIpcHandle ) return logAndPropagateResult("zeMemOpenIpcHandle", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemOpenIpcHandlePrologue( hContext, hDevice, handle, flags, pptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemOpenIpcHandle", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemOpenIpcHandlePrologue( hContext, hDevice, handle, flags, pptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemOpenIpcHandle", result); } auto driver_result = pfnOpenIpcHandle( hContext, hDevice, handle, flags, pptr ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemOpenIpcHandleEpilogue( hContext, hDevice, handle, flags, pptr ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemOpenIpcHandle", result); } return logAndPropagateResult("zeMemOpenIpcHandle", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemCloseIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemCloseIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr ///< [in][release] pointer to device allocation in this process ) { context.logger->log_trace("zeMemCloseIpcHandle(hContext, ptr)"); auto pfnCloseIpcHandle = context.zeDdiTable.Mem.pfnCloseIpcHandle; if( nullptr == pfnCloseIpcHandle ) return logAndPropagateResult("zeMemCloseIpcHandle", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemCloseIpcHandlePrologue( hContext, ptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemCloseIpcHandle", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemCloseIpcHandlePrologue( hContext, ptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemCloseIpcHandle", result); } auto driver_result = pfnCloseIpcHandle( hContext, ptr ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemCloseIpcHandleEpilogue( hContext, ptr ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemCloseIpcHandle", result); } return logAndPropagateResult("zeMemCloseIpcHandle", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemSetAtomicAccessAttributeExp __zedlllocal ze_result_t ZE_APICALL zeMemSetAtomicAccessAttributeExp( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t attr ///< [in] Atomic access attributes to set for the specified range. ///< Must be 0 (default) or a valid combination of ::ze_memory_atomic_attr_exp_flag_t. ) { context.logger->log_trace("zeMemSetAtomicAccessAttributeExp(hContext, hDevice, ptr, size, attr)"); auto pfnSetAtomicAccessAttributeExp = context.zeDdiTable.MemExp.pfnSetAtomicAccessAttributeExp; if( nullptr == pfnSetAtomicAccessAttributeExp ) return logAndPropagateResult("zeMemSetAtomicAccessAttributeExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemSetAtomicAccessAttributeExpPrologue( hContext, hDevice, ptr, size, attr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemSetAtomicAccessAttributeExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemSetAtomicAccessAttributeExpPrologue( hContext, hDevice, ptr, size, attr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemSetAtomicAccessAttributeExp", result); } auto driver_result = pfnSetAtomicAccessAttributeExp( hContext, hDevice, ptr, size, attr ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemSetAtomicAccessAttributeExpEpilogue( hContext, hDevice, ptr, size, attr ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemSetAtomicAccessAttributeExp", result); } return logAndPropagateResult("zeMemSetAtomicAccessAttributeExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetAtomicAccessAttributeExp __zedlllocal ze_result_t ZE_APICALL zeMemGetAtomicAccessAttributeExp( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t* pAttr ///< [out] Atomic access attributes for the specified range ) { context.logger->log_trace("zeMemGetAtomicAccessAttributeExp(hContext, hDevice, ptr, size, pAttr)"); auto pfnGetAtomicAccessAttributeExp = context.zeDdiTable.MemExp.pfnGetAtomicAccessAttributeExp; if( nullptr == pfnGetAtomicAccessAttributeExp ) return logAndPropagateResult("zeMemGetAtomicAccessAttributeExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetAtomicAccessAttributeExpPrologue( hContext, hDevice, ptr, size, pAttr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetAtomicAccessAttributeExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemGetAtomicAccessAttributeExpPrologue( hContext, hDevice, ptr, size, pAttr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetAtomicAccessAttributeExp", result); } auto driver_result = pfnGetAtomicAccessAttributeExp( hContext, hDevice, ptr, size, pAttr ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetAtomicAccessAttributeExpEpilogue( hContext, hDevice, ptr, size, pAttr ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetAtomicAccessAttributeExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeMemGetAtomicAccessAttributeExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleCreate __zedlllocal ze_result_t ZE_APICALL zeModuleCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_module_desc_t* desc, ///< [in] pointer to module descriptor ze_module_handle_t* phModule, ///< [out] pointer to handle of module object created ze_module_build_log_handle_t* phBuildLog ///< [out][optional] pointer to handle of module's build log. ) { context.logger->log_trace("zeModuleCreate(hContext, hDevice, desc, phModule, phBuildLog)"); auto pfnCreate = context.zeDdiTable.Module.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zeModuleCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleCreatePrologue( hContext, hDevice, desc, phModule, phBuildLog ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeModuleCreatePrologue( hContext, hDevice, desc, phModule, phBuildLog ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleCreate", result); } auto driver_result = pfnCreate( hContext, hDevice, desc, phModule, phBuildLog ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleCreateEpilogue( hContext, hDevice, desc, phModule, phBuildLog ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phModule){ context.handleLifetime->addHandle( *phModule ); context.handleLifetime->addDependent( hContext, *phModule ); } if (phBuildLog){ context.handleLifetime->addHandle( *phBuildLog ); context.handleLifetime->addDependent( hContext, *phBuildLog ); } } return logAndPropagateResult("zeModuleCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleDestroy __zedlllocal ze_result_t ZE_APICALL zeModuleDestroy( ze_module_handle_t hModule ///< [in][release] handle of the module ) { context.logger->log_trace("zeModuleDestroy(hModule)"); auto pfnDestroy = context.zeDdiTable.Module.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zeModuleDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleDestroyPrologue( hModule ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeModuleDestroyPrologue( hModule ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleDestroy", result); } auto driver_result = pfnDestroy( hModule ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleDestroyEpilogue( hModule ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleDestroy", result); } return logAndPropagateResult("zeModuleDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleDynamicLink __zedlllocal ze_result_t ZE_APICALL zeModuleDynamicLink( uint32_t numModules, ///< [in] number of modules to be linked pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to ///< dynamically link together. ze_module_build_log_handle_t* phLinkLog ///< [out][optional] pointer to handle of dynamic link log. ) { context.logger->log_trace("zeModuleDynamicLink(numModules, phModulesLocal, phLinkLog)"); auto pfnDynamicLink = context.zeDdiTable.Module.pfnDynamicLink; if( nullptr == pfnDynamicLink ) return logAndPropagateResult("zeModuleDynamicLink", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleDynamicLinkPrologue( numModules, phModules, phLinkLog ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleDynamicLink", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeModuleDynamicLinkPrologue( numModules, phModules, phLinkLog ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleDynamicLink", result); } auto driver_result = pfnDynamicLink( numModules, phModules, phLinkLog ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleDynamicLinkEpilogue( numModules, phModules, phLinkLog ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleDynamicLink", result); } return logAndPropagateResult("zeModuleDynamicLink", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleBuildLogDestroy __zedlllocal ze_result_t ZE_APICALL zeModuleBuildLogDestroy( ze_module_build_log_handle_t hModuleBuildLog ///< [in][release] handle of the module build log object. ) { context.logger->log_trace("zeModuleBuildLogDestroy(hModuleBuildLog)"); auto pfnDestroy = context.zeDdiTable.ModuleBuildLog.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zeModuleBuildLogDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleBuildLogDestroyPrologue( hModuleBuildLog ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleBuildLogDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeModuleBuildLogDestroyPrologue( hModuleBuildLog ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleBuildLogDestroy", result); } auto driver_result = pfnDestroy( hModuleBuildLog ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleBuildLogDestroyEpilogue( hModuleBuildLog ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleBuildLogDestroy", result); } return logAndPropagateResult("zeModuleBuildLogDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleBuildLogGetString __zedlllocal ze_result_t ZE_APICALL zeModuleBuildLogGetString( ze_module_build_log_handle_t hModuleBuildLog, ///< [in] handle of the module build log object. size_t* pSize, ///< [in,out] size of build log string. char* pBuildLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { context.logger->log_trace("zeModuleBuildLogGetString(hModuleBuildLog, pSize, pBuildLog)"); auto pfnGetString = context.zeDdiTable.ModuleBuildLog.pfnGetString; if( nullptr == pfnGetString ) return logAndPropagateResult("zeModuleBuildLogGetString", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleBuildLogGetStringPrologue( hModuleBuildLog, pSize, pBuildLog ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleBuildLogGetString", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeModuleBuildLogGetStringPrologue( hModuleBuildLog, pSize, pBuildLog ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleBuildLogGetString", result); } auto driver_result = pfnGetString( hModuleBuildLog, pSize, pBuildLog ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleBuildLogGetStringEpilogue( hModuleBuildLog, pSize, pBuildLog ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleBuildLogGetString", result); } return logAndPropagateResult("zeModuleBuildLogGetString", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetNativeBinary __zedlllocal ze_result_t ZE_APICALL zeModuleGetNativeBinary( ze_module_handle_t hModule, ///< [in] handle of the module size_t* pSize, ///< [in,out] size of native binary in bytes. uint8_t* pModuleNativeBinary ///< [in,out][optional] byte pointer to native binary ) { context.logger->log_trace("zeModuleGetNativeBinary(hModule, pSize, pModuleNativeBinary)"); auto pfnGetNativeBinary = context.zeDdiTable.Module.pfnGetNativeBinary; if( nullptr == pfnGetNativeBinary ) return logAndPropagateResult("zeModuleGetNativeBinary", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleGetNativeBinaryPrologue( hModule, pSize, pModuleNativeBinary ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetNativeBinary", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeModuleGetNativeBinaryPrologue( hModule, pSize, pModuleNativeBinary ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetNativeBinary", result); } auto driver_result = pfnGetNativeBinary( hModule, pSize, pModuleNativeBinary ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleGetNativeBinaryEpilogue( hModule, pSize, pModuleNativeBinary ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetNativeBinary", result); } return logAndPropagateResult("zeModuleGetNativeBinary", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetGlobalPointer __zedlllocal ze_result_t ZE_APICALL zeModuleGetGlobalPointer( ze_module_handle_t hModule, ///< [in] handle of the module const char* pGlobalName, ///< [in] name of global variable in module size_t* pSize, ///< [in,out][optional] size of global variable void** pptr ///< [in,out][optional] device visible pointer ) { context.logger->log_trace("zeModuleGetGlobalPointer(hModule, pGlobalName, pSize, pptr)"); auto pfnGetGlobalPointer = context.zeDdiTable.Module.pfnGetGlobalPointer; if( nullptr == pfnGetGlobalPointer ) return logAndPropagateResult("zeModuleGetGlobalPointer", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleGetGlobalPointerPrologue( hModule, pGlobalName, pSize, pptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetGlobalPointer", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeModuleGetGlobalPointerPrologue( hModule, pGlobalName, pSize, pptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetGlobalPointer", result); } auto driver_result = pfnGetGlobalPointer( hModule, pGlobalName, pSize, pptr ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleGetGlobalPointerEpilogue( hModule, pGlobalName, pSize, pptr ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetGlobalPointer", result); } return logAndPropagateResult("zeModuleGetGlobalPointer", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetKernelNames __zedlllocal ze_result_t ZE_APICALL zeModuleGetKernelNames( ze_module_handle_t hModule, ///< [in] handle of the module uint32_t* pCount, ///< [in,out] pointer to the number of names. ///< if count is zero, then the driver shall update the value with the ///< total number of names available. ///< if count is greater than the number of names available, then the ///< driver shall update the value with the correct number of names available. const char** pNames ///< [in,out][optional][range(0, *pCount)] array of names of functions. ///< if count is less than the number of names available, then driver shall ///< only retrieve that number of names. ) { context.logger->log_trace("zeModuleGetKernelNames(hModule, pCount, pNames)"); auto pfnGetKernelNames = context.zeDdiTable.Module.pfnGetKernelNames; if( nullptr == pfnGetKernelNames ) return logAndPropagateResult("zeModuleGetKernelNames", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleGetKernelNamesPrologue( hModule, pCount, pNames ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetKernelNames", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeModuleGetKernelNamesPrologue( hModule, pCount, pNames ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetKernelNames", result); } auto driver_result = pfnGetKernelNames( hModule, pCount, pNames ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleGetKernelNamesEpilogue( hModule, pCount, pNames ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetKernelNames", result); } return logAndPropagateResult("zeModuleGetKernelNames", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetProperties __zedlllocal ze_result_t ZE_APICALL zeModuleGetProperties( ze_module_handle_t hModule, ///< [in] handle of the module ze_module_properties_t* pModuleProperties ///< [in,out] query result for module properties. ) { context.logger->log_trace("zeModuleGetProperties(hModule, pModuleProperties)"); auto pfnGetProperties = context.zeDdiTable.Module.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zeModuleGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleGetPropertiesPrologue( hModule, pModuleProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeModuleGetPropertiesPrologue( hModule, pModuleProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetProperties", result); } auto driver_result = pfnGetProperties( hModule, pModuleProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleGetPropertiesEpilogue( hModule, pModuleProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetProperties", result); } return logAndPropagateResult("zeModuleGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelCreate __zedlllocal ze_result_t ZE_APICALL zeKernelCreate( ze_module_handle_t hModule, ///< [in] handle of the module const ze_kernel_desc_t* desc, ///< [in] pointer to kernel descriptor ze_kernel_handle_t* phKernel ///< [out] handle of the Function object ) { context.logger->log_trace("zeKernelCreate(hModule, desc, phKernel)"); auto pfnCreate = context.zeDdiTable.Kernel.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zeKernelCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelCreatePrologue( hModule, desc, phKernel ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelCreatePrologue( hModule, desc, phKernel ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelCreate", result); } auto driver_result = pfnCreate( hModule, desc, phKernel ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelCreateEpilogue( hModule, desc, phKernel ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phKernel){ context.handleLifetime->addHandle( *phKernel ); context.handleLifetime->addDependent( hModule, *phKernel ); } } return logAndPropagateResult("zeKernelCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelDestroy __zedlllocal ze_result_t ZE_APICALL zeKernelDestroy( ze_kernel_handle_t hKernel ///< [in][release] handle of the kernel object ) { context.logger->log_trace("zeKernelDestroy(hKernel)"); auto pfnDestroy = context.zeDdiTable.Kernel.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zeKernelDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelDestroyPrologue( hKernel ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelDestroyPrologue( hKernel ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelDestroy", result); } auto driver_result = pfnDestroy( hKernel ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelDestroyEpilogue( hKernel ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelDestroy", result); } return logAndPropagateResult("zeKernelDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetFunctionPointer __zedlllocal ze_result_t ZE_APICALL zeModuleGetFunctionPointer( ze_module_handle_t hModule, ///< [in] handle of the module const char* pFunctionName, ///< [in] Name of function to retrieve function pointer for. void** pfnFunction ///< [out] pointer to function. ) { context.logger->log_trace("zeModuleGetFunctionPointer(hModule, pFunctionName, pfnFunction)"); auto pfnGetFunctionPointer = context.zeDdiTable.Module.pfnGetFunctionPointer; if( nullptr == pfnGetFunctionPointer ) return logAndPropagateResult("zeModuleGetFunctionPointer", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleGetFunctionPointerPrologue( hModule, pFunctionName, pfnFunction ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetFunctionPointer", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeModuleGetFunctionPointerPrologue( hModule, pFunctionName, pfnFunction ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetFunctionPointer", result); } auto driver_result = pfnGetFunctionPointer( hModule, pFunctionName, pfnFunction ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleGetFunctionPointerEpilogue( hModule, pFunctionName, pfnFunction ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleGetFunctionPointer", result); } return logAndPropagateResult("zeModuleGetFunctionPointer", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetGroupSize __zedlllocal ze_result_t ZE_APICALL zeKernelSetGroupSize( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t groupSizeX, ///< [in] group size for X dimension to use for this kernel uint32_t groupSizeY, ///< [in] group size for Y dimension to use for this kernel uint32_t groupSizeZ ///< [in] group size for Z dimension to use for this kernel ) { context.logger->log_trace("zeKernelSetGroupSize(hKernel, groupSizeX, groupSizeY, groupSizeZ)"); auto pfnSetGroupSize = context.zeDdiTable.Kernel.pfnSetGroupSize; if( nullptr == pfnSetGroupSize ) return logAndPropagateResult("zeKernelSetGroupSize", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSetGroupSizePrologue( hKernel, groupSizeX, groupSizeY, groupSizeZ ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetGroupSize", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelSetGroupSizePrologue( hKernel, groupSizeX, groupSizeY, groupSizeZ ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetGroupSize", result); } auto driver_result = pfnSetGroupSize( hKernel, groupSizeX, groupSizeY, groupSizeZ ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSetGroupSizeEpilogue( hKernel, groupSizeX, groupSizeY, groupSizeZ ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetGroupSize", result); } return logAndPropagateResult("zeKernelSetGroupSize", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSuggestGroupSize __zedlllocal ze_result_t ZE_APICALL zeKernelSuggestGroupSize( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t globalSizeX, ///< [in] global width for X dimension uint32_t globalSizeY, ///< [in] global width for Y dimension uint32_t globalSizeZ, ///< [in] global width for Z dimension uint32_t* groupSizeX, ///< [out] recommended size of group for X dimension uint32_t* groupSizeY, ///< [out] recommended size of group for Y dimension uint32_t* groupSizeZ ///< [out] recommended size of group for Z dimension ) { context.logger->log_trace("zeKernelSuggestGroupSize(hKernel, globalSizeX, globalSizeY, globalSizeZ, groupSizeX, groupSizeY, groupSizeZ)"); auto pfnSuggestGroupSize = context.zeDdiTable.Kernel.pfnSuggestGroupSize; if( nullptr == pfnSuggestGroupSize ) return logAndPropagateResult("zeKernelSuggestGroupSize", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSuggestGroupSizePrologue( hKernel, globalSizeX, globalSizeY, globalSizeZ, groupSizeX, groupSizeY, groupSizeZ ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSuggestGroupSize", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelSuggestGroupSizePrologue( hKernel, globalSizeX, globalSizeY, globalSizeZ, groupSizeX, groupSizeY, groupSizeZ ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSuggestGroupSize", result); } auto driver_result = pfnSuggestGroupSize( hKernel, globalSizeX, globalSizeY, globalSizeZ, groupSizeX, groupSizeY, groupSizeZ ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSuggestGroupSizeEpilogue( hKernel, globalSizeX, globalSizeY, globalSizeZ, groupSizeX, groupSizeY, groupSizeZ ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSuggestGroupSize", result); } return logAndPropagateResult("zeKernelSuggestGroupSize", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSuggestMaxCooperativeGroupCount __zedlllocal ze_result_t ZE_APICALL zeKernelSuggestMaxCooperativeGroupCount( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* totalGroupCount ///< [out] recommended total group count. ) { context.logger->log_trace("zeKernelSuggestMaxCooperativeGroupCount(hKernel, totalGroupCount)"); auto pfnSuggestMaxCooperativeGroupCount = context.zeDdiTable.Kernel.pfnSuggestMaxCooperativeGroupCount; if( nullptr == pfnSuggestMaxCooperativeGroupCount ) return logAndPropagateResult("zeKernelSuggestMaxCooperativeGroupCount", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSuggestMaxCooperativeGroupCountPrologue( hKernel, totalGroupCount ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSuggestMaxCooperativeGroupCount", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelSuggestMaxCooperativeGroupCountPrologue( hKernel, totalGroupCount ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSuggestMaxCooperativeGroupCount", result); } auto driver_result = pfnSuggestMaxCooperativeGroupCount( hKernel, totalGroupCount ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSuggestMaxCooperativeGroupCountEpilogue( hKernel, totalGroupCount ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSuggestMaxCooperativeGroupCount", result); } return logAndPropagateResult("zeKernelSuggestMaxCooperativeGroupCount", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetArgumentValue __zedlllocal ze_result_t ZE_APICALL zeKernelSetArgumentValue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t argIndex, ///< [in] argument index in range [0, num args - 1] size_t argSize, ///< [in] size of argument type const void* pArgValue ///< [in][optional] argument value represented as matching arg type. If ///< null then argument value is considered null. ) { context.logger->log_trace("zeKernelSetArgumentValue(hKernel, argIndex, argSize, pArgValue)"); auto pfnSetArgumentValue = context.zeDdiTable.Kernel.pfnSetArgumentValue; if( nullptr == pfnSetArgumentValue ) return logAndPropagateResult("zeKernelSetArgumentValue", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSetArgumentValuePrologue( hKernel, argIndex, argSize, pArgValue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetArgumentValue", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelSetArgumentValuePrologue( hKernel, argIndex, argSize, pArgValue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetArgumentValue", result); } auto driver_result = pfnSetArgumentValue( hKernel, argIndex, argSize, pArgValue ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSetArgumentValueEpilogue( hKernel, argIndex, argSize, pArgValue ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetArgumentValue", result); } return logAndPropagateResult("zeKernelSetArgumentValue", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetIndirectAccess __zedlllocal ze_result_t ZE_APICALL zeKernelSetIndirectAccess( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t flags ///< [in] kernel indirect access flags ) { context.logger->log_trace("zeKernelSetIndirectAccess(hKernel, flags)"); auto pfnSetIndirectAccess = context.zeDdiTable.Kernel.pfnSetIndirectAccess; if( nullptr == pfnSetIndirectAccess ) return logAndPropagateResult("zeKernelSetIndirectAccess", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSetIndirectAccessPrologue( hKernel, flags ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetIndirectAccess", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelSetIndirectAccessPrologue( hKernel, flags ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetIndirectAccess", result); } auto driver_result = pfnSetIndirectAccess( hKernel, flags ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSetIndirectAccessEpilogue( hKernel, flags ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetIndirectAccess", result); } return logAndPropagateResult("zeKernelSetIndirectAccess", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetIndirectAccess __zedlllocal ze_result_t ZE_APICALL zeKernelGetIndirectAccess( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t* pFlags ///< [out] query result for kernel indirect access flags. ) { context.logger->log_trace("zeKernelGetIndirectAccess(hKernel, pFlags)"); auto pfnGetIndirectAccess = context.zeDdiTable.Kernel.pfnGetIndirectAccess; if( nullptr == pfnGetIndirectAccess ) return logAndPropagateResult("zeKernelGetIndirectAccess", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelGetIndirectAccessPrologue( hKernel, pFlags ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetIndirectAccess", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelGetIndirectAccessPrologue( hKernel, pFlags ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetIndirectAccess", result); } auto driver_result = pfnGetIndirectAccess( hKernel, pFlags ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelGetIndirectAccessEpilogue( hKernel, pFlags ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetIndirectAccess", result); } return logAndPropagateResult("zeKernelGetIndirectAccess", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetSourceAttributes __zedlllocal ze_result_t ZE_APICALL zeKernelGetSourceAttributes( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* pSize, ///< [in,out] pointer to size of string in bytes, including ///< null-terminating character. char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including ///< a null-terminating character, is returned in pSize. ///< Otherwise, pString must point to valid application memory that is ///< greater than or equal to *pSize bytes in length, and on return the ///< pointed-to string will contain a space-separated list of kernel source attributes. ) { context.logger->log_trace("zeKernelGetSourceAttributes(hKernel, pSize, pString)"); auto pfnGetSourceAttributes = context.zeDdiTable.Kernel.pfnGetSourceAttributes; if( nullptr == pfnGetSourceAttributes ) return logAndPropagateResult("zeKernelGetSourceAttributes", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelGetSourceAttributesPrologue( hKernel, pSize, pString ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetSourceAttributes", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelGetSourceAttributesPrologue( hKernel, pSize, pString ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetSourceAttributes", result); } auto driver_result = pfnGetSourceAttributes( hKernel, pSize, pString ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelGetSourceAttributesEpilogue( hKernel, pSize, pString ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetSourceAttributes", result); } return logAndPropagateResult("zeKernelGetSourceAttributes", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetCacheConfig __zedlllocal ze_result_t ZE_APICALL zeKernelSetCacheConfig( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_cache_config_flags_t flags ///< [in] cache configuration. ///< must be 0 (default configuration) or a valid combination of ::ze_cache_config_flag_t. ) { context.logger->log_trace("zeKernelSetCacheConfig(hKernel, flags)"); auto pfnSetCacheConfig = context.zeDdiTable.Kernel.pfnSetCacheConfig; if( nullptr == pfnSetCacheConfig ) return logAndPropagateResult("zeKernelSetCacheConfig", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSetCacheConfigPrologue( hKernel, flags ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetCacheConfig", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelSetCacheConfigPrologue( hKernel, flags ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetCacheConfig", result); } auto driver_result = pfnSetCacheConfig( hKernel, flags ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSetCacheConfigEpilogue( hKernel, flags ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetCacheConfig", result); } return logAndPropagateResult("zeKernelSetCacheConfig", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetProperties __zedlllocal ze_result_t ZE_APICALL zeKernelGetProperties( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_properties_t* pKernelProperties ///< [in,out] query result for kernel properties. ) { context.logger->log_trace("zeKernelGetProperties(hKernel, pKernelProperties)"); auto pfnGetProperties = context.zeDdiTable.Kernel.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zeKernelGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelGetPropertiesPrologue( hKernel, pKernelProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelGetPropertiesPrologue( hKernel, pKernelProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetProperties", result); } auto driver_result = pfnGetProperties( hKernel, pKernelProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelGetPropertiesEpilogue( hKernel, pKernelProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetProperties", result); } return logAndPropagateResult("zeKernelGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetName __zedlllocal ze_result_t ZE_APICALL zeKernelGetName( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object size_t* pSize, ///< [in,out] size of kernel name string, including null terminator, in ///< bytes. char* pName ///< [in,out][optional] char pointer to kernel name. ) { context.logger->log_trace("zeKernelGetName(hKernel, pSize, pName)"); auto pfnGetName = context.zeDdiTable.Kernel.pfnGetName; if( nullptr == pfnGetName ) return logAndPropagateResult("zeKernelGetName", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelGetNamePrologue( hKernel, pSize, pName ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetName", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelGetNamePrologue( hKernel, pSize, pName ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetName", result); } auto driver_result = pfnGetName( hKernel, pSize, pName ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelGetNameEpilogue( hKernel, pSize, pName ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetName", result); } return logAndPropagateResult("zeKernelGetName", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchKernel __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchKernel( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendLaunchKernel(hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendLaunchKernel = context.zeDdiTable.CommandList.pfnAppendLaunchKernel; if( nullptr == pfnAppendLaunchKernel ) return logAndPropagateResult("zeCommandListAppendLaunchKernel", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendLaunchKernelPrologue( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendLaunchKernel", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendLaunchKernelPrologue( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendLaunchKernel", result); } auto driver_result = pfnAppendLaunchKernel( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendLaunchKernelEpilogue( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendLaunchKernel", result); } return logAndPropagateResult("zeCommandListAppendLaunchKernel", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchCooperativeKernel __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchCooperativeKernel( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendLaunchCooperativeKernel(hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendLaunchCooperativeKernel = context.zeDdiTable.CommandList.pfnAppendLaunchCooperativeKernel; if( nullptr == pfnAppendLaunchCooperativeKernel ) return logAndPropagateResult("zeCommandListAppendLaunchCooperativeKernel", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendLaunchCooperativeKernelPrologue( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendLaunchCooperativeKernel", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendLaunchCooperativeKernelPrologue( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendLaunchCooperativeKernel", result); } auto driver_result = pfnAppendLaunchCooperativeKernel( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendLaunchCooperativeKernelEpilogue( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendLaunchCooperativeKernel", result); } return logAndPropagateResult("zeCommandListAppendLaunchCooperativeKernel", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchKernelIndirect __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchKernelIndirect( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in] pointer to device buffer that will contain thread group launch ///< arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendLaunchKernelIndirect(hCommandList, hKernel, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendLaunchKernelIndirect = context.zeDdiTable.CommandList.pfnAppendLaunchKernelIndirect; if( nullptr == pfnAppendLaunchKernelIndirect ) return logAndPropagateResult("zeCommandListAppendLaunchKernelIndirect", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendLaunchKernelIndirectPrologue( hCommandList, hKernel, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendLaunchKernelIndirect", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendLaunchKernelIndirectPrologue( hCommandList, hKernel, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendLaunchKernelIndirect", result); } auto driver_result = pfnAppendLaunchKernelIndirect( hCommandList, hKernel, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendLaunchKernelIndirectEpilogue( hCommandList, hKernel, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendLaunchKernelIndirect", result); } return logAndPropagateResult("zeCommandListAppendLaunchKernelIndirect", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchMultipleKernelsIndirect __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchMultipleKernelsIndirect( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] maximum number of kernels to launch ze_kernel_handle_t* phKernels, ///< [in][range(0, numKernels)] handles of the kernel objects const uint32_t* pCountBuffer, ///< [in] pointer to device memory location that will contain the actual ///< number of kernels to launch; value must be less than or equal to ///< numKernels const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in][range(0, numKernels)] pointer to device buffer that will contain ///< a contiguous array of thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendLaunchMultipleKernelsIndirect(hCommandList, numKernels, phKernelsLocal, pCountBuffer, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendLaunchMultipleKernelsIndirect = context.zeDdiTable.CommandList.pfnAppendLaunchMultipleKernelsIndirect; if( nullptr == pfnAppendLaunchMultipleKernelsIndirect ) return logAndPropagateResult("zeCommandListAppendLaunchMultipleKernelsIndirect", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendLaunchMultipleKernelsIndirectPrologue( hCommandList, numKernels, phKernels, pCountBuffer, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendLaunchMultipleKernelsIndirect", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendLaunchMultipleKernelsIndirectPrologue( hCommandList, numKernels, phKernels, pCountBuffer, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendLaunchMultipleKernelsIndirect", result); } auto driver_result = pfnAppendLaunchMultipleKernelsIndirect( hCommandList, numKernels, phKernels, pCountBuffer, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendLaunchMultipleKernelsIndirectEpilogue( hCommandList, numKernels, phKernels, pCountBuffer, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendLaunchMultipleKernelsIndirect", result); } return logAndPropagateResult("zeCommandListAppendLaunchMultipleKernelsIndirect", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextMakeMemoryResident __zedlllocal ze_result_t ZE_APICALL zeContextMakeMemoryResident( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to make resident size_t size ///< [in] size in bytes to make resident ) { context.logger->log_trace("zeContextMakeMemoryResident(hContext, hDevice, ptr, size)"); auto pfnMakeMemoryResident = context.zeDdiTable.Context.pfnMakeMemoryResident; if( nullptr == pfnMakeMemoryResident ) return logAndPropagateResult("zeContextMakeMemoryResident", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextMakeMemoryResidentPrologue( hContext, hDevice, ptr, size ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextMakeMemoryResident", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeContextMakeMemoryResidentPrologue( hContext, hDevice, ptr, size ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextMakeMemoryResident", result); } auto driver_result = pfnMakeMemoryResident( hContext, hDevice, ptr, size ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextMakeMemoryResidentEpilogue( hContext, hDevice, ptr, size ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextMakeMemoryResident", result); } return logAndPropagateResult("zeContextMakeMemoryResident", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextEvictMemory __zedlllocal ze_result_t ZE_APICALL zeContextEvictMemory( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to evict size_t size ///< [in] size in bytes to evict ) { context.logger->log_trace("zeContextEvictMemory(hContext, hDevice, ptr, size)"); auto pfnEvictMemory = context.zeDdiTable.Context.pfnEvictMemory; if( nullptr == pfnEvictMemory ) return logAndPropagateResult("zeContextEvictMemory", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextEvictMemoryPrologue( hContext, hDevice, ptr, size ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextEvictMemory", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeContextEvictMemoryPrologue( hContext, hDevice, ptr, size ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextEvictMemory", result); } auto driver_result = pfnEvictMemory( hContext, hDevice, ptr, size ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextEvictMemoryEpilogue( hContext, hDevice, ptr, size ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextEvictMemory", result); } return logAndPropagateResult("zeContextEvictMemory", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextMakeImageResident __zedlllocal ze_result_t ZE_APICALL zeContextMakeImageResident( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make resident ) { context.logger->log_trace("zeContextMakeImageResident(hContext, hDevice, hImage)"); auto pfnMakeImageResident = context.zeDdiTable.Context.pfnMakeImageResident; if( nullptr == pfnMakeImageResident ) return logAndPropagateResult("zeContextMakeImageResident", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextMakeImageResidentPrologue( hContext, hDevice, hImage ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextMakeImageResident", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeContextMakeImageResidentPrologue( hContext, hDevice, hImage ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextMakeImageResident", result); } auto driver_result = pfnMakeImageResident( hContext, hDevice, hImage ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextMakeImageResidentEpilogue( hContext, hDevice, hImage ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextMakeImageResident", result); } return logAndPropagateResult("zeContextMakeImageResident", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextEvictImage __zedlllocal ze_result_t ZE_APICALL zeContextEvictImage( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make evict ) { context.logger->log_trace("zeContextEvictImage(hContext, hDevice, hImage)"); auto pfnEvictImage = context.zeDdiTable.Context.pfnEvictImage; if( nullptr == pfnEvictImage ) return logAndPropagateResult("zeContextEvictImage", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextEvictImagePrologue( hContext, hDevice, hImage ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextEvictImage", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeContextEvictImagePrologue( hContext, hDevice, hImage ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextEvictImage", result); } auto driver_result = pfnEvictImage( hContext, hDevice, hImage ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeContextEvictImageEpilogue( hContext, hDevice, hImage ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeContextEvictImage", result); } return logAndPropagateResult("zeContextEvictImage", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeSamplerCreate __zedlllocal ze_result_t ZE_APICALL zeSamplerCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_sampler_desc_t* desc, ///< [in] pointer to sampler descriptor ze_sampler_handle_t* phSampler ///< [out] handle of the sampler ) { context.logger->log_trace("zeSamplerCreate(hContext, hDevice, desc, phSampler)"); auto pfnCreate = context.zeDdiTable.Sampler.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zeSamplerCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeSamplerCreatePrologue( hContext, hDevice, desc, phSampler ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeSamplerCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeSamplerCreatePrologue( hContext, hDevice, desc, phSampler ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeSamplerCreate", result); } auto driver_result = pfnCreate( hContext, hDevice, desc, phSampler ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeSamplerCreateEpilogue( hContext, hDevice, desc, phSampler ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeSamplerCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phSampler){ context.handleLifetime->addHandle( *phSampler ); context.handleLifetime->addDependent( hContext, *phSampler ); } } return logAndPropagateResult("zeSamplerCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeSamplerDestroy __zedlllocal ze_result_t ZE_APICALL zeSamplerDestroy( ze_sampler_handle_t hSampler ///< [in][release] handle of the sampler ) { context.logger->log_trace("zeSamplerDestroy(hSampler)"); auto pfnDestroy = context.zeDdiTable.Sampler.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zeSamplerDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeSamplerDestroyPrologue( hSampler ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeSamplerDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeSamplerDestroyPrologue( hSampler ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeSamplerDestroy", result); } auto driver_result = pfnDestroy( hSampler ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeSamplerDestroyEpilogue( hSampler ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeSamplerDestroy", result); } return logAndPropagateResult("zeSamplerDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemReserve __zedlllocal ze_result_t ZE_APICALL zeVirtualMemReserve( ze_context_handle_t hContext, ///< [in] handle of the context object const void* pStart, ///< [in][optional] pointer to start of region to reserve. If nullptr then ///< implementation will choose a start address. size_t size, ///< [in] size in bytes to reserve; must be page aligned. void** pptr ///< [out] pointer to virtual reservation. ) { context.logger->log_trace("zeVirtualMemReserve(hContext, pStart, size, pptr)"); auto pfnReserve = context.zeDdiTable.VirtualMem.pfnReserve; if( nullptr == pfnReserve ) return logAndPropagateResult("zeVirtualMemReserve", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemReservePrologue( hContext, pStart, size, pptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemReserve", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeVirtualMemReservePrologue( hContext, pStart, size, pptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemReserve", result); } auto driver_result = pfnReserve( hContext, pStart, size, pptr ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemReserveEpilogue( hContext, pStart, size, pptr ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemReserve", result); } return logAndPropagateResult("zeVirtualMemReserve", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemFree __zedlllocal ze_result_t ZE_APICALL zeVirtualMemFree( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to free. size_t size ///< [in] size in bytes to free; must be page aligned. ) { context.logger->log_trace("zeVirtualMemFree(hContext, ptr, size)"); auto pfnFree = context.zeDdiTable.VirtualMem.pfnFree; if( nullptr == pfnFree ) return logAndPropagateResult("zeVirtualMemFree", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemFreePrologue( hContext, ptr, size ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemFree", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeVirtualMemFreePrologue( hContext, ptr, size ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemFree", result); } auto driver_result = pfnFree( hContext, ptr, size ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemFreeEpilogue( hContext, ptr, size ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemFree", result); } return logAndPropagateResult("zeVirtualMemFree", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemQueryPageSize __zedlllocal ze_result_t ZE_APICALL zeVirtualMemQueryPageSize( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] unaligned allocation size in bytes size_t* pagesize ///< [out] pointer to page size to use for start address and size ///< alignments. ) { context.logger->log_trace("zeVirtualMemQueryPageSize(hContext, hDevice, size, pagesize)"); auto pfnQueryPageSize = context.zeDdiTable.VirtualMem.pfnQueryPageSize; if( nullptr == pfnQueryPageSize ) return logAndPropagateResult("zeVirtualMemQueryPageSize", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemQueryPageSizePrologue( hContext, hDevice, size, pagesize ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemQueryPageSize", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeVirtualMemQueryPageSizePrologue( hContext, hDevice, size, pagesize ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemQueryPageSize", result); } auto driver_result = pfnQueryPageSize( hContext, hDevice, size, pagesize ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemQueryPageSizeEpilogue( hContext, hDevice, size, pagesize ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemQueryPageSize", result); } return logAndPropagateResult("zeVirtualMemQueryPageSize", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zePhysicalMemCreate __zedlllocal ze_result_t ZE_APICALL zePhysicalMemCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) { context.logger->log_trace("zePhysicalMemCreate(hContext, hDevice, desc, phPhysicalMemory)"); auto pfnCreate = context.zeDdiTable.PhysicalMem.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zePhysicalMemCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zePhysicalMemCreatePrologue( hContext, hDevice, desc, phPhysicalMemory ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zePhysicalMemCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zePhysicalMemCreatePrologue( hContext, hDevice, desc, phPhysicalMemory ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zePhysicalMemCreate", result); } auto driver_result = pfnCreate( hContext, hDevice, desc, phPhysicalMemory ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zePhysicalMemCreateEpilogue( hContext, hDevice, desc, phPhysicalMemory ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zePhysicalMemCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phPhysicalMemory){ context.handleLifetime->addHandle( *phPhysicalMemory ); context.handleLifetime->addDependent( hContext, *phPhysicalMemory ); } } return logAndPropagateResult("zePhysicalMemCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zePhysicalMemDestroy __zedlllocal ze_result_t ZE_APICALL zePhysicalMemDestroy( ze_context_handle_t hContext, ///< [in] handle of the context object ze_physical_mem_handle_t hPhysicalMemory ///< [in][release] handle of physical memory object to destroy ) { context.logger->log_trace("zePhysicalMemDestroy(hContext, hPhysicalMemory)"); auto pfnDestroy = context.zeDdiTable.PhysicalMem.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zePhysicalMemDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zePhysicalMemDestroyPrologue( hContext, hPhysicalMemory ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zePhysicalMemDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zePhysicalMemDestroyPrologue( hContext, hPhysicalMemory ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zePhysicalMemDestroy", result); } auto driver_result = pfnDestroy( hContext, hPhysicalMemory ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zePhysicalMemDestroyEpilogue( hContext, hPhysicalMemory ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zePhysicalMemDestroy", result); } return logAndPropagateResult("zePhysicalMemDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemMap __zedlllocal ze_result_t ZE_APICALL zeVirtualMemMap( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address range to map. size_t size, ///< [in] size in bytes of virtual address range to map; must be page ///< aligned. ze_physical_mem_handle_t hPhysicalMemory, ///< [in] handle to physical memory object. size_t offset, ///< [in] offset into physical memory allocation object; must be page ///< aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { context.logger->log_trace("zeVirtualMemMap(hContext, ptr, size, hPhysicalMemory, offset, access)"); auto pfnMap = context.zeDdiTable.VirtualMem.pfnMap; if( nullptr == pfnMap ) return logAndPropagateResult("zeVirtualMemMap", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemMapPrologue( hContext, ptr, size, hPhysicalMemory, offset, access ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemMap", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeVirtualMemMapPrologue( hContext, ptr, size, hPhysicalMemory, offset, access ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemMap", result); } auto driver_result = pfnMap( hContext, ptr, size, hPhysicalMemory, offset, access ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemMapEpilogue( hContext, ptr, size, hPhysicalMemory, offset, access ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemMap", result); } return logAndPropagateResult("zeVirtualMemMap", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemUnmap __zedlllocal ze_result_t ZE_APICALL zeVirtualMemUnmap( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to unmap. size_t size ///< [in] size in bytes to unmap; must be page aligned. ) { context.logger->log_trace("zeVirtualMemUnmap(hContext, ptr, size)"); auto pfnUnmap = context.zeDdiTable.VirtualMem.pfnUnmap; if( nullptr == pfnUnmap ) return logAndPropagateResult("zeVirtualMemUnmap", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemUnmapPrologue( hContext, ptr, size ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemUnmap", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeVirtualMemUnmapPrologue( hContext, ptr, size ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemUnmap", result); } auto driver_result = pfnUnmap( hContext, ptr, size ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemUnmapEpilogue( hContext, ptr, size ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemUnmap", result); } return logAndPropagateResult("zeVirtualMemUnmap", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemSetAccessAttribute __zedlllocal ze_result_t ZE_APICALL zeVirtualMemSetAccessAttribute( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of reserved virtual address region. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { context.logger->log_trace("zeVirtualMemSetAccessAttribute(hContext, ptr, size, access)"); auto pfnSetAccessAttribute = context.zeDdiTable.VirtualMem.pfnSetAccessAttribute; if( nullptr == pfnSetAccessAttribute ) return logAndPropagateResult("zeVirtualMemSetAccessAttribute", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemSetAccessAttributePrologue( hContext, ptr, size, access ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemSetAccessAttribute", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeVirtualMemSetAccessAttributePrologue( hContext, ptr, size, access ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemSetAccessAttribute", result); } auto driver_result = pfnSetAccessAttribute( hContext, ptr, size, access ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemSetAccessAttributeEpilogue( hContext, ptr, size, access ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemSetAccessAttribute", result); } return logAndPropagateResult("zeVirtualMemSetAccessAttribute", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemGetAccessAttribute __zedlllocal ze_result_t ZE_APICALL zeVirtualMemGetAccessAttribute( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address region for query. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t* access, ///< [out] query result for page access attribute. size_t* outSize ///< [out] query result for size of virtual address range, starting at ptr, ///< that shares same access attribute. ) { context.logger->log_trace("zeVirtualMemGetAccessAttribute(hContext, ptr, size, access, outSize)"); auto pfnGetAccessAttribute = context.zeDdiTable.VirtualMem.pfnGetAccessAttribute; if( nullptr == pfnGetAccessAttribute ) return logAndPropagateResult("zeVirtualMemGetAccessAttribute", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemGetAccessAttributePrologue( hContext, ptr, size, access, outSize ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemGetAccessAttribute", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeVirtualMemGetAccessAttributePrologue( hContext, ptr, size, access, outSize ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemGetAccessAttribute", result); } auto driver_result = pfnGetAccessAttribute( hContext, ptr, size, access, outSize ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeVirtualMemGetAccessAttributeEpilogue( hContext, ptr, size, access, outSize ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeVirtualMemGetAccessAttribute", result); } return logAndPropagateResult("zeVirtualMemGetAccessAttribute", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetGlobalOffsetExp __zedlllocal ze_result_t ZE_APICALL zeKernelSetGlobalOffsetExp( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t offsetX, ///< [in] global offset for X dimension to use for this kernel uint32_t offsetY, ///< [in] global offset for Y dimension to use for this kernel uint32_t offsetZ ///< [in] global offset for Z dimension to use for this kernel ) { context.logger->log_trace("zeKernelSetGlobalOffsetExp(hKernel, offsetX, offsetY, offsetZ)"); auto pfnSetGlobalOffsetExp = context.zeDdiTable.KernelExp.pfnSetGlobalOffsetExp; if( nullptr == pfnSetGlobalOffsetExp ) return logAndPropagateResult("zeKernelSetGlobalOffsetExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSetGlobalOffsetExpPrologue( hKernel, offsetX, offsetY, offsetZ ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetGlobalOffsetExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelSetGlobalOffsetExpPrologue( hKernel, offsetX, offsetY, offsetZ ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetGlobalOffsetExp", result); } auto driver_result = pfnSetGlobalOffsetExp( hKernel, offsetX, offsetY, offsetZ ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSetGlobalOffsetExpEpilogue( hKernel, offsetX, offsetY, offsetZ ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSetGlobalOffsetExp", result); } return logAndPropagateResult("zeKernelSetGlobalOffsetExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetBinaryExp __zedlllocal ze_result_t ZE_APICALL zeKernelGetBinaryExp( ze_kernel_handle_t hKernel, ///< [in] Kernel handle. size_t* pSize, ///< [in,out] pointer to variable with size of GEN ISA binary. uint8_t* pKernelBinary ///< [in,out] pointer to storage area for GEN ISA binary function. ) { context.logger->log_trace("zeKernelGetBinaryExp(hKernel, pSize, pKernelBinary)"); auto pfnGetBinaryExp = context.zeDdiTable.KernelExp.pfnGetBinaryExp; if( nullptr == pfnGetBinaryExp ) return logAndPropagateResult("zeKernelGetBinaryExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelGetBinaryExpPrologue( hKernel, pSize, pKernelBinary ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetBinaryExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelGetBinaryExpPrologue( hKernel, pSize, pKernelBinary ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetBinaryExp", result); } auto driver_result = pfnGetBinaryExp( hKernel, pSize, pKernelBinary ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelGetBinaryExpEpilogue( hKernel, pSize, pKernelBinary ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelGetBinaryExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeKernelGetBinaryExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceImportExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeDeviceImportExternalSemaphoreExt( ze_device_handle_t hDevice, ///< [in] The device handle. const ze_external_semaphore_ext_desc_t* desc, ///< [in] The pointer to external semaphore descriptor. ze_external_semaphore_ext_handle_t* phSemaphore ///< [out] The handle of the external semaphore imported. ) { context.logger->log_trace("zeDeviceImportExternalSemaphoreExt(hDevice, desc, phSemaphore)"); auto pfnImportExternalSemaphoreExt = context.zeDdiTable.Device.pfnImportExternalSemaphoreExt; if( nullptr == pfnImportExternalSemaphoreExt ) return logAndPropagateResult("zeDeviceImportExternalSemaphoreExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceImportExternalSemaphoreExtPrologue( hDevice, desc, phSemaphore ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceImportExternalSemaphoreExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceImportExternalSemaphoreExtPrologue( hDevice, desc, phSemaphore ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceImportExternalSemaphoreExt", result); } auto driver_result = pfnImportExternalSemaphoreExt( hDevice, desc, phSemaphore ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceImportExternalSemaphoreExtEpilogue( hDevice, desc, phSemaphore ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceImportExternalSemaphoreExt", result); } return logAndPropagateResult("zeDeviceImportExternalSemaphoreExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceReleaseExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeDeviceReleaseExternalSemaphoreExt( ze_external_semaphore_ext_handle_t hSemaphore ///< [in] The handle of the external semaphore. ) { context.logger->log_trace("zeDeviceReleaseExternalSemaphoreExt(hSemaphore)"); auto pfnReleaseExternalSemaphoreExt = context.zeDdiTable.Device.pfnReleaseExternalSemaphoreExt; if( nullptr == pfnReleaseExternalSemaphoreExt ) return logAndPropagateResult("zeDeviceReleaseExternalSemaphoreExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceReleaseExternalSemaphoreExtPrologue( hSemaphore ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceReleaseExternalSemaphoreExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceReleaseExternalSemaphoreExtPrologue( hSemaphore ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceReleaseExternalSemaphoreExt", result); } auto driver_result = pfnReleaseExternalSemaphoreExt( hSemaphore ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceReleaseExternalSemaphoreExtEpilogue( hSemaphore ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceReleaseExternalSemaphoreExt", result); } return logAndPropagateResult("zeDeviceReleaseExternalSemaphoreExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendSignalExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendSignalExternalSemaphoreExt( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in][range(0, numSemaphores)] The vector of external semaphore handles ///< to be appended into command list. ze_external_semaphore_signal_params_ext_t* signalParams,///< [in] Signal parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendSignalExternalSemaphoreExt(hCommandList, numSemaphores, phSemaphoresLocal, signalParams, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendSignalExternalSemaphoreExt = context.zeDdiTable.CommandList.pfnAppendSignalExternalSemaphoreExt; if( nullptr == pfnAppendSignalExternalSemaphoreExt ) return logAndPropagateResult("zeCommandListAppendSignalExternalSemaphoreExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendSignalExternalSemaphoreExtPrologue( hCommandList, numSemaphores, phSemaphores, signalParams, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendSignalExternalSemaphoreExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendSignalExternalSemaphoreExtPrologue( hCommandList, numSemaphores, phSemaphores, signalParams, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendSignalExternalSemaphoreExt", result); } auto driver_result = pfnAppendSignalExternalSemaphoreExt( hCommandList, numSemaphores, phSemaphores, signalParams, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendSignalExternalSemaphoreExtEpilogue( hCommandList, numSemaphores, phSemaphores, signalParams, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendSignalExternalSemaphoreExt", result); } return logAndPropagateResult("zeCommandListAppendSignalExternalSemaphoreExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendWaitExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendWaitExternalSemaphoreExt( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in] [range(0,numSemaphores)] The vector of external semaphore handles ///< to append into command list. ze_external_semaphore_wait_params_ext_t* waitParams,///< [in] Wait parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendWaitExternalSemaphoreExt(hCommandList, numSemaphores, phSemaphoresLocal, waitParams, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendWaitExternalSemaphoreExt = context.zeDdiTable.CommandList.pfnAppendWaitExternalSemaphoreExt; if( nullptr == pfnAppendWaitExternalSemaphoreExt ) return logAndPropagateResult("zeCommandListAppendWaitExternalSemaphoreExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendWaitExternalSemaphoreExtPrologue( hCommandList, numSemaphores, phSemaphores, waitParams, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendWaitExternalSemaphoreExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendWaitExternalSemaphoreExtPrologue( hCommandList, numSemaphores, phSemaphores, waitParams, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendWaitExternalSemaphoreExt", result); } auto driver_result = pfnAppendWaitExternalSemaphoreExt( hCommandList, numSemaphores, phSemaphores, waitParams, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendWaitExternalSemaphoreExtEpilogue( hCommandList, numSemaphores, phSemaphores, waitParams, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendWaitExternalSemaphoreExt", result); } return logAndPropagateResult("zeCommandListAppendWaitExternalSemaphoreExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceReserveCacheExt __zedlllocal ze_result_t ZE_APICALL zeDeviceReserveCacheExt( ze_device_handle_t hDevice, ///< [in] handle of the device object size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the ///< driver shall default to last level of cache and attempt to reserve in ///< that cache. size_t cacheReservationSize ///< [in] value for reserving size, in bytes. If zero, then the driver ///< shall remove prior reservation ) { context.logger->log_trace("zeDeviceReserveCacheExt(hDevice, cacheLevel, cacheReservationSize)"); auto pfnReserveCacheExt = context.zeDdiTable.Device.pfnReserveCacheExt; if( nullptr == pfnReserveCacheExt ) return logAndPropagateResult("zeDeviceReserveCacheExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceReserveCacheExtPrologue( hDevice, cacheLevel, cacheReservationSize ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceReserveCacheExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceReserveCacheExtPrologue( hDevice, cacheLevel, cacheReservationSize ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceReserveCacheExt", result); } auto driver_result = pfnReserveCacheExt( hDevice, cacheLevel, cacheReservationSize ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceReserveCacheExtEpilogue( hDevice, cacheLevel, cacheReservationSize ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceReserveCacheExt", result); } return logAndPropagateResult("zeDeviceReserveCacheExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceSetCacheAdviceExt __zedlllocal ze_result_t ZE_APICALL zeDeviceSetCacheAdviceExt( ze_device_handle_t hDevice, ///< [in] handle of the device object void* ptr, ///< [in] memory pointer to query size_t regionSize, ///< [in] region size, in pages ze_cache_ext_region_t cacheRegion ///< [in] reservation region ) { context.logger->log_trace("zeDeviceSetCacheAdviceExt(hDevice, ptr, regionSize, cacheRegion)"); auto pfnSetCacheAdviceExt = context.zeDdiTable.Device.pfnSetCacheAdviceExt; if( nullptr == pfnSetCacheAdviceExt ) return logAndPropagateResult("zeDeviceSetCacheAdviceExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceSetCacheAdviceExtPrologue( hDevice, ptr, regionSize, cacheRegion ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceSetCacheAdviceExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceSetCacheAdviceExtPrologue( hDevice, ptr, regionSize, cacheRegion ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceSetCacheAdviceExt", result); } auto driver_result = pfnSetCacheAdviceExt( hDevice, ptr, regionSize, cacheRegion ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceSetCacheAdviceExtEpilogue( hDevice, ptr, regionSize, cacheRegion ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceSetCacheAdviceExt", result); } return logAndPropagateResult("zeDeviceSetCacheAdviceExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryTimestampsExp __zedlllocal ze_result_t ZE_APICALL zeEventQueryTimestampsExp( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of timestamp results. ///< if count is zero, then the driver shall update the value with the ///< total number of timestamps available. ///< if count is greater than the number of timestamps available, then the ///< driver shall update the value with the correct number of timestamps available. ze_kernel_timestamp_result_t* pTimestamps ///< [in,out][optional][range(0, *pCount)] array of timestamp results. ///< if count is less than the number of timestamps available, then driver ///< shall only retrieve that number of timestamps. ) { context.logger->log_trace("zeEventQueryTimestampsExp(hEvent, hDevice, pCount, pTimestamps)"); auto pfnQueryTimestampsExp = context.zeDdiTable.EventExp.pfnQueryTimestampsExp; if( nullptr == pfnQueryTimestampsExp ) return logAndPropagateResult("zeEventQueryTimestampsExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventQueryTimestampsExpPrologue( hEvent, hDevice, pCount, pTimestamps ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventQueryTimestampsExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventQueryTimestampsExpPrologue( hEvent, hDevice, pCount, pTimestamps ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventQueryTimestampsExp", result); } auto driver_result = pfnQueryTimestampsExp( hEvent, hDevice, pCount, pTimestamps ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventQueryTimestampsExpEpilogue( hEvent, hDevice, pCount, pTimestamps ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventQueryTimestampsExp", result); } return logAndPropagateResult("zeEventQueryTimestampsExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetMemoryPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeImageGetMemoryPropertiesExp( ze_image_handle_t hImage, ///< [in] handle of image object ze_image_memory_properties_exp_t* pMemoryProperties ///< [in,out] query result for image memory properties. ) { context.logger->log_trace("zeImageGetMemoryPropertiesExp(hImage, pMemoryProperties)"); auto pfnGetMemoryPropertiesExp = context.zeDdiTable.ImageExp.pfnGetMemoryPropertiesExp; if( nullptr == pfnGetMemoryPropertiesExp ) return logAndPropagateResult("zeImageGetMemoryPropertiesExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageGetMemoryPropertiesExpPrologue( hImage, pMemoryProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageGetMemoryPropertiesExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeImageGetMemoryPropertiesExpPrologue( hImage, pMemoryProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageGetMemoryPropertiesExp", result); } auto driver_result = pfnGetMemoryPropertiesExp( hImage, pMemoryProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageGetMemoryPropertiesExpEpilogue( hImage, pMemoryProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageGetMemoryPropertiesExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeImageGetMemoryPropertiesExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageViewCreateExt __zedlllocal ze_result_t ZE_APICALL zeImageViewCreateExt( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { context.logger->log_trace("zeImageViewCreateExt(hContext, hDevice, desc, hImage, phImageView)"); auto pfnViewCreateExt = context.zeDdiTable.Image.pfnViewCreateExt; if( nullptr == pfnViewCreateExt ) return logAndPropagateResult("zeImageViewCreateExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageViewCreateExtPrologue( hContext, hDevice, desc, hImage, phImageView ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageViewCreateExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeImageViewCreateExtPrologue( hContext, hDevice, desc, hImage, phImageView ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageViewCreateExt", result); } auto driver_result = pfnViewCreateExt( hContext, hDevice, desc, hImage, phImageView ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageViewCreateExtEpilogue( hContext, hDevice, desc, hImage, phImageView ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageViewCreateExt", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phImageView){ context.handleLifetime->addHandle( *phImageView ); context.handleLifetime->addDependent( hContext, *phImageView ); } } return logAndPropagateResult("zeImageViewCreateExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageViewCreateExp __zedlllocal ze_result_t ZE_APICALL zeImageViewCreateExp( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { context.logger->log_trace("zeImageViewCreateExp(hContext, hDevice, desc, hImage, phImageView)"); auto pfnViewCreateExp = context.zeDdiTable.ImageExp.pfnViewCreateExp; if( nullptr == pfnViewCreateExp ) return logAndPropagateResult("zeImageViewCreateExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageViewCreateExpPrologue( hContext, hDevice, desc, hImage, phImageView ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageViewCreateExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeImageViewCreateExpPrologue( hContext, hDevice, desc, hImage, phImageView ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageViewCreateExp", result); } auto driver_result = pfnViewCreateExp( hContext, hDevice, desc, hImage, phImageView ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageViewCreateExpEpilogue( hContext, hDevice, desc, hImage, phImageView ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageViewCreateExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phImageView){ context.handleLifetime->addHandle( *phImageView ); context.handleLifetime->addDependent( hContext, *phImageView ); } } return logAndPropagateResult("zeImageViewCreateExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSchedulingHintExp __zedlllocal ze_result_t ZE_APICALL zeKernelSchedulingHintExp( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_scheduling_hint_exp_desc_t* pHint ///< [in] pointer to kernel scheduling hint descriptor ) { context.logger->log_trace("zeKernelSchedulingHintExp(hKernel, pHint)"); auto pfnSchedulingHintExp = context.zeDdiTable.KernelExp.pfnSchedulingHintExp; if( nullptr == pfnSchedulingHintExp ) return logAndPropagateResult("zeKernelSchedulingHintExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSchedulingHintExpPrologue( hKernel, pHint ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSchedulingHintExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeKernelSchedulingHintExpPrologue( hKernel, pHint ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSchedulingHintExp", result); } auto driver_result = pfnSchedulingHintExp( hKernel, pHint ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeKernelSchedulingHintExpEpilogue( hKernel, pHint ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeKernelSchedulingHintExp", result); } return logAndPropagateResult("zeKernelSchedulingHintExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDevicePciGetPropertiesExt __zedlllocal ze_result_t ZE_APICALL zeDevicePciGetPropertiesExt( ze_device_handle_t hDevice, ///< [in] handle of the device object. ze_pci_ext_properties_t* pPciProperties ///< [in,out] returns the PCI properties of the device. ) { context.logger->log_trace("zeDevicePciGetPropertiesExt(hDevice, pPciProperties)"); auto pfnPciGetPropertiesExt = context.zeDdiTable.Device.pfnPciGetPropertiesExt; if( nullptr == pfnPciGetPropertiesExt ) return logAndPropagateResult("zeDevicePciGetPropertiesExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDevicePciGetPropertiesExtPrologue( hDevice, pPciProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDevicePciGetPropertiesExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDevicePciGetPropertiesExtPrologue( hDevice, pPciProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDevicePciGetPropertiesExt", result); } auto driver_result = pfnPciGetPropertiesExt( hDevice, pPciProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDevicePciGetPropertiesExtEpilogue( hDevice, pPciProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDevicePciGetPropertiesExt", result); } return logAndPropagateResult("zeDevicePciGetPropertiesExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyToMemoryExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemoryExt( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor uint32_t destRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being written uint32_t destSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being written ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendImageCopyToMemoryExt(hCommandList, dstptr, hSrcImage, pSrcRegion, destRowPitch, destSlicePitch, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendImageCopyToMemoryExt = context.zeDdiTable.CommandList.pfnAppendImageCopyToMemoryExt; if( nullptr == pfnAppendImageCopyToMemoryExt ) return logAndPropagateResult("zeCommandListAppendImageCopyToMemoryExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendImageCopyToMemoryExtPrologue( hCommandList, dstptr, hSrcImage, pSrcRegion, destRowPitch, destSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyToMemoryExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendImageCopyToMemoryExtPrologue( hCommandList, dstptr, hSrcImage, pSrcRegion, destRowPitch, destSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyToMemoryExt", result); } auto driver_result = pfnAppendImageCopyToMemoryExt( hCommandList, dstptr, hSrcImage, pSrcRegion, destRowPitch, destSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendImageCopyToMemoryExtEpilogue( hCommandList, dstptr, hSrcImage, pSrcRegion, destRowPitch, destSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyToMemoryExt", result); } return logAndPropagateResult("zeCommandListAppendImageCopyToMemoryExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyFromMemoryExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyFromMemoryExt( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor uint32_t srcRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being read uint32_t srcSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being read ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListAppendImageCopyFromMemoryExt(hCommandList, hDstImage, srcptr, pDstRegion, srcRowPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendImageCopyFromMemoryExt = context.zeDdiTable.CommandList.pfnAppendImageCopyFromMemoryExt; if( nullptr == pfnAppendImageCopyFromMemoryExt ) return logAndPropagateResult("zeCommandListAppendImageCopyFromMemoryExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendImageCopyFromMemoryExtPrologue( hCommandList, hDstImage, srcptr, pDstRegion, srcRowPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyFromMemoryExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListAppendImageCopyFromMemoryExtPrologue( hCommandList, hDstImage, srcptr, pDstRegion, srcRowPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyFromMemoryExt", result); } auto driver_result = pfnAppendImageCopyFromMemoryExt( hCommandList, hDstImage, srcptr, pDstRegion, srcRowPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListAppendImageCopyFromMemoryExtEpilogue( hCommandList, hDstImage, srcptr, pDstRegion, srcRowPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListAppendImageCopyFromMemoryExt", result); } return logAndPropagateResult("zeCommandListAppendImageCopyFromMemoryExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetAllocPropertiesExt __zedlllocal ze_result_t ZE_APICALL zeImageGetAllocPropertiesExt( ze_context_handle_t hContext, ///< [in] handle of the context object ze_image_handle_t hImage, ///< [in] handle of image object to query ze_image_allocation_ext_properties_t* pImageAllocProperties ///< [in,out] query result for image allocation properties ) { context.logger->log_trace("zeImageGetAllocPropertiesExt(hContext, hImage, pImageAllocProperties)"); auto pfnGetAllocPropertiesExt = context.zeDdiTable.Image.pfnGetAllocPropertiesExt; if( nullptr == pfnGetAllocPropertiesExt ) return logAndPropagateResult("zeImageGetAllocPropertiesExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageGetAllocPropertiesExtPrologue( hContext, hImage, pImageAllocProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageGetAllocPropertiesExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeImageGetAllocPropertiesExtPrologue( hContext, hImage, pImageAllocProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageGetAllocPropertiesExt", result); } auto driver_result = pfnGetAllocPropertiesExt( hContext, hImage, pImageAllocProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageGetAllocPropertiesExtEpilogue( hContext, hImage, pImageAllocProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageGetAllocPropertiesExt", result); } return logAndPropagateResult("zeImageGetAllocPropertiesExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleInspectLinkageExt __zedlllocal ze_result_t ZE_APICALL zeModuleInspectLinkageExt( ze_linkage_inspection_ext_desc_t* pInspectDesc, ///< [in] pointer to linkage inspection descriptor structure. uint32_t numModules, ///< [in] number of modules to be inspected pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to be ///< inspected for import dependencies. ze_module_build_log_handle_t* phLog ///< [out] pointer to handle of linkage inspection log. Log object will ///< contain separate lists of imports, un-resolvable imports, and exports. ) { context.logger->log_trace("zeModuleInspectLinkageExt(pInspectDesc, numModules, phModulesLocal, phLog)"); auto pfnInspectLinkageExt = context.zeDdiTable.Module.pfnInspectLinkageExt; if( nullptr == pfnInspectLinkageExt ) return logAndPropagateResult("zeModuleInspectLinkageExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleInspectLinkageExtPrologue( pInspectDesc, numModules, phModules, phLog ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleInspectLinkageExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeModuleInspectLinkageExtPrologue( pInspectDesc, numModules, phModules, phLog ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleInspectLinkageExt", result); } auto driver_result = pfnInspectLinkageExt( pInspectDesc, numModules, phModules, phLog ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeModuleInspectLinkageExtEpilogue( pInspectDesc, numModules, phModules, phLog ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeModuleInspectLinkageExt", result); } return logAndPropagateResult("zeModuleInspectLinkageExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemFreeExt __zedlllocal ze_result_t ZE_APICALL zeMemFreeExt( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_memory_free_ext_desc_t* pMemFreeDesc, ///< [in] pointer to memory free descriptor void* ptr ///< [in][release] pointer to memory to free ) { context.logger->log_trace("zeMemFreeExt(hContext, pMemFreeDesc, ptr)"); auto pfnFreeExt = context.zeDdiTable.Mem.pfnFreeExt; if( nullptr == pfnFreeExt ) return logAndPropagateResult("zeMemFreeExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemFreeExtPrologue( hContext, pMemFreeDesc, ptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemFreeExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemFreeExtPrologue( hContext, pMemFreeDesc, ptr ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemFreeExt", result); } auto driver_result = pfnFreeExt( hContext, pMemFreeDesc, ptr ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemFreeExtEpilogue( hContext, pMemFreeDesc, ptr ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemFreeExt", result); } return logAndPropagateResult("zeMemFreeExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetExp( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric vertices available. ///< if count is greater than the number of fabric vertices available, then ///< the driver shall update the value with the correct number of fabric ///< vertices available. ze_fabric_vertex_handle_t* phVertices ///< [in,out][optional][range(0, *pCount)] array of handle of fabric vertices. ///< if count is less than the number of fabric vertices available, then ///< driver shall only retrieve that number of fabric vertices. ) { context.logger->log_trace("zeFabricVertexGetExp(hDriver, pCount, phVertices)"); auto pfnGetExp = context.zeDdiTable.FabricVertexExp.pfnGetExp; if( nullptr == pfnGetExp ) return logAndPropagateResult("zeFabricVertexGetExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricVertexGetExpPrologue( hDriver, pCount, phVertices ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricVertexGetExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeFabricVertexGetExpPrologue( hDriver, pCount, phVertices ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricVertexGetExp", result); } auto driver_result = pfnGetExp( hDriver, pCount, phVertices ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricVertexGetExpEpilogue( hDriver, pCount, phVertices ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricVertexGetExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phVertices) && (i < *pCount); ++i){ if (phVertices[i]){ context.handleLifetime->addHandle( phVertices[i] ); context.handleLifetime->addDependent( hDriver, phVertices[i] ); } } } return logAndPropagateResult("zeFabricVertexGetExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetSubVerticesExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetSubVerticesExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex object uint32_t* pCount, ///< [in,out] pointer to the number of sub-vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-vertices available. ///< if count is greater than the number of sub-vertices available, then ///< the driver shall update the value with the correct number of ///< sub-vertices available. ze_fabric_vertex_handle_t* phSubvertices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-vertices. ///< if count is less than the number of sub-vertices available, then ///< driver shall only retrieve that number of sub-vertices. ) { context.logger->log_trace("zeFabricVertexGetSubVerticesExp(hVertex, pCount, phSubvertices)"); auto pfnGetSubVerticesExp = context.zeDdiTable.FabricVertexExp.pfnGetSubVerticesExp; if( nullptr == pfnGetSubVerticesExp ) return logAndPropagateResult("zeFabricVertexGetSubVerticesExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricVertexGetSubVerticesExpPrologue( hVertex, pCount, phSubvertices ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricVertexGetSubVerticesExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeFabricVertexGetSubVerticesExpPrologue( hVertex, pCount, phSubvertices ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricVertexGetSubVerticesExp", result); } auto driver_result = pfnGetSubVerticesExp( hVertex, pCount, phSubvertices ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricVertexGetSubVerticesExpEpilogue( hVertex, pCount, phSubvertices ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricVertexGetSubVerticesExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phSubvertices) && (i < *pCount); ++i){ if (phSubvertices[i]){ context.handleLifetime->addHandle( phSubvertices[i] ); context.handleLifetime->addDependent( hVertex, phSubvertices[i] ); } } } return logAndPropagateResult("zeFabricVertexGetSubVerticesExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetPropertiesExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_fabric_vertex_exp_properties_t* pVertexProperties///< [in,out] query result for fabric vertex properties ) { context.logger->log_trace("zeFabricVertexGetPropertiesExp(hVertex, pVertexProperties)"); auto pfnGetPropertiesExp = context.zeDdiTable.FabricVertexExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp ) return logAndPropagateResult("zeFabricVertexGetPropertiesExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricVertexGetPropertiesExpPrologue( hVertex, pVertexProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricVertexGetPropertiesExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeFabricVertexGetPropertiesExpPrologue( hVertex, pVertexProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricVertexGetPropertiesExp", result); } auto driver_result = pfnGetPropertiesExp( hVertex, pVertexProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricVertexGetPropertiesExpEpilogue( hVertex, pVertexProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricVertexGetPropertiesExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeFabricVertexGetPropertiesExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetDeviceExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetDeviceExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_device_handle_t* phDevice ///< [out] device handle corresponding to fabric vertex ) { context.logger->log_trace("zeFabricVertexGetDeviceExp(hVertex, phDevice)"); auto pfnGetDeviceExp = context.zeDdiTable.FabricVertexExp.pfnGetDeviceExp; if( nullptr == pfnGetDeviceExp ) return logAndPropagateResult("zeFabricVertexGetDeviceExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricVertexGetDeviceExpPrologue( hVertex, phDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricVertexGetDeviceExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeFabricVertexGetDeviceExpPrologue( hVertex, phDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricVertexGetDeviceExp", result); } auto driver_result = pfnGetDeviceExp( hVertex, phDevice ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricVertexGetDeviceExpEpilogue( hVertex, phDevice ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricVertexGetDeviceExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phDevice){ context.handleLifetime->addHandle( *phDevice ); context.handleLifetime->addDependent( hVertex, *phDevice ); } } return logAndPropagateResult("zeFabricVertexGetDeviceExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetFabricVertexExp __zedlllocal ze_result_t ZE_APICALL zeDeviceGetFabricVertexExp( ze_device_handle_t hDevice, ///< [in] handle of the device ze_fabric_vertex_handle_t* phVertex ///< [out] fabric vertex handle corresponding to device ) { context.logger->log_trace("zeDeviceGetFabricVertexExp(hDevice, phVertex)"); auto pfnGetFabricVertexExp = context.zeDdiTable.DeviceExp.pfnGetFabricVertexExp; if( nullptr == pfnGetFabricVertexExp ) return logAndPropagateResult("zeDeviceGetFabricVertexExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetFabricVertexExpPrologue( hDevice, phVertex ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetFabricVertexExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDeviceGetFabricVertexExpPrologue( hDevice, phVertex ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetFabricVertexExp", result); } auto driver_result = pfnGetFabricVertexExp( hDevice, phVertex ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDeviceGetFabricVertexExpEpilogue( hDevice, phVertex ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDeviceGetFabricVertexExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phVertex){ context.handleLifetime->addHandle( *phVertex ); context.handleLifetime->addDependent( hDevice, *phVertex ); } } return logAndPropagateResult("zeDeviceGetFabricVertexExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricEdgeGetExp __zedlllocal ze_result_t ZE_APICALL zeFabricEdgeGetExp( ze_fabric_vertex_handle_t hVertexA, ///< [in] handle of first fabric vertex instance ze_fabric_vertex_handle_t hVertexB, ///< [in] handle of second fabric vertex instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric edges. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric edges available. ///< if count is greater than the number of fabric edges available, then ///< the driver shall update the value with the correct number of fabric ///< edges available. ze_fabric_edge_handle_t* phEdges ///< [in,out][optional][range(0, *pCount)] array of handle of fabric edges. ///< if count is less than the number of fabric edges available, then ///< driver shall only retrieve that number of fabric edges. ) { context.logger->log_trace("zeFabricEdgeGetExp(hVertexA, hVertexB, pCount, phEdges)"); auto pfnGetExp = context.zeDdiTable.FabricEdgeExp.pfnGetExp; if( nullptr == pfnGetExp ) return logAndPropagateResult("zeFabricEdgeGetExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricEdgeGetExpPrologue( hVertexA, hVertexB, pCount, phEdges ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricEdgeGetExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeFabricEdgeGetExpPrologue( hVertexA, hVertexB, pCount, phEdges ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricEdgeGetExp", result); } auto driver_result = pfnGetExp( hVertexA, hVertexB, pCount, phEdges ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricEdgeGetExpEpilogue( hVertexA, hVertexB, pCount, phEdges ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricEdgeGetExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phEdges) && (i < *pCount); ++i){ if (phEdges[i]){ context.handleLifetime->addHandle( phEdges[i] ); context.handleLifetime->addDependent( hVertexA, phEdges[i] ); } } } return logAndPropagateResult("zeFabricEdgeGetExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricEdgeGetVerticesExp __zedlllocal ze_result_t ZE_APICALL zeFabricEdgeGetVerticesExp( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge instance ze_fabric_vertex_handle_t* phVertexA, ///< [out] fabric vertex connected to one end of the given fabric edge. ze_fabric_vertex_handle_t* phVertexB ///< [out] fabric vertex connected to other end of the given fabric edge. ) { context.logger->log_trace("zeFabricEdgeGetVerticesExp(hEdge, phVertexA, phVertexB)"); auto pfnGetVerticesExp = context.zeDdiTable.FabricEdgeExp.pfnGetVerticesExp; if( nullptr == pfnGetVerticesExp ) return logAndPropagateResult("zeFabricEdgeGetVerticesExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricEdgeGetVerticesExpPrologue( hEdge, phVertexA, phVertexB ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricEdgeGetVerticesExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeFabricEdgeGetVerticesExpPrologue( hEdge, phVertexA, phVertexB ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricEdgeGetVerticesExp", result); } auto driver_result = pfnGetVerticesExp( hEdge, phVertexA, phVertexB ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricEdgeGetVerticesExpEpilogue( hEdge, phVertexA, phVertexB ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricEdgeGetVerticesExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phVertexA){ context.handleLifetime->addHandle( *phVertexA ); context.handleLifetime->addDependent( hEdge, *phVertexA ); } if (phVertexB){ context.handleLifetime->addHandle( *phVertexB ); context.handleLifetime->addDependent( hEdge, *phVertexB ); } } return logAndPropagateResult("zeFabricEdgeGetVerticesExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricEdgeGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeFabricEdgeGetPropertiesExp( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge ze_fabric_edge_exp_properties_t* pEdgeProperties///< [in,out] query result for fabric edge properties ) { context.logger->log_trace("zeFabricEdgeGetPropertiesExp(hEdge, pEdgeProperties)"); auto pfnGetPropertiesExp = context.zeDdiTable.FabricEdgeExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp ) return logAndPropagateResult("zeFabricEdgeGetPropertiesExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricEdgeGetPropertiesExpPrologue( hEdge, pEdgeProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricEdgeGetPropertiesExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeFabricEdgeGetPropertiesExpPrologue( hEdge, pEdgeProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricEdgeGetPropertiesExp", result); } auto driver_result = pfnGetPropertiesExp( hEdge, pEdgeProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeFabricEdgeGetPropertiesExpEpilogue( hEdge, pEdgeProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeFabricEdgeGetPropertiesExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeFabricEdgeGetPropertiesExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryKernelTimestampsExt __zedlllocal ze_result_t ZE_APICALL zeEventQueryKernelTimestampsExt( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of event packets available. ///< - This value is implementation specific. ///< - if `*pCount` is zero, then the driver shall update the value with ///< the total number of event packets available. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver shall update the value with the correct value. ///< - Buffer(s) for query results must be sized by the application to ///< accommodate a minimum of `*pCount` elements. ze_event_query_kernel_timestamps_results_ext_properties_t* pResults ///< [in,out][optional][range(0, *pCount)] pointer to event query ///< properties structure(s). ///< - This parameter may be null when `*pCount` is zero. ///< - if `*pCount` is less than the number of event packets available, ///< the driver may only update `*pCount` elements, starting at element zero. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver may only update the valid elements. ) { context.logger->log_trace("zeEventQueryKernelTimestampsExt(hEvent, hDevice, pCount, pResults)"); auto pfnQueryKernelTimestampsExt = context.zeDdiTable.Event.pfnQueryKernelTimestampsExt; if( nullptr == pfnQueryKernelTimestampsExt ) return logAndPropagateResult("zeEventQueryKernelTimestampsExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventQueryKernelTimestampsExtPrologue( hEvent, hDevice, pCount, pResults ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventQueryKernelTimestampsExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeEventQueryKernelTimestampsExtPrologue( hEvent, hDevice, pCount, pResults ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventQueryKernelTimestampsExt", result); } auto driver_result = pfnQueryKernelTimestampsExt( hEvent, hDevice, pCount, pResults ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeEventQueryKernelTimestampsExtEpilogue( hEvent, hDevice, pCount, pResults ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeEventQueryKernelTimestampsExt", result); } return logAndPropagateResult("zeEventQueryKernelTimestampsExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderCreateExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderCreateExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object const ze_rtas_builder_exp_desc_t* pDescriptor, ///< [in] pointer to builder descriptor ze_rtas_builder_exp_handle_t* phBuilder ///< [out] handle of builder object ) { context.logger->log_trace("zeRTASBuilderCreateExp(hDriver, pDescriptor, phBuilder)"); auto pfnCreateExp = context.zeDdiTable.RTASBuilderExp.pfnCreateExp; if( nullptr == pfnCreateExp ) return logAndPropagateResult("zeRTASBuilderCreateExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderCreateExpPrologue( hDriver, pDescriptor, phBuilder ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderCreateExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeRTASBuilderCreateExpPrologue( hDriver, pDescriptor, phBuilder ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderCreateExp", result); } auto driver_result = pfnCreateExp( hDriver, pDescriptor, phBuilder ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderCreateExpEpilogue( hDriver, pDescriptor, phBuilder ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderCreateExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phBuilder){ context.handleLifetime->addHandle( *phBuilder ); context.handleLifetime->addDependent( hDriver, *phBuilder ); } } return logAndPropagateResult("zeRTASBuilderCreateExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderGetBuildPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderGetBuildPropertiesExp( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor ze_rtas_builder_exp_properties_t* pProperties ///< [in,out] query result for builder properties ) { context.logger->log_trace("zeRTASBuilderGetBuildPropertiesExp(hBuilder, pBuildOpDescriptor, pProperties)"); auto pfnGetBuildPropertiesExp = context.zeDdiTable.RTASBuilderExp.pfnGetBuildPropertiesExp; if( nullptr == pfnGetBuildPropertiesExp ) return logAndPropagateResult("zeRTASBuilderGetBuildPropertiesExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderGetBuildPropertiesExpPrologue( hBuilder, pBuildOpDescriptor, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderGetBuildPropertiesExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeRTASBuilderGetBuildPropertiesExpPrologue( hBuilder, pBuildOpDescriptor, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderGetBuildPropertiesExp", result); } auto driver_result = pfnGetBuildPropertiesExp( hBuilder, pBuildOpDescriptor, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderGetBuildPropertiesExpEpilogue( hBuilder, pBuildOpDescriptor, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderGetBuildPropertiesExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeRTASBuilderGetBuildPropertiesExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverRTASFormatCompatibilityCheckExp __zedlllocal ze_result_t ZE_APICALL zeDriverRTASFormatCompatibilityCheckExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_format_exp_t rtasFormatA, ///< [in] operand A ze_rtas_format_exp_t rtasFormatB ///< [in] operand B ) { context.logger->log_trace("zeDriverRTASFormatCompatibilityCheckExp(hDriver, rtasFormatA, rtasFormatB)"); auto pfnRTASFormatCompatibilityCheckExp = context.zeDdiTable.DriverExp.pfnRTASFormatCompatibilityCheckExp; if( nullptr == pfnRTASFormatCompatibilityCheckExp ) return logAndPropagateResult("zeDriverRTASFormatCompatibilityCheckExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverRTASFormatCompatibilityCheckExpPrologue( hDriver, rtasFormatA, rtasFormatB ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverRTASFormatCompatibilityCheckExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeDriverRTASFormatCompatibilityCheckExpPrologue( hDriver, rtasFormatA, rtasFormatB ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverRTASFormatCompatibilityCheckExp", result); } auto driver_result = pfnRTASFormatCompatibilityCheckExp( hDriver, rtasFormatA, rtasFormatB ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeDriverRTASFormatCompatibilityCheckExpEpilogue( hDriver, rtasFormatA, rtasFormatB ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeDriverRTASFormatCompatibilityCheckExp", result); } return logAndPropagateResult("zeDriverRTASFormatCompatibilityCheckExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderBuildExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderBuildExp( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used ///< during acceleration structure construction size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes void* pRtasBuffer, ///< [in] pointer to destination buffer size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks ze_rtas_aabb_exp_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration ///< structure bounds size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in ///< bytes ) { context.logger->log_trace("zeRTASBuilderBuildExp(hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes)"); auto pfnBuildExp = context.zeDdiTable.RTASBuilderExp.pfnBuildExp; if( nullptr == pfnBuildExp ) return logAndPropagateResult("zeRTASBuilderBuildExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderBuildExpPrologue( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderBuildExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeRTASBuilderBuildExpPrologue( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderBuildExp", result); } auto driver_result = pfnBuildExp( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderBuildExpEpilogue( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderBuildExp", result); } return logAndPropagateResult("zeRTASBuilderBuildExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderDestroyExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderDestroyExp( ze_rtas_builder_exp_handle_t hBuilder ///< [in][release] handle of builder object to destroy ) { context.logger->log_trace("zeRTASBuilderDestroyExp(hBuilder)"); auto pfnDestroyExp = context.zeDdiTable.RTASBuilderExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) return logAndPropagateResult("zeRTASBuilderDestroyExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderDestroyExpPrologue( hBuilder ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderDestroyExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeRTASBuilderDestroyExpPrologue( hBuilder ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderDestroyExp", result); } auto driver_result = pfnDestroyExp( hBuilder ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASBuilderDestroyExpEpilogue( hBuilder ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASBuilderDestroyExp", result); } return logAndPropagateResult("zeRTASBuilderDestroyExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationCreateExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationCreateExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_parallel_operation_exp_handle_t* phParallelOperation///< [out] handle of parallel operation object ) { context.logger->log_trace("zeRTASParallelOperationCreateExp(hDriver, phParallelOperation)"); auto pfnCreateExp = context.zeDdiTable.RTASParallelOperationExp.pfnCreateExp; if( nullptr == pfnCreateExp ) return logAndPropagateResult("zeRTASParallelOperationCreateExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationCreateExpPrologue( hDriver, phParallelOperation ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationCreateExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeRTASParallelOperationCreateExpPrologue( hDriver, phParallelOperation ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationCreateExp", result); } auto driver_result = pfnCreateExp( hDriver, phParallelOperation ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationCreateExpEpilogue( hDriver, phParallelOperation ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationCreateExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phParallelOperation){ context.handleLifetime->addHandle( *phParallelOperation ); context.handleLifetime->addDependent( hDriver, *phParallelOperation ); } } return logAndPropagateResult("zeRTASParallelOperationCreateExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationGetPropertiesExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in] handle of parallel operation object ze_rtas_parallel_operation_exp_properties_t* pProperties///< [in,out] query result for parallel operation properties ) { context.logger->log_trace("zeRTASParallelOperationGetPropertiesExp(hParallelOperation, pProperties)"); auto pfnGetPropertiesExp = context.zeDdiTable.RTASParallelOperationExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp ) return logAndPropagateResult("zeRTASParallelOperationGetPropertiesExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationGetPropertiesExpPrologue( hParallelOperation, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationGetPropertiesExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeRTASParallelOperationGetPropertiesExpPrologue( hParallelOperation, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationGetPropertiesExp", result); } auto driver_result = pfnGetPropertiesExp( hParallelOperation, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationGetPropertiesExpEpilogue( hParallelOperation, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationGetPropertiesExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeRTASParallelOperationGetPropertiesExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationJoinExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationJoinExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in] handle of parallel operation object ) { context.logger->log_trace("zeRTASParallelOperationJoinExp(hParallelOperation)"); auto pfnJoinExp = context.zeDdiTable.RTASParallelOperationExp.pfnJoinExp; if( nullptr == pfnJoinExp ) return logAndPropagateResult("zeRTASParallelOperationJoinExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationJoinExpPrologue( hParallelOperation ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationJoinExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeRTASParallelOperationJoinExpPrologue( hParallelOperation ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationJoinExp", result); } auto driver_result = pfnJoinExp( hParallelOperation ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationJoinExpEpilogue( hParallelOperation ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationJoinExp", result); } return logAndPropagateResult("zeRTASParallelOperationJoinExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationDestroyExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationDestroyExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy ) { context.logger->log_trace("zeRTASParallelOperationDestroyExp(hParallelOperation)"); auto pfnDestroyExp = context.zeDdiTable.RTASParallelOperationExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) return logAndPropagateResult("zeRTASParallelOperationDestroyExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationDestroyExpPrologue( hParallelOperation ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationDestroyExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeRTASParallelOperationDestroyExpPrologue( hParallelOperation ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationDestroyExp", result); } auto driver_result = pfnDestroyExp( hParallelOperation ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeRTASParallelOperationDestroyExpEpilogue( hParallelOperation ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeRTASParallelOperationDestroyExp", result); } return logAndPropagateResult("zeRTASParallelOperationDestroyExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetPitchFor2dImage __zedlllocal ze_result_t ZE_APICALL zeMemGetPitchFor2dImage( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device size_t imageWidth, ///< [in] imageWidth size_t imageHeight, ///< [in] imageHeight unsigned int elementSizeInBytes, ///< [in] Element size in bytes size_t * rowPitch ///< [out] rowPitch ) { context.logger->log_trace("zeMemGetPitchFor2dImage(hContext, hDevice, imageWidth, imageHeight, elementSizeInBytes, rowPitch)"); auto pfnGetPitchFor2dImage = context.zeDdiTable.Mem.pfnGetPitchFor2dImage; if( nullptr == pfnGetPitchFor2dImage ) return logAndPropagateResult("zeMemGetPitchFor2dImage", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetPitchFor2dImagePrologue( hContext, hDevice, imageWidth, imageHeight, elementSizeInBytes, rowPitch ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetPitchFor2dImage", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeMemGetPitchFor2dImagePrologue( hContext, hDevice, imageWidth, imageHeight, elementSizeInBytes, rowPitch ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetPitchFor2dImage", result); } auto driver_result = pfnGetPitchFor2dImage( hContext, hDevice, imageWidth, imageHeight, elementSizeInBytes, rowPitch ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeMemGetPitchFor2dImageEpilogue( hContext, hDevice, imageWidth, imageHeight, elementSizeInBytes, rowPitch ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeMemGetPitchFor2dImage", result); } return logAndPropagateResult("zeMemGetPitchFor2dImage", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetDeviceOffsetExp __zedlllocal ze_result_t ZE_APICALL zeImageGetDeviceOffsetExp( ze_image_handle_t hImage, ///< [in] handle of the image uint64_t* pDeviceOffset ///< [out] bindless device offset for image ) { context.logger->log_trace("zeImageGetDeviceOffsetExp(hImage, pDeviceOffset)"); auto pfnGetDeviceOffsetExp = context.zeDdiTable.ImageExp.pfnGetDeviceOffsetExp; if( nullptr == pfnGetDeviceOffsetExp ) return logAndPropagateResult("zeImageGetDeviceOffsetExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageGetDeviceOffsetExpPrologue( hImage, pDeviceOffset ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageGetDeviceOffsetExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeImageGetDeviceOffsetExpPrologue( hImage, pDeviceOffset ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageGetDeviceOffsetExp", result); } auto driver_result = pfnGetDeviceOffsetExp( hImage, pDeviceOffset ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeImageGetDeviceOffsetExpEpilogue( hImage, pDeviceOffset ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeImageGetDeviceOffsetExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeImageGetDeviceOffsetExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListCreateCloneExp __zedlllocal ze_result_t ZE_APICALL zeCommandListCreateCloneExp( ze_command_list_handle_t hCommandList, ///< [in] handle to source command list (the command list to clone) ze_command_list_handle_t* phClonedCommandList ///< [out] pointer to handle of the cloned command list ) { context.logger->log_trace("zeCommandListCreateCloneExp(hCommandList, phClonedCommandList)"); auto pfnCreateCloneExp = context.zeDdiTable.CommandListExp.pfnCreateCloneExp; if( nullptr == pfnCreateCloneExp ) return logAndPropagateResult("zeCommandListCreateCloneExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListCreateCloneExpPrologue( hCommandList, phClonedCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListCreateCloneExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListCreateCloneExpPrologue( hCommandList, phClonedCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListCreateCloneExp", result); } auto driver_result = pfnCreateCloneExp( hCommandList, phClonedCommandList ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListCreateCloneExpEpilogue( hCommandList, phClonedCommandList ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListCreateCloneExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phClonedCommandList){ context.handleLifetime->addHandle( *phClonedCommandList ); context.handleLifetime->addDependent( hCommandList, *phClonedCommandList ); } } return logAndPropagateResult("zeCommandListCreateCloneExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListImmediateAppendCommandListsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListImmediateAppendCommandListsExp( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t numCommandLists, ///< [in] number of command lists ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion ///< - if not null, this event is signaled after the completion of all ///< appended command lists uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended ///< command lists; must be 0 if nullptr == phWaitEvents ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing appended command lists. ///< - if not null, all wait events must be satisfied prior to the start ///< of any appended command list(s) ) { context.logger->log_trace("zeCommandListImmediateAppendCommandListsExp(hCommandListImmediate, numCommandLists, phCommandListsLocal, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnImmediateAppendCommandListsExp = context.zeDdiTable.CommandListExp.pfnImmediateAppendCommandListsExp; if( nullptr == pfnImmediateAppendCommandListsExp ) return logAndPropagateResult("zeCommandListImmediateAppendCommandListsExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListImmediateAppendCommandListsExpPrologue( hCommandListImmediate, numCommandLists, phCommandLists, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListImmediateAppendCommandListsExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListImmediateAppendCommandListsExpPrologue( hCommandListImmediate, numCommandLists, phCommandLists, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListImmediateAppendCommandListsExp", result); } auto driver_result = pfnImmediateAppendCommandListsExp( hCommandListImmediate, numCommandLists, phCommandLists, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListImmediateAppendCommandListsExpEpilogue( hCommandListImmediate, numCommandLists, phCommandLists, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListImmediateAppendCommandListsExp", result); } return logAndPropagateResult("zeCommandListImmediateAppendCommandListsExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdExp __zedlllocal ze_result_t ZE_APICALL zeCommandListGetNextCommandIdExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in] pointer to mutable command identifier descriptor uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { context.logger->log_trace("zeCommandListGetNextCommandIdExp(hCommandList, desc, pCommandId)"); auto pfnGetNextCommandIdExp = context.zeDdiTable.CommandListExp.pfnGetNextCommandIdExp; if( nullptr == pfnGetNextCommandIdExp ) return logAndPropagateResult("zeCommandListGetNextCommandIdExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListGetNextCommandIdExpPrologue( hCommandList, desc, pCommandId ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetNextCommandIdExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListGetNextCommandIdExpPrologue( hCommandList, desc, pCommandId ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetNextCommandIdExp", result); } auto driver_result = pfnGetNextCommandIdExp( hCommandList, desc, pCommandId ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListGetNextCommandIdExpEpilogue( hCommandList, desc, pCommandId ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetNextCommandIdExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeCommandListGetNextCommandIdExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdWithKernelsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListGetNextCommandIdWithKernelsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in][out] pointer to mutable command identifier descriptor uint32_t numKernels, ///< [in][optional] number of entries on phKernels list ze_kernel_handle_t* phKernels, ///< [in][optional][range(0, numKernels)] list of kernels that user can ///< switch between using ::zeCommandListUpdateMutableCommandKernelsExp ///< call uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { context.logger->log_trace("zeCommandListGetNextCommandIdWithKernelsExp(hCommandList, desc, numKernels, phKernelsLocal, pCommandId)"); auto pfnGetNextCommandIdWithKernelsExp = context.zeDdiTable.CommandListExp.pfnGetNextCommandIdWithKernelsExp; if( nullptr == pfnGetNextCommandIdWithKernelsExp ) return logAndPropagateResult("zeCommandListGetNextCommandIdWithKernelsExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListGetNextCommandIdWithKernelsExpPrologue( hCommandList, desc, numKernels, phKernels, pCommandId ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetNextCommandIdWithKernelsExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListGetNextCommandIdWithKernelsExpPrologue( hCommandList, desc, numKernels, phKernels, pCommandId ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetNextCommandIdWithKernelsExp", result); } auto driver_result = pfnGetNextCommandIdWithKernelsExp( hCommandList, desc, numKernels, phKernels, pCommandId ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListGetNextCommandIdWithKernelsExpEpilogue( hCommandList, desc, numKernels, phKernels, pCommandId ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListGetNextCommandIdWithKernelsExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zeCommandListGetNextCommandIdWithKernelsExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_commands_exp_desc_t* desc ///< [in] pointer to mutable commands descriptor; multiple descriptors may ///< be chained via `pNext` member ) { context.logger->log_trace("zeCommandListUpdateMutableCommandsExp(hCommandList, desc)"); auto pfnUpdateMutableCommandsExp = context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandsExp; if( nullptr == pfnUpdateMutableCommandsExp ) return logAndPropagateResult("zeCommandListUpdateMutableCommandsExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListUpdateMutableCommandsExpPrologue( hCommandList, desc ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListUpdateMutableCommandsExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListUpdateMutableCommandsExpPrologue( hCommandList, desc ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListUpdateMutableCommandsExp", result); } auto driver_result = pfnUpdateMutableCommandsExp( hCommandList, desc ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListUpdateMutableCommandsExpEpilogue( hCommandList, desc ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListUpdateMutableCommandsExp", result); } return logAndPropagateResult("zeCommandListUpdateMutableCommandsExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandSignalEventExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandSignalEventExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier ze_event_handle_t hSignalEvent ///< [in][optional] handle of the event to signal on completion ) { context.logger->log_trace("zeCommandListUpdateMutableCommandSignalEventExp(hCommandList, commandId, hSignalEvent)"); auto pfnUpdateMutableCommandSignalEventExp = context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandSignalEventExp; if( nullptr == pfnUpdateMutableCommandSignalEventExp ) return logAndPropagateResult("zeCommandListUpdateMutableCommandSignalEventExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListUpdateMutableCommandSignalEventExpPrologue( hCommandList, commandId, hSignalEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListUpdateMutableCommandSignalEventExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListUpdateMutableCommandSignalEventExpPrologue( hCommandList, commandId, hSignalEvent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListUpdateMutableCommandSignalEventExp", result); } auto driver_result = pfnUpdateMutableCommandSignalEventExp( hCommandList, commandId, hSignalEvent ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListUpdateMutableCommandSignalEventExpEpilogue( hCommandList, commandId, hSignalEvent ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListUpdateMutableCommandSignalEventExp", result); } return logAndPropagateResult("zeCommandListUpdateMutableCommandSignalEventExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandWaitEventsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandWaitEventsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier uint32_t numWaitEvents, ///< [in][optional] the number of wait events ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { context.logger->log_trace("zeCommandListUpdateMutableCommandWaitEventsExp(hCommandList, commandId, numWaitEvents, phWaitEventsLocal)"); auto pfnUpdateMutableCommandWaitEventsExp = context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandWaitEventsExp; if( nullptr == pfnUpdateMutableCommandWaitEventsExp ) return logAndPropagateResult("zeCommandListUpdateMutableCommandWaitEventsExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListUpdateMutableCommandWaitEventsExpPrologue( hCommandList, commandId, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListUpdateMutableCommandWaitEventsExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListUpdateMutableCommandWaitEventsExpPrologue( hCommandList, commandId, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListUpdateMutableCommandWaitEventsExp", result); } auto driver_result = pfnUpdateMutableCommandWaitEventsExp( hCommandList, commandId, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListUpdateMutableCommandWaitEventsExpEpilogue( hCommandList, commandId, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListUpdateMutableCommandWaitEventsExp", result); } return logAndPropagateResult("zeCommandListUpdateMutableCommandWaitEventsExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandKernelsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandKernelsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] the number of kernels to update uint64_t* pCommandId, ///< [in][range(0, numKernels)] command identifier ze_kernel_handle_t* phKernels ///< [in][range(0, numKernels)] handle of the kernel for a command ///< identifier to switch to ) { context.logger->log_trace("zeCommandListUpdateMutableCommandKernelsExp(hCommandList, numKernels, pCommandId, phKernelsLocal)"); auto pfnUpdateMutableCommandKernelsExp = context.zeDdiTable.CommandListExp.pfnUpdateMutableCommandKernelsExp; if( nullptr == pfnUpdateMutableCommandKernelsExp ) return logAndPropagateResult("zeCommandListUpdateMutableCommandKernelsExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListUpdateMutableCommandKernelsExpPrologue( hCommandList, numKernels, pCommandId, phKernels ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListUpdateMutableCommandKernelsExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zeHandleLifetime.zeCommandListUpdateMutableCommandKernelsExpPrologue( hCommandList, numKernels, pCommandId, phKernels ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListUpdateMutableCommandKernelsExp", result); } auto driver_result = pfnUpdateMutableCommandKernelsExp( hCommandList, numKernels, pCommandId, phKernels ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zeValidation->zeCommandListUpdateMutableCommandKernelsExpEpilogue( hCommandList, numKernels, pCommandId, phKernels ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zeCommandListUpdateMutableCommandKernelsExp", result); } return logAndPropagateResult("zeCommandListUpdateMutableCommandKernelsExp", driver_result); } } // namespace validation_layer #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Global table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetGlobalProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_global_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.Global; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnInit = pDdiTable->pfnInit; pDdiTable->pfnInit = validation_layer::zeInit; dditable.pfnInitDrivers = pDdiTable->pfnInitDrivers; pDdiTable->pfnInitDrivers = validation_layer::zeInitDrivers; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASBuilderExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetRTASBuilderExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_rtas_builder_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.RTASBuilderExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreateExp = pDdiTable->pfnCreateExp; pDdiTable->pfnCreateExp = validation_layer::zeRTASBuilderCreateExp; dditable.pfnGetBuildPropertiesExp = pDdiTable->pfnGetBuildPropertiesExp; pDdiTable->pfnGetBuildPropertiesExp = validation_layer::zeRTASBuilderGetBuildPropertiesExp; dditable.pfnBuildExp = pDdiTable->pfnBuildExp; pDdiTable->pfnBuildExp = validation_layer::zeRTASBuilderBuildExp; dditable.pfnDestroyExp = pDdiTable->pfnDestroyExp; pDdiTable->pfnDestroyExp = validation_layer::zeRTASBuilderDestroyExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASParallelOperationExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetRTASParallelOperationExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_rtas_parallel_operation_exp_dditable_t* pDdiTable///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.RTASParallelOperationExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreateExp = pDdiTable->pfnCreateExp; pDdiTable->pfnCreateExp = validation_layer::zeRTASParallelOperationCreateExp; dditable.pfnGetPropertiesExp = pDdiTable->pfnGetPropertiesExp; pDdiTable->pfnGetPropertiesExp = validation_layer::zeRTASParallelOperationGetPropertiesExp; dditable.pfnJoinExp = pDdiTable->pfnJoinExp; pDdiTable->pfnJoinExp = validation_layer::zeRTASParallelOperationJoinExp; dditable.pfnDestroyExp = pDdiTable->pfnDestroyExp; pDdiTable->pfnDestroyExp = validation_layer::zeRTASParallelOperationDestroyExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Driver table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDriverProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_driver_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.Driver; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGet = pDdiTable->pfnGet; pDdiTable->pfnGet = validation_layer::zeDriverGet; dditable.pfnGetApiVersion = pDdiTable->pfnGetApiVersion; pDdiTable->pfnGetApiVersion = validation_layer::zeDriverGetApiVersion; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zeDriverGetProperties; dditable.pfnGetIpcProperties = pDdiTable->pfnGetIpcProperties; pDdiTable->pfnGetIpcProperties = validation_layer::zeDriverGetIpcProperties; dditable.pfnGetExtensionProperties = pDdiTable->pfnGetExtensionProperties; pDdiTable->pfnGetExtensionProperties = validation_layer::zeDriverGetExtensionProperties; dditable.pfnGetExtensionFunctionAddress = pDdiTable->pfnGetExtensionFunctionAddress; pDdiTable->pfnGetExtensionFunctionAddress = validation_layer::zeDriverGetExtensionFunctionAddress; dditable.pfnGetLastErrorDescription = pDdiTable->pfnGetLastErrorDescription; pDdiTable->pfnGetLastErrorDescription = validation_layer::zeDriverGetLastErrorDescription; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DriverExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDriverExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_driver_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.DriverExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnRTASFormatCompatibilityCheckExp = pDdiTable->pfnRTASFormatCompatibilityCheckExp; pDdiTable->pfnRTASFormatCompatibilityCheckExp = validation_layer::zeDriverRTASFormatCompatibilityCheckExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.Device; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGet = pDdiTable->pfnGet; pDdiTable->pfnGet = validation_layer::zeDeviceGet; dditable.pfnGetSubDevices = pDdiTable->pfnGetSubDevices; pDdiTable->pfnGetSubDevices = validation_layer::zeDeviceGetSubDevices; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zeDeviceGetProperties; dditable.pfnGetComputeProperties = pDdiTable->pfnGetComputeProperties; pDdiTable->pfnGetComputeProperties = validation_layer::zeDeviceGetComputeProperties; dditable.pfnGetModuleProperties = pDdiTable->pfnGetModuleProperties; pDdiTable->pfnGetModuleProperties = validation_layer::zeDeviceGetModuleProperties; dditable.pfnGetCommandQueueGroupProperties = pDdiTable->pfnGetCommandQueueGroupProperties; pDdiTable->pfnGetCommandQueueGroupProperties = validation_layer::zeDeviceGetCommandQueueGroupProperties; dditable.pfnGetMemoryProperties = pDdiTable->pfnGetMemoryProperties; pDdiTable->pfnGetMemoryProperties = validation_layer::zeDeviceGetMemoryProperties; dditable.pfnGetMemoryAccessProperties = pDdiTable->pfnGetMemoryAccessProperties; pDdiTable->pfnGetMemoryAccessProperties = validation_layer::zeDeviceGetMemoryAccessProperties; dditable.pfnGetCacheProperties = pDdiTable->pfnGetCacheProperties; pDdiTable->pfnGetCacheProperties = validation_layer::zeDeviceGetCacheProperties; dditable.pfnGetImageProperties = pDdiTable->pfnGetImageProperties; pDdiTable->pfnGetImageProperties = validation_layer::zeDeviceGetImageProperties; dditable.pfnGetExternalMemoryProperties = pDdiTable->pfnGetExternalMemoryProperties; pDdiTable->pfnGetExternalMemoryProperties = validation_layer::zeDeviceGetExternalMemoryProperties; dditable.pfnGetP2PProperties = pDdiTable->pfnGetP2PProperties; pDdiTable->pfnGetP2PProperties = validation_layer::zeDeviceGetP2PProperties; dditable.pfnCanAccessPeer = pDdiTable->pfnCanAccessPeer; pDdiTable->pfnCanAccessPeer = validation_layer::zeDeviceCanAccessPeer; dditable.pfnGetStatus = pDdiTable->pfnGetStatus; pDdiTable->pfnGetStatus = validation_layer::zeDeviceGetStatus; dditable.pfnGetGlobalTimestamps = pDdiTable->pfnGetGlobalTimestamps; pDdiTable->pfnGetGlobalTimestamps = validation_layer::zeDeviceGetGlobalTimestamps; dditable.pfnImportExternalSemaphoreExt = pDdiTable->pfnImportExternalSemaphoreExt; pDdiTable->pfnImportExternalSemaphoreExt = validation_layer::zeDeviceImportExternalSemaphoreExt; dditable.pfnReleaseExternalSemaphoreExt = pDdiTable->pfnReleaseExternalSemaphoreExt; pDdiTable->pfnReleaseExternalSemaphoreExt = validation_layer::zeDeviceReleaseExternalSemaphoreExt; dditable.pfnReserveCacheExt = pDdiTable->pfnReserveCacheExt; pDdiTable->pfnReserveCacheExt = validation_layer::zeDeviceReserveCacheExt; dditable.pfnSetCacheAdviceExt = pDdiTable->pfnSetCacheAdviceExt; pDdiTable->pfnSetCacheAdviceExt = validation_layer::zeDeviceSetCacheAdviceExt; dditable.pfnPciGetPropertiesExt = pDdiTable->pfnPciGetPropertiesExt; pDdiTable->pfnPciGetPropertiesExt = validation_layer::zeDevicePciGetPropertiesExt; dditable.pfnGetRootDevice = pDdiTable->pfnGetRootDevice; pDdiTable->pfnGetRootDevice = validation_layer::zeDeviceGetRootDevice; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.DeviceExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetFabricVertexExp = pDdiTable->pfnGetFabricVertexExp; pDdiTable->pfnGetFabricVertexExp = validation_layer::zeDeviceGetFabricVertexExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Context table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetContextProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_context_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.Context; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zeContextCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zeContextDestroy; dditable.pfnGetStatus = pDdiTable->pfnGetStatus; pDdiTable->pfnGetStatus = validation_layer::zeContextGetStatus; dditable.pfnSystemBarrier = pDdiTable->pfnSystemBarrier; pDdiTable->pfnSystemBarrier = validation_layer::zeContextSystemBarrier; dditable.pfnMakeMemoryResident = pDdiTable->pfnMakeMemoryResident; pDdiTable->pfnMakeMemoryResident = validation_layer::zeContextMakeMemoryResident; dditable.pfnEvictMemory = pDdiTable->pfnEvictMemory; pDdiTable->pfnEvictMemory = validation_layer::zeContextEvictMemory; dditable.pfnMakeImageResident = pDdiTable->pfnMakeImageResident; pDdiTable->pfnMakeImageResident = validation_layer::zeContextMakeImageResident; dditable.pfnEvictImage = pDdiTable->pfnEvictImage; pDdiTable->pfnEvictImage = validation_layer::zeContextEvictImage; dditable.pfnCreateEx = pDdiTable->pfnCreateEx; pDdiTable->pfnCreateEx = validation_layer::zeContextCreateEx; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandQueue table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandQueueProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_queue_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.CommandQueue; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zeCommandQueueCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zeCommandQueueDestroy; dditable.pfnExecuteCommandLists = pDdiTable->pfnExecuteCommandLists; pDdiTable->pfnExecuteCommandLists = validation_layer::zeCommandQueueExecuteCommandLists; dditable.pfnSynchronize = pDdiTable->pfnSynchronize; pDdiTable->pfnSynchronize = validation_layer::zeCommandQueueSynchronize; dditable.pfnGetOrdinal = pDdiTable->pfnGetOrdinal; pDdiTable->pfnGetOrdinal = validation_layer::zeCommandQueueGetOrdinal; dditable.pfnGetIndex = pDdiTable->pfnGetIndex; pDdiTable->pfnGetIndex = validation_layer::zeCommandQueueGetIndex; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandList table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandListProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_list_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.CommandList; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zeCommandListCreate; dditable.pfnCreateImmediate = pDdiTable->pfnCreateImmediate; pDdiTable->pfnCreateImmediate = validation_layer::zeCommandListCreateImmediate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zeCommandListDestroy; dditable.pfnClose = pDdiTable->pfnClose; pDdiTable->pfnClose = validation_layer::zeCommandListClose; dditable.pfnReset = pDdiTable->pfnReset; pDdiTable->pfnReset = validation_layer::zeCommandListReset; dditable.pfnAppendWriteGlobalTimestamp = pDdiTable->pfnAppendWriteGlobalTimestamp; pDdiTable->pfnAppendWriteGlobalTimestamp = validation_layer::zeCommandListAppendWriteGlobalTimestamp; dditable.pfnAppendBarrier = pDdiTable->pfnAppendBarrier; pDdiTable->pfnAppendBarrier = validation_layer::zeCommandListAppendBarrier; dditable.pfnAppendMemoryRangesBarrier = pDdiTable->pfnAppendMemoryRangesBarrier; pDdiTable->pfnAppendMemoryRangesBarrier = validation_layer::zeCommandListAppendMemoryRangesBarrier; dditable.pfnAppendMemoryCopy = pDdiTable->pfnAppendMemoryCopy; pDdiTable->pfnAppendMemoryCopy = validation_layer::zeCommandListAppendMemoryCopy; dditable.pfnAppendMemoryFill = pDdiTable->pfnAppendMemoryFill; pDdiTable->pfnAppendMemoryFill = validation_layer::zeCommandListAppendMemoryFill; dditable.pfnAppendMemoryCopyRegion = pDdiTable->pfnAppendMemoryCopyRegion; pDdiTable->pfnAppendMemoryCopyRegion = validation_layer::zeCommandListAppendMemoryCopyRegion; dditable.pfnAppendMemoryCopyFromContext = pDdiTable->pfnAppendMemoryCopyFromContext; pDdiTable->pfnAppendMemoryCopyFromContext = validation_layer::zeCommandListAppendMemoryCopyFromContext; dditable.pfnAppendImageCopy = pDdiTable->pfnAppendImageCopy; pDdiTable->pfnAppendImageCopy = validation_layer::zeCommandListAppendImageCopy; dditable.pfnAppendImageCopyRegion = pDdiTable->pfnAppendImageCopyRegion; pDdiTable->pfnAppendImageCopyRegion = validation_layer::zeCommandListAppendImageCopyRegion; dditable.pfnAppendImageCopyToMemory = pDdiTable->pfnAppendImageCopyToMemory; pDdiTable->pfnAppendImageCopyToMemory = validation_layer::zeCommandListAppendImageCopyToMemory; dditable.pfnAppendImageCopyFromMemory = pDdiTable->pfnAppendImageCopyFromMemory; pDdiTable->pfnAppendImageCopyFromMemory = validation_layer::zeCommandListAppendImageCopyFromMemory; dditable.pfnAppendMemoryPrefetch = pDdiTable->pfnAppendMemoryPrefetch; pDdiTable->pfnAppendMemoryPrefetch = validation_layer::zeCommandListAppendMemoryPrefetch; dditable.pfnAppendMemAdvise = pDdiTable->pfnAppendMemAdvise; pDdiTable->pfnAppendMemAdvise = validation_layer::zeCommandListAppendMemAdvise; dditable.pfnAppendSignalEvent = pDdiTable->pfnAppendSignalEvent; pDdiTable->pfnAppendSignalEvent = validation_layer::zeCommandListAppendSignalEvent; dditable.pfnAppendWaitOnEvents = pDdiTable->pfnAppendWaitOnEvents; pDdiTable->pfnAppendWaitOnEvents = validation_layer::zeCommandListAppendWaitOnEvents; dditable.pfnAppendEventReset = pDdiTable->pfnAppendEventReset; pDdiTable->pfnAppendEventReset = validation_layer::zeCommandListAppendEventReset; dditable.pfnAppendQueryKernelTimestamps = pDdiTable->pfnAppendQueryKernelTimestamps; pDdiTable->pfnAppendQueryKernelTimestamps = validation_layer::zeCommandListAppendQueryKernelTimestamps; dditable.pfnAppendLaunchKernel = pDdiTable->pfnAppendLaunchKernel; pDdiTable->pfnAppendLaunchKernel = validation_layer::zeCommandListAppendLaunchKernel; dditable.pfnAppendLaunchCooperativeKernel = pDdiTable->pfnAppendLaunchCooperativeKernel; pDdiTable->pfnAppendLaunchCooperativeKernel = validation_layer::zeCommandListAppendLaunchCooperativeKernel; dditable.pfnAppendLaunchKernelIndirect = pDdiTable->pfnAppendLaunchKernelIndirect; pDdiTable->pfnAppendLaunchKernelIndirect = validation_layer::zeCommandListAppendLaunchKernelIndirect; dditable.pfnAppendLaunchMultipleKernelsIndirect = pDdiTable->pfnAppendLaunchMultipleKernelsIndirect; pDdiTable->pfnAppendLaunchMultipleKernelsIndirect = validation_layer::zeCommandListAppendLaunchMultipleKernelsIndirect; dditable.pfnAppendSignalExternalSemaphoreExt = pDdiTable->pfnAppendSignalExternalSemaphoreExt; pDdiTable->pfnAppendSignalExternalSemaphoreExt = validation_layer::zeCommandListAppendSignalExternalSemaphoreExt; dditable.pfnAppendWaitExternalSemaphoreExt = pDdiTable->pfnAppendWaitExternalSemaphoreExt; pDdiTable->pfnAppendWaitExternalSemaphoreExt = validation_layer::zeCommandListAppendWaitExternalSemaphoreExt; dditable.pfnAppendImageCopyToMemoryExt = pDdiTable->pfnAppendImageCopyToMemoryExt; pDdiTable->pfnAppendImageCopyToMemoryExt = validation_layer::zeCommandListAppendImageCopyToMemoryExt; dditable.pfnAppendImageCopyFromMemoryExt = pDdiTable->pfnAppendImageCopyFromMemoryExt; pDdiTable->pfnAppendImageCopyFromMemoryExt = validation_layer::zeCommandListAppendImageCopyFromMemoryExt; dditable.pfnHostSynchronize = pDdiTable->pfnHostSynchronize; pDdiTable->pfnHostSynchronize = validation_layer::zeCommandListHostSynchronize; dditable.pfnGetDeviceHandle = pDdiTable->pfnGetDeviceHandle; pDdiTable->pfnGetDeviceHandle = validation_layer::zeCommandListGetDeviceHandle; dditable.pfnGetContextHandle = pDdiTable->pfnGetContextHandle; pDdiTable->pfnGetContextHandle = validation_layer::zeCommandListGetContextHandle; dditable.pfnGetOrdinal = pDdiTable->pfnGetOrdinal; pDdiTable->pfnGetOrdinal = validation_layer::zeCommandListGetOrdinal; dditable.pfnImmediateGetIndex = pDdiTable->pfnImmediateGetIndex; pDdiTable->pfnImmediateGetIndex = validation_layer::zeCommandListImmediateGetIndex; dditable.pfnIsImmediate = pDdiTable->pfnIsImmediate; pDdiTable->pfnIsImmediate = validation_layer::zeCommandListIsImmediate; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandListExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandListExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_list_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.CommandListExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetNextCommandIdWithKernelsExp = pDdiTable->pfnGetNextCommandIdWithKernelsExp; pDdiTable->pfnGetNextCommandIdWithKernelsExp = validation_layer::zeCommandListGetNextCommandIdWithKernelsExp; dditable.pfnUpdateMutableCommandKernelsExp = pDdiTable->pfnUpdateMutableCommandKernelsExp; pDdiTable->pfnUpdateMutableCommandKernelsExp = validation_layer::zeCommandListUpdateMutableCommandKernelsExp; dditable.pfnCreateCloneExp = pDdiTable->pfnCreateCloneExp; pDdiTable->pfnCreateCloneExp = validation_layer::zeCommandListCreateCloneExp; dditable.pfnImmediateAppendCommandListsExp = pDdiTable->pfnImmediateAppendCommandListsExp; pDdiTable->pfnImmediateAppendCommandListsExp = validation_layer::zeCommandListImmediateAppendCommandListsExp; dditable.pfnGetNextCommandIdExp = pDdiTable->pfnGetNextCommandIdExp; pDdiTable->pfnGetNextCommandIdExp = validation_layer::zeCommandListGetNextCommandIdExp; dditable.pfnUpdateMutableCommandsExp = pDdiTable->pfnUpdateMutableCommandsExp; pDdiTable->pfnUpdateMutableCommandsExp = validation_layer::zeCommandListUpdateMutableCommandsExp; dditable.pfnUpdateMutableCommandSignalEventExp = pDdiTable->pfnUpdateMutableCommandSignalEventExp; pDdiTable->pfnUpdateMutableCommandSignalEventExp = validation_layer::zeCommandListUpdateMutableCommandSignalEventExp; dditable.pfnUpdateMutableCommandWaitEventsExp = pDdiTable->pfnUpdateMutableCommandWaitEventsExp; pDdiTable->pfnUpdateMutableCommandWaitEventsExp = validation_layer::zeCommandListUpdateMutableCommandWaitEventsExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Event table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.Event; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zeEventCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zeEventDestroy; dditable.pfnHostSignal = pDdiTable->pfnHostSignal; pDdiTable->pfnHostSignal = validation_layer::zeEventHostSignal; dditable.pfnHostSynchronize = pDdiTable->pfnHostSynchronize; pDdiTable->pfnHostSynchronize = validation_layer::zeEventHostSynchronize; dditable.pfnQueryStatus = pDdiTable->pfnQueryStatus; pDdiTable->pfnQueryStatus = validation_layer::zeEventQueryStatus; dditable.pfnHostReset = pDdiTable->pfnHostReset; pDdiTable->pfnHostReset = validation_layer::zeEventHostReset; dditable.pfnQueryKernelTimestamp = pDdiTable->pfnQueryKernelTimestamp; pDdiTable->pfnQueryKernelTimestamp = validation_layer::zeEventQueryKernelTimestamp; dditable.pfnQueryKernelTimestampsExt = pDdiTable->pfnQueryKernelTimestampsExt; pDdiTable->pfnQueryKernelTimestampsExt = validation_layer::zeEventQueryKernelTimestampsExt; dditable.pfnGetEventPool = pDdiTable->pfnGetEventPool; pDdiTable->pfnGetEventPool = validation_layer::zeEventGetEventPool; dditable.pfnGetSignalScope = pDdiTable->pfnGetSignalScope; pDdiTable->pfnGetSignalScope = validation_layer::zeEventGetSignalScope; dditable.pfnGetWaitScope = pDdiTable->pfnGetWaitScope; pDdiTable->pfnGetWaitScope = validation_layer::zeEventGetWaitScope; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's EventExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.EventExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnQueryTimestampsExp = pDdiTable->pfnQueryTimestampsExp; pDdiTable->pfnQueryTimestampsExp = validation_layer::zeEventQueryTimestampsExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's EventPool table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventPoolProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_pool_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.EventPool; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zeEventPoolCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zeEventPoolDestroy; dditable.pfnGetIpcHandle = pDdiTable->pfnGetIpcHandle; pDdiTable->pfnGetIpcHandle = validation_layer::zeEventPoolGetIpcHandle; dditable.pfnOpenIpcHandle = pDdiTable->pfnOpenIpcHandle; pDdiTable->pfnOpenIpcHandle = validation_layer::zeEventPoolOpenIpcHandle; dditable.pfnCloseIpcHandle = pDdiTable->pfnCloseIpcHandle; pDdiTable->pfnCloseIpcHandle = validation_layer::zeEventPoolCloseIpcHandle; dditable.pfnPutIpcHandle = pDdiTable->pfnPutIpcHandle; pDdiTable->pfnPutIpcHandle = validation_layer::zeEventPoolPutIpcHandle; dditable.pfnGetContextHandle = pDdiTable->pfnGetContextHandle; pDdiTable->pfnGetContextHandle = validation_layer::zeEventPoolGetContextHandle; dditable.pfnGetFlags = pDdiTable->pfnGetFlags; pDdiTable->pfnGetFlags = validation_layer::zeEventPoolGetFlags; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Fence table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFenceProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fence_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.Fence; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zeFenceCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zeFenceDestroy; dditable.pfnHostSynchronize = pDdiTable->pfnHostSynchronize; pDdiTable->pfnHostSynchronize = validation_layer::zeFenceHostSynchronize; dditable.pfnQueryStatus = pDdiTable->pfnQueryStatus; pDdiTable->pfnQueryStatus = validation_layer::zeFenceQueryStatus; dditable.pfnReset = pDdiTable->pfnReset; pDdiTable->pfnReset = validation_layer::zeFenceReset; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Image table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetImageProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_image_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.Image; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zeImageGetProperties; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zeImageCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zeImageDestroy; dditable.pfnGetAllocPropertiesExt = pDdiTable->pfnGetAllocPropertiesExt; pDdiTable->pfnGetAllocPropertiesExt = validation_layer::zeImageGetAllocPropertiesExt; dditable.pfnViewCreateExt = pDdiTable->pfnViewCreateExt; pDdiTable->pfnViewCreateExt = validation_layer::zeImageViewCreateExt; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ImageExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetImageExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_image_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.ImageExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetMemoryPropertiesExp = pDdiTable->pfnGetMemoryPropertiesExp; pDdiTable->pfnGetMemoryPropertiesExp = validation_layer::zeImageGetMemoryPropertiesExp; dditable.pfnViewCreateExp = pDdiTable->pfnViewCreateExp; pDdiTable->pfnViewCreateExp = validation_layer::zeImageViewCreateExp; dditable.pfnGetDeviceOffsetExp = pDdiTable->pfnGetDeviceOffsetExp; pDdiTable->pfnGetDeviceOffsetExp = validation_layer::zeImageGetDeviceOffsetExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Kernel table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetKernelProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_kernel_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.Kernel; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zeKernelCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zeKernelDestroy; dditable.pfnSetCacheConfig = pDdiTable->pfnSetCacheConfig; pDdiTable->pfnSetCacheConfig = validation_layer::zeKernelSetCacheConfig; dditable.pfnSetGroupSize = pDdiTable->pfnSetGroupSize; pDdiTable->pfnSetGroupSize = validation_layer::zeKernelSetGroupSize; dditable.pfnSuggestGroupSize = pDdiTable->pfnSuggestGroupSize; pDdiTable->pfnSuggestGroupSize = validation_layer::zeKernelSuggestGroupSize; dditable.pfnSuggestMaxCooperativeGroupCount = pDdiTable->pfnSuggestMaxCooperativeGroupCount; pDdiTable->pfnSuggestMaxCooperativeGroupCount = validation_layer::zeKernelSuggestMaxCooperativeGroupCount; dditable.pfnSetArgumentValue = pDdiTable->pfnSetArgumentValue; pDdiTable->pfnSetArgumentValue = validation_layer::zeKernelSetArgumentValue; dditable.pfnSetIndirectAccess = pDdiTable->pfnSetIndirectAccess; pDdiTable->pfnSetIndirectAccess = validation_layer::zeKernelSetIndirectAccess; dditable.pfnGetIndirectAccess = pDdiTable->pfnGetIndirectAccess; pDdiTable->pfnGetIndirectAccess = validation_layer::zeKernelGetIndirectAccess; dditable.pfnGetSourceAttributes = pDdiTable->pfnGetSourceAttributes; pDdiTable->pfnGetSourceAttributes = validation_layer::zeKernelGetSourceAttributes; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zeKernelGetProperties; dditable.pfnGetName = pDdiTable->pfnGetName; pDdiTable->pfnGetName = validation_layer::zeKernelGetName; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's KernelExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetKernelExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_kernel_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.KernelExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnSetGlobalOffsetExp = pDdiTable->pfnSetGlobalOffsetExp; pDdiTable->pfnSetGlobalOffsetExp = validation_layer::zeKernelSetGlobalOffsetExp; dditable.pfnGetBinaryExp = pDdiTable->pfnGetBinaryExp; pDdiTable->pfnGetBinaryExp = validation_layer::zeKernelGetBinaryExp; dditable.pfnSchedulingHintExp = pDdiTable->pfnSchedulingHintExp; pDdiTable->pfnSchedulingHintExp = validation_layer::zeKernelSchedulingHintExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Mem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.Mem; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnAllocShared = pDdiTable->pfnAllocShared; pDdiTable->pfnAllocShared = validation_layer::zeMemAllocShared; dditable.pfnAllocDevice = pDdiTable->pfnAllocDevice; pDdiTable->pfnAllocDevice = validation_layer::zeMemAllocDevice; dditable.pfnAllocHost = pDdiTable->pfnAllocHost; pDdiTable->pfnAllocHost = validation_layer::zeMemAllocHost; dditable.pfnFree = pDdiTable->pfnFree; pDdiTable->pfnFree = validation_layer::zeMemFree; dditable.pfnGetAllocProperties = pDdiTable->pfnGetAllocProperties; pDdiTable->pfnGetAllocProperties = validation_layer::zeMemGetAllocProperties; dditable.pfnGetAddressRange = pDdiTable->pfnGetAddressRange; pDdiTable->pfnGetAddressRange = validation_layer::zeMemGetAddressRange; dditable.pfnGetIpcHandle = pDdiTable->pfnGetIpcHandle; pDdiTable->pfnGetIpcHandle = validation_layer::zeMemGetIpcHandle; dditable.pfnOpenIpcHandle = pDdiTable->pfnOpenIpcHandle; pDdiTable->pfnOpenIpcHandle = validation_layer::zeMemOpenIpcHandle; dditable.pfnCloseIpcHandle = pDdiTable->pfnCloseIpcHandle; pDdiTable->pfnCloseIpcHandle = validation_layer::zeMemCloseIpcHandle; dditable.pfnFreeExt = pDdiTable->pfnFreeExt; pDdiTable->pfnFreeExt = validation_layer::zeMemFreeExt; dditable.pfnPutIpcHandle = pDdiTable->pfnPutIpcHandle; pDdiTable->pfnPutIpcHandle = validation_layer::zeMemPutIpcHandle; dditable.pfnGetPitchFor2dImage = pDdiTable->pfnGetPitchFor2dImage; pDdiTable->pfnGetPitchFor2dImage = validation_layer::zeMemGetPitchFor2dImage; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MemExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetMemExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_mem_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.MemExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetIpcHandleFromFileDescriptorExp = pDdiTable->pfnGetIpcHandleFromFileDescriptorExp; pDdiTable->pfnGetIpcHandleFromFileDescriptorExp = validation_layer::zeMemGetIpcHandleFromFileDescriptorExp; dditable.pfnGetFileDescriptorFromIpcHandleExp = pDdiTable->pfnGetFileDescriptorFromIpcHandleExp; pDdiTable->pfnGetFileDescriptorFromIpcHandleExp = validation_layer::zeMemGetFileDescriptorFromIpcHandleExp; dditable.pfnSetAtomicAccessAttributeExp = pDdiTable->pfnSetAtomicAccessAttributeExp; pDdiTable->pfnSetAtomicAccessAttributeExp = validation_layer::zeMemSetAtomicAccessAttributeExp; dditable.pfnGetAtomicAccessAttributeExp = pDdiTable->pfnGetAtomicAccessAttributeExp; pDdiTable->pfnGetAtomicAccessAttributeExp = validation_layer::zeMemGetAtomicAccessAttributeExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Module table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetModuleProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_module_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.Module; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zeModuleCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zeModuleDestroy; dditable.pfnDynamicLink = pDdiTable->pfnDynamicLink; pDdiTable->pfnDynamicLink = validation_layer::zeModuleDynamicLink; dditable.pfnGetNativeBinary = pDdiTable->pfnGetNativeBinary; pDdiTable->pfnGetNativeBinary = validation_layer::zeModuleGetNativeBinary; dditable.pfnGetGlobalPointer = pDdiTable->pfnGetGlobalPointer; pDdiTable->pfnGetGlobalPointer = validation_layer::zeModuleGetGlobalPointer; dditable.pfnGetKernelNames = pDdiTable->pfnGetKernelNames; pDdiTable->pfnGetKernelNames = validation_layer::zeModuleGetKernelNames; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zeModuleGetProperties; dditable.pfnGetFunctionPointer = pDdiTable->pfnGetFunctionPointer; pDdiTable->pfnGetFunctionPointer = validation_layer::zeModuleGetFunctionPointer; dditable.pfnInspectLinkageExt = pDdiTable->pfnInspectLinkageExt; pDdiTable->pfnInspectLinkageExt = validation_layer::zeModuleInspectLinkageExt; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ModuleBuildLog table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetModuleBuildLogProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_module_build_log_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.ModuleBuildLog; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zeModuleBuildLogDestroy; dditable.pfnGetString = pDdiTable->pfnGetString; pDdiTable->pfnGetString = validation_layer::zeModuleBuildLogGetString; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's PhysicalMem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetPhysicalMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_physical_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.PhysicalMem; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zePhysicalMemCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zePhysicalMemDestroy; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Sampler table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetSamplerProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_sampler_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.Sampler; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zeSamplerCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zeSamplerDestroy; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's VirtualMem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetVirtualMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_virtual_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.VirtualMem; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnReserve = pDdiTable->pfnReserve; pDdiTable->pfnReserve = validation_layer::zeVirtualMemReserve; dditable.pfnFree = pDdiTable->pfnFree; pDdiTable->pfnFree = validation_layer::zeVirtualMemFree; dditable.pfnQueryPageSize = pDdiTable->pfnQueryPageSize; pDdiTable->pfnQueryPageSize = validation_layer::zeVirtualMemQueryPageSize; dditable.pfnMap = pDdiTable->pfnMap; pDdiTable->pfnMap = validation_layer::zeVirtualMemMap; dditable.pfnUnmap = pDdiTable->pfnUnmap; pDdiTable->pfnUnmap = validation_layer::zeVirtualMemUnmap; dditable.pfnSetAccessAttribute = pDdiTable->pfnSetAccessAttribute; pDdiTable->pfnSetAccessAttribute = validation_layer::zeVirtualMemSetAccessAttribute; dditable.pfnGetAccessAttribute = pDdiTable->pfnGetAccessAttribute; pDdiTable->pfnGetAccessAttribute = validation_layer::zeVirtualMemGetAccessAttribute; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricEdgeExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFabricEdgeExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fabric_edge_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.FabricEdgeExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetExp = pDdiTable->pfnGetExp; pDdiTable->pfnGetExp = validation_layer::zeFabricEdgeGetExp; dditable.pfnGetVerticesExp = pDdiTable->pfnGetVerticesExp; pDdiTable->pfnGetVerticesExp = validation_layer::zeFabricEdgeGetVerticesExp; dditable.pfnGetPropertiesExp = pDdiTable->pfnGetPropertiesExp; pDdiTable->pfnGetPropertiesExp = validation_layer::zeFabricEdgeGetPropertiesExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricVertexExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFabricVertexExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fabric_vertex_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zeDdiTable.FabricVertexExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetExp = pDdiTable->pfnGetExp; pDdiTable->pfnGetExp = validation_layer::zeFabricVertexGetExp; dditable.pfnGetSubVerticesExp = pDdiTable->pfnGetSubVerticesExp; pDdiTable->pfnGetSubVerticesExp = validation_layer::zeFabricVertexGetSubVerticesExp; dditable.pfnGetPropertiesExp = pDdiTable->pfnGetPropertiesExp; pDdiTable->pfnGetPropertiesExp = validation_layer::zeFabricVertexGetPropertiesExp; dditable.pfnGetDeviceExp = pDdiTable->pfnGetDeviceExp; pDdiTable->pfnGetDeviceExp = validation_layer::zeFabricVertexGetDeviceExp; return result; } #if defined(__cplusplus) }; #endif level-zero-1.20.6/source/layers/validation/ze_validation_layer.cpp000066400000000000000000000030341475521542100253530ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_validation_layer.cpp * */ #include "ze_validation_layer.h" #include "param_validation.h" #include namespace validation_layer { context_t& context = context_t::getInstance(); /////////////////////////////////////////////////////////////////////////////// context_t::context_t() { enableHandleLifetime = getenv_tobool( "ZE_ENABLE_HANDLE_LIFETIME" ); if (enableHandleLifetime) { handleLifetime = std::make_unique(); } enableThreadingValidation = getenv_tobool( "ZE_ENABLE_THREADING_VALIDATION" ); logger = loader::createLogger(); } /////////////////////////////////////////////////////////////////////////////// context_t::~context_t() { validationHandlers.clear(); } } // namespace validation_layer #if defined(__cplusplus) extern "C" { #endif ZE_DLLEXPORT ze_result_t ZE_APICALL zelLoaderGetVersion(zel_component_version_t *version) { if(version == nullptr) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; string_copy_s(version->component_name, VALIDATION_COMP_NAME, ZEL_COMPONENT_STRING_SIZE); version->spec_version = ZE_API_VERSION_CURRENT; version->component_lib_version.major = LOADER_VERSION_MAJOR; version->component_lib_version.minor = LOADER_VERSION_MINOR; version->component_lib_version.patch = LOADER_VERSION_PATCH; return ZE_RESULT_SUCCESS; } #if defined(__cplusplus) }; #endif level-zero-1.20.6/source/layers/validation/ze_validation_layer.h000066400000000000000000000027631475521542100250300ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_layer.h * */ #pragma once #include "ze_ddi.h" #include "zet_ddi.h" #include "zes_ddi.h" #include "ze_util.h" #include "loader/ze_loader.h" #include "handle_lifetime.h" #include "ze_entry_points.h" #include "zet_entry_points.h" #include "zes_entry_points.h" #include "logging.h" #include #include #define VALIDATION_COMP_NAME "validation layer" namespace validation_layer { /////////////////////////////////////////////////////////////////////////////// class validationChecker { public: ZEValidationEntryPoints *zeValidation; ZESValidationEntryPoints *zesValidation; ZETValidationEntryPoints *zetValidation; }; class __zedlllocal context_t { public: ze_api_version_t version = ZE_API_VERSION_CURRENT; bool enableHandleLifetime = false; bool enableThreadingValidation = false; ze_dditable_t zeDdiTable = {}; zet_dditable_t zetDdiTable = {}; zes_dditable_t zesDdiTable = {}; std::vector validationHandlers; std::unique_ptr handleLifetime; std::shared_ptr logger; static context_t& getInstance() { static context_t instance; return instance; } context_t(); ~context_t(); }; extern context_t& context; } // namespace validation_layer level-zero-1.20.6/source/layers/validation/zes_valddi.cpp000066400000000000000000014425761475521542100234760ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See valddi.cpp.mako for modifications * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_valddi.cpp * */ #include "ze_validation_layer.h" namespace validation_layer { static ze_result_t logAndPropagateResult(const char* fname, ze_result_t result) { if (result != ZE_RESULT_SUCCESS) { context.logger->log_trace("Error (" + loader::to_string(result) + ") in " + std::string(fname)); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesInit __zedlllocal ze_result_t ZE_APICALL zesInit( zes_init_flags_t flags ///< [in] initialization flags. ///< currently unused, must be 0 (default). ) { context.logger->log_trace("zesInit(flags)"); auto pfnInit = context.zesDdiTable.Global.pfnInit; if( nullptr == pfnInit ) return logAndPropagateResult("zesInit", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesInitPrologue( flags ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesInit", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesInitPrologue( flags ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesInit", result); } auto driver_result = pfnInit( flags ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesInitEpilogue( flags ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesInit", result); } return logAndPropagateResult("zesInit", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverGet __zedlllocal ze_result_t ZE_APICALL zesDriverGet( uint32_t* pCount, ///< [in,out] pointer to the number of sysman driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of sysman drivers available. ///< if count is greater than the number of sysman drivers available, then ///< the loader shall update the value with the correct number of sysman ///< drivers available. zes_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of sysman driver instance handles. ///< if count is less than the number of sysman drivers available, then the ///< loader shall only retrieve that number of sysman drivers. ) { context.logger->log_trace("zesDriverGet(pCount, phDrivers)"); auto pfnGet = context.zesDdiTable.Driver.pfnGet; if( nullptr == pfnGet ) return logAndPropagateResult("zesDriverGet", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDriverGetPrologue( pCount, phDrivers ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverGet", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDriverGetPrologue( pCount, phDrivers ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverGet", result); } auto driver_result = pfnGet( pCount, phDrivers ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDriverGetEpilogue( pCount, phDrivers ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverGet", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phDrivers) && (i < *pCount); ++i){ if (phDrivers[i]){ context.handleLifetime->addHandle( phDrivers[i] ); context.handleLifetime->addDependent( pCount, phDrivers[i] ); } } } return logAndPropagateResult("zesDriverGet", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverGetExtensionProperties __zedlllocal ze_result_t ZE_APICALL zesDriverGetExtensionProperties( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. zes_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { context.logger->log_trace("zesDriverGetExtensionProperties(hDriver, pCount, pExtensionProperties)"); auto pfnGetExtensionProperties = context.zesDdiTable.Driver.pfnGetExtensionProperties; if( nullptr == pfnGetExtensionProperties ) return logAndPropagateResult("zesDriverGetExtensionProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDriverGetExtensionPropertiesPrologue( hDriver, pCount, pExtensionProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverGetExtensionProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDriverGetExtensionPropertiesPrologue( hDriver, pCount, pExtensionProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverGetExtensionProperties", result); } auto driver_result = pfnGetExtensionProperties( hDriver, pCount, pExtensionProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDriverGetExtensionPropertiesEpilogue( hDriver, pCount, pExtensionProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverGetExtensionProperties", result); } return logAndPropagateResult("zesDriverGetExtensionProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverGetExtensionFunctionAddress __zedlllocal ze_result_t ZE_APICALL zesDriverGetExtensionFunctionAddress( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { context.logger->log_trace("zesDriverGetExtensionFunctionAddress(hDriver, name, ppFunctionAddress)"); auto pfnGetExtensionFunctionAddress = context.zesDdiTable.Driver.pfnGetExtensionFunctionAddress; if( nullptr == pfnGetExtensionFunctionAddress ) return logAndPropagateResult("zesDriverGetExtensionFunctionAddress", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDriverGetExtensionFunctionAddressPrologue( hDriver, name, ppFunctionAddress ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverGetExtensionFunctionAddress", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDriverGetExtensionFunctionAddressPrologue( hDriver, name, ppFunctionAddress ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverGetExtensionFunctionAddress", result); } auto driver_result = pfnGetExtensionFunctionAddress( hDriver, name, ppFunctionAddress ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDriverGetExtensionFunctionAddressEpilogue( hDriver, name, ppFunctionAddress ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverGetExtensionFunctionAddress", result); } return logAndPropagateResult("zesDriverGetExtensionFunctionAddress", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGet __zedlllocal ze_result_t ZE_APICALL zesDeviceGet( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance uint32_t* pCount, ///< [in,out] pointer to the number of sysman devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sysman devices available. ///< if count is greater than the number of sysman devices available, then ///< the driver shall update the value with the correct number of sysman ///< devices available. zes_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of sysman devices. ///< if count is less than the number of sysman devices available, then ///< driver shall only retrieve that number of sysman devices. ) { context.logger->log_trace("zesDeviceGet(hDriver, pCount, phDevices)"); auto pfnGet = context.zesDdiTable.Device.pfnGet; if( nullptr == pfnGet ) return logAndPropagateResult("zesDeviceGet", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetPrologue( hDriver, pCount, phDevices ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGet", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceGetPrologue( hDriver, pCount, phDevices ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGet", result); } auto driver_result = pfnGet( hDriver, pCount, phDevices ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetEpilogue( hDriver, pCount, phDevices ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGet", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phDevices) && (i < *pCount); ++i){ if (phDevices[i]){ context.handleLifetime->addHandle( phDevices[i] ); context.handleLifetime->addDependent( hDriver, phDevices[i] ); } } } return logAndPropagateResult("zesDeviceGet", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetProperties __zedlllocal ze_result_t ZE_APICALL zesDeviceGetProperties( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_properties_t* pProperties ///< [in,out] Structure that will contain information about the device. ) { context.logger->log_trace("zesDeviceGetProperties(hDevice, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Device.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesDeviceGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetPropertiesPrologue( hDevice, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceGetPropertiesPrologue( hDevice, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetProperties", result); } auto driver_result = pfnGetProperties( hDevice, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetPropertiesEpilogue( hDevice, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetProperties", result); } return logAndPropagateResult("zesDeviceGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetState __zedlllocal ze_result_t ZE_APICALL zesDeviceGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_state_t* pState ///< [in,out] Structure that will contain information about the device. ) { context.logger->log_trace("zesDeviceGetState(hDevice, pState)"); auto pfnGetState = context.zesDdiTable.Device.pfnGetState; if( nullptr == pfnGetState ) return logAndPropagateResult("zesDeviceGetState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetStatePrologue( hDevice, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceGetStatePrologue( hDevice, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetState", result); } auto driver_result = pfnGetState( hDevice, pState ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetStateEpilogue( hDevice, pState ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetState", result); } return logAndPropagateResult("zesDeviceGetState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceReset __zedlllocal ze_result_t ZE_APICALL zesDeviceReset( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device ze_bool_t force ///< [in] If set to true, all applications that are currently using the ///< device will be forcibly killed. ) { context.logger->log_trace("zesDeviceReset(hDevice, force)"); auto pfnReset = context.zesDdiTable.Device.pfnReset; if( nullptr == pfnReset ) return logAndPropagateResult("zesDeviceReset", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceResetPrologue( hDevice, force ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceReset", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceResetPrologue( hDevice, force ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceReset", result); } auto driver_result = pfnReset( hDevice, force ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceResetEpilogue( hDevice, force ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceReset", result); } return logAndPropagateResult("zesDeviceReset", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceResetExt __zedlllocal ze_result_t ZE_APICALL zesDeviceResetExt( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device zes_reset_properties_t* pProperties ///< [in] Device reset properties to apply ) { context.logger->log_trace("zesDeviceResetExt(hDevice, pProperties)"); auto pfnResetExt = context.zesDdiTable.Device.pfnResetExt; if( nullptr == pfnResetExt ) return logAndPropagateResult("zesDeviceResetExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceResetExtPrologue( hDevice, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceResetExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceResetExtPrologue( hDevice, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceResetExt", result); } auto driver_result = pfnResetExt( hDevice, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceResetExtEpilogue( hDevice, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceResetExt", result); } return logAndPropagateResult("zesDeviceResetExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceProcessesGetState __zedlllocal ze_result_t ZE_APICALL zesDeviceProcessesGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device uint32_t* pCount, ///< [in,out] pointer to the number of processes. ///< if count is zero, then the driver shall update the value with the ///< total number of processes currently attached to the device. ///< if count is greater than the number of processes currently attached to ///< the device, then the driver shall update the value with the correct ///< number of processes. zes_process_state_t* pProcesses ///< [in,out][optional][range(0, *pCount)] array of process information. ///< if count is less than the number of processes currently attached to ///< the device, then the driver shall only retrieve information about that ///< number of processes. In this case, the return code will ::ZE_RESULT_ERROR_INVALID_SIZE. ) { context.logger->log_trace("zesDeviceProcessesGetState(hDevice, pCount, pProcesses)"); auto pfnProcessesGetState = context.zesDdiTable.Device.pfnProcessesGetState; if( nullptr == pfnProcessesGetState ) return logAndPropagateResult("zesDeviceProcessesGetState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceProcessesGetStatePrologue( hDevice, pCount, pProcesses ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceProcessesGetState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceProcessesGetStatePrologue( hDevice, pCount, pProcesses ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceProcessesGetState", result); } auto driver_result = pfnProcessesGetState( hDevice, pCount, pProcesses ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceProcessesGetStateEpilogue( hDevice, pCount, pProcesses ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceProcessesGetState", result); } return logAndPropagateResult("zesDeviceProcessesGetState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDevicePciGetProperties __zedlllocal ze_result_t ZE_APICALL zesDevicePciGetProperties( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_properties_t* pProperties ///< [in,out] Will contain the PCI properties. ) { context.logger->log_trace("zesDevicePciGetProperties(hDevice, pProperties)"); auto pfnPciGetProperties = context.zesDdiTable.Device.pfnPciGetProperties; if( nullptr == pfnPciGetProperties ) return logAndPropagateResult("zesDevicePciGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDevicePciGetPropertiesPrologue( hDevice, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDevicePciGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDevicePciGetPropertiesPrologue( hDevice, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDevicePciGetProperties", result); } auto driver_result = pfnPciGetProperties( hDevice, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDevicePciGetPropertiesEpilogue( hDevice, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDevicePciGetProperties", result); } return logAndPropagateResult("zesDevicePciGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDevicePciGetState __zedlllocal ze_result_t ZE_APICALL zesDevicePciGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_state_t* pState ///< [in,out] Will contain the PCI properties. ) { context.logger->log_trace("zesDevicePciGetState(hDevice, pState)"); auto pfnPciGetState = context.zesDdiTable.Device.pfnPciGetState; if( nullptr == pfnPciGetState ) return logAndPropagateResult("zesDevicePciGetState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDevicePciGetStatePrologue( hDevice, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDevicePciGetState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDevicePciGetStatePrologue( hDevice, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDevicePciGetState", result); } auto driver_result = pfnPciGetState( hDevice, pState ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDevicePciGetStateEpilogue( hDevice, pState ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDevicePciGetState", result); } return logAndPropagateResult("zesDevicePciGetState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDevicePciGetBars __zedlllocal ze_result_t ZE_APICALL zesDevicePciGetBars( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of PCI bars. ///< if count is zero, then the driver shall update the value with the ///< total number of PCI bars that are setup. ///< if count is greater than the number of PCI bars that are setup, then ///< the driver shall update the value with the correct number of PCI bars. zes_pci_bar_properties_t* pProperties ///< [in,out][optional][range(0, *pCount)] array of information about setup ///< PCI bars. ///< if count is less than the number of PCI bars that are setup, then the ///< driver shall only retrieve information about that number of PCI bars. ) { context.logger->log_trace("zesDevicePciGetBars(hDevice, pCount, pProperties)"); auto pfnPciGetBars = context.zesDdiTable.Device.pfnPciGetBars; if( nullptr == pfnPciGetBars ) return logAndPropagateResult("zesDevicePciGetBars", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDevicePciGetBarsPrologue( hDevice, pCount, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDevicePciGetBars", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDevicePciGetBarsPrologue( hDevice, pCount, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDevicePciGetBars", result); } auto driver_result = pfnPciGetBars( hDevice, pCount, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDevicePciGetBarsEpilogue( hDevice, pCount, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDevicePciGetBars", result); } return logAndPropagateResult("zesDevicePciGetBars", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDevicePciGetStats __zedlllocal ze_result_t ZE_APICALL zesDevicePciGetStats( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_stats_t* pStats ///< [in,out] Will contain a snapshot of the latest stats. ) { context.logger->log_trace("zesDevicePciGetStats(hDevice, pStats)"); auto pfnPciGetStats = context.zesDdiTable.Device.pfnPciGetStats; if( nullptr == pfnPciGetStats ) return logAndPropagateResult("zesDevicePciGetStats", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDevicePciGetStatsPrologue( hDevice, pStats ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDevicePciGetStats", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDevicePciGetStatsPrologue( hDevice, pStats ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDevicePciGetStats", result); } auto driver_result = pfnPciGetStats( hDevice, pStats ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDevicePciGetStatsEpilogue( hDevice, pStats ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDevicePciGetStats", result); } return logAndPropagateResult("zesDevicePciGetStats", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceSetOverclockWaiver __zedlllocal ze_result_t ZE_APICALL zesDeviceSetOverclockWaiver( zes_device_handle_t hDevice ///< [in] Sysman handle of the device. ) { context.logger->log_trace("zesDeviceSetOverclockWaiver(hDevice)"); auto pfnSetOverclockWaiver = context.zesDdiTable.Device.pfnSetOverclockWaiver; if( nullptr == pfnSetOverclockWaiver ) return logAndPropagateResult("zesDeviceSetOverclockWaiver", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceSetOverclockWaiverPrologue( hDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceSetOverclockWaiver", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceSetOverclockWaiverPrologue( hDevice ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceSetOverclockWaiver", result); } auto driver_result = pfnSetOverclockWaiver( hDevice ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceSetOverclockWaiverEpilogue( hDevice ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceSetOverclockWaiver", result); } return logAndPropagateResult("zesDeviceSetOverclockWaiver", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetOverclockDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceGetOverclockDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pOverclockDomains ///< [in,out] Returns the overclock domains that are supported (a bit for ///< each of enum ::zes_overclock_domain_t). If no bits are set, the device ///< doesn't support overclocking. ) { context.logger->log_trace("zesDeviceGetOverclockDomains(hDevice, pOverclockDomains)"); auto pfnGetOverclockDomains = context.zesDdiTable.Device.pfnGetOverclockDomains; if( nullptr == pfnGetOverclockDomains ) return logAndPropagateResult("zesDeviceGetOverclockDomains", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetOverclockDomainsPrologue( hDevice, pOverclockDomains ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetOverclockDomains", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceGetOverclockDomainsPrologue( hDevice, pOverclockDomains ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetOverclockDomains", result); } auto driver_result = pfnGetOverclockDomains( hDevice, pOverclockDomains ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetOverclockDomainsEpilogue( hDevice, pOverclockDomains ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetOverclockDomains", result); } return logAndPropagateResult("zesDeviceGetOverclockDomains", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetOverclockControls __zedlllocal ze_result_t ZE_APICALL zesDeviceGetOverclockControls( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_domain_t domainType, ///< [in] Domain type. uint32_t* pAvailableControls ///< [in,out] Returns the overclock controls that are supported for the ///< specified overclock domain (a bit for each of enum ///< ::zes_overclock_control_t). ) { context.logger->log_trace("zesDeviceGetOverclockControls(hDevice, domainType, pAvailableControls)"); auto pfnGetOverclockControls = context.zesDdiTable.Device.pfnGetOverclockControls; if( nullptr == pfnGetOverclockControls ) return logAndPropagateResult("zesDeviceGetOverclockControls", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetOverclockControlsPrologue( hDevice, domainType, pAvailableControls ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetOverclockControls", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceGetOverclockControlsPrologue( hDevice, domainType, pAvailableControls ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetOverclockControls", result); } auto driver_result = pfnGetOverclockControls( hDevice, domainType, pAvailableControls ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetOverclockControlsEpilogue( hDevice, domainType, pAvailableControls ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetOverclockControls", result); } return logAndPropagateResult("zesDeviceGetOverclockControls", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceResetOverclockSettings __zedlllocal ze_result_t ZE_APICALL zesDeviceResetOverclockSettings( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. ze_bool_t onShippedState ///< [in] True will reset to shipped state; false will reset to ///< manufacturing state ) { context.logger->log_trace("zesDeviceResetOverclockSettings(hDevice, onShippedState)"); auto pfnResetOverclockSettings = context.zesDdiTable.Device.pfnResetOverclockSettings; if( nullptr == pfnResetOverclockSettings ) return logAndPropagateResult("zesDeviceResetOverclockSettings", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceResetOverclockSettingsPrologue( hDevice, onShippedState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceResetOverclockSettings", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceResetOverclockSettingsPrologue( hDevice, onShippedState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceResetOverclockSettings", result); } auto driver_result = pfnResetOverclockSettings( hDevice, onShippedState ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceResetOverclockSettingsEpilogue( hDevice, onShippedState ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceResetOverclockSettings", result); } return logAndPropagateResult("zesDeviceResetOverclockSettings", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceReadOverclockState __zedlllocal ze_result_t ZE_APICALL zesDeviceReadOverclockState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_mode_t* pOverclockMode, ///< [out] One of overclock mode. ze_bool_t* pWaiverSetting, ///< [out] Waiver setting: 0 = Waiver not set, 1 = waiver has been set. ze_bool_t* pOverclockState, ///< [out] Current settings 0 =manufacturing state, 1= shipped state).. zes_pending_action_t* pPendingAction, ///< [out] This enum is returned when the driver attempts to set an ///< overclock control or reset overclock settings. ze_bool_t* pPendingReset ///< [out] Pending reset 0 =manufacturing state, 1= shipped state).. ) { context.logger->log_trace("zesDeviceReadOverclockState(hDevice, pOverclockMode, pWaiverSetting, pOverclockState, pPendingAction, pPendingReset)"); auto pfnReadOverclockState = context.zesDdiTable.Device.pfnReadOverclockState; if( nullptr == pfnReadOverclockState ) return logAndPropagateResult("zesDeviceReadOverclockState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceReadOverclockStatePrologue( hDevice, pOverclockMode, pWaiverSetting, pOverclockState, pPendingAction, pPendingReset ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceReadOverclockState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceReadOverclockStatePrologue( hDevice, pOverclockMode, pWaiverSetting, pOverclockState, pPendingAction, pPendingReset ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceReadOverclockState", result); } auto driver_result = pfnReadOverclockState( hDevice, pOverclockMode, pWaiverSetting, pOverclockState, pPendingAction, pPendingReset ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceReadOverclockStateEpilogue( hDevice, pOverclockMode, pWaiverSetting, pOverclockState, pPendingAction, pPendingReset ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceReadOverclockState", result); } return logAndPropagateResult("zesDeviceReadOverclockState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumOverclockDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumOverclockDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_overclock_handle_t* phDomainHandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumOverclockDomains(hDevice, pCount, phDomainHandle)"); auto pfnEnumOverclockDomains = context.zesDdiTable.Device.pfnEnumOverclockDomains; if( nullptr == pfnEnumOverclockDomains ) return logAndPropagateResult("zesDeviceEnumOverclockDomains", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumOverclockDomainsPrologue( hDevice, pCount, phDomainHandle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumOverclockDomains", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumOverclockDomainsPrologue( hDevice, pCount, phDomainHandle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumOverclockDomains", result); } auto driver_result = pfnEnumOverclockDomains( hDevice, pCount, phDomainHandle ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumOverclockDomainsEpilogue( hDevice, pCount, phDomainHandle ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumOverclockDomains", result); } return logAndPropagateResult("zesDeviceEnumOverclockDomains", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetDomainProperties __zedlllocal ze_result_t ZE_APICALL zesOverclockGetDomainProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_properties_t* pDomainProperties ///< [in,out] The overclock properties for the specified domain. ) { context.logger->log_trace("zesOverclockGetDomainProperties(hDomainHandle, pDomainProperties)"); auto pfnGetDomainProperties = context.zesDdiTable.Overclock.pfnGetDomainProperties; if( nullptr == pfnGetDomainProperties ) return logAndPropagateResult("zesOverclockGetDomainProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetDomainPropertiesPrologue( hDomainHandle, pDomainProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetDomainProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesOverclockGetDomainPropertiesPrologue( hDomainHandle, pDomainProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetDomainProperties", result); } auto driver_result = pfnGetDomainProperties( hDomainHandle, pDomainProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetDomainPropertiesEpilogue( hDomainHandle, pDomainProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetDomainProperties", result); } return logAndPropagateResult("zesOverclockGetDomainProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetDomainVFProperties __zedlllocal ze_result_t ZE_APICALL zesOverclockGetDomainVFProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_property_t* pVFProperties ///< [in,out] The VF min,max,step for a specified domain. ) { context.logger->log_trace("zesOverclockGetDomainVFProperties(hDomainHandle, pVFProperties)"); auto pfnGetDomainVFProperties = context.zesDdiTable.Overclock.pfnGetDomainVFProperties; if( nullptr == pfnGetDomainVFProperties ) return logAndPropagateResult("zesOverclockGetDomainVFProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetDomainVFPropertiesPrologue( hDomainHandle, pVFProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetDomainVFProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesOverclockGetDomainVFPropertiesPrologue( hDomainHandle, pVFProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetDomainVFProperties", result); } auto driver_result = pfnGetDomainVFProperties( hDomainHandle, pVFProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetDomainVFPropertiesEpilogue( hDomainHandle, pVFProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetDomainVFProperties", result); } return logAndPropagateResult("zesOverclockGetDomainVFProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetDomainControlProperties __zedlllocal ze_result_t ZE_APICALL zesOverclockGetDomainControlProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Handle for the component. zes_control_property_t* pControlProperties ///< [in,out] overclock control values. ) { context.logger->log_trace("zesOverclockGetDomainControlProperties(hDomainHandle, DomainControl, pControlProperties)"); auto pfnGetDomainControlProperties = context.zesDdiTable.Overclock.pfnGetDomainControlProperties; if( nullptr == pfnGetDomainControlProperties ) return logAndPropagateResult("zesOverclockGetDomainControlProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetDomainControlPropertiesPrologue( hDomainHandle, DomainControl, pControlProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetDomainControlProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesOverclockGetDomainControlPropertiesPrologue( hDomainHandle, DomainControl, pControlProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetDomainControlProperties", result); } auto driver_result = pfnGetDomainControlProperties( hDomainHandle, DomainControl, pControlProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetDomainControlPropertiesEpilogue( hDomainHandle, DomainControl, pControlProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetDomainControlProperties", result); } return logAndPropagateResult("zesOverclockGetDomainControlProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetControlCurrentValue __zedlllocal ze_result_t ZE_APICALL zesOverclockGetControlCurrentValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [in,out] Getting overclock control value for the specified control. ) { context.logger->log_trace("zesOverclockGetControlCurrentValue(hDomainHandle, DomainControl, pValue)"); auto pfnGetControlCurrentValue = context.zesDdiTable.Overclock.pfnGetControlCurrentValue; if( nullptr == pfnGetControlCurrentValue ) return logAndPropagateResult("zesOverclockGetControlCurrentValue", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetControlCurrentValuePrologue( hDomainHandle, DomainControl, pValue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetControlCurrentValue", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesOverclockGetControlCurrentValuePrologue( hDomainHandle, DomainControl, pValue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetControlCurrentValue", result); } auto driver_result = pfnGetControlCurrentValue( hDomainHandle, DomainControl, pValue ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetControlCurrentValueEpilogue( hDomainHandle, DomainControl, pValue ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetControlCurrentValue", result); } return logAndPropagateResult("zesOverclockGetControlCurrentValue", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetControlPendingValue __zedlllocal ze_result_t ZE_APICALL zesOverclockGetControlPendingValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [out] Returns the pending value for a given control. The units and ///< format of the value depend on the control type. ) { context.logger->log_trace("zesOverclockGetControlPendingValue(hDomainHandle, DomainControl, pValue)"); auto pfnGetControlPendingValue = context.zesDdiTable.Overclock.pfnGetControlPendingValue; if( nullptr == pfnGetControlPendingValue ) return logAndPropagateResult("zesOverclockGetControlPendingValue", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetControlPendingValuePrologue( hDomainHandle, DomainControl, pValue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetControlPendingValue", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesOverclockGetControlPendingValuePrologue( hDomainHandle, DomainControl, pValue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetControlPendingValue", result); } auto driver_result = pfnGetControlPendingValue( hDomainHandle, DomainControl, pValue ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetControlPendingValueEpilogue( hDomainHandle, DomainControl, pValue ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetControlPendingValue", result); } return logAndPropagateResult("zesOverclockGetControlPendingValue", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockSetControlUserValue __zedlllocal ze_result_t ZE_APICALL zesOverclockSetControlUserValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. double pValue, ///< [in] The new value of the control. The units and format of the value ///< depend on the control type. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ) { context.logger->log_trace("zesOverclockSetControlUserValue(hDomainHandle, DomainControl, pValue, pPendingAction)"); auto pfnSetControlUserValue = context.zesDdiTable.Overclock.pfnSetControlUserValue; if( nullptr == pfnSetControlUserValue ) return logAndPropagateResult("zesOverclockSetControlUserValue", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockSetControlUserValuePrologue( hDomainHandle, DomainControl, pValue, pPendingAction ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockSetControlUserValue", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesOverclockSetControlUserValuePrologue( hDomainHandle, DomainControl, pValue, pPendingAction ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockSetControlUserValue", result); } auto driver_result = pfnSetControlUserValue( hDomainHandle, DomainControl, pValue, pPendingAction ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockSetControlUserValueEpilogue( hDomainHandle, DomainControl, pValue, pPendingAction ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockSetControlUserValue", result); } return logAndPropagateResult("zesOverclockSetControlUserValue", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetControlState __zedlllocal ze_result_t ZE_APICALL zesOverclockGetControlState( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. zes_control_state_t* pControlState, ///< [out] Current overclock control state. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ) { context.logger->log_trace("zesOverclockGetControlState(hDomainHandle, DomainControl, pControlState, pPendingAction)"); auto pfnGetControlState = context.zesDdiTable.Overclock.pfnGetControlState; if( nullptr == pfnGetControlState ) return logAndPropagateResult("zesOverclockGetControlState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetControlStatePrologue( hDomainHandle, DomainControl, pControlState, pPendingAction ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetControlState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesOverclockGetControlStatePrologue( hDomainHandle, DomainControl, pControlState, pPendingAction ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetControlState", result); } auto driver_result = pfnGetControlState( hDomainHandle, DomainControl, pControlState, pPendingAction ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetControlStateEpilogue( hDomainHandle, DomainControl, pControlState, pPendingAction ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetControlState", result); } return logAndPropagateResult("zesOverclockGetControlState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetVFPointValues __zedlllocal ze_result_t ZE_APICALL zesOverclockGetVFPointValues( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. zes_vf_array_type_t VFArrayType, ///< [in] User,Default or Live VF array to read from uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t* PointValue ///< [out] Returns the frequency in 1kHz units or voltage in millivolt ///< units from the custom V-F curve at the specified zero-based index ) { context.logger->log_trace("zesOverclockGetVFPointValues(hDomainHandle, VFType, VFArrayType, PointIndex, PointValue)"); auto pfnGetVFPointValues = context.zesDdiTable.Overclock.pfnGetVFPointValues; if( nullptr == pfnGetVFPointValues ) return logAndPropagateResult("zesOverclockGetVFPointValues", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetVFPointValuesPrologue( hDomainHandle, VFType, VFArrayType, PointIndex, PointValue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetVFPointValues", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesOverclockGetVFPointValuesPrologue( hDomainHandle, VFType, VFArrayType, PointIndex, PointValue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetVFPointValues", result); } auto driver_result = pfnGetVFPointValues( hDomainHandle, VFType, VFArrayType, PointIndex, PointValue ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockGetVFPointValuesEpilogue( hDomainHandle, VFType, VFArrayType, PointIndex, PointValue ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockGetVFPointValues", result); } return logAndPropagateResult("zesOverclockGetVFPointValues", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockSetVFPointValues __zedlllocal ze_result_t ZE_APICALL zesOverclockSetVFPointValues( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t PointValue ///< [in] Writes frequency in 1kHz units or voltage in millivolt units to ///< custom V-F curve at the specified zero-based index ) { context.logger->log_trace("zesOverclockSetVFPointValues(hDomainHandle, VFType, PointIndex, PointValue)"); auto pfnSetVFPointValues = context.zesDdiTable.Overclock.pfnSetVFPointValues; if( nullptr == pfnSetVFPointValues ) return logAndPropagateResult("zesOverclockSetVFPointValues", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockSetVFPointValuesPrologue( hDomainHandle, VFType, PointIndex, PointValue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockSetVFPointValues", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesOverclockSetVFPointValuesPrologue( hDomainHandle, VFType, PointIndex, PointValue ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockSetVFPointValues", result); } auto driver_result = pfnSetVFPointValues( hDomainHandle, VFType, PointIndex, PointValue ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesOverclockSetVFPointValuesEpilogue( hDomainHandle, VFType, PointIndex, PointValue ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesOverclockSetVFPointValues", result); } return logAndPropagateResult("zesOverclockSetVFPointValues", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumDiagnosticTestSuites __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumDiagnosticTestSuites( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_diag_handle_t* phDiagnostics ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumDiagnosticTestSuites(hDevice, pCount, phDiagnostics)"); auto pfnEnumDiagnosticTestSuites = context.zesDdiTable.Device.pfnEnumDiagnosticTestSuites; if( nullptr == pfnEnumDiagnosticTestSuites ) return logAndPropagateResult("zesDeviceEnumDiagnosticTestSuites", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumDiagnosticTestSuitesPrologue( hDevice, pCount, phDiagnostics ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumDiagnosticTestSuites", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumDiagnosticTestSuitesPrologue( hDevice, pCount, phDiagnostics ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumDiagnosticTestSuites", result); } auto driver_result = pfnEnumDiagnosticTestSuites( hDevice, pCount, phDiagnostics ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumDiagnosticTestSuitesEpilogue( hDevice, pCount, phDiagnostics ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumDiagnosticTestSuites", result); } return logAndPropagateResult("zesDeviceEnumDiagnosticTestSuites", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDiagnosticsGetProperties __zedlllocal ze_result_t ZE_APICALL zesDiagnosticsGetProperties( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. zes_diag_properties_t* pProperties ///< [in,out] Structure describing the properties of a diagnostics test ///< suite ) { context.logger->log_trace("zesDiagnosticsGetProperties(hDiagnostics, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Diagnostics.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesDiagnosticsGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDiagnosticsGetPropertiesPrologue( hDiagnostics, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDiagnosticsGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDiagnosticsGetPropertiesPrologue( hDiagnostics, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDiagnosticsGetProperties", result); } auto driver_result = pfnGetProperties( hDiagnostics, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDiagnosticsGetPropertiesEpilogue( hDiagnostics, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDiagnosticsGetProperties", result); } return logAndPropagateResult("zesDiagnosticsGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDiagnosticsGetTests __zedlllocal ze_result_t ZE_APICALL zesDiagnosticsGetTests( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of tests. ///< if count is zero, then the driver shall update the value with the ///< total number of tests that are available. ///< if count is greater than the number of tests that are available, then ///< the driver shall update the value with the correct number of tests. zes_diag_test_t* pTests ///< [in,out][optional][range(0, *pCount)] array of information about ///< individual tests sorted by increasing value of the `index` member of ::zes_diag_test_t. ///< if count is less than the number of tests that are available, then the ///< driver shall only retrieve that number of tests. ) { context.logger->log_trace("zesDiagnosticsGetTests(hDiagnostics, pCount, pTests)"); auto pfnGetTests = context.zesDdiTable.Diagnostics.pfnGetTests; if( nullptr == pfnGetTests ) return logAndPropagateResult("zesDiagnosticsGetTests", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDiagnosticsGetTestsPrologue( hDiagnostics, pCount, pTests ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDiagnosticsGetTests", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDiagnosticsGetTestsPrologue( hDiagnostics, pCount, pTests ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDiagnosticsGetTests", result); } auto driver_result = pfnGetTests( hDiagnostics, pCount, pTests ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDiagnosticsGetTestsEpilogue( hDiagnostics, pCount, pTests ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDiagnosticsGetTests", result); } return logAndPropagateResult("zesDiagnosticsGetTests", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDiagnosticsRunTests __zedlllocal ze_result_t ZE_APICALL zesDiagnosticsRunTests( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t startIndex, ///< [in] The index of the first test to run. Set to ///< ::ZES_DIAG_FIRST_TEST_INDEX to start from the beginning. uint32_t endIndex, ///< [in] The index of the last test to run. Set to ///< ::ZES_DIAG_LAST_TEST_INDEX to complete all tests after the start test. zes_diag_result_t* pResult ///< [in,out] The result of the diagnostics ) { context.logger->log_trace("zesDiagnosticsRunTests(hDiagnostics, startIndex, endIndex, pResult)"); auto pfnRunTests = context.zesDdiTable.Diagnostics.pfnRunTests; if( nullptr == pfnRunTests ) return logAndPropagateResult("zesDiagnosticsRunTests", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDiagnosticsRunTestsPrologue( hDiagnostics, startIndex, endIndex, pResult ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDiagnosticsRunTests", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDiagnosticsRunTestsPrologue( hDiagnostics, startIndex, endIndex, pResult ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDiagnosticsRunTests", result); } auto driver_result = pfnRunTests( hDiagnostics, startIndex, endIndex, pResult ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDiagnosticsRunTestsEpilogue( hDiagnostics, startIndex, endIndex, pResult ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDiagnosticsRunTests", result); } return logAndPropagateResult("zesDiagnosticsRunTests", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEccAvailable __zedlllocal ze_result_t ZE_APICALL zesDeviceEccAvailable( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pAvailable ///< [out] ECC functionality is available (true)/unavailable (false). ) { context.logger->log_trace("zesDeviceEccAvailable(hDevice, pAvailable)"); auto pfnEccAvailable = context.zesDdiTable.Device.pfnEccAvailable; if( nullptr == pfnEccAvailable ) return logAndPropagateResult("zesDeviceEccAvailable", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEccAvailablePrologue( hDevice, pAvailable ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEccAvailable", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEccAvailablePrologue( hDevice, pAvailable ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEccAvailable", result); } auto driver_result = pfnEccAvailable( hDevice, pAvailable ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEccAvailableEpilogue( hDevice, pAvailable ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEccAvailable", result); } return logAndPropagateResult("zesDeviceEccAvailable", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEccConfigurable __zedlllocal ze_result_t ZE_APICALL zesDeviceEccConfigurable( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pConfigurable ///< [out] ECC can be enabled/disabled (true)/enabled/disabled (false). ) { context.logger->log_trace("zesDeviceEccConfigurable(hDevice, pConfigurable)"); auto pfnEccConfigurable = context.zesDdiTable.Device.pfnEccConfigurable; if( nullptr == pfnEccConfigurable ) return logAndPropagateResult("zesDeviceEccConfigurable", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEccConfigurablePrologue( hDevice, pConfigurable ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEccConfigurable", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEccConfigurablePrologue( hDevice, pConfigurable ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEccConfigurable", result); } auto driver_result = pfnEccConfigurable( hDevice, pConfigurable ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEccConfigurableEpilogue( hDevice, pConfigurable ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEccConfigurable", result); } return logAndPropagateResult("zesDeviceEccConfigurable", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetEccState __zedlllocal ze_result_t ZE_APICALL zesDeviceGetEccState( zes_device_handle_t hDevice, ///< [in] Handle for the component. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ) { context.logger->log_trace("zesDeviceGetEccState(hDevice, pState)"); auto pfnGetEccState = context.zesDdiTable.Device.pfnGetEccState; if( nullptr == pfnGetEccState ) return logAndPropagateResult("zesDeviceGetEccState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetEccStatePrologue( hDevice, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetEccState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceGetEccStatePrologue( hDevice, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetEccState", result); } auto driver_result = pfnGetEccState( hDevice, pState ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetEccStateEpilogue( hDevice, pState ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetEccState", result); } return logAndPropagateResult("zesDeviceGetEccState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceSetEccState __zedlllocal ze_result_t ZE_APICALL zesDeviceSetEccState( zes_device_handle_t hDevice, ///< [in] Handle for the component. const zes_device_ecc_desc_t* newState, ///< [in] Pointer to desired ECC state. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ) { context.logger->log_trace("zesDeviceSetEccState(hDevice, newState, pState)"); auto pfnSetEccState = context.zesDdiTable.Device.pfnSetEccState; if( nullptr == pfnSetEccState ) return logAndPropagateResult("zesDeviceSetEccState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceSetEccStatePrologue( hDevice, newState, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceSetEccState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceSetEccStatePrologue( hDevice, newState, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceSetEccState", result); } auto driver_result = pfnSetEccState( hDevice, newState, pState ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceSetEccStateEpilogue( hDevice, newState, pState ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceSetEccState", result); } return logAndPropagateResult("zesDeviceSetEccState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumEngineGroups __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumEngineGroups( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_engine_handle_t* phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumEngineGroups(hDevice, pCount, phEngine)"); auto pfnEnumEngineGroups = context.zesDdiTable.Device.pfnEnumEngineGroups; if( nullptr == pfnEnumEngineGroups ) return logAndPropagateResult("zesDeviceEnumEngineGroups", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumEngineGroupsPrologue( hDevice, pCount, phEngine ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumEngineGroups", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumEngineGroupsPrologue( hDevice, pCount, phEngine ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumEngineGroups", result); } auto driver_result = pfnEnumEngineGroups( hDevice, pCount, phEngine ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumEngineGroupsEpilogue( hDevice, pCount, phEngine ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumEngineGroups", result); } return logAndPropagateResult("zesDeviceEnumEngineGroups", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetProperties __zedlllocal ze_result_t ZE_APICALL zesEngineGetProperties( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_properties_t* pProperties ///< [in,out] The properties for the specified engine group. ) { context.logger->log_trace("zesEngineGetProperties(hEngine, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Engine.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesEngineGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesEngineGetPropertiesPrologue( hEngine, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesEngineGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesEngineGetPropertiesPrologue( hEngine, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesEngineGetProperties", result); } auto driver_result = pfnGetProperties( hEngine, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesEngineGetPropertiesEpilogue( hEngine, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesEngineGetProperties", result); } return logAndPropagateResult("zesEngineGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetActivity __zedlllocal ze_result_t ZE_APICALL zesEngineGetActivity( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_stats_t* pStats ///< [in,out] Will contain a snapshot of the engine group activity ///< counters. ) { context.logger->log_trace("zesEngineGetActivity(hEngine, pStats)"); auto pfnGetActivity = context.zesDdiTable.Engine.pfnGetActivity; if( nullptr == pfnGetActivity ) return logAndPropagateResult("zesEngineGetActivity", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesEngineGetActivityPrologue( hEngine, pStats ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesEngineGetActivity", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesEngineGetActivityPrologue( hEngine, pStats ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesEngineGetActivity", result); } auto driver_result = pfnGetActivity( hEngine, pStats ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesEngineGetActivityEpilogue( hEngine, pStats ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesEngineGetActivity", result); } return logAndPropagateResult("zesEngineGetActivity", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEventRegister __zedlllocal ze_result_t ZE_APICALL zesDeviceEventRegister( zes_device_handle_t hDevice, ///< [in] The device handle. zes_event_type_flags_t events ///< [in] List of events to listen to. ) { context.logger->log_trace("zesDeviceEventRegister(hDevice, events)"); auto pfnEventRegister = context.zesDdiTable.Device.pfnEventRegister; if( nullptr == pfnEventRegister ) return logAndPropagateResult("zesDeviceEventRegister", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEventRegisterPrologue( hDevice, events ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEventRegister", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEventRegisterPrologue( hDevice, events ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEventRegister", result); } auto driver_result = pfnEventRegister( hDevice, events ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEventRegisterEpilogue( hDevice, events ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEventRegister", result); } return logAndPropagateResult("zesDeviceEventRegister", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverEventListen __zedlllocal ze_result_t ZE_APICALL zesDriverEventListen( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT32_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ) { context.logger->log_trace("zesDriverEventListen(hDriver, timeout, count, phDevicesLocal, pNumDeviceEvents, pEvents)"); auto pfnEventListen = context.zesDdiTable.Driver.pfnEventListen; if( nullptr == pfnEventListen ) return logAndPropagateResult("zesDriverEventListen", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDriverEventListenPrologue( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverEventListen", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDriverEventListenPrologue( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverEventListen", result); } auto driver_result = pfnEventListen( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDriverEventListenEpilogue( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverEventListen", result); } return logAndPropagateResult("zesDriverEventListen", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverEventListenEx __zedlllocal ze_result_t ZE_APICALL zesDriverEventListenEx( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT64_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ) { context.logger->log_trace("zesDriverEventListenEx(hDriver, timeout, count, phDevicesLocal, pNumDeviceEvents, pEvents)"); auto pfnEventListenEx = context.zesDdiTable.Driver.pfnEventListenEx; if( nullptr == pfnEventListenEx ) return logAndPropagateResult("zesDriverEventListenEx", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDriverEventListenExPrologue( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverEventListenEx", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDriverEventListenExPrologue( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverEventListenEx", result); } auto driver_result = pfnEventListenEx( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDriverEventListenExEpilogue( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverEventListenEx", result); } return logAndPropagateResult("zesDriverEventListenEx", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumFabricPorts __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumFabricPorts( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fabric_port_handle_t* phPort ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumFabricPorts(hDevice, pCount, phPort)"); auto pfnEnumFabricPorts = context.zesDdiTable.Device.pfnEnumFabricPorts; if( nullptr == pfnEnumFabricPorts ) return logAndPropagateResult("zesDeviceEnumFabricPorts", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumFabricPortsPrologue( hDevice, pCount, phPort ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumFabricPorts", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumFabricPortsPrologue( hDevice, pCount, phPort ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumFabricPorts", result); } auto driver_result = pfnEnumFabricPorts( hDevice, pCount, phPort ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumFabricPortsEpilogue( hDevice, pCount, phPort ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumFabricPorts", result); } return logAndPropagateResult("zesDeviceEnumFabricPorts", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetProperties __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetProperties( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_properties_t* pProperties ///< [in,out] Will contain properties of the Fabric Port. ) { context.logger->log_trace("zesFabricPortGetProperties(hPort, pProperties)"); auto pfnGetProperties = context.zesDdiTable.FabricPort.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesFabricPortGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetPropertiesPrologue( hPort, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFabricPortGetPropertiesPrologue( hPort, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetProperties", result); } auto driver_result = pfnGetProperties( hPort, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetPropertiesEpilogue( hPort, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetProperties", result); } return logAndPropagateResult("zesFabricPortGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetLinkType __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetLinkType( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_link_type_t* pLinkType ///< [in,out] Will contain details about the link attached to the Fabric ///< port. ) { context.logger->log_trace("zesFabricPortGetLinkType(hPort, pLinkType)"); auto pfnGetLinkType = context.zesDdiTable.FabricPort.pfnGetLinkType; if( nullptr == pfnGetLinkType ) return logAndPropagateResult("zesFabricPortGetLinkType", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetLinkTypePrologue( hPort, pLinkType ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetLinkType", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFabricPortGetLinkTypePrologue( hPort, pLinkType ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetLinkType", result); } auto driver_result = pfnGetLinkType( hPort, pLinkType ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetLinkTypeEpilogue( hPort, pLinkType ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetLinkType", result); } return logAndPropagateResult("zesFabricPortGetLinkType", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetConfig __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetConfig( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_config_t* pConfig ///< [in,out] Will contain configuration of the Fabric Port. ) { context.logger->log_trace("zesFabricPortGetConfig(hPort, pConfig)"); auto pfnGetConfig = context.zesDdiTable.FabricPort.pfnGetConfig; if( nullptr == pfnGetConfig ) return logAndPropagateResult("zesFabricPortGetConfig", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetConfigPrologue( hPort, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetConfig", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFabricPortGetConfigPrologue( hPort, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetConfig", result); } auto driver_result = pfnGetConfig( hPort, pConfig ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetConfigEpilogue( hPort, pConfig ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetConfig", result); } return logAndPropagateResult("zesFabricPortGetConfig", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortSetConfig __zedlllocal ze_result_t ZE_APICALL zesFabricPortSetConfig( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. const zes_fabric_port_config_t* pConfig ///< [in] Contains new configuration of the Fabric Port. ) { context.logger->log_trace("zesFabricPortSetConfig(hPort, pConfig)"); auto pfnSetConfig = context.zesDdiTable.FabricPort.pfnSetConfig; if( nullptr == pfnSetConfig ) return logAndPropagateResult("zesFabricPortSetConfig", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortSetConfigPrologue( hPort, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortSetConfig", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFabricPortSetConfigPrologue( hPort, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortSetConfig", result); } auto driver_result = pfnSetConfig( hPort, pConfig ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortSetConfigEpilogue( hPort, pConfig ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortSetConfig", result); } return logAndPropagateResult("zesFabricPortSetConfig", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetState __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetState( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_state_t* pState ///< [in,out] Will contain the current state of the Fabric Port ) { context.logger->log_trace("zesFabricPortGetState(hPort, pState)"); auto pfnGetState = context.zesDdiTable.FabricPort.pfnGetState; if( nullptr == pfnGetState ) return logAndPropagateResult("zesFabricPortGetState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetStatePrologue( hPort, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFabricPortGetStatePrologue( hPort, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetState", result); } auto driver_result = pfnGetState( hPort, pState ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetStateEpilogue( hPort, pState ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetState", result); } return logAndPropagateResult("zesFabricPortGetState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetThroughput __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetThroughput( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_throughput_t* pThroughput ///< [in,out] Will contain the Fabric port throughput counters. ) { context.logger->log_trace("zesFabricPortGetThroughput(hPort, pThroughput)"); auto pfnGetThroughput = context.zesDdiTable.FabricPort.pfnGetThroughput; if( nullptr == pfnGetThroughput ) return logAndPropagateResult("zesFabricPortGetThroughput", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetThroughputPrologue( hPort, pThroughput ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetThroughput", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFabricPortGetThroughputPrologue( hPort, pThroughput ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetThroughput", result); } auto driver_result = pfnGetThroughput( hPort, pThroughput ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetThroughputEpilogue( hPort, pThroughput ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetThroughput", result); } return logAndPropagateResult("zesFabricPortGetThroughput", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetFabricErrorCounters __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetFabricErrorCounters( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_error_counters_t* pErrors ///< [in,out] Will contain the Fabric port Error counters. ) { context.logger->log_trace("zesFabricPortGetFabricErrorCounters(hPort, pErrors)"); auto pfnGetFabricErrorCounters = context.zesDdiTable.FabricPort.pfnGetFabricErrorCounters; if( nullptr == pfnGetFabricErrorCounters ) return logAndPropagateResult("zesFabricPortGetFabricErrorCounters", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetFabricErrorCountersPrologue( hPort, pErrors ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetFabricErrorCounters", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFabricPortGetFabricErrorCountersPrologue( hPort, pErrors ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetFabricErrorCounters", result); } auto driver_result = pfnGetFabricErrorCounters( hPort, pErrors ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetFabricErrorCountersEpilogue( hPort, pErrors ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetFabricErrorCounters", result); } return logAndPropagateResult("zesFabricPortGetFabricErrorCounters", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetMultiPortThroughput __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetMultiPortThroughput( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t numPorts, ///< [in] Number of ports enumerated in function ::zesDeviceEnumFabricPorts zes_fabric_port_handle_t* phPort, ///< [in][range(0, numPorts)] array of fabric port handles provided by user ///< to gather throughput values. zes_fabric_port_throughput_t** pThroughput ///< [out][range(0, numPorts)] array of fabric port throughput counters ///< from multiple ports of type ::zes_fabric_port_throughput_t. ) { context.logger->log_trace("zesFabricPortGetMultiPortThroughput(hDevice, numPorts, phPortLocal, pThroughput)"); auto pfnGetMultiPortThroughput = context.zesDdiTable.FabricPort.pfnGetMultiPortThroughput; if( nullptr == pfnGetMultiPortThroughput ) return logAndPropagateResult("zesFabricPortGetMultiPortThroughput", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetMultiPortThroughputPrologue( hDevice, numPorts, phPort, pThroughput ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetMultiPortThroughput", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFabricPortGetMultiPortThroughputPrologue( hDevice, numPorts, phPort, pThroughput ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetMultiPortThroughput", result); } auto driver_result = pfnGetMultiPortThroughput( hDevice, numPorts, phPort, pThroughput ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFabricPortGetMultiPortThroughputEpilogue( hDevice, numPorts, phPort, pThroughput ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFabricPortGetMultiPortThroughput", result); } return logAndPropagateResult("zesFabricPortGetMultiPortThroughput", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumFans __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumFans( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fan_handle_t* phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumFans(hDevice, pCount, phFan)"); auto pfnEnumFans = context.zesDdiTable.Device.pfnEnumFans; if( nullptr == pfnEnumFans ) return logAndPropagateResult("zesDeviceEnumFans", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumFansPrologue( hDevice, pCount, phFan ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumFans", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumFansPrologue( hDevice, pCount, phFan ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumFans", result); } auto driver_result = pfnEnumFans( hDevice, pCount, phFan ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumFansEpilogue( hDevice, pCount, phFan ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumFans", result); } return logAndPropagateResult("zesDeviceEnumFans", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanGetProperties __zedlllocal ze_result_t ZE_APICALL zesFanGetProperties( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_properties_t* pProperties ///< [in,out] Will contain the properties of the fan. ) { context.logger->log_trace("zesFanGetProperties(hFan, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Fan.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesFanGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFanGetPropertiesPrologue( hFan, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFanGetPropertiesPrologue( hFan, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanGetProperties", result); } auto driver_result = pfnGetProperties( hFan, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFanGetPropertiesEpilogue( hFan, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanGetProperties", result); } return logAndPropagateResult("zesFanGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanGetConfig __zedlllocal ze_result_t ZE_APICALL zesFanGetConfig( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_config_t* pConfig ///< [in,out] Will contain the current configuration of the fan. ) { context.logger->log_trace("zesFanGetConfig(hFan, pConfig)"); auto pfnGetConfig = context.zesDdiTable.Fan.pfnGetConfig; if( nullptr == pfnGetConfig ) return logAndPropagateResult("zesFanGetConfig", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFanGetConfigPrologue( hFan, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanGetConfig", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFanGetConfigPrologue( hFan, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanGetConfig", result); } auto driver_result = pfnGetConfig( hFan, pConfig ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFanGetConfigEpilogue( hFan, pConfig ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanGetConfig", result); } return logAndPropagateResult("zesFanGetConfig", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanSetDefaultMode __zedlllocal ze_result_t ZE_APICALL zesFanSetDefaultMode( zes_fan_handle_t hFan ///< [in] Handle for the component. ) { context.logger->log_trace("zesFanSetDefaultMode(hFan)"); auto pfnSetDefaultMode = context.zesDdiTable.Fan.pfnSetDefaultMode; if( nullptr == pfnSetDefaultMode ) return logAndPropagateResult("zesFanSetDefaultMode", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFanSetDefaultModePrologue( hFan ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanSetDefaultMode", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFanSetDefaultModePrologue( hFan ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanSetDefaultMode", result); } auto driver_result = pfnSetDefaultMode( hFan ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFanSetDefaultModeEpilogue( hFan ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanSetDefaultMode", result); } return logAndPropagateResult("zesFanSetDefaultMode", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanSetFixedSpeedMode __zedlllocal ze_result_t ZE_APICALL zesFanSetFixedSpeedMode( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_t* speed ///< [in] The fixed fan speed setting ) { context.logger->log_trace("zesFanSetFixedSpeedMode(hFan, speed)"); auto pfnSetFixedSpeedMode = context.zesDdiTable.Fan.pfnSetFixedSpeedMode; if( nullptr == pfnSetFixedSpeedMode ) return logAndPropagateResult("zesFanSetFixedSpeedMode", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFanSetFixedSpeedModePrologue( hFan, speed ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanSetFixedSpeedMode", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFanSetFixedSpeedModePrologue( hFan, speed ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanSetFixedSpeedMode", result); } auto driver_result = pfnSetFixedSpeedMode( hFan, speed ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFanSetFixedSpeedModeEpilogue( hFan, speed ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanSetFixedSpeedMode", result); } return logAndPropagateResult("zesFanSetFixedSpeedMode", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanSetSpeedTableMode __zedlllocal ze_result_t ZE_APICALL zesFanSetSpeedTableMode( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_table_t* speedTable ///< [in] A table containing temperature/speed pairs. ) { context.logger->log_trace("zesFanSetSpeedTableMode(hFan, speedTable)"); auto pfnSetSpeedTableMode = context.zesDdiTable.Fan.pfnSetSpeedTableMode; if( nullptr == pfnSetSpeedTableMode ) return logAndPropagateResult("zesFanSetSpeedTableMode", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFanSetSpeedTableModePrologue( hFan, speedTable ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanSetSpeedTableMode", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFanSetSpeedTableModePrologue( hFan, speedTable ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanSetSpeedTableMode", result); } auto driver_result = pfnSetSpeedTableMode( hFan, speedTable ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFanSetSpeedTableModeEpilogue( hFan, speedTable ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanSetSpeedTableMode", result); } return logAndPropagateResult("zesFanSetSpeedTableMode", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanGetState __zedlllocal ze_result_t ZE_APICALL zesFanGetState( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned. int32_t* pSpeed ///< [in,out] Will contain the current speed of the fan in the units ///< requested. A value of -1 indicates that the fan speed cannot be ///< measured. ) { context.logger->log_trace("zesFanGetState(hFan, units, pSpeed)"); auto pfnGetState = context.zesDdiTable.Fan.pfnGetState; if( nullptr == pfnGetState ) return logAndPropagateResult("zesFanGetState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFanGetStatePrologue( hFan, units, pSpeed ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanGetState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFanGetStatePrologue( hFan, units, pSpeed ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanGetState", result); } auto driver_result = pfnGetState( hFan, units, pSpeed ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFanGetStateEpilogue( hFan, units, pSpeed ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFanGetState", result); } return logAndPropagateResult("zesFanGetState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumFirmwares __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumFirmwares( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_firmware_handle_t* phFirmware ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumFirmwares(hDevice, pCount, phFirmware)"); auto pfnEnumFirmwares = context.zesDdiTable.Device.pfnEnumFirmwares; if( nullptr == pfnEnumFirmwares ) return logAndPropagateResult("zesDeviceEnumFirmwares", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumFirmwaresPrologue( hDevice, pCount, phFirmware ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumFirmwares", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumFirmwaresPrologue( hDevice, pCount, phFirmware ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumFirmwares", result); } auto driver_result = pfnEnumFirmwares( hDevice, pCount, phFirmware ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumFirmwaresEpilogue( hDevice, pCount, phFirmware ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumFirmwares", result); } return logAndPropagateResult("zesDeviceEnumFirmwares", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetProperties __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetProperties( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. zes_firmware_properties_t* pProperties ///< [in,out] Pointer to an array that will hold the properties of the ///< firmware ) { context.logger->log_trace("zesFirmwareGetProperties(hFirmware, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Firmware.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesFirmwareGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFirmwareGetPropertiesPrologue( hFirmware, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFirmwareGetPropertiesPrologue( hFirmware, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareGetProperties", result); } auto driver_result = pfnGetProperties( hFirmware, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFirmwareGetPropertiesEpilogue( hFirmware, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareGetProperties", result); } return logAndPropagateResult("zesFirmwareGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareFlash __zedlllocal ze_result_t ZE_APICALL zesFirmwareFlash( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. void* pImage, ///< [in] Image of the new firmware to flash. uint32_t size ///< [in] Size of the flash image. ) { context.logger->log_trace("zesFirmwareFlash(hFirmware, pImage, size)"); auto pfnFlash = context.zesDdiTable.Firmware.pfnFlash; if( nullptr == pfnFlash ) return logAndPropagateResult("zesFirmwareFlash", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFirmwareFlashPrologue( hFirmware, pImage, size ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareFlash", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFirmwareFlashPrologue( hFirmware, pImage, size ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareFlash", result); } auto driver_result = pfnFlash( hFirmware, pImage, size ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFirmwareFlashEpilogue( hFirmware, pImage, size ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareFlash", result); } return logAndPropagateResult("zesFirmwareFlash", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetFlashProgress __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetFlashProgress( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. uint32_t* pCompletionPercent ///< [in,out] Pointer to the Completion Percentage of Firmware Update ) { context.logger->log_trace("zesFirmwareGetFlashProgress(hFirmware, pCompletionPercent)"); auto pfnGetFlashProgress = context.zesDdiTable.Firmware.pfnGetFlashProgress; if( nullptr == pfnGetFlashProgress ) return logAndPropagateResult("zesFirmwareGetFlashProgress", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFirmwareGetFlashProgressPrologue( hFirmware, pCompletionPercent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareGetFlashProgress", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFirmwareGetFlashProgressPrologue( hFirmware, pCompletionPercent ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareGetFlashProgress", result); } auto driver_result = pfnGetFlashProgress( hFirmware, pCompletionPercent ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFirmwareGetFlashProgressEpilogue( hFirmware, pCompletionPercent ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareGetFlashProgress", result); } return logAndPropagateResult("zesFirmwareGetFlashProgress", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetConsoleLogs __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetConsoleLogs( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. size_t* pSize, ///< [in,out] size of firmware log char* pFirmwareLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { context.logger->log_trace("zesFirmwareGetConsoleLogs(hFirmware, pSize, pFirmwareLog)"); auto pfnGetConsoleLogs = context.zesDdiTable.Firmware.pfnGetConsoleLogs; if( nullptr == pfnGetConsoleLogs ) return logAndPropagateResult("zesFirmwareGetConsoleLogs", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFirmwareGetConsoleLogsPrologue( hFirmware, pSize, pFirmwareLog ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareGetConsoleLogs", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFirmwareGetConsoleLogsPrologue( hFirmware, pSize, pFirmwareLog ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareGetConsoleLogs", result); } auto driver_result = pfnGetConsoleLogs( hFirmware, pSize, pFirmwareLog ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFirmwareGetConsoleLogsEpilogue( hFirmware, pSize, pFirmwareLog ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareGetConsoleLogs", result); } return logAndPropagateResult("zesFirmwareGetConsoleLogs", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumFrequencyDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumFrequencyDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_freq_handle_t* phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumFrequencyDomains(hDevice, pCount, phFrequency)"); auto pfnEnumFrequencyDomains = context.zesDdiTable.Device.pfnEnumFrequencyDomains; if( nullptr == pfnEnumFrequencyDomains ) return logAndPropagateResult("zesDeviceEnumFrequencyDomains", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumFrequencyDomainsPrologue( hDevice, pCount, phFrequency ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumFrequencyDomains", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumFrequencyDomainsPrologue( hDevice, pCount, phFrequency ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumFrequencyDomains", result); } auto driver_result = pfnEnumFrequencyDomains( hDevice, pCount, phFrequency ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumFrequencyDomainsEpilogue( hDevice, pCount, phFrequency ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumFrequencyDomains", result); } return logAndPropagateResult("zesDeviceEnumFrequencyDomains", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetProperties __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetProperties( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_properties_t* pProperties ///< [in,out] The frequency properties for the specified domain. ) { context.logger->log_trace("zesFrequencyGetProperties(hFrequency, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Frequency.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesFrequencyGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyGetPropertiesPrologue( hFrequency, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyGetPropertiesPrologue( hFrequency, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetProperties", result); } auto driver_result = pfnGetProperties( hFrequency, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyGetPropertiesEpilogue( hFrequency, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetProperties", result); } return logAndPropagateResult("zesFrequencyGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetAvailableClocks __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetAvailableClocks( zes_freq_handle_t hFrequency, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of frequencies. ///< if count is zero, then the driver shall update the value with the ///< total number of frequencies that are available. ///< if count is greater than the number of frequencies that are available, ///< then the driver shall update the value with the correct number of frequencies. double* phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of ///< MHz and sorted from slowest to fastest. ///< if count is less than the number of frequencies that are available, ///< then the driver shall only retrieve that number of frequencies. ) { context.logger->log_trace("zesFrequencyGetAvailableClocks(hFrequency, pCount, phFrequency)"); auto pfnGetAvailableClocks = context.zesDdiTable.Frequency.pfnGetAvailableClocks; if( nullptr == pfnGetAvailableClocks ) return logAndPropagateResult("zesFrequencyGetAvailableClocks", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyGetAvailableClocksPrologue( hFrequency, pCount, phFrequency ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetAvailableClocks", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyGetAvailableClocksPrologue( hFrequency, pCount, phFrequency ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetAvailableClocks", result); } auto driver_result = pfnGetAvailableClocks( hFrequency, pCount, phFrequency ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyGetAvailableClocksEpilogue( hFrequency, pCount, phFrequency ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetAvailableClocks", result); } return logAndPropagateResult("zesFrequencyGetAvailableClocks", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetRange __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetRange( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_range_t* pLimits ///< [in,out] The range between which the hardware can operate for the ///< specified domain. ) { context.logger->log_trace("zesFrequencyGetRange(hFrequency, pLimits)"); auto pfnGetRange = context.zesDdiTable.Frequency.pfnGetRange; if( nullptr == pfnGetRange ) return logAndPropagateResult("zesFrequencyGetRange", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyGetRangePrologue( hFrequency, pLimits ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetRange", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyGetRangePrologue( hFrequency, pLimits ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetRange", result); } auto driver_result = pfnGetRange( hFrequency, pLimits ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyGetRangeEpilogue( hFrequency, pLimits ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetRange", result); } return logAndPropagateResult("zesFrequencyGetRange", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencySetRange __zedlllocal ze_result_t ZE_APICALL zesFrequencySetRange( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. const zes_freq_range_t* pLimits ///< [in] The limits between which the hardware can operate for the ///< specified domain. ) { context.logger->log_trace("zesFrequencySetRange(hFrequency, pLimits)"); auto pfnSetRange = context.zesDdiTable.Frequency.pfnSetRange; if( nullptr == pfnSetRange ) return logAndPropagateResult("zesFrequencySetRange", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencySetRangePrologue( hFrequency, pLimits ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencySetRange", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencySetRangePrologue( hFrequency, pLimits ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencySetRange", result); } auto driver_result = pfnSetRange( hFrequency, pLimits ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencySetRangeEpilogue( hFrequency, pLimits ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencySetRange", result); } return logAndPropagateResult("zesFrequencySetRange", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetState __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetState( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_state_t* pState ///< [in,out] Frequency state for the specified domain. ) { context.logger->log_trace("zesFrequencyGetState(hFrequency, pState)"); auto pfnGetState = context.zesDdiTable.Frequency.pfnGetState; if( nullptr == pfnGetState ) return logAndPropagateResult("zesFrequencyGetState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyGetStatePrologue( hFrequency, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyGetStatePrologue( hFrequency, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetState", result); } auto driver_result = pfnGetState( hFrequency, pState ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyGetStateEpilogue( hFrequency, pState ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetState", result); } return logAndPropagateResult("zesFrequencyGetState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetThrottleTime __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetThrottleTime( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_throttle_time_t* pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the ///< specified domain. ) { context.logger->log_trace("zesFrequencyGetThrottleTime(hFrequency, pThrottleTime)"); auto pfnGetThrottleTime = context.zesDdiTable.Frequency.pfnGetThrottleTime; if( nullptr == pfnGetThrottleTime ) return logAndPropagateResult("zesFrequencyGetThrottleTime", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyGetThrottleTimePrologue( hFrequency, pThrottleTime ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetThrottleTime", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyGetThrottleTimePrologue( hFrequency, pThrottleTime ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetThrottleTime", result); } auto driver_result = pfnGetThrottleTime( hFrequency, pThrottleTime ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyGetThrottleTimeEpilogue( hFrequency, pThrottleTime ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyGetThrottleTime", result); } return logAndPropagateResult("zesFrequencyGetThrottleTime", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetCapabilities __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetCapabilities( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_capabilities_t* pOcCapabilities ///< [in,out] Pointer to the capabilities structure. ) { context.logger->log_trace("zesFrequencyOcGetCapabilities(hFrequency, pOcCapabilities)"); auto pfnOcGetCapabilities = context.zesDdiTable.Frequency.pfnOcGetCapabilities; if( nullptr == pfnOcGetCapabilities ) return logAndPropagateResult("zesFrequencyOcGetCapabilities", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcGetCapabilitiesPrologue( hFrequency, pOcCapabilities ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetCapabilities", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyOcGetCapabilitiesPrologue( hFrequency, pOcCapabilities ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetCapabilities", result); } auto driver_result = pfnOcGetCapabilities( hFrequency, pOcCapabilities ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcGetCapabilitiesEpilogue( hFrequency, pOcCapabilities ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetCapabilities", result); } return logAndPropagateResult("zesFrequencyOcGetCapabilities", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetFrequencyTarget __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetFrequencyTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentOcFrequency ///< [out] Overclocking Frequency in MHz, if extended moded is supported, ///< will returned in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ) { context.logger->log_trace("zesFrequencyOcGetFrequencyTarget(hFrequency, pCurrentOcFrequency)"); auto pfnOcGetFrequencyTarget = context.zesDdiTable.Frequency.pfnOcGetFrequencyTarget; if( nullptr == pfnOcGetFrequencyTarget ) return logAndPropagateResult("zesFrequencyOcGetFrequencyTarget", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcGetFrequencyTargetPrologue( hFrequency, pCurrentOcFrequency ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetFrequencyTarget", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyOcGetFrequencyTargetPrologue( hFrequency, pCurrentOcFrequency ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetFrequencyTarget", result); } auto driver_result = pfnOcGetFrequencyTarget( hFrequency, pCurrentOcFrequency ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcGetFrequencyTargetEpilogue( hFrequency, pCurrentOcFrequency ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetFrequencyTarget", result); } return logAndPropagateResult("zesFrequencyOcGetFrequencyTarget", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetFrequencyTarget __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetFrequencyTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentOcFrequency ///< [in] Overclocking Frequency in MHz, if extended moded is supported, it ///< could be set in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ) { context.logger->log_trace("zesFrequencyOcSetFrequencyTarget(hFrequency, CurrentOcFrequency)"); auto pfnOcSetFrequencyTarget = context.zesDdiTable.Frequency.pfnOcSetFrequencyTarget; if( nullptr == pfnOcSetFrequencyTarget ) return logAndPropagateResult("zesFrequencyOcSetFrequencyTarget", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcSetFrequencyTargetPrologue( hFrequency, CurrentOcFrequency ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetFrequencyTarget", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyOcSetFrequencyTargetPrologue( hFrequency, CurrentOcFrequency ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetFrequencyTarget", result); } auto driver_result = pfnOcSetFrequencyTarget( hFrequency, CurrentOcFrequency ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcSetFrequencyTargetEpilogue( hFrequency, CurrentOcFrequency ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetFrequencyTarget", result); } return logAndPropagateResult("zesFrequencyOcSetFrequencyTarget", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetVoltageTarget __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetVoltageTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentVoltageTarget, ///< [out] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double* pCurrentVoltageOffset ///< [out] This voltage offset is applied to all points on the ///< voltage/frequency curve, including the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ) { context.logger->log_trace("zesFrequencyOcGetVoltageTarget(hFrequency, pCurrentVoltageTarget, pCurrentVoltageOffset)"); auto pfnOcGetVoltageTarget = context.zesDdiTable.Frequency.pfnOcGetVoltageTarget; if( nullptr == pfnOcGetVoltageTarget ) return logAndPropagateResult("zesFrequencyOcGetVoltageTarget", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcGetVoltageTargetPrologue( hFrequency, pCurrentVoltageTarget, pCurrentVoltageOffset ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetVoltageTarget", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyOcGetVoltageTargetPrologue( hFrequency, pCurrentVoltageTarget, pCurrentVoltageOffset ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetVoltageTarget", result); } auto driver_result = pfnOcGetVoltageTarget( hFrequency, pCurrentVoltageTarget, pCurrentVoltageOffset ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcGetVoltageTargetEpilogue( hFrequency, pCurrentVoltageTarget, pCurrentVoltageOffset ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetVoltageTarget", result); } return logAndPropagateResult("zesFrequencyOcGetVoltageTarget", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetVoltageTarget __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetVoltageTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentVoltageTarget, ///< [in] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double CurrentVoltageOffset ///< [in] This voltage offset is applied to all points on the ///< voltage/frequency curve, include the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ) { context.logger->log_trace("zesFrequencyOcSetVoltageTarget(hFrequency, CurrentVoltageTarget, CurrentVoltageOffset)"); auto pfnOcSetVoltageTarget = context.zesDdiTable.Frequency.pfnOcSetVoltageTarget; if( nullptr == pfnOcSetVoltageTarget ) return logAndPropagateResult("zesFrequencyOcSetVoltageTarget", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcSetVoltageTargetPrologue( hFrequency, CurrentVoltageTarget, CurrentVoltageOffset ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetVoltageTarget", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyOcSetVoltageTargetPrologue( hFrequency, CurrentVoltageTarget, CurrentVoltageOffset ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetVoltageTarget", result); } auto driver_result = pfnOcSetVoltageTarget( hFrequency, CurrentVoltageTarget, CurrentVoltageOffset ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcSetVoltageTargetEpilogue( hFrequency, CurrentVoltageTarget, CurrentVoltageOffset ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetVoltageTarget", result); } return logAndPropagateResult("zesFrequencyOcSetVoltageTarget", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetMode __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetMode( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t CurrentOcMode ///< [in] Current Overclocking Mode ::zes_oc_mode_t. ) { context.logger->log_trace("zesFrequencyOcSetMode(hFrequency, CurrentOcMode)"); auto pfnOcSetMode = context.zesDdiTable.Frequency.pfnOcSetMode; if( nullptr == pfnOcSetMode ) return logAndPropagateResult("zesFrequencyOcSetMode", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcSetModePrologue( hFrequency, CurrentOcMode ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetMode", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyOcSetModePrologue( hFrequency, CurrentOcMode ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetMode", result); } auto driver_result = pfnOcSetMode( hFrequency, CurrentOcMode ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcSetModeEpilogue( hFrequency, CurrentOcMode ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetMode", result); } return logAndPropagateResult("zesFrequencyOcSetMode", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetMode __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetMode( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t* pCurrentOcMode ///< [out] Current Overclocking Mode ::zes_oc_mode_t. ) { context.logger->log_trace("zesFrequencyOcGetMode(hFrequency, pCurrentOcMode)"); auto pfnOcGetMode = context.zesDdiTable.Frequency.pfnOcGetMode; if( nullptr == pfnOcGetMode ) return logAndPropagateResult("zesFrequencyOcGetMode", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcGetModePrologue( hFrequency, pCurrentOcMode ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetMode", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyOcGetModePrologue( hFrequency, pCurrentOcMode ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetMode", result); } auto driver_result = pfnOcGetMode( hFrequency, pCurrentOcMode ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcGetModeEpilogue( hFrequency, pCurrentOcMode ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetMode", result); } return logAndPropagateResult("zesFrequencyOcGetMode", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetIccMax __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetIccMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcIccMax ///< [in,out] Will contain the maximum current limit in Amperes on ///< successful return. ) { context.logger->log_trace("zesFrequencyOcGetIccMax(hFrequency, pOcIccMax)"); auto pfnOcGetIccMax = context.zesDdiTable.Frequency.pfnOcGetIccMax; if( nullptr == pfnOcGetIccMax ) return logAndPropagateResult("zesFrequencyOcGetIccMax", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcGetIccMaxPrologue( hFrequency, pOcIccMax ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetIccMax", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyOcGetIccMaxPrologue( hFrequency, pOcIccMax ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetIccMax", result); } auto driver_result = pfnOcGetIccMax( hFrequency, pOcIccMax ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcGetIccMaxEpilogue( hFrequency, pOcIccMax ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetIccMax", result); } return logAndPropagateResult("zesFrequencyOcGetIccMax", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetIccMax __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetIccMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocIccMax ///< [in] The new maximum current limit in Amperes. ) { context.logger->log_trace("zesFrequencyOcSetIccMax(hFrequency, ocIccMax)"); auto pfnOcSetIccMax = context.zesDdiTable.Frequency.pfnOcSetIccMax; if( nullptr == pfnOcSetIccMax ) return logAndPropagateResult("zesFrequencyOcSetIccMax", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcSetIccMaxPrologue( hFrequency, ocIccMax ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetIccMax", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyOcSetIccMaxPrologue( hFrequency, ocIccMax ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetIccMax", result); } auto driver_result = pfnOcSetIccMax( hFrequency, ocIccMax ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcSetIccMaxEpilogue( hFrequency, ocIccMax ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetIccMax", result); } return logAndPropagateResult("zesFrequencyOcSetIccMax", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetTjMax __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetTjMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcTjMax ///< [in,out] Will contain the maximum temperature limit in degrees Celsius ///< on successful return. ) { context.logger->log_trace("zesFrequencyOcGetTjMax(hFrequency, pOcTjMax)"); auto pfnOcGetTjMax = context.zesDdiTable.Frequency.pfnOcGetTjMax; if( nullptr == pfnOcGetTjMax ) return logAndPropagateResult("zesFrequencyOcGetTjMax", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcGetTjMaxPrologue( hFrequency, pOcTjMax ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetTjMax", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyOcGetTjMaxPrologue( hFrequency, pOcTjMax ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetTjMax", result); } auto driver_result = pfnOcGetTjMax( hFrequency, pOcTjMax ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcGetTjMaxEpilogue( hFrequency, pOcTjMax ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcGetTjMax", result); } return logAndPropagateResult("zesFrequencyOcGetTjMax", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetTjMax __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetTjMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocTjMax ///< [in] The new maximum temperature limit in degrees Celsius. ) { context.logger->log_trace("zesFrequencyOcSetTjMax(hFrequency, ocTjMax)"); auto pfnOcSetTjMax = context.zesDdiTable.Frequency.pfnOcSetTjMax; if( nullptr == pfnOcSetTjMax ) return logAndPropagateResult("zesFrequencyOcSetTjMax", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcSetTjMaxPrologue( hFrequency, ocTjMax ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetTjMax", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFrequencyOcSetTjMaxPrologue( hFrequency, ocTjMax ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetTjMax", result); } auto driver_result = pfnOcSetTjMax( hFrequency, ocTjMax ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFrequencyOcSetTjMaxEpilogue( hFrequency, ocTjMax ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFrequencyOcSetTjMax", result); } return logAndPropagateResult("zesFrequencyOcSetTjMax", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumLeds __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumLeds( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_led_handle_t* phLed ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumLeds(hDevice, pCount, phLed)"); auto pfnEnumLeds = context.zesDdiTable.Device.pfnEnumLeds; if( nullptr == pfnEnumLeds ) return logAndPropagateResult("zesDeviceEnumLeds", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumLedsPrologue( hDevice, pCount, phLed ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumLeds", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumLedsPrologue( hDevice, pCount, phLed ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumLeds", result); } auto driver_result = pfnEnumLeds( hDevice, pCount, phLed ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumLedsEpilogue( hDevice, pCount, phLed ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumLeds", result); } return logAndPropagateResult("zesDeviceEnumLeds", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesLedGetProperties __zedlllocal ze_result_t ZE_APICALL zesLedGetProperties( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_properties_t* pProperties ///< [in,out] Will contain the properties of the LED. ) { context.logger->log_trace("zesLedGetProperties(hLed, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Led.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesLedGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesLedGetPropertiesPrologue( hLed, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesLedGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesLedGetPropertiesPrologue( hLed, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesLedGetProperties", result); } auto driver_result = pfnGetProperties( hLed, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesLedGetPropertiesEpilogue( hLed, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesLedGetProperties", result); } return logAndPropagateResult("zesLedGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesLedGetState __zedlllocal ze_result_t ZE_APICALL zesLedGetState( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_state_t* pState ///< [in,out] Will contain the current state of the LED. ) { context.logger->log_trace("zesLedGetState(hLed, pState)"); auto pfnGetState = context.zesDdiTable.Led.pfnGetState; if( nullptr == pfnGetState ) return logAndPropagateResult("zesLedGetState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesLedGetStatePrologue( hLed, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesLedGetState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesLedGetStatePrologue( hLed, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesLedGetState", result); } auto driver_result = pfnGetState( hLed, pState ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesLedGetStateEpilogue( hLed, pState ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesLedGetState", result); } return logAndPropagateResult("zesLedGetState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesLedSetState __zedlllocal ze_result_t ZE_APICALL zesLedSetState( zes_led_handle_t hLed, ///< [in] Handle for the component. ze_bool_t enable ///< [in] Set to TRUE to turn the LED on, FALSE to turn off. ) { context.logger->log_trace("zesLedSetState(hLed, enable)"); auto pfnSetState = context.zesDdiTable.Led.pfnSetState; if( nullptr == pfnSetState ) return logAndPropagateResult("zesLedSetState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesLedSetStatePrologue( hLed, enable ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesLedSetState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesLedSetStatePrologue( hLed, enable ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesLedSetState", result); } auto driver_result = pfnSetState( hLed, enable ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesLedSetStateEpilogue( hLed, enable ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesLedSetState", result); } return logAndPropagateResult("zesLedSetState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesLedSetColor __zedlllocal ze_result_t ZE_APICALL zesLedSetColor( zes_led_handle_t hLed, ///< [in] Handle for the component. const zes_led_color_t* pColor ///< [in] New color of the LED. ) { context.logger->log_trace("zesLedSetColor(hLed, pColor)"); auto pfnSetColor = context.zesDdiTable.Led.pfnSetColor; if( nullptr == pfnSetColor ) return logAndPropagateResult("zesLedSetColor", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesLedSetColorPrologue( hLed, pColor ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesLedSetColor", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesLedSetColorPrologue( hLed, pColor ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesLedSetColor", result); } auto driver_result = pfnSetColor( hLed, pColor ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesLedSetColorEpilogue( hLed, pColor ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesLedSetColor", result); } return logAndPropagateResult("zesLedSetColor", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumMemoryModules __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumMemoryModules( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_mem_handle_t* phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumMemoryModules(hDevice, pCount, phMemory)"); auto pfnEnumMemoryModules = context.zesDdiTable.Device.pfnEnumMemoryModules; if( nullptr == pfnEnumMemoryModules ) return logAndPropagateResult("zesDeviceEnumMemoryModules", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumMemoryModulesPrologue( hDevice, pCount, phMemory ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumMemoryModules", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumMemoryModulesPrologue( hDevice, pCount, phMemory ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumMemoryModules", result); } auto driver_result = pfnEnumMemoryModules( hDevice, pCount, phMemory ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumMemoryModulesEpilogue( hDevice, pCount, phMemory ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumMemoryModules", result); } return logAndPropagateResult("zesDeviceEnumMemoryModules", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesMemoryGetProperties __zedlllocal ze_result_t ZE_APICALL zesMemoryGetProperties( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_properties_t* pProperties ///< [in,out] Will contain memory properties. ) { context.logger->log_trace("zesMemoryGetProperties(hMemory, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Memory.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesMemoryGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesMemoryGetPropertiesPrologue( hMemory, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesMemoryGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesMemoryGetPropertiesPrologue( hMemory, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesMemoryGetProperties", result); } auto driver_result = pfnGetProperties( hMemory, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesMemoryGetPropertiesEpilogue( hMemory, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesMemoryGetProperties", result); } return logAndPropagateResult("zesMemoryGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesMemoryGetState __zedlllocal ze_result_t ZE_APICALL zesMemoryGetState( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_state_t* pState ///< [in,out] Will contain the current health and allocated memory. ) { context.logger->log_trace("zesMemoryGetState(hMemory, pState)"); auto pfnGetState = context.zesDdiTable.Memory.pfnGetState; if( nullptr == pfnGetState ) return logAndPropagateResult("zesMemoryGetState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesMemoryGetStatePrologue( hMemory, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesMemoryGetState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesMemoryGetStatePrologue( hMemory, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesMemoryGetState", result); } auto driver_result = pfnGetState( hMemory, pState ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesMemoryGetStateEpilogue( hMemory, pState ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesMemoryGetState", result); } return logAndPropagateResult("zesMemoryGetState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesMemoryGetBandwidth __zedlllocal ze_result_t ZE_APICALL zesMemoryGetBandwidth( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_bandwidth_t* pBandwidth ///< [in,out] Will contain the total number of bytes read from and written ///< to memory, as well as the current maximum bandwidth. ) { context.logger->log_trace("zesMemoryGetBandwidth(hMemory, pBandwidth)"); auto pfnGetBandwidth = context.zesDdiTable.Memory.pfnGetBandwidth; if( nullptr == pfnGetBandwidth ) return logAndPropagateResult("zesMemoryGetBandwidth", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesMemoryGetBandwidthPrologue( hMemory, pBandwidth ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesMemoryGetBandwidth", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesMemoryGetBandwidthPrologue( hMemory, pBandwidth ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesMemoryGetBandwidth", result); } auto driver_result = pfnGetBandwidth( hMemory, pBandwidth ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesMemoryGetBandwidthEpilogue( hMemory, pBandwidth ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesMemoryGetBandwidth", result); } return logAndPropagateResult("zesMemoryGetBandwidth", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPerformanceFactorDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumPerformanceFactorDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_perf_handle_t* phPerf ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumPerformanceFactorDomains(hDevice, pCount, phPerf)"); auto pfnEnumPerformanceFactorDomains = context.zesDdiTable.Device.pfnEnumPerformanceFactorDomains; if( nullptr == pfnEnumPerformanceFactorDomains ) return logAndPropagateResult("zesDeviceEnumPerformanceFactorDomains", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumPerformanceFactorDomainsPrologue( hDevice, pCount, phPerf ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumPerformanceFactorDomains", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumPerformanceFactorDomainsPrologue( hDevice, pCount, phPerf ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumPerformanceFactorDomains", result); } auto driver_result = pfnEnumPerformanceFactorDomains( hDevice, pCount, phPerf ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumPerformanceFactorDomainsEpilogue( hDevice, pCount, phPerf ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumPerformanceFactorDomains", result); } return logAndPropagateResult("zesDeviceEnumPerformanceFactorDomains", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPerformanceFactorGetProperties __zedlllocal ze_result_t ZE_APICALL zesPerformanceFactorGetProperties( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. zes_perf_properties_t* pProperties ///< [in,out] Will contain information about the specified Performance ///< Factor domain. ) { context.logger->log_trace("zesPerformanceFactorGetProperties(hPerf, pProperties)"); auto pfnGetProperties = context.zesDdiTable.PerformanceFactor.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesPerformanceFactorGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPerformanceFactorGetPropertiesPrologue( hPerf, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPerformanceFactorGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPerformanceFactorGetPropertiesPrologue( hPerf, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPerformanceFactorGetProperties", result); } auto driver_result = pfnGetProperties( hPerf, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPerformanceFactorGetPropertiesEpilogue( hPerf, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPerformanceFactorGetProperties", result); } return logAndPropagateResult("zesPerformanceFactorGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPerformanceFactorGetConfig __zedlllocal ze_result_t ZE_APICALL zesPerformanceFactorGetConfig( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double* pFactor ///< [in,out] Will contain the actual Performance Factor being used by the ///< hardware (may not be the same as the requested Performance Factor). ) { context.logger->log_trace("zesPerformanceFactorGetConfig(hPerf, pFactor)"); auto pfnGetConfig = context.zesDdiTable.PerformanceFactor.pfnGetConfig; if( nullptr == pfnGetConfig ) return logAndPropagateResult("zesPerformanceFactorGetConfig", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPerformanceFactorGetConfigPrologue( hPerf, pFactor ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPerformanceFactorGetConfig", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPerformanceFactorGetConfigPrologue( hPerf, pFactor ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPerformanceFactorGetConfig", result); } auto driver_result = pfnGetConfig( hPerf, pFactor ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPerformanceFactorGetConfigEpilogue( hPerf, pFactor ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPerformanceFactorGetConfig", result); } return logAndPropagateResult("zesPerformanceFactorGetConfig", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPerformanceFactorSetConfig __zedlllocal ze_result_t ZE_APICALL zesPerformanceFactorSetConfig( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double factor ///< [in] The new Performance Factor. ) { context.logger->log_trace("zesPerformanceFactorSetConfig(hPerf, factor)"); auto pfnSetConfig = context.zesDdiTable.PerformanceFactor.pfnSetConfig; if( nullptr == pfnSetConfig ) return logAndPropagateResult("zesPerformanceFactorSetConfig", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPerformanceFactorSetConfigPrologue( hPerf, factor ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPerformanceFactorSetConfig", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPerformanceFactorSetConfigPrologue( hPerf, factor ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPerformanceFactorSetConfig", result); } auto driver_result = pfnSetConfig( hPerf, factor ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPerformanceFactorSetConfigEpilogue( hPerf, factor ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPerformanceFactorSetConfig", result); } return logAndPropagateResult("zesPerformanceFactorSetConfig", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPowerDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumPowerDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_pwr_handle_t* phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumPowerDomains(hDevice, pCount, phPower)"); auto pfnEnumPowerDomains = context.zesDdiTable.Device.pfnEnumPowerDomains; if( nullptr == pfnEnumPowerDomains ) return logAndPropagateResult("zesDeviceEnumPowerDomains", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumPowerDomainsPrologue( hDevice, pCount, phPower ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumPowerDomains", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumPowerDomainsPrologue( hDevice, pCount, phPower ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumPowerDomains", result); } auto driver_result = pfnEnumPowerDomains( hDevice, pCount, phPower ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumPowerDomainsEpilogue( hDevice, pCount, phPower ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumPowerDomains", result); } return logAndPropagateResult("zesDeviceEnumPowerDomains", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetCardPowerDomain __zedlllocal ze_result_t ZE_APICALL zesDeviceGetCardPowerDomain( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pwr_handle_t* phPower ///< [in,out] power domain handle for the entire PCIe card. ) { context.logger->log_trace("zesDeviceGetCardPowerDomain(hDevice, phPower)"); auto pfnGetCardPowerDomain = context.zesDdiTable.Device.pfnGetCardPowerDomain; if( nullptr == pfnGetCardPowerDomain ) return logAndPropagateResult("zesDeviceGetCardPowerDomain", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetCardPowerDomainPrologue( hDevice, phPower ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetCardPowerDomain", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceGetCardPowerDomainPrologue( hDevice, phPower ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetCardPowerDomain", result); } auto driver_result = pfnGetCardPowerDomain( hDevice, phPower ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetCardPowerDomainEpilogue( hDevice, phPower ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetCardPowerDomain", result); } return logAndPropagateResult("zesDeviceGetCardPowerDomain", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetProperties __zedlllocal ze_result_t ZE_APICALL zesPowerGetProperties( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_properties_t* pProperties ///< [in,out] Structure that will contain property data. ) { context.logger->log_trace("zesPowerGetProperties(hPower, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Power.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesPowerGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerGetPropertiesPrologue( hPower, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPowerGetPropertiesPrologue( hPower, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetProperties", result); } auto driver_result = pfnGetProperties( hPower, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerGetPropertiesEpilogue( hPower, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetProperties", result); } return logAndPropagateResult("zesPowerGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetEnergyCounter __zedlllocal ze_result_t ZE_APICALL zesPowerGetEnergyCounter( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_energy_counter_t* pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and ///< timestamp when the last counter value was measured. ) { context.logger->log_trace("zesPowerGetEnergyCounter(hPower, pEnergy)"); auto pfnGetEnergyCounter = context.zesDdiTable.Power.pfnGetEnergyCounter; if( nullptr == pfnGetEnergyCounter ) return logAndPropagateResult("zesPowerGetEnergyCounter", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerGetEnergyCounterPrologue( hPower, pEnergy ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetEnergyCounter", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPowerGetEnergyCounterPrologue( hPower, pEnergy ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetEnergyCounter", result); } auto driver_result = pfnGetEnergyCounter( hPower, pEnergy ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerGetEnergyCounterEpilogue( hPower, pEnergy ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetEnergyCounter", result); } return logAndPropagateResult("zesPowerGetEnergyCounter", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetLimits __zedlllocal ze_result_t ZE_APICALL zesPowerGetLimits( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_sustained_limit_t* pSustained, ///< [in,out][optional] The sustained power limit. If this is null, the ///< current sustained power limits will not be returned. zes_power_burst_limit_t* pBurst, ///< [in,out][optional] The burst power limit. If this is null, the current ///< peak power limits will not be returned. zes_power_peak_limit_t* pPeak ///< [in,out][optional] The peak power limit. If this is null, the peak ///< power limits will not be returned. ) { context.logger->log_trace("zesPowerGetLimits(hPower, pSustained, pBurst, pPeak)"); auto pfnGetLimits = context.zesDdiTable.Power.pfnGetLimits; if( nullptr == pfnGetLimits ) return logAndPropagateResult("zesPowerGetLimits", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerGetLimitsPrologue( hPower, pSustained, pBurst, pPeak ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetLimits", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPowerGetLimitsPrologue( hPower, pSustained, pBurst, pPeak ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetLimits", result); } auto driver_result = pfnGetLimits( hPower, pSustained, pBurst, pPeak ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerGetLimitsEpilogue( hPower, pSustained, pBurst, pPeak ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetLimits", result); } return logAndPropagateResult("zesPowerGetLimits", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerSetLimits __zedlllocal ze_result_t ZE_APICALL zesPowerSetLimits( zes_pwr_handle_t hPower, ///< [in] Handle for the component. const zes_power_sustained_limit_t* pSustained, ///< [in][optional] The sustained power limit. If this is null, no changes ///< will be made to the sustained power limits. const zes_power_burst_limit_t* pBurst, ///< [in][optional] The burst power limit. If this is null, no changes will ///< be made to the burst power limits. const zes_power_peak_limit_t* pPeak ///< [in][optional] The peak power limit. If this is null, no changes will ///< be made to the peak power limits. ) { context.logger->log_trace("zesPowerSetLimits(hPower, pSustained, pBurst, pPeak)"); auto pfnSetLimits = context.zesDdiTable.Power.pfnSetLimits; if( nullptr == pfnSetLimits ) return logAndPropagateResult("zesPowerSetLimits", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerSetLimitsPrologue( hPower, pSustained, pBurst, pPeak ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerSetLimits", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPowerSetLimitsPrologue( hPower, pSustained, pBurst, pPeak ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerSetLimits", result); } auto driver_result = pfnSetLimits( hPower, pSustained, pBurst, pPeak ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerSetLimitsEpilogue( hPower, pSustained, pBurst, pPeak ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerSetLimits", result); } return logAndPropagateResult("zesPowerSetLimits", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetEnergyThreshold __zedlllocal ze_result_t ZE_APICALL zesPowerGetEnergyThreshold( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_energy_threshold_t* pThreshold ///< [in,out] Returns information about the energy threshold setting - ///< enabled/energy threshold/process ID. ) { context.logger->log_trace("zesPowerGetEnergyThreshold(hPower, pThreshold)"); auto pfnGetEnergyThreshold = context.zesDdiTable.Power.pfnGetEnergyThreshold; if( nullptr == pfnGetEnergyThreshold ) return logAndPropagateResult("zesPowerGetEnergyThreshold", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerGetEnergyThresholdPrologue( hPower, pThreshold ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetEnergyThreshold", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPowerGetEnergyThresholdPrologue( hPower, pThreshold ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetEnergyThreshold", result); } auto driver_result = pfnGetEnergyThreshold( hPower, pThreshold ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerGetEnergyThresholdEpilogue( hPower, pThreshold ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetEnergyThreshold", result); } return logAndPropagateResult("zesPowerGetEnergyThreshold", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerSetEnergyThreshold __zedlllocal ze_result_t ZE_APICALL zesPowerSetEnergyThreshold( zes_pwr_handle_t hPower, ///< [in] Handle for the component. double threshold ///< [in] The energy threshold to be set in joules. ) { context.logger->log_trace("zesPowerSetEnergyThreshold(hPower, threshold)"); auto pfnSetEnergyThreshold = context.zesDdiTable.Power.pfnSetEnergyThreshold; if( nullptr == pfnSetEnergyThreshold ) return logAndPropagateResult("zesPowerSetEnergyThreshold", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerSetEnergyThresholdPrologue( hPower, threshold ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerSetEnergyThreshold", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPowerSetEnergyThresholdPrologue( hPower, threshold ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerSetEnergyThreshold", result); } auto driver_result = pfnSetEnergyThreshold( hPower, threshold ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerSetEnergyThresholdEpilogue( hPower, threshold ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerSetEnergyThreshold", result); } return logAndPropagateResult("zesPowerSetEnergyThreshold", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPsus __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumPsus( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_psu_handle_t* phPsu ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumPsus(hDevice, pCount, phPsu)"); auto pfnEnumPsus = context.zesDdiTable.Device.pfnEnumPsus; if( nullptr == pfnEnumPsus ) return logAndPropagateResult("zesDeviceEnumPsus", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumPsusPrologue( hDevice, pCount, phPsu ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumPsus", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumPsusPrologue( hDevice, pCount, phPsu ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumPsus", result); } auto driver_result = pfnEnumPsus( hDevice, pCount, phPsu ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumPsusEpilogue( hDevice, pCount, phPsu ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumPsus", result); } return logAndPropagateResult("zesDeviceEnumPsus", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPsuGetProperties __zedlllocal ze_result_t ZE_APICALL zesPsuGetProperties( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_properties_t* pProperties ///< [in,out] Will contain the properties of the power supply. ) { context.logger->log_trace("zesPsuGetProperties(hPsu, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Psu.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesPsuGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPsuGetPropertiesPrologue( hPsu, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPsuGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPsuGetPropertiesPrologue( hPsu, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPsuGetProperties", result); } auto driver_result = pfnGetProperties( hPsu, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPsuGetPropertiesEpilogue( hPsu, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPsuGetProperties", result); } return logAndPropagateResult("zesPsuGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPsuGetState __zedlllocal ze_result_t ZE_APICALL zesPsuGetState( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_state_t* pState ///< [in,out] Will contain the current state of the power supply. ) { context.logger->log_trace("zesPsuGetState(hPsu, pState)"); auto pfnGetState = context.zesDdiTable.Psu.pfnGetState; if( nullptr == pfnGetState ) return logAndPropagateResult("zesPsuGetState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPsuGetStatePrologue( hPsu, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPsuGetState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPsuGetStatePrologue( hPsu, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPsuGetState", result); } auto driver_result = pfnGetState( hPsu, pState ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPsuGetStateEpilogue( hPsu, pState ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPsuGetState", result); } return logAndPropagateResult("zesPsuGetState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumRasErrorSets __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumRasErrorSets( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_ras_handle_t* phRas ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumRasErrorSets(hDevice, pCount, phRas)"); auto pfnEnumRasErrorSets = context.zesDdiTable.Device.pfnEnumRasErrorSets; if( nullptr == pfnEnumRasErrorSets ) return logAndPropagateResult("zesDeviceEnumRasErrorSets", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumRasErrorSetsPrologue( hDevice, pCount, phRas ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumRasErrorSets", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumRasErrorSetsPrologue( hDevice, pCount, phRas ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumRasErrorSets", result); } auto driver_result = pfnEnumRasErrorSets( hDevice, pCount, phRas ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumRasErrorSetsEpilogue( hDevice, pCount, phRas ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumRasErrorSets", result); } return logAndPropagateResult("zesDeviceEnumRasErrorSets", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasGetProperties __zedlllocal ze_result_t ZE_APICALL zesRasGetProperties( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_properties_t* pProperties ///< [in,out] Structure describing RAS properties ) { context.logger->log_trace("zesRasGetProperties(hRas, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Ras.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesRasGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesRasGetPropertiesPrologue( hRas, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesRasGetPropertiesPrologue( hRas, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasGetProperties", result); } auto driver_result = pfnGetProperties( hRas, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesRasGetPropertiesEpilogue( hRas, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasGetProperties", result); } return logAndPropagateResult("zesRasGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasGetConfig __zedlllocal ze_result_t ZE_APICALL zesRasGetConfig( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_config_t* pConfig ///< [in,out] Will be populed with the current RAS configuration - ///< thresholds used to trigger events ) { context.logger->log_trace("zesRasGetConfig(hRas, pConfig)"); auto pfnGetConfig = context.zesDdiTable.Ras.pfnGetConfig; if( nullptr == pfnGetConfig ) return logAndPropagateResult("zesRasGetConfig", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesRasGetConfigPrologue( hRas, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasGetConfig", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesRasGetConfigPrologue( hRas, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasGetConfig", result); } auto driver_result = pfnGetConfig( hRas, pConfig ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesRasGetConfigEpilogue( hRas, pConfig ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasGetConfig", result); } return logAndPropagateResult("zesRasGetConfig", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasSetConfig __zedlllocal ze_result_t ZE_APICALL zesRasSetConfig( zes_ras_handle_t hRas, ///< [in] Handle for the component. const zes_ras_config_t* pConfig ///< [in] Change the RAS configuration - thresholds used to trigger events ) { context.logger->log_trace("zesRasSetConfig(hRas, pConfig)"); auto pfnSetConfig = context.zesDdiTable.Ras.pfnSetConfig; if( nullptr == pfnSetConfig ) return logAndPropagateResult("zesRasSetConfig", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesRasSetConfigPrologue( hRas, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasSetConfig", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesRasSetConfigPrologue( hRas, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasSetConfig", result); } auto driver_result = pfnSetConfig( hRas, pConfig ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesRasSetConfigEpilogue( hRas, pConfig ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasSetConfig", result); } return logAndPropagateResult("zesRasSetConfig", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasGetState __zedlllocal ze_result_t ZE_APICALL zesRasGetState( zes_ras_handle_t hRas, ///< [in] Handle for the component. ze_bool_t clear, ///< [in] Set to 1 to clear the counters of this type zes_ras_state_t* pState ///< [in,out] Breakdown of where errors have occurred ) { context.logger->log_trace("zesRasGetState(hRas, clear, pState)"); auto pfnGetState = context.zesDdiTable.Ras.pfnGetState; if( nullptr == pfnGetState ) return logAndPropagateResult("zesRasGetState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesRasGetStatePrologue( hRas, clear, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasGetState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesRasGetStatePrologue( hRas, clear, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasGetState", result); } auto driver_result = pfnGetState( hRas, clear, pState ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesRasGetStateEpilogue( hRas, clear, pState ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasGetState", result); } return logAndPropagateResult("zesRasGetState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumSchedulers __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumSchedulers( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_sched_handle_t* phScheduler ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumSchedulers(hDevice, pCount, phScheduler)"); auto pfnEnumSchedulers = context.zesDdiTable.Device.pfnEnumSchedulers; if( nullptr == pfnEnumSchedulers ) return logAndPropagateResult("zesDeviceEnumSchedulers", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumSchedulersPrologue( hDevice, pCount, phScheduler ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumSchedulers", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumSchedulersPrologue( hDevice, pCount, phScheduler ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumSchedulers", result); } auto driver_result = pfnEnumSchedulers( hDevice, pCount, phScheduler ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumSchedulersEpilogue( hDevice, pCount, phScheduler ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumSchedulers", result); } return logAndPropagateResult("zesDeviceEnumSchedulers", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerGetProperties __zedlllocal ze_result_t ZE_APICALL zesSchedulerGetProperties( zes_sched_handle_t hScheduler, ///< [in] Handle for the component. zes_sched_properties_t* pProperties ///< [in,out] Structure that will contain property data. ) { context.logger->log_trace("zesSchedulerGetProperties(hScheduler, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Scheduler.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesSchedulerGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerGetPropertiesPrologue( hScheduler, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesSchedulerGetPropertiesPrologue( hScheduler, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerGetProperties", result); } auto driver_result = pfnGetProperties( hScheduler, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerGetPropertiesEpilogue( hScheduler, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerGetProperties", result); } return logAndPropagateResult("zesSchedulerGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerGetCurrentMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerGetCurrentMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_mode_t* pMode ///< [in,out] Will contain the current scheduler mode. ) { context.logger->log_trace("zesSchedulerGetCurrentMode(hScheduler, pMode)"); auto pfnGetCurrentMode = context.zesDdiTable.Scheduler.pfnGetCurrentMode; if( nullptr == pfnGetCurrentMode ) return logAndPropagateResult("zesSchedulerGetCurrentMode", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerGetCurrentModePrologue( hScheduler, pMode ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerGetCurrentMode", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesSchedulerGetCurrentModePrologue( hScheduler, pMode ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerGetCurrentMode", result); } auto driver_result = pfnGetCurrentMode( hScheduler, pMode ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerGetCurrentModeEpilogue( hScheduler, pMode ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerGetCurrentMode", result); } return logAndPropagateResult("zesSchedulerGetCurrentMode", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerGetTimeoutModeProperties __zedlllocal ze_result_t ZE_APICALL zesSchedulerGetTimeoutModeProperties( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeout_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ) { context.logger->log_trace("zesSchedulerGetTimeoutModeProperties(hScheduler, getDefaults, pConfig)"); auto pfnGetTimeoutModeProperties = context.zesDdiTable.Scheduler.pfnGetTimeoutModeProperties; if( nullptr == pfnGetTimeoutModeProperties ) return logAndPropagateResult("zesSchedulerGetTimeoutModeProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerGetTimeoutModePropertiesPrologue( hScheduler, getDefaults, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerGetTimeoutModeProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesSchedulerGetTimeoutModePropertiesPrologue( hScheduler, getDefaults, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerGetTimeoutModeProperties", result); } auto driver_result = pfnGetTimeoutModeProperties( hScheduler, getDefaults, pConfig ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerGetTimeoutModePropertiesEpilogue( hScheduler, getDefaults, pConfig ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerGetTimeoutModeProperties", result); } return logAndPropagateResult("zesSchedulerGetTimeoutModeProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerGetTimesliceModeProperties __zedlllocal ze_result_t ZE_APICALL zesSchedulerGetTimesliceModeProperties( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeslice_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ) { context.logger->log_trace("zesSchedulerGetTimesliceModeProperties(hScheduler, getDefaults, pConfig)"); auto pfnGetTimesliceModeProperties = context.zesDdiTable.Scheduler.pfnGetTimesliceModeProperties; if( nullptr == pfnGetTimesliceModeProperties ) return logAndPropagateResult("zesSchedulerGetTimesliceModeProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerGetTimesliceModePropertiesPrologue( hScheduler, getDefaults, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerGetTimesliceModeProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesSchedulerGetTimesliceModePropertiesPrologue( hScheduler, getDefaults, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerGetTimesliceModeProperties", result); } auto driver_result = pfnGetTimesliceModeProperties( hScheduler, getDefaults, pConfig ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerGetTimesliceModePropertiesEpilogue( hScheduler, getDefaults, pConfig ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerGetTimesliceModeProperties", result); } return logAndPropagateResult("zesSchedulerGetTimesliceModeProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerSetTimeoutMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerSetTimeoutMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeout_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { context.logger->log_trace("zesSchedulerSetTimeoutMode(hScheduler, pProperties, pNeedReload)"); auto pfnSetTimeoutMode = context.zesDdiTable.Scheduler.pfnSetTimeoutMode; if( nullptr == pfnSetTimeoutMode ) return logAndPropagateResult("zesSchedulerSetTimeoutMode", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerSetTimeoutModePrologue( hScheduler, pProperties, pNeedReload ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerSetTimeoutMode", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesSchedulerSetTimeoutModePrologue( hScheduler, pProperties, pNeedReload ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerSetTimeoutMode", result); } auto driver_result = pfnSetTimeoutMode( hScheduler, pProperties, pNeedReload ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerSetTimeoutModeEpilogue( hScheduler, pProperties, pNeedReload ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerSetTimeoutMode", result); } return logAndPropagateResult("zesSchedulerSetTimeoutMode", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerSetTimesliceMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerSetTimesliceMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeslice_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { context.logger->log_trace("zesSchedulerSetTimesliceMode(hScheduler, pProperties, pNeedReload)"); auto pfnSetTimesliceMode = context.zesDdiTable.Scheduler.pfnSetTimesliceMode; if( nullptr == pfnSetTimesliceMode ) return logAndPropagateResult("zesSchedulerSetTimesliceMode", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerSetTimesliceModePrologue( hScheduler, pProperties, pNeedReload ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerSetTimesliceMode", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesSchedulerSetTimesliceModePrologue( hScheduler, pProperties, pNeedReload ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerSetTimesliceMode", result); } auto driver_result = pfnSetTimesliceMode( hScheduler, pProperties, pNeedReload ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerSetTimesliceModeEpilogue( hScheduler, pProperties, pNeedReload ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerSetTimesliceMode", result); } return logAndPropagateResult("zesSchedulerSetTimesliceMode", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerSetExclusiveMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerSetExclusiveMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { context.logger->log_trace("zesSchedulerSetExclusiveMode(hScheduler, pNeedReload)"); auto pfnSetExclusiveMode = context.zesDdiTable.Scheduler.pfnSetExclusiveMode; if( nullptr == pfnSetExclusiveMode ) return logAndPropagateResult("zesSchedulerSetExclusiveMode", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerSetExclusiveModePrologue( hScheduler, pNeedReload ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerSetExclusiveMode", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesSchedulerSetExclusiveModePrologue( hScheduler, pNeedReload ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerSetExclusiveMode", result); } auto driver_result = pfnSetExclusiveMode( hScheduler, pNeedReload ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerSetExclusiveModeEpilogue( hScheduler, pNeedReload ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerSetExclusiveMode", result); } return logAndPropagateResult("zesSchedulerSetExclusiveMode", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerSetComputeUnitDebugMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerSetComputeUnitDebugMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { context.logger->log_trace("zesSchedulerSetComputeUnitDebugMode(hScheduler, pNeedReload)"); auto pfnSetComputeUnitDebugMode = context.zesDdiTable.Scheduler.pfnSetComputeUnitDebugMode; if( nullptr == pfnSetComputeUnitDebugMode ) return logAndPropagateResult("zesSchedulerSetComputeUnitDebugMode", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerSetComputeUnitDebugModePrologue( hScheduler, pNeedReload ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerSetComputeUnitDebugMode", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesSchedulerSetComputeUnitDebugModePrologue( hScheduler, pNeedReload ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerSetComputeUnitDebugMode", result); } auto driver_result = pfnSetComputeUnitDebugMode( hScheduler, pNeedReload ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesSchedulerSetComputeUnitDebugModeEpilogue( hScheduler, pNeedReload ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesSchedulerSetComputeUnitDebugMode", result); } return logAndPropagateResult("zesSchedulerSetComputeUnitDebugMode", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumStandbyDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumStandbyDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_standby_handle_t* phStandby ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumStandbyDomains(hDevice, pCount, phStandby)"); auto pfnEnumStandbyDomains = context.zesDdiTable.Device.pfnEnumStandbyDomains; if( nullptr == pfnEnumStandbyDomains ) return logAndPropagateResult("zesDeviceEnumStandbyDomains", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumStandbyDomainsPrologue( hDevice, pCount, phStandby ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumStandbyDomains", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumStandbyDomainsPrologue( hDevice, pCount, phStandby ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumStandbyDomains", result); } auto driver_result = pfnEnumStandbyDomains( hDevice, pCount, phStandby ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumStandbyDomainsEpilogue( hDevice, pCount, phStandby ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumStandbyDomains", result); } return logAndPropagateResult("zesDeviceEnumStandbyDomains", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesStandbyGetProperties __zedlllocal ze_result_t ZE_APICALL zesStandbyGetProperties( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_properties_t* pProperties ///< [in,out] Will contain the standby hardware properties. ) { context.logger->log_trace("zesStandbyGetProperties(hStandby, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Standby.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesStandbyGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesStandbyGetPropertiesPrologue( hStandby, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesStandbyGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesStandbyGetPropertiesPrologue( hStandby, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesStandbyGetProperties", result); } auto driver_result = pfnGetProperties( hStandby, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesStandbyGetPropertiesEpilogue( hStandby, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesStandbyGetProperties", result); } return logAndPropagateResult("zesStandbyGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesStandbyGetMode __zedlllocal ze_result_t ZE_APICALL zesStandbyGetMode( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t* pMode ///< [in,out] Will contain the current standby mode. ) { context.logger->log_trace("zesStandbyGetMode(hStandby, pMode)"); auto pfnGetMode = context.zesDdiTable.Standby.pfnGetMode; if( nullptr == pfnGetMode ) return logAndPropagateResult("zesStandbyGetMode", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesStandbyGetModePrologue( hStandby, pMode ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesStandbyGetMode", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesStandbyGetModePrologue( hStandby, pMode ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesStandbyGetMode", result); } auto driver_result = pfnGetMode( hStandby, pMode ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesStandbyGetModeEpilogue( hStandby, pMode ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesStandbyGetMode", result); } return logAndPropagateResult("zesStandbyGetMode", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesStandbySetMode __zedlllocal ze_result_t ZE_APICALL zesStandbySetMode( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t mode ///< [in] New standby mode. ) { context.logger->log_trace("zesStandbySetMode(hStandby, mode)"); auto pfnSetMode = context.zesDdiTable.Standby.pfnSetMode; if( nullptr == pfnSetMode ) return logAndPropagateResult("zesStandbySetMode", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesStandbySetModePrologue( hStandby, mode ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesStandbySetMode", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesStandbySetModePrologue( hStandby, mode ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesStandbySetMode", result); } auto driver_result = pfnSetMode( hStandby, mode ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesStandbySetModeEpilogue( hStandby, mode ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesStandbySetMode", result); } return logAndPropagateResult("zesStandbySetMode", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumTemperatureSensors __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumTemperatureSensors( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_temp_handle_t* phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumTemperatureSensors(hDevice, pCount, phTemperature)"); auto pfnEnumTemperatureSensors = context.zesDdiTable.Device.pfnEnumTemperatureSensors; if( nullptr == pfnEnumTemperatureSensors ) return logAndPropagateResult("zesDeviceEnumTemperatureSensors", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumTemperatureSensorsPrologue( hDevice, pCount, phTemperature ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumTemperatureSensors", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumTemperatureSensorsPrologue( hDevice, pCount, phTemperature ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumTemperatureSensors", result); } auto driver_result = pfnEnumTemperatureSensors( hDevice, pCount, phTemperature ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumTemperatureSensorsEpilogue( hDevice, pCount, phTemperature ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumTemperatureSensors", result); } return logAndPropagateResult("zesDeviceEnumTemperatureSensors", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesTemperatureGetProperties __zedlllocal ze_result_t ZE_APICALL zesTemperatureGetProperties( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_properties_t* pProperties ///< [in,out] Will contain the temperature sensor properties. ) { context.logger->log_trace("zesTemperatureGetProperties(hTemperature, pProperties)"); auto pfnGetProperties = context.zesDdiTable.Temperature.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zesTemperatureGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesTemperatureGetPropertiesPrologue( hTemperature, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesTemperatureGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesTemperatureGetPropertiesPrologue( hTemperature, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesTemperatureGetProperties", result); } auto driver_result = pfnGetProperties( hTemperature, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesTemperatureGetPropertiesEpilogue( hTemperature, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesTemperatureGetProperties", result); } return logAndPropagateResult("zesTemperatureGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesTemperatureGetConfig __zedlllocal ze_result_t ZE_APICALL zesTemperatureGetConfig( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_config_t* pConfig ///< [in,out] Returns current configuration. ) { context.logger->log_trace("zesTemperatureGetConfig(hTemperature, pConfig)"); auto pfnGetConfig = context.zesDdiTable.Temperature.pfnGetConfig; if( nullptr == pfnGetConfig ) return logAndPropagateResult("zesTemperatureGetConfig", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesTemperatureGetConfigPrologue( hTemperature, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesTemperatureGetConfig", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesTemperatureGetConfigPrologue( hTemperature, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesTemperatureGetConfig", result); } auto driver_result = pfnGetConfig( hTemperature, pConfig ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesTemperatureGetConfigEpilogue( hTemperature, pConfig ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesTemperatureGetConfig", result); } return logAndPropagateResult("zesTemperatureGetConfig", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesTemperatureSetConfig __zedlllocal ze_result_t ZE_APICALL zesTemperatureSetConfig( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. const zes_temp_config_t* pConfig ///< [in] New configuration. ) { context.logger->log_trace("zesTemperatureSetConfig(hTemperature, pConfig)"); auto pfnSetConfig = context.zesDdiTable.Temperature.pfnSetConfig; if( nullptr == pfnSetConfig ) return logAndPropagateResult("zesTemperatureSetConfig", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesTemperatureSetConfigPrologue( hTemperature, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesTemperatureSetConfig", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesTemperatureSetConfigPrologue( hTemperature, pConfig ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesTemperatureSetConfig", result); } auto driver_result = pfnSetConfig( hTemperature, pConfig ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesTemperatureSetConfigEpilogue( hTemperature, pConfig ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesTemperatureSetConfig", result); } return logAndPropagateResult("zesTemperatureSetConfig", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesTemperatureGetState __zedlllocal ze_result_t ZE_APICALL zesTemperatureGetState( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. double* pTemperature ///< [in,out] Will contain the temperature read from the specified sensor ///< in degrees Celsius. ) { context.logger->log_trace("zesTemperatureGetState(hTemperature, pTemperature)"); auto pfnGetState = context.zesDdiTable.Temperature.pfnGetState; if( nullptr == pfnGetState ) return logAndPropagateResult("zesTemperatureGetState", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesTemperatureGetStatePrologue( hTemperature, pTemperature ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesTemperatureGetState", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesTemperatureGetStatePrologue( hTemperature, pTemperature ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesTemperatureGetState", result); } auto driver_result = pfnGetState( hTemperature, pTemperature ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesTemperatureGetStateEpilogue( hTemperature, pTemperature ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesTemperatureGetState", result); } return logAndPropagateResult("zesTemperatureGetState", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetLimitsExt __zedlllocal ze_result_t ZE_APICALL zesPowerGetLimitsExt( zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. uint32_t* pCount, ///< [in,out] Pointer to the number of power limit descriptors. If count is ///< zero, then the driver shall update the value with the total number of ///< components of this type that are available. If count is greater than ///< the number of components of this type that are available, then the ///< driver shall update the value with the correct number of components. zes_power_limit_ext_desc_t* pSustained ///< [in,out][optional][range(0, *pCount)] Array of query results for power ///< limit descriptors. If count is less than the number of components of ///< this type that are available, then the driver shall only retrieve that ///< number of components. ) { context.logger->log_trace("zesPowerGetLimitsExt(hPower, pCount, pSustained)"); auto pfnGetLimitsExt = context.zesDdiTable.Power.pfnGetLimitsExt; if( nullptr == pfnGetLimitsExt ) return logAndPropagateResult("zesPowerGetLimitsExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerGetLimitsExtPrologue( hPower, pCount, pSustained ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetLimitsExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPowerGetLimitsExtPrologue( hPower, pCount, pSustained ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetLimitsExt", result); } auto driver_result = pfnGetLimitsExt( hPower, pCount, pSustained ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerGetLimitsExtEpilogue( hPower, pCount, pSustained ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerGetLimitsExt", result); } return logAndPropagateResult("zesPowerGetLimitsExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerSetLimitsExt __zedlllocal ze_result_t ZE_APICALL zesPowerSetLimitsExt( zes_pwr_handle_t hPower, ///< [in] Handle for the component. uint32_t* pCount, ///< [in] Pointer to the number of power limit descriptors. zes_power_limit_ext_desc_t* pSustained ///< [in][optional][range(0, *pCount)] Array of power limit descriptors. ) { context.logger->log_trace("zesPowerSetLimitsExt(hPower, pCount, pSustained)"); auto pfnSetLimitsExt = context.zesDdiTable.Power.pfnSetLimitsExt; if( nullptr == pfnSetLimitsExt ) return logAndPropagateResult("zesPowerSetLimitsExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerSetLimitsExtPrologue( hPower, pCount, pSustained ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerSetLimitsExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesPowerSetLimitsExtPrologue( hPower, pCount, pSustained ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerSetLimitsExt", result); } auto driver_result = pfnSetLimitsExt( hPower, pCount, pSustained ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesPowerSetLimitsExtEpilogue( hPower, pCount, pSustained ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesPowerSetLimitsExt", result); } return logAndPropagateResult("zesPowerSetLimitsExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetActivityExt __zedlllocal ze_result_t ZE_APICALL zesEngineGetActivityExt( zes_engine_handle_t hEngine, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_engine_stats_t* pStats ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector with engine stat for ///< PF at index 0 of the vector followed by user provided pCount-1 number ///< of VF engine stats. ) { context.logger->log_trace("zesEngineGetActivityExt(hEngine, pCount, pStats)"); auto pfnGetActivityExt = context.zesDdiTable.Engine.pfnGetActivityExt; if( nullptr == pfnGetActivityExt ) return logAndPropagateResult("zesEngineGetActivityExt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesEngineGetActivityExtPrologue( hEngine, pCount, pStats ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesEngineGetActivityExt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesEngineGetActivityExtPrologue( hEngine, pCount, pStats ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesEngineGetActivityExt", result); } auto driver_result = pfnGetActivityExt( hEngine, pCount, pStats ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesEngineGetActivityExtEpilogue( hEngine, pCount, pStats ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesEngineGetActivityExt", result); } return logAndPropagateResult("zesEngineGetActivityExt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasGetStateExp __zedlllocal ze_result_t ZE_APICALL zesRasGetStateExp( zes_ras_handle_t hRas, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of RAS state structures that can be retrieved. ///< if count is zero, then the driver shall update the value with the ///< total number of error categories for which state can be retrieved. ///< if count is greater than the number of RAS states available, then the ///< driver shall update the value with the correct number of RAS states available. zes_ras_state_exp_t* pState ///< [in,out][optional][range(0, *pCount)] array of query results for RAS ///< error states for different categories. ///< if count is less than the number of RAS states available, then driver ///< shall only retrieve that number of RAS states. ) { context.logger->log_trace("zesRasGetStateExp(hRas, pCount, pState)"); auto pfnGetStateExp = context.zesDdiTable.RasExp.pfnGetStateExp; if( nullptr == pfnGetStateExp ) return logAndPropagateResult("zesRasGetStateExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesRasGetStateExpPrologue( hRas, pCount, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasGetStateExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesRasGetStateExpPrologue( hRas, pCount, pState ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasGetStateExp", result); } auto driver_result = pfnGetStateExp( hRas, pCount, pState ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesRasGetStateExpEpilogue( hRas, pCount, pState ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasGetStateExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zesRasGetStateExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasClearStateExp __zedlllocal ze_result_t ZE_APICALL zesRasClearStateExp( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_error_category_exp_t category ///< [in] category for which error counter is to be cleared. ) { context.logger->log_trace("zesRasClearStateExp(hRas, category)"); auto pfnClearStateExp = context.zesDdiTable.RasExp.pfnClearStateExp; if( nullptr == pfnClearStateExp ) return logAndPropagateResult("zesRasClearStateExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesRasClearStateExpPrologue( hRas, category ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasClearStateExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesRasClearStateExpPrologue( hRas, category ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasClearStateExp", result); } auto driver_result = pfnClearStateExp( hRas, category ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesRasClearStateExpEpilogue( hRas, category ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesRasClearStateExp", result); } return logAndPropagateResult("zesRasClearStateExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetSecurityVersionExp __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetSecurityVersionExp( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. char* pVersion ///< [in,out] NULL terminated string value. The string "unknown" will be ///< returned if this property cannot be determined. ) { context.logger->log_trace("zesFirmwareGetSecurityVersionExp(hFirmware, pVersion)"); auto pfnGetSecurityVersionExp = context.zesDdiTable.FirmwareExp.pfnGetSecurityVersionExp; if( nullptr == pfnGetSecurityVersionExp ) return logAndPropagateResult("zesFirmwareGetSecurityVersionExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFirmwareGetSecurityVersionExpPrologue( hFirmware, pVersion ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareGetSecurityVersionExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFirmwareGetSecurityVersionExpPrologue( hFirmware, pVersion ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareGetSecurityVersionExp", result); } auto driver_result = pfnGetSecurityVersionExp( hFirmware, pVersion ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFirmwareGetSecurityVersionExpEpilogue( hFirmware, pVersion ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareGetSecurityVersionExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zesFirmwareGetSecurityVersionExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareSetSecurityVersionExp __zedlllocal ze_result_t ZE_APICALL zesFirmwareSetSecurityVersionExp( zes_firmware_handle_t hFirmware ///< [in] Handle for the component. ) { context.logger->log_trace("zesFirmwareSetSecurityVersionExp(hFirmware)"); auto pfnSetSecurityVersionExp = context.zesDdiTable.FirmwareExp.pfnSetSecurityVersionExp; if( nullptr == pfnSetSecurityVersionExp ) return logAndPropagateResult("zesFirmwareSetSecurityVersionExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFirmwareSetSecurityVersionExpPrologue( hFirmware ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareSetSecurityVersionExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesFirmwareSetSecurityVersionExpPrologue( hFirmware ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareSetSecurityVersionExp", result); } auto driver_result = pfnSetSecurityVersionExp( hFirmware ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesFirmwareSetSecurityVersionExpEpilogue( hFirmware ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesFirmwareSetSecurityVersionExp", result); } return logAndPropagateResult("zesFirmwareSetSecurityVersionExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetSubDevicePropertiesExp __zedlllocal ze_result_t ZE_APICALL zesDeviceGetSubDevicePropertiesExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of sub devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub devices currently attached to the device. ///< if count is greater than the number of sub devices currently attached ///< to the device, then the driver shall update the value with the correct ///< number of sub devices. zes_subdevice_exp_properties_t* pSubdeviceProps ///< [in,out][optional][range(0, *pCount)] array of sub device property structures. ///< if count is less than the number of sysman sub devices available, then ///< the driver shall only retrieve that number of sub device property structures. ) { context.logger->log_trace("zesDeviceGetSubDevicePropertiesExp(hDevice, pCount, pSubdeviceProps)"); auto pfnGetSubDevicePropertiesExp = context.zesDdiTable.DeviceExp.pfnGetSubDevicePropertiesExp; if( nullptr == pfnGetSubDevicePropertiesExp ) return logAndPropagateResult("zesDeviceGetSubDevicePropertiesExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetSubDevicePropertiesExpPrologue( hDevice, pCount, pSubdeviceProps ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetSubDevicePropertiesExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceGetSubDevicePropertiesExpPrologue( hDevice, pCount, pSubdeviceProps ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetSubDevicePropertiesExp", result); } auto driver_result = pfnGetSubDevicePropertiesExp( hDevice, pCount, pSubdeviceProps ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceGetSubDevicePropertiesExpEpilogue( hDevice, pCount, pSubdeviceProps ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceGetSubDevicePropertiesExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zesDeviceGetSubDevicePropertiesExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverGetDeviceByUuidExp __zedlllocal ze_result_t ZE_APICALL zesDriverGetDeviceByUuidExp( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance zes_uuid_t uuid, ///< [in] universal unique identifier. zes_device_handle_t* phDevice, ///< [out] Sysman handle of the device. ze_bool_t* onSubdevice, ///< [out] True if the UUID belongs to the sub-device; false means that ///< UUID belongs to the root device. uint32_t* subdeviceId ///< [out] If onSubdevice is true, this gives the ID of the sub-device ) { context.logger->log_trace("zesDriverGetDeviceByUuidExp(hDriver, uuid, phDevice, onSubdevice, subdeviceId)"); auto pfnGetDeviceByUuidExp = context.zesDdiTable.DriverExp.pfnGetDeviceByUuidExp; if( nullptr == pfnGetDeviceByUuidExp ) return logAndPropagateResult("zesDriverGetDeviceByUuidExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDriverGetDeviceByUuidExpPrologue( hDriver, uuid, phDevice, onSubdevice, subdeviceId ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverGetDeviceByUuidExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDriverGetDeviceByUuidExpPrologue( hDriver, uuid, phDevice, onSubdevice, subdeviceId ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverGetDeviceByUuidExp", result); } auto driver_result = pfnGetDeviceByUuidExp( hDriver, uuid, phDevice, onSubdevice, subdeviceId ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDriverGetDeviceByUuidExpEpilogue( hDriver, uuid, phDevice, onSubdevice, subdeviceId ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDriverGetDeviceByUuidExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phDevice){ context.handleLifetime->addHandle( *phDevice ); context.handleLifetime->addDependent( hDriver, *phDevice ); } } return logAndPropagateResult("zesDriverGetDeviceByUuidExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumActiveVFExp __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumActiveVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumActiveVFExp(hDevice, pCount, phVFhandle)"); auto pfnEnumActiveVFExp = context.zesDdiTable.DeviceExp.pfnEnumActiveVFExp; if( nullptr == pfnEnumActiveVFExp ) return logAndPropagateResult("zesDeviceEnumActiveVFExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumActiveVFExpPrologue( hDevice, pCount, phVFhandle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumActiveVFExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumActiveVFExpPrologue( hDevice, pCount, phVFhandle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumActiveVFExp", result); } auto driver_result = pfnEnumActiveVFExp( hDevice, pCount, phVFhandle ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumActiveVFExpEpilogue( hDevice, pCount, phVFhandle ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumActiveVFExp", result); } return logAndPropagateResult("zesDeviceEnumActiveVFExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFPropertiesExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFPropertiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. ) { context.logger->log_trace("zesVFManagementGetVFPropertiesExp(hVFhandle, pProperties)"); auto pfnGetVFPropertiesExp = context.zesDdiTable.VFManagementExp.pfnGetVFPropertiesExp; if( nullptr == pfnGetVFPropertiesExp ) return logAndPropagateResult("zesVFManagementGetVFPropertiesExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFPropertiesExpPrologue( hVFhandle, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFPropertiesExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementGetVFPropertiesExpPrologue( hVFhandle, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFPropertiesExp", result); } auto driver_result = pfnGetVFPropertiesExp( hVFhandle, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFPropertiesExpEpilogue( hVFhandle, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFPropertiesExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zesVFManagementGetVFPropertiesExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFMemoryUtilizationExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFMemoryUtilizationExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ) { context.logger->log_trace("zesVFManagementGetVFMemoryUtilizationExp(hVFhandle, pCount, pMemUtil)"); auto pfnGetVFMemoryUtilizationExp = context.zesDdiTable.VFManagementExp.pfnGetVFMemoryUtilizationExp; if( nullptr == pfnGetVFMemoryUtilizationExp ) return logAndPropagateResult("zesVFManagementGetVFMemoryUtilizationExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFMemoryUtilizationExpPrologue( hVFhandle, pCount, pMemUtil ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFMemoryUtilizationExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementGetVFMemoryUtilizationExpPrologue( hVFhandle, pCount, pMemUtil ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFMemoryUtilizationExp", result); } auto driver_result = pfnGetVFMemoryUtilizationExp( hVFhandle, pCount, pMemUtil ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFMemoryUtilizationExpEpilogue( hVFhandle, pCount, pMemUtil ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFMemoryUtilizationExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zesVFManagementGetVFMemoryUtilizationExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFEngineUtilizationExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFEngineUtilizationExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ) { context.logger->log_trace("zesVFManagementGetVFEngineUtilizationExp(hVFhandle, pCount, pEngineUtil)"); auto pfnGetVFEngineUtilizationExp = context.zesDdiTable.VFManagementExp.pfnGetVFEngineUtilizationExp; if( nullptr == pfnGetVFEngineUtilizationExp ) return logAndPropagateResult("zesVFManagementGetVFEngineUtilizationExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFEngineUtilizationExpPrologue( hVFhandle, pCount, pEngineUtil ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFEngineUtilizationExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementGetVFEngineUtilizationExpPrologue( hVFhandle, pCount, pEngineUtil ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFEngineUtilizationExp", result); } auto driver_result = pfnGetVFEngineUtilizationExp( hVFhandle, pCount, pEngineUtil ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFEngineUtilizationExpEpilogue( hVFhandle, pCount, pEngineUtil ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFEngineUtilizationExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zesVFManagementGetVFEngineUtilizationExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementSetVFTelemetryModeExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementSetVFTelemetryModeExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. ze_bool_t enable ///< [in] Enable utilization telemetry. ) { context.logger->log_trace("zesVFManagementSetVFTelemetryModeExp(hVFhandle, flags, enable)"); auto pfnSetVFTelemetryModeExp = context.zesDdiTable.VFManagementExp.pfnSetVFTelemetryModeExp; if( nullptr == pfnSetVFTelemetryModeExp ) return logAndPropagateResult("zesVFManagementSetVFTelemetryModeExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementSetVFTelemetryModeExpPrologue( hVFhandle, flags, enable ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementSetVFTelemetryModeExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementSetVFTelemetryModeExpPrologue( hVFhandle, flags, enable ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementSetVFTelemetryModeExp", result); } auto driver_result = pfnSetVFTelemetryModeExp( hVFhandle, flags, enable ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementSetVFTelemetryModeExpEpilogue( hVFhandle, flags, enable ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementSetVFTelemetryModeExp", result); } return logAndPropagateResult("zesVFManagementSetVFTelemetryModeExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementSetVFTelemetrySamplingIntervalExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementSetVFTelemetrySamplingIntervalExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. uint64_t samplingInterval ///< [in] Sampling interval value. ) { context.logger->log_trace("zesVFManagementSetVFTelemetrySamplingIntervalExp(hVFhandle, flag, samplingInterval)"); auto pfnSetVFTelemetrySamplingIntervalExp = context.zesDdiTable.VFManagementExp.pfnSetVFTelemetrySamplingIntervalExp; if( nullptr == pfnSetVFTelemetrySamplingIntervalExp ) return logAndPropagateResult("zesVFManagementSetVFTelemetrySamplingIntervalExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( hVFhandle, flag, samplingInterval ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementSetVFTelemetrySamplingIntervalExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementSetVFTelemetrySamplingIntervalExpPrologue( hVFhandle, flag, samplingInterval ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementSetVFTelemetrySamplingIntervalExp", result); } auto driver_result = pfnSetVFTelemetrySamplingIntervalExp( hVFhandle, flag, samplingInterval ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementSetVFTelemetrySamplingIntervalExpEpilogue( hVFhandle, flag, samplingInterval ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementSetVFTelemetrySamplingIntervalExp", result); } return logAndPropagateResult("zesVFManagementSetVFTelemetrySamplingIntervalExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumEnabledVFExp __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumEnabledVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { context.logger->log_trace("zesDeviceEnumEnabledVFExp(hDevice, pCount, phVFhandle)"); auto pfnEnumEnabledVFExp = context.zesDdiTable.DeviceExp.pfnEnumEnabledVFExp; if( nullptr == pfnEnumEnabledVFExp ) return logAndPropagateResult("zesDeviceEnumEnabledVFExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumEnabledVFExpPrologue( hDevice, pCount, phVFhandle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumEnabledVFExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesDeviceEnumEnabledVFExpPrologue( hDevice, pCount, phVFhandle ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumEnabledVFExp", result); } auto driver_result = pfnEnumEnabledVFExp( hDevice, pCount, phVFhandle ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesDeviceEnumEnabledVFExpEpilogue( hDevice, pCount, phVFhandle ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesDeviceEnumEnabledVFExp", result); } return logAndPropagateResult("zesDeviceEnumEnabledVFExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFCapabilitiesExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFCapabilitiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ) { context.logger->log_trace("zesVFManagementGetVFCapabilitiesExp(hVFhandle, pCapability)"); auto pfnGetVFCapabilitiesExp = context.zesDdiTable.VFManagementExp.pfnGetVFCapabilitiesExp; if( nullptr == pfnGetVFCapabilitiesExp ) return logAndPropagateResult("zesVFManagementGetVFCapabilitiesExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFCapabilitiesExpPrologue( hVFhandle, pCapability ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFCapabilitiesExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementGetVFCapabilitiesExpPrologue( hVFhandle, pCapability ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFCapabilitiesExp", result); } auto driver_result = pfnGetVFCapabilitiesExp( hVFhandle, pCapability ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFCapabilitiesExpEpilogue( hVFhandle, pCapability ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFCapabilitiesExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zesVFManagementGetVFCapabilitiesExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFMemoryUtilizationExp2 __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFMemoryUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ) { context.logger->log_trace("zesVFManagementGetVFMemoryUtilizationExp2(hVFhandle, pCount, pMemUtil)"); auto pfnGetVFMemoryUtilizationExp2 = context.zesDdiTable.VFManagementExp.pfnGetVFMemoryUtilizationExp2; if( nullptr == pfnGetVFMemoryUtilizationExp2 ) return logAndPropagateResult("zesVFManagementGetVFMemoryUtilizationExp2", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFMemoryUtilizationExp2Prologue( hVFhandle, pCount, pMemUtil ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFMemoryUtilizationExp2", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementGetVFMemoryUtilizationExp2Prologue( hVFhandle, pCount, pMemUtil ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFMemoryUtilizationExp2", result); } auto driver_result = pfnGetVFMemoryUtilizationExp2( hVFhandle, pCount, pMemUtil ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFMemoryUtilizationExp2Epilogue( hVFhandle, pCount, pMemUtil ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFMemoryUtilizationExp2", result); } return logAndPropagateResult("zesVFManagementGetVFMemoryUtilizationExp2", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFEngineUtilizationExp2 __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFEngineUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ) { context.logger->log_trace("zesVFManagementGetVFEngineUtilizationExp2(hVFhandle, pCount, pEngineUtil)"); auto pfnGetVFEngineUtilizationExp2 = context.zesDdiTable.VFManagementExp.pfnGetVFEngineUtilizationExp2; if( nullptr == pfnGetVFEngineUtilizationExp2 ) return logAndPropagateResult("zesVFManagementGetVFEngineUtilizationExp2", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFEngineUtilizationExp2Prologue( hVFhandle, pCount, pEngineUtil ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFEngineUtilizationExp2", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementGetVFEngineUtilizationExp2Prologue( hVFhandle, pCount, pEngineUtil ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFEngineUtilizationExp2", result); } auto driver_result = pfnGetVFEngineUtilizationExp2( hVFhandle, pCount, pEngineUtil ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFEngineUtilizationExp2Epilogue( hVFhandle, pCount, pEngineUtil ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFEngineUtilizationExp2", result); } return logAndPropagateResult("zesVFManagementGetVFEngineUtilizationExp2", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFCapabilitiesExp2 __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFCapabilitiesExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp2_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ) { context.logger->log_trace("zesVFManagementGetVFCapabilitiesExp2(hVFhandle, pCapability)"); auto pfnGetVFCapabilitiesExp2 = context.zesDdiTable.VFManagementExp.pfnGetVFCapabilitiesExp2; if( nullptr == pfnGetVFCapabilitiesExp2 ) return logAndPropagateResult("zesVFManagementGetVFCapabilitiesExp2", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFCapabilitiesExp2Prologue( hVFhandle, pCapability ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFCapabilitiesExp2", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zesHandleLifetime.zesVFManagementGetVFCapabilitiesExp2Prologue( hVFhandle, pCapability ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFCapabilitiesExp2", result); } auto driver_result = pfnGetVFCapabilitiesExp2( hVFhandle, pCapability ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zesValidation->zesVFManagementGetVFCapabilitiesExp2Epilogue( hVFhandle, pCapability ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zesVFManagementGetVFCapabilitiesExp2", result); } return logAndPropagateResult("zesVFManagementGetVFCapabilitiesExp2", driver_result); } } // namespace validation_layer #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Global table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetGlobalProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_global_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Global; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnInit = pDdiTable->pfnInit; pDdiTable->pfnInit = validation_layer::zesInit; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Device; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesDeviceGetProperties; dditable.pfnGetState = pDdiTable->pfnGetState; pDdiTable->pfnGetState = validation_layer::zesDeviceGetState; dditable.pfnReset = pDdiTable->pfnReset; pDdiTable->pfnReset = validation_layer::zesDeviceReset; dditable.pfnProcessesGetState = pDdiTable->pfnProcessesGetState; pDdiTable->pfnProcessesGetState = validation_layer::zesDeviceProcessesGetState; dditable.pfnPciGetProperties = pDdiTable->pfnPciGetProperties; pDdiTable->pfnPciGetProperties = validation_layer::zesDevicePciGetProperties; dditable.pfnPciGetState = pDdiTable->pfnPciGetState; pDdiTable->pfnPciGetState = validation_layer::zesDevicePciGetState; dditable.pfnPciGetBars = pDdiTable->pfnPciGetBars; pDdiTable->pfnPciGetBars = validation_layer::zesDevicePciGetBars; dditable.pfnPciGetStats = pDdiTable->pfnPciGetStats; pDdiTable->pfnPciGetStats = validation_layer::zesDevicePciGetStats; dditable.pfnEnumDiagnosticTestSuites = pDdiTable->pfnEnumDiagnosticTestSuites; pDdiTable->pfnEnumDiagnosticTestSuites = validation_layer::zesDeviceEnumDiagnosticTestSuites; dditable.pfnEnumEngineGroups = pDdiTable->pfnEnumEngineGroups; pDdiTable->pfnEnumEngineGroups = validation_layer::zesDeviceEnumEngineGroups; dditable.pfnEventRegister = pDdiTable->pfnEventRegister; pDdiTable->pfnEventRegister = validation_layer::zesDeviceEventRegister; dditable.pfnEnumFabricPorts = pDdiTable->pfnEnumFabricPorts; pDdiTable->pfnEnumFabricPorts = validation_layer::zesDeviceEnumFabricPorts; dditable.pfnEnumFans = pDdiTable->pfnEnumFans; pDdiTable->pfnEnumFans = validation_layer::zesDeviceEnumFans; dditable.pfnEnumFirmwares = pDdiTable->pfnEnumFirmwares; pDdiTable->pfnEnumFirmwares = validation_layer::zesDeviceEnumFirmwares; dditable.pfnEnumFrequencyDomains = pDdiTable->pfnEnumFrequencyDomains; pDdiTable->pfnEnumFrequencyDomains = validation_layer::zesDeviceEnumFrequencyDomains; dditable.pfnEnumLeds = pDdiTable->pfnEnumLeds; pDdiTable->pfnEnumLeds = validation_layer::zesDeviceEnumLeds; dditable.pfnEnumMemoryModules = pDdiTable->pfnEnumMemoryModules; pDdiTable->pfnEnumMemoryModules = validation_layer::zesDeviceEnumMemoryModules; dditable.pfnEnumPerformanceFactorDomains = pDdiTable->pfnEnumPerformanceFactorDomains; pDdiTable->pfnEnumPerformanceFactorDomains = validation_layer::zesDeviceEnumPerformanceFactorDomains; dditable.pfnEnumPowerDomains = pDdiTable->pfnEnumPowerDomains; pDdiTable->pfnEnumPowerDomains = validation_layer::zesDeviceEnumPowerDomains; dditable.pfnGetCardPowerDomain = pDdiTable->pfnGetCardPowerDomain; pDdiTable->pfnGetCardPowerDomain = validation_layer::zesDeviceGetCardPowerDomain; dditable.pfnEnumPsus = pDdiTable->pfnEnumPsus; pDdiTable->pfnEnumPsus = validation_layer::zesDeviceEnumPsus; dditable.pfnEnumRasErrorSets = pDdiTable->pfnEnumRasErrorSets; pDdiTable->pfnEnumRasErrorSets = validation_layer::zesDeviceEnumRasErrorSets; dditable.pfnEnumSchedulers = pDdiTable->pfnEnumSchedulers; pDdiTable->pfnEnumSchedulers = validation_layer::zesDeviceEnumSchedulers; dditable.pfnEnumStandbyDomains = pDdiTable->pfnEnumStandbyDomains; pDdiTable->pfnEnumStandbyDomains = validation_layer::zesDeviceEnumStandbyDomains; dditable.pfnEnumTemperatureSensors = pDdiTable->pfnEnumTemperatureSensors; pDdiTable->pfnEnumTemperatureSensors = validation_layer::zesDeviceEnumTemperatureSensors; dditable.pfnEccAvailable = pDdiTable->pfnEccAvailable; pDdiTable->pfnEccAvailable = validation_layer::zesDeviceEccAvailable; dditable.pfnEccConfigurable = pDdiTable->pfnEccConfigurable; pDdiTable->pfnEccConfigurable = validation_layer::zesDeviceEccConfigurable; dditable.pfnGetEccState = pDdiTable->pfnGetEccState; pDdiTable->pfnGetEccState = validation_layer::zesDeviceGetEccState; dditable.pfnSetEccState = pDdiTable->pfnSetEccState; pDdiTable->pfnSetEccState = validation_layer::zesDeviceSetEccState; dditable.pfnGet = pDdiTable->pfnGet; pDdiTable->pfnGet = validation_layer::zesDeviceGet; dditable.pfnSetOverclockWaiver = pDdiTable->pfnSetOverclockWaiver; pDdiTable->pfnSetOverclockWaiver = validation_layer::zesDeviceSetOverclockWaiver; dditable.pfnGetOverclockDomains = pDdiTable->pfnGetOverclockDomains; pDdiTable->pfnGetOverclockDomains = validation_layer::zesDeviceGetOverclockDomains; dditable.pfnGetOverclockControls = pDdiTable->pfnGetOverclockControls; pDdiTable->pfnGetOverclockControls = validation_layer::zesDeviceGetOverclockControls; dditable.pfnResetOverclockSettings = pDdiTable->pfnResetOverclockSettings; pDdiTable->pfnResetOverclockSettings = validation_layer::zesDeviceResetOverclockSettings; dditable.pfnReadOverclockState = pDdiTable->pfnReadOverclockState; pDdiTable->pfnReadOverclockState = validation_layer::zesDeviceReadOverclockState; dditable.pfnEnumOverclockDomains = pDdiTable->pfnEnumOverclockDomains; pDdiTable->pfnEnumOverclockDomains = validation_layer::zesDeviceEnumOverclockDomains; dditable.pfnResetExt = pDdiTable->pfnResetExt; pDdiTable->pfnResetExt = validation_layer::zesDeviceResetExt; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.DeviceExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnEnumEnabledVFExp = pDdiTable->pfnEnumEnabledVFExp; pDdiTable->pfnEnumEnabledVFExp = validation_layer::zesDeviceEnumEnabledVFExp; dditable.pfnGetSubDevicePropertiesExp = pDdiTable->pfnGetSubDevicePropertiesExp; pDdiTable->pfnGetSubDevicePropertiesExp = validation_layer::zesDeviceGetSubDevicePropertiesExp; dditable.pfnEnumActiveVFExp = pDdiTable->pfnEnumActiveVFExp; pDdiTable->pfnEnumActiveVFExp = validation_layer::zesDeviceEnumActiveVFExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Driver table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDriverProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_driver_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Driver; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnEventListen = pDdiTable->pfnEventListen; pDdiTable->pfnEventListen = validation_layer::zesDriverEventListen; dditable.pfnEventListenEx = pDdiTable->pfnEventListenEx; pDdiTable->pfnEventListenEx = validation_layer::zesDriverEventListenEx; dditable.pfnGet = pDdiTable->pfnGet; pDdiTable->pfnGet = validation_layer::zesDriverGet; dditable.pfnGetExtensionProperties = pDdiTable->pfnGetExtensionProperties; pDdiTable->pfnGetExtensionProperties = validation_layer::zesDriverGetExtensionProperties; dditable.pfnGetExtensionFunctionAddress = pDdiTable->pfnGetExtensionFunctionAddress; pDdiTable->pfnGetExtensionFunctionAddress = validation_layer::zesDriverGetExtensionFunctionAddress; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DriverExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDriverExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_driver_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.DriverExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetDeviceByUuidExp = pDdiTable->pfnGetDeviceByUuidExp; pDdiTable->pfnGetDeviceByUuidExp = validation_layer::zesDriverGetDeviceByUuidExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Diagnostics table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDiagnosticsProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_diagnostics_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Diagnostics; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesDiagnosticsGetProperties; dditable.pfnGetTests = pDdiTable->pfnGetTests; pDdiTable->pfnGetTests = validation_layer::zesDiagnosticsGetTests; dditable.pfnRunTests = pDdiTable->pfnRunTests; pDdiTable->pfnRunTests = validation_layer::zesDiagnosticsRunTests; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Engine table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetEngineProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_engine_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Engine; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesEngineGetProperties; dditable.pfnGetActivity = pDdiTable->pfnGetActivity; pDdiTable->pfnGetActivity = validation_layer::zesEngineGetActivity; dditable.pfnGetActivityExt = pDdiTable->pfnGetActivityExt; pDdiTable->pfnGetActivityExt = validation_layer::zesEngineGetActivityExt; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricPort table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFabricPortProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_fabric_port_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.FabricPort; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesFabricPortGetProperties; dditable.pfnGetLinkType = pDdiTable->pfnGetLinkType; pDdiTable->pfnGetLinkType = validation_layer::zesFabricPortGetLinkType; dditable.pfnGetConfig = pDdiTable->pfnGetConfig; pDdiTable->pfnGetConfig = validation_layer::zesFabricPortGetConfig; dditable.pfnSetConfig = pDdiTable->pfnSetConfig; pDdiTable->pfnSetConfig = validation_layer::zesFabricPortSetConfig; dditable.pfnGetState = pDdiTable->pfnGetState; pDdiTable->pfnGetState = validation_layer::zesFabricPortGetState; dditable.pfnGetThroughput = pDdiTable->pfnGetThroughput; pDdiTable->pfnGetThroughput = validation_layer::zesFabricPortGetThroughput; dditable.pfnGetFabricErrorCounters = pDdiTable->pfnGetFabricErrorCounters; pDdiTable->pfnGetFabricErrorCounters = validation_layer::zesFabricPortGetFabricErrorCounters; dditable.pfnGetMultiPortThroughput = pDdiTable->pfnGetMultiPortThroughput; pDdiTable->pfnGetMultiPortThroughput = validation_layer::zesFabricPortGetMultiPortThroughput; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Fan table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFanProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_fan_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Fan; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesFanGetProperties; dditable.pfnGetConfig = pDdiTable->pfnGetConfig; pDdiTable->pfnGetConfig = validation_layer::zesFanGetConfig; dditable.pfnSetDefaultMode = pDdiTable->pfnSetDefaultMode; pDdiTable->pfnSetDefaultMode = validation_layer::zesFanSetDefaultMode; dditable.pfnSetFixedSpeedMode = pDdiTable->pfnSetFixedSpeedMode; pDdiTable->pfnSetFixedSpeedMode = validation_layer::zesFanSetFixedSpeedMode; dditable.pfnSetSpeedTableMode = pDdiTable->pfnSetSpeedTableMode; pDdiTable->pfnSetSpeedTableMode = validation_layer::zesFanSetSpeedTableMode; dditable.pfnGetState = pDdiTable->pfnGetState; pDdiTable->pfnGetState = validation_layer::zesFanGetState; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Firmware table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFirmwareProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_firmware_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Firmware; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesFirmwareGetProperties; dditable.pfnFlash = pDdiTable->pfnFlash; pDdiTable->pfnFlash = validation_layer::zesFirmwareFlash; dditable.pfnGetFlashProgress = pDdiTable->pfnGetFlashProgress; pDdiTable->pfnGetFlashProgress = validation_layer::zesFirmwareGetFlashProgress; dditable.pfnGetConsoleLogs = pDdiTable->pfnGetConsoleLogs; pDdiTable->pfnGetConsoleLogs = validation_layer::zesFirmwareGetConsoleLogs; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FirmwareExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFirmwareExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_firmware_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.FirmwareExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetSecurityVersionExp = pDdiTable->pfnGetSecurityVersionExp; pDdiTable->pfnGetSecurityVersionExp = validation_layer::zesFirmwareGetSecurityVersionExp; dditable.pfnSetSecurityVersionExp = pDdiTable->pfnSetSecurityVersionExp; pDdiTable->pfnSetSecurityVersionExp = validation_layer::zesFirmwareSetSecurityVersionExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Frequency table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFrequencyProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_frequency_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Frequency; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesFrequencyGetProperties; dditable.pfnGetAvailableClocks = pDdiTable->pfnGetAvailableClocks; pDdiTable->pfnGetAvailableClocks = validation_layer::zesFrequencyGetAvailableClocks; dditable.pfnGetRange = pDdiTable->pfnGetRange; pDdiTable->pfnGetRange = validation_layer::zesFrequencyGetRange; dditable.pfnSetRange = pDdiTable->pfnSetRange; pDdiTable->pfnSetRange = validation_layer::zesFrequencySetRange; dditable.pfnGetState = pDdiTable->pfnGetState; pDdiTable->pfnGetState = validation_layer::zesFrequencyGetState; dditable.pfnGetThrottleTime = pDdiTable->pfnGetThrottleTime; pDdiTable->pfnGetThrottleTime = validation_layer::zesFrequencyGetThrottleTime; dditable.pfnOcGetCapabilities = pDdiTable->pfnOcGetCapabilities; pDdiTable->pfnOcGetCapabilities = validation_layer::zesFrequencyOcGetCapabilities; dditable.pfnOcGetFrequencyTarget = pDdiTable->pfnOcGetFrequencyTarget; pDdiTable->pfnOcGetFrequencyTarget = validation_layer::zesFrequencyOcGetFrequencyTarget; dditable.pfnOcSetFrequencyTarget = pDdiTable->pfnOcSetFrequencyTarget; pDdiTable->pfnOcSetFrequencyTarget = validation_layer::zesFrequencyOcSetFrequencyTarget; dditable.pfnOcGetVoltageTarget = pDdiTable->pfnOcGetVoltageTarget; pDdiTable->pfnOcGetVoltageTarget = validation_layer::zesFrequencyOcGetVoltageTarget; dditable.pfnOcSetVoltageTarget = pDdiTable->pfnOcSetVoltageTarget; pDdiTable->pfnOcSetVoltageTarget = validation_layer::zesFrequencyOcSetVoltageTarget; dditable.pfnOcSetMode = pDdiTable->pfnOcSetMode; pDdiTable->pfnOcSetMode = validation_layer::zesFrequencyOcSetMode; dditable.pfnOcGetMode = pDdiTable->pfnOcGetMode; pDdiTable->pfnOcGetMode = validation_layer::zesFrequencyOcGetMode; dditable.pfnOcGetIccMax = pDdiTable->pfnOcGetIccMax; pDdiTable->pfnOcGetIccMax = validation_layer::zesFrequencyOcGetIccMax; dditable.pfnOcSetIccMax = pDdiTable->pfnOcSetIccMax; pDdiTable->pfnOcSetIccMax = validation_layer::zesFrequencyOcSetIccMax; dditable.pfnOcGetTjMax = pDdiTable->pfnOcGetTjMax; pDdiTable->pfnOcGetTjMax = validation_layer::zesFrequencyOcGetTjMax; dditable.pfnOcSetTjMax = pDdiTable->pfnOcSetTjMax; pDdiTable->pfnOcSetTjMax = validation_layer::zesFrequencyOcSetTjMax; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Led table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetLedProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_led_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Led; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesLedGetProperties; dditable.pfnGetState = pDdiTable->pfnGetState; pDdiTable->pfnGetState = validation_layer::zesLedGetState; dditable.pfnSetState = pDdiTable->pfnSetState; pDdiTable->pfnSetState = validation_layer::zesLedSetState; dditable.pfnSetColor = pDdiTable->pfnSetColor; pDdiTable->pfnSetColor = validation_layer::zesLedSetColor; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Memory table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetMemoryProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_memory_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Memory; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesMemoryGetProperties; dditable.pfnGetState = pDdiTable->pfnGetState; pDdiTable->pfnGetState = validation_layer::zesMemoryGetState; dditable.pfnGetBandwidth = pDdiTable->pfnGetBandwidth; pDdiTable->pfnGetBandwidth = validation_layer::zesMemoryGetBandwidth; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Overclock table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetOverclockProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_overclock_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Overclock; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetDomainProperties = pDdiTable->pfnGetDomainProperties; pDdiTable->pfnGetDomainProperties = validation_layer::zesOverclockGetDomainProperties; dditable.pfnGetDomainVFProperties = pDdiTable->pfnGetDomainVFProperties; pDdiTable->pfnGetDomainVFProperties = validation_layer::zesOverclockGetDomainVFProperties; dditable.pfnGetDomainControlProperties = pDdiTable->pfnGetDomainControlProperties; pDdiTable->pfnGetDomainControlProperties = validation_layer::zesOverclockGetDomainControlProperties; dditable.pfnGetControlCurrentValue = pDdiTable->pfnGetControlCurrentValue; pDdiTable->pfnGetControlCurrentValue = validation_layer::zesOverclockGetControlCurrentValue; dditable.pfnGetControlPendingValue = pDdiTable->pfnGetControlPendingValue; pDdiTable->pfnGetControlPendingValue = validation_layer::zesOverclockGetControlPendingValue; dditable.pfnSetControlUserValue = pDdiTable->pfnSetControlUserValue; pDdiTable->pfnSetControlUserValue = validation_layer::zesOverclockSetControlUserValue; dditable.pfnGetControlState = pDdiTable->pfnGetControlState; pDdiTable->pfnGetControlState = validation_layer::zesOverclockGetControlState; dditable.pfnGetVFPointValues = pDdiTable->pfnGetVFPointValues; pDdiTable->pfnGetVFPointValues = validation_layer::zesOverclockGetVFPointValues; dditable.pfnSetVFPointValues = pDdiTable->pfnSetVFPointValues; pDdiTable->pfnSetVFPointValues = validation_layer::zesOverclockSetVFPointValues; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's PerformanceFactor table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetPerformanceFactorProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_performance_factor_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.PerformanceFactor; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesPerformanceFactorGetProperties; dditable.pfnGetConfig = pDdiTable->pfnGetConfig; pDdiTable->pfnGetConfig = validation_layer::zesPerformanceFactorGetConfig; dditable.pfnSetConfig = pDdiTable->pfnSetConfig; pDdiTable->pfnSetConfig = validation_layer::zesPerformanceFactorSetConfig; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Power table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetPowerProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_power_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Power; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesPowerGetProperties; dditable.pfnGetEnergyCounter = pDdiTable->pfnGetEnergyCounter; pDdiTable->pfnGetEnergyCounter = validation_layer::zesPowerGetEnergyCounter; dditable.pfnGetLimits = pDdiTable->pfnGetLimits; pDdiTable->pfnGetLimits = validation_layer::zesPowerGetLimits; dditable.pfnSetLimits = pDdiTable->pfnSetLimits; pDdiTable->pfnSetLimits = validation_layer::zesPowerSetLimits; dditable.pfnGetEnergyThreshold = pDdiTable->pfnGetEnergyThreshold; pDdiTable->pfnGetEnergyThreshold = validation_layer::zesPowerGetEnergyThreshold; dditable.pfnSetEnergyThreshold = pDdiTable->pfnSetEnergyThreshold; pDdiTable->pfnSetEnergyThreshold = validation_layer::zesPowerSetEnergyThreshold; dditable.pfnGetLimitsExt = pDdiTable->pfnGetLimitsExt; pDdiTable->pfnGetLimitsExt = validation_layer::zesPowerGetLimitsExt; dditable.pfnSetLimitsExt = pDdiTable->pfnSetLimitsExt; pDdiTable->pfnSetLimitsExt = validation_layer::zesPowerSetLimitsExt; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Psu table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetPsuProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_psu_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Psu; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesPsuGetProperties; dditable.pfnGetState = pDdiTable->pfnGetState; pDdiTable->pfnGetState = validation_layer::zesPsuGetState; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Ras table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetRasProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_ras_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Ras; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesRasGetProperties; dditable.pfnGetConfig = pDdiTable->pfnGetConfig; pDdiTable->pfnGetConfig = validation_layer::zesRasGetConfig; dditable.pfnSetConfig = pDdiTable->pfnSetConfig; pDdiTable->pfnSetConfig = validation_layer::zesRasSetConfig; dditable.pfnGetState = pDdiTable->pfnGetState; pDdiTable->pfnGetState = validation_layer::zesRasGetState; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RasExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetRasExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_ras_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.RasExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetStateExp = pDdiTable->pfnGetStateExp; pDdiTable->pfnGetStateExp = validation_layer::zesRasGetStateExp; dditable.pfnClearStateExp = pDdiTable->pfnClearStateExp; pDdiTable->pfnClearStateExp = validation_layer::zesRasClearStateExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Scheduler table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetSchedulerProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_scheduler_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Scheduler; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesSchedulerGetProperties; dditable.pfnGetCurrentMode = pDdiTable->pfnGetCurrentMode; pDdiTable->pfnGetCurrentMode = validation_layer::zesSchedulerGetCurrentMode; dditable.pfnGetTimeoutModeProperties = pDdiTable->pfnGetTimeoutModeProperties; pDdiTable->pfnGetTimeoutModeProperties = validation_layer::zesSchedulerGetTimeoutModeProperties; dditable.pfnGetTimesliceModeProperties = pDdiTable->pfnGetTimesliceModeProperties; pDdiTable->pfnGetTimesliceModeProperties = validation_layer::zesSchedulerGetTimesliceModeProperties; dditable.pfnSetTimeoutMode = pDdiTable->pfnSetTimeoutMode; pDdiTable->pfnSetTimeoutMode = validation_layer::zesSchedulerSetTimeoutMode; dditable.pfnSetTimesliceMode = pDdiTable->pfnSetTimesliceMode; pDdiTable->pfnSetTimesliceMode = validation_layer::zesSchedulerSetTimesliceMode; dditable.pfnSetExclusiveMode = pDdiTable->pfnSetExclusiveMode; pDdiTable->pfnSetExclusiveMode = validation_layer::zesSchedulerSetExclusiveMode; dditable.pfnSetComputeUnitDebugMode = pDdiTable->pfnSetComputeUnitDebugMode; pDdiTable->pfnSetComputeUnitDebugMode = validation_layer::zesSchedulerSetComputeUnitDebugMode; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Standby table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetStandbyProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_standby_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Standby; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesStandbyGetProperties; dditable.pfnGetMode = pDdiTable->pfnGetMode; pDdiTable->pfnGetMode = validation_layer::zesStandbyGetMode; dditable.pfnSetMode = pDdiTable->pfnSetMode; pDdiTable->pfnSetMode = validation_layer::zesStandbySetMode; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Temperature table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetTemperatureProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_temperature_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.Temperature; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zesTemperatureGetProperties; dditable.pfnGetConfig = pDdiTable->pfnGetConfig; pDdiTable->pfnGetConfig = validation_layer::zesTemperatureGetConfig; dditable.pfnSetConfig = pDdiTable->pfnSetConfig; pDdiTable->pfnSetConfig = validation_layer::zesTemperatureSetConfig; dditable.pfnGetState = pDdiTable->pfnGetState; pDdiTable->pfnGetState = validation_layer::zesTemperatureGetState; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's VFManagementExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetVFManagementExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_vf_management_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zesDdiTable.VFManagementExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetVFCapabilitiesExp = pDdiTable->pfnGetVFCapabilitiesExp; pDdiTable->pfnGetVFCapabilitiesExp = validation_layer::zesVFManagementGetVFCapabilitiesExp; dditable.pfnGetVFMemoryUtilizationExp2 = pDdiTable->pfnGetVFMemoryUtilizationExp2; pDdiTable->pfnGetVFMemoryUtilizationExp2 = validation_layer::zesVFManagementGetVFMemoryUtilizationExp2; dditable.pfnGetVFEngineUtilizationExp2 = pDdiTable->pfnGetVFEngineUtilizationExp2; pDdiTable->pfnGetVFEngineUtilizationExp2 = validation_layer::zesVFManagementGetVFEngineUtilizationExp2; dditable.pfnGetVFCapabilitiesExp2 = pDdiTable->pfnGetVFCapabilitiesExp2; pDdiTable->pfnGetVFCapabilitiesExp2 = validation_layer::zesVFManagementGetVFCapabilitiesExp2; dditable.pfnGetVFPropertiesExp = pDdiTable->pfnGetVFPropertiesExp; pDdiTable->pfnGetVFPropertiesExp = validation_layer::zesVFManagementGetVFPropertiesExp; dditable.pfnGetVFMemoryUtilizationExp = pDdiTable->pfnGetVFMemoryUtilizationExp; pDdiTable->pfnGetVFMemoryUtilizationExp = validation_layer::zesVFManagementGetVFMemoryUtilizationExp; dditable.pfnGetVFEngineUtilizationExp = pDdiTable->pfnGetVFEngineUtilizationExp; pDdiTable->pfnGetVFEngineUtilizationExp = validation_layer::zesVFManagementGetVFEngineUtilizationExp; dditable.pfnSetVFTelemetryModeExp = pDdiTable->pfnSetVFTelemetryModeExp; pDdiTable->pfnSetVFTelemetryModeExp = validation_layer::zesVFManagementSetVFTelemetryModeExp; dditable.pfnSetVFTelemetrySamplingIntervalExp = pDdiTable->pfnSetVFTelemetrySamplingIntervalExp; pDdiTable->pfnSetVFTelemetrySamplingIntervalExp = validation_layer::zesVFManagementSetVFTelemetrySamplingIntervalExp; return result; } #if defined(__cplusplus) }; #endif level-zero-1.20.6/source/layers/validation/zet_valddi.cpp000066400000000000000000006433061475521542100234700ustar00rootroot00000000000000/* * ***THIS FILE IS GENERATED. *** * See valddi.cpp.mako for modifications * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_valddi.cpp * */ #include "ze_validation_layer.h" namespace validation_layer { static ze_result_t logAndPropagateResult(const char* fname, ze_result_t result) { if (result != ZE_RESULT_SUCCESS) { context.logger->log_trace("Error (" + loader::to_string(result) + ") in " + std::string(fname)); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetModuleGetDebugInfo __zedlllocal ze_result_t ZE_APICALL zetModuleGetDebugInfo( zet_module_handle_t hModule, ///< [in] handle of the module zet_module_debug_info_format_t format, ///< [in] debug info format requested size_t* pSize, ///< [in,out] size of debug info in bytes uint8_t* pDebugInfo ///< [in,out][optional] byte pointer to debug info ) { context.logger->log_trace("zetModuleGetDebugInfo(hModule, format, pSize, pDebugInfo)"); auto pfnGetDebugInfo = context.zetDdiTable.Module.pfnGetDebugInfo; if( nullptr == pfnGetDebugInfo ) return logAndPropagateResult("zetModuleGetDebugInfo", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetModuleGetDebugInfoPrologue( hModule, format, pSize, pDebugInfo ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetModuleGetDebugInfo", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetModuleGetDebugInfoPrologue( hModule, format, pSize, pDebugInfo ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetModuleGetDebugInfo", result); } auto driver_result = pfnGetDebugInfo( hModule, format, pSize, pDebugInfo ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetModuleGetDebugInfoEpilogue( hModule, format, pSize, pDebugInfo ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetModuleGetDebugInfo", result); } return logAndPropagateResult("zetModuleGetDebugInfo", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDeviceGetDebugProperties __zedlllocal ze_result_t ZE_APICALL zetDeviceGetDebugProperties( zet_device_handle_t hDevice, ///< [in] device handle zet_device_debug_properties_t* pDebugProperties ///< [in,out] query result for debug properties ) { context.logger->log_trace("zetDeviceGetDebugProperties(hDevice, pDebugProperties)"); auto pfnGetDebugProperties = context.zetDdiTable.Device.pfnGetDebugProperties; if( nullptr == pfnGetDebugProperties ) return logAndPropagateResult("zetDeviceGetDebugProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDeviceGetDebugPropertiesPrologue( hDevice, pDebugProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceGetDebugProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDeviceGetDebugPropertiesPrologue( hDevice, pDebugProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceGetDebugProperties", result); } auto driver_result = pfnGetDebugProperties( hDevice, pDebugProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDeviceGetDebugPropertiesEpilogue( hDevice, pDebugProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceGetDebugProperties", result); } return logAndPropagateResult("zetDeviceGetDebugProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugAttach __zedlllocal ze_result_t ZE_APICALL zetDebugAttach( zet_device_handle_t hDevice, ///< [in] device handle const zet_debug_config_t* config, ///< [in] the debug configuration zet_debug_session_handle_t* phDebug ///< [out] debug session handle ) { context.logger->log_trace("zetDebugAttach(hDevice, config, phDebug)"); auto pfnAttach = context.zetDdiTable.Debug.pfnAttach; if( nullptr == pfnAttach ) return logAndPropagateResult("zetDebugAttach", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugAttachPrologue( hDevice, config, phDebug ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugAttach", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDebugAttachPrologue( hDevice, config, phDebug ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugAttach", result); } auto driver_result = pfnAttach( hDevice, config, phDebug ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugAttachEpilogue( hDevice, config, phDebug ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugAttach", result); } return logAndPropagateResult("zetDebugAttach", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugDetach __zedlllocal ze_result_t ZE_APICALL zetDebugDetach( zet_debug_session_handle_t hDebug ///< [in][release] debug session handle ) { context.logger->log_trace("zetDebugDetach(hDebug)"); auto pfnDetach = context.zetDdiTable.Debug.pfnDetach; if( nullptr == pfnDetach ) return logAndPropagateResult("zetDebugDetach", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugDetachPrologue( hDebug ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugDetach", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDebugDetachPrologue( hDebug ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugDetach", result); } auto driver_result = pfnDetach( hDebug ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugDetachEpilogue( hDebug ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugDetach", result); } return logAndPropagateResult("zetDebugDetach", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugReadEvent __zedlllocal ze_result_t ZE_APICALL zetDebugReadEvent( zet_debug_session_handle_t hDebug, ///< [in] debug session handle uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the event; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. zet_debug_event_t* event ///< [in,out] a pointer to a ::zet_debug_event_t. ) { context.logger->log_trace("zetDebugReadEvent(hDebug, timeout, event)"); auto pfnReadEvent = context.zetDdiTable.Debug.pfnReadEvent; if( nullptr == pfnReadEvent ) return logAndPropagateResult("zetDebugReadEvent", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugReadEventPrologue( hDebug, timeout, event ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugReadEvent", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDebugReadEventPrologue( hDebug, timeout, event ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugReadEvent", result); } auto driver_result = pfnReadEvent( hDebug, timeout, event ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugReadEventEpilogue( hDebug, timeout, event ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugReadEvent", result); } return logAndPropagateResult("zetDebugReadEvent", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugAcknowledgeEvent __zedlllocal ze_result_t ZE_APICALL zetDebugAcknowledgeEvent( zet_debug_session_handle_t hDebug, ///< [in] debug session handle const zet_debug_event_t* event ///< [in] a pointer to a ::zet_debug_event_t. ) { context.logger->log_trace("zetDebugAcknowledgeEvent(hDebug, event)"); auto pfnAcknowledgeEvent = context.zetDdiTable.Debug.pfnAcknowledgeEvent; if( nullptr == pfnAcknowledgeEvent ) return logAndPropagateResult("zetDebugAcknowledgeEvent", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugAcknowledgeEventPrologue( hDebug, event ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugAcknowledgeEvent", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDebugAcknowledgeEventPrologue( hDebug, event ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugAcknowledgeEvent", result); } auto driver_result = pfnAcknowledgeEvent( hDebug, event ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugAcknowledgeEventEpilogue( hDebug, event ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugAcknowledgeEvent", result); } return logAndPropagateResult("zetDebugAcknowledgeEvent", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugInterrupt __zedlllocal ze_result_t ZE_APICALL zetDebugInterrupt( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to interrupt ) { context.logger->log_trace("zetDebugInterrupt(hDebug, thread)"); auto pfnInterrupt = context.zetDdiTable.Debug.pfnInterrupt; if( nullptr == pfnInterrupt ) return logAndPropagateResult("zetDebugInterrupt", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugInterruptPrologue( hDebug, thread ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugInterrupt", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDebugInterruptPrologue( hDebug, thread ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugInterrupt", result); } auto driver_result = pfnInterrupt( hDebug, thread ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugInterruptEpilogue( hDebug, thread ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugInterrupt", result); } return logAndPropagateResult("zetDebugInterrupt", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugResume __zedlllocal ze_result_t ZE_APICALL zetDebugResume( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to resume ) { context.logger->log_trace("zetDebugResume(hDebug, thread)"); auto pfnResume = context.zetDdiTable.Debug.pfnResume; if( nullptr == pfnResume ) return logAndPropagateResult("zetDebugResume", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugResumePrologue( hDebug, thread ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugResume", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDebugResumePrologue( hDebug, thread ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugResume", result); } auto driver_result = pfnResume( hDebug, thread ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugResumeEpilogue( hDebug, thread ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugResume", result); } return logAndPropagateResult("zetDebugResume", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugReadMemory __zedlllocal ze_result_t ZE_APICALL zetDebugReadMemory( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to read void* buffer ///< [in,out] a buffer to hold a copy of the memory ) { context.logger->log_trace("zetDebugReadMemory(hDebug, thread, desc, size, buffer)"); auto pfnReadMemory = context.zetDdiTable.Debug.pfnReadMemory; if( nullptr == pfnReadMemory ) return logAndPropagateResult("zetDebugReadMemory", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugReadMemoryPrologue( hDebug, thread, desc, size, buffer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugReadMemory", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDebugReadMemoryPrologue( hDebug, thread, desc, size, buffer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugReadMemory", result); } auto driver_result = pfnReadMemory( hDebug, thread, desc, size, buffer ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugReadMemoryEpilogue( hDebug, thread, desc, size, buffer ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugReadMemory", result); } return logAndPropagateResult("zetDebugReadMemory", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugWriteMemory __zedlllocal ze_result_t ZE_APICALL zetDebugWriteMemory( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to write const void* buffer ///< [in] a buffer holding the pattern to write ) { context.logger->log_trace("zetDebugWriteMemory(hDebug, thread, desc, size, buffer)"); auto pfnWriteMemory = context.zetDdiTable.Debug.pfnWriteMemory; if( nullptr == pfnWriteMemory ) return logAndPropagateResult("zetDebugWriteMemory", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugWriteMemoryPrologue( hDebug, thread, desc, size, buffer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugWriteMemory", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDebugWriteMemoryPrologue( hDebug, thread, desc, size, buffer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugWriteMemory", result); } auto driver_result = pfnWriteMemory( hDebug, thread, desc, size, buffer ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugWriteMemoryEpilogue( hDebug, thread, desc, size, buffer ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugWriteMemory", result); } return logAndPropagateResult("zetDebugWriteMemory", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugGetRegisterSetProperties __zedlllocal ze_result_t ZE_APICALL zetDebugGetRegisterSetProperties( zet_device_handle_t hDevice, ///< [in] device handle uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ) { context.logger->log_trace("zetDebugGetRegisterSetProperties(hDevice, pCount, pRegisterSetProperties)"); auto pfnGetRegisterSetProperties = context.zetDdiTable.Debug.pfnGetRegisterSetProperties; if( nullptr == pfnGetRegisterSetProperties ) return logAndPropagateResult("zetDebugGetRegisterSetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugGetRegisterSetPropertiesPrologue( hDevice, pCount, pRegisterSetProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugGetRegisterSetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDebugGetRegisterSetPropertiesPrologue( hDevice, pCount, pRegisterSetProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugGetRegisterSetProperties", result); } auto driver_result = pfnGetRegisterSetProperties( hDevice, pCount, pRegisterSetProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugGetRegisterSetPropertiesEpilogue( hDevice, pCount, pRegisterSetProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugGetRegisterSetProperties", result); } return logAndPropagateResult("zetDebugGetRegisterSetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugGetThreadRegisterSetProperties __zedlllocal ze_result_t ZE_APICALL zetDebugGetThreadRegisterSetProperties( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier specifying a single stopped thread uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ) { context.logger->log_trace("zetDebugGetThreadRegisterSetProperties(hDebug, thread, pCount, pRegisterSetProperties)"); auto pfnGetThreadRegisterSetProperties = context.zetDdiTable.Debug.pfnGetThreadRegisterSetProperties; if( nullptr == pfnGetThreadRegisterSetProperties ) return logAndPropagateResult("zetDebugGetThreadRegisterSetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugGetThreadRegisterSetPropertiesPrologue( hDebug, thread, pCount, pRegisterSetProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugGetThreadRegisterSetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDebugGetThreadRegisterSetPropertiesPrologue( hDebug, thread, pCount, pRegisterSetProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugGetThreadRegisterSetProperties", result); } auto driver_result = pfnGetThreadRegisterSetProperties( hDebug, thread, pCount, pRegisterSetProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugGetThreadRegisterSetPropertiesEpilogue( hDebug, thread, pCount, pRegisterSetProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugGetThreadRegisterSetProperties", result); } return logAndPropagateResult("zetDebugGetThreadRegisterSetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugReadRegisters __zedlllocal ze_result_t ZE_APICALL zetDebugReadRegisters( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or ///< equal to the `count` member of ::zet_debug_register_group_properties_t ///< for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { context.logger->log_trace("zetDebugReadRegisters(hDebug, thread, type, start, count, pRegisterValues)"); auto pfnReadRegisters = context.zetDdiTable.Debug.pfnReadRegisters; if( nullptr == pfnReadRegisters ) return logAndPropagateResult("zetDebugReadRegisters", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugReadRegistersPrologue( hDebug, thread, type, start, count, pRegisterValues ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugReadRegisters", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDebugReadRegistersPrologue( hDebug, thread, type, start, count, pRegisterValues ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugReadRegisters", result); } auto driver_result = pfnReadRegisters( hDebug, thread, type, start, count, pRegisterValues ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugReadRegistersEpilogue( hDebug, thread, type, start, count, pRegisterValues ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugReadRegisters", result); } return logAndPropagateResult("zetDebugReadRegisters", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugWriteRegisters __zedlllocal ze_result_t ZE_APICALL zetDebugWriteRegisters( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than ///< or equal to the `count` member of ///< ::zet_debug_register_group_properties_t for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { context.logger->log_trace("zetDebugWriteRegisters(hDebug, thread, type, start, count, pRegisterValues)"); auto pfnWriteRegisters = context.zetDdiTable.Debug.pfnWriteRegisters; if( nullptr == pfnWriteRegisters ) return logAndPropagateResult("zetDebugWriteRegisters", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugWriteRegistersPrologue( hDebug, thread, type, start, count, pRegisterValues ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugWriteRegisters", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDebugWriteRegistersPrologue( hDebug, thread, type, start, count, pRegisterValues ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugWriteRegisters", result); } auto driver_result = pfnWriteRegisters( hDebug, thread, type, start, count, pRegisterValues ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDebugWriteRegistersEpilogue( hDebug, thread, type, start, count, pRegisterValues ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDebugWriteRegisters", result); } return logAndPropagateResult("zetDebugWriteRegisters", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupGet __zedlllocal ze_result_t ZE_APICALL zetMetricGroupGet( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric groups. ///< if count is zero, then the driver shall update the value with the ///< total number of metric groups available. ///< if count is greater than the number of metric groups available, then ///< the driver shall update the value with the correct number of metric ///< groups available. zet_metric_group_handle_t* phMetricGroups ///< [in,out][optional][range(0, *pCount)] array of handle of metric groups. ///< if count is less than the number of metric groups available, then ///< driver shall only retrieve that number of metric groups. ) { context.logger->log_trace("zetMetricGroupGet(hDevice, pCount, phMetricGroups)"); auto pfnGet = context.zetDdiTable.MetricGroup.pfnGet; if( nullptr == pfnGet ) return logAndPropagateResult("zetMetricGroupGet", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupGetPrologue( hDevice, pCount, phMetricGroups ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupGet", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupGetPrologue( hDevice, pCount, phMetricGroups ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupGet", result); } auto driver_result = pfnGet( hDevice, pCount, phMetricGroups ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupGetEpilogue( hDevice, pCount, phMetricGroups ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupGet", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phMetricGroups) && (i < *pCount); ++i){ if (phMetricGroups[i]){ context.handleLifetime->addHandle( phMetricGroups[i] ); context.handleLifetime->addDependent( hDevice, phMetricGroups[i] ); } } } return logAndPropagateResult("zetMetricGroupGet", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupGetProperties __zedlllocal ze_result_t ZE_APICALL zetMetricGroupGetProperties( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_properties_t* pProperties ///< [in,out] metric group properties ) { context.logger->log_trace("zetMetricGroupGetProperties(hMetricGroup, pProperties)"); auto pfnGetProperties = context.zetDdiTable.MetricGroup.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zetMetricGroupGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupGetPropertiesPrologue( hMetricGroup, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupGetPropertiesPrologue( hMetricGroup, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupGetProperties", result); } auto driver_result = pfnGetProperties( hMetricGroup, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupGetPropertiesEpilogue( hMetricGroup, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupGetProperties", result); } return logAndPropagateResult("zetMetricGroupGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCalculateMetricValues __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCalculateMetricValues( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pMetricValueCount, ///< [in,out] pointer to number of metric values calculated. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pMetricValueCount)] buffer of calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { context.logger->log_trace("zetMetricGroupCalculateMetricValues(hMetricGroup, type, rawDataSize, pRawData, pMetricValueCount, pMetricValues)"); auto pfnCalculateMetricValues = context.zetDdiTable.MetricGroup.pfnCalculateMetricValues; if( nullptr == pfnCalculateMetricValues ) return logAndPropagateResult("zetMetricGroupCalculateMetricValues", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupCalculateMetricValuesPrologue( hMetricGroup, type, rawDataSize, pRawData, pMetricValueCount, pMetricValues ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCalculateMetricValues", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupCalculateMetricValuesPrologue( hMetricGroup, type, rawDataSize, pRawData, pMetricValueCount, pMetricValues ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCalculateMetricValues", result); } auto driver_result = pfnCalculateMetricValues( hMetricGroup, type, rawDataSize, pRawData, pMetricValueCount, pMetricValues ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupCalculateMetricValuesEpilogue( hMetricGroup, type, rawDataSize, pRawData, pMetricValueCount, pMetricValues ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCalculateMetricValues", result); } return logAndPropagateResult("zetMetricGroupCalculateMetricValues", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGet __zedlllocal ze_result_t ZE_APICALL zetMetricGet( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group uint32_t* pCount, ///< [in,out] pointer to the number of metrics. ///< if count is zero, then the driver shall update the value with the ///< total number of metrics available. ///< if count is greater than the number of metrics available, then the ///< driver shall update the value with the correct number of metrics available. zet_metric_handle_t* phMetrics ///< [in,out][optional][range(0, *pCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metrics. ) { context.logger->log_trace("zetMetricGet(hMetricGroup, pCount, phMetrics)"); auto pfnGet = context.zetDdiTable.Metric.pfnGet; if( nullptr == pfnGet ) return logAndPropagateResult("zetMetricGet", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGetPrologue( hMetricGroup, pCount, phMetrics ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGet", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGetPrologue( hMetricGroup, pCount, phMetrics ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGet", result); } auto driver_result = pfnGet( hMetricGroup, pCount, phMetrics ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGetEpilogue( hMetricGroup, pCount, phMetrics ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGet", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phMetrics) && (i < *pCount); ++i){ if (phMetrics[i]){ context.handleLifetime->addHandle( phMetrics[i] ); context.handleLifetime->addDependent( hMetricGroup, phMetrics[i] ); } } } return logAndPropagateResult("zetMetricGet", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGetProperties __zedlllocal ze_result_t ZE_APICALL zetMetricGetProperties( zet_metric_handle_t hMetric, ///< [in] handle of the metric zet_metric_properties_t* pProperties ///< [in,out] metric properties ) { context.logger->log_trace("zetMetricGetProperties(hMetric, pProperties)"); auto pfnGetProperties = context.zetDdiTable.Metric.pfnGetProperties; if( nullptr == pfnGetProperties ) return logAndPropagateResult("zetMetricGetProperties", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGetPropertiesPrologue( hMetric, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGetProperties", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGetPropertiesPrologue( hMetric, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGetProperties", result); } auto driver_result = pfnGetProperties( hMetric, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGetPropertiesEpilogue( hMetric, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGetProperties", result); } return logAndPropagateResult("zetMetricGetProperties", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetContextActivateMetricGroups __zedlllocal ze_result_t ZE_APICALL zetContextActivateMetricGroups( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t count, ///< [in] metric group count to activate; must be 0 if `nullptr == ///< phMetricGroups` zet_metric_group_handle_t* phMetricGroups ///< [in][optional][range(0, count)] handles of the metric groups to activate. ///< nullptr deactivates all previously used metric groups. ///< all metrics groups must come from a different domains. ///< metric query and metric stream must use activated metric groups. ) { context.logger->log_trace("zetContextActivateMetricGroups(hContext, hDevice, count, phMetricGroupsLocal)"); auto pfnActivateMetricGroups = context.zetDdiTable.Context.pfnActivateMetricGroups; if( nullptr == pfnActivateMetricGroups ) return logAndPropagateResult("zetContextActivateMetricGroups", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetContextActivateMetricGroupsPrologue( hContext, hDevice, count, phMetricGroups ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetContextActivateMetricGroups", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetContextActivateMetricGroupsPrologue( hContext, hDevice, count, phMetricGroups ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetContextActivateMetricGroups", result); } auto driver_result = pfnActivateMetricGroups( hContext, hDevice, count, phMetricGroups ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetContextActivateMetricGroupsEpilogue( hContext, hDevice, count, phMetricGroups ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetContextActivateMetricGroups", result); } return logAndPropagateResult("zetContextActivateMetricGroups", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricStreamerOpen __zedlllocal ze_result_t ZE_APICALL zetMetricStreamerOpen( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_streamer_desc_t* desc, ///< [in,out] metric streamer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification zet_metric_streamer_handle_t* phMetricStreamer ///< [out] handle of metric streamer ) { context.logger->log_trace("zetMetricStreamerOpen(hContext, hDevice, hMetricGroup, desc, hNotificationEvent, phMetricStreamer)"); auto pfnOpen = context.zetDdiTable.MetricStreamer.pfnOpen; if( nullptr == pfnOpen ) return logAndPropagateResult("zetMetricStreamerOpen", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricStreamerOpenPrologue( hContext, hDevice, hMetricGroup, desc, hNotificationEvent, phMetricStreamer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricStreamerOpen", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricStreamerOpenPrologue( hContext, hDevice, hMetricGroup, desc, hNotificationEvent, phMetricStreamer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricStreamerOpen", result); } auto driver_result = pfnOpen( hContext, hDevice, hMetricGroup, desc, hNotificationEvent, phMetricStreamer ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricStreamerOpenEpilogue( hContext, hDevice, hMetricGroup, desc, hNotificationEvent, phMetricStreamer ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricStreamerOpen", result); } return logAndPropagateResult("zetMetricStreamerOpen", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetCommandListAppendMetricStreamerMarker __zedlllocal ze_result_t ZE_APICALL zetCommandListAppendMetricStreamerMarker( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t value ///< [in] streamer marker value ) { context.logger->log_trace("zetCommandListAppendMetricStreamerMarker(hCommandList, hMetricStreamer, value)"); auto pfnAppendMetricStreamerMarker = context.zetDdiTable.CommandList.pfnAppendMetricStreamerMarker; if( nullptr == pfnAppendMetricStreamerMarker ) return logAndPropagateResult("zetCommandListAppendMetricStreamerMarker", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetCommandListAppendMetricStreamerMarkerPrologue( hCommandList, hMetricStreamer, value ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMetricStreamerMarker", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetCommandListAppendMetricStreamerMarkerPrologue( hCommandList, hMetricStreamer, value ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMetricStreamerMarker", result); } auto driver_result = pfnAppendMetricStreamerMarker( hCommandList, hMetricStreamer, value ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetCommandListAppendMetricStreamerMarkerEpilogue( hCommandList, hMetricStreamer, value ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMetricStreamerMarker", result); } return logAndPropagateResult("zetCommandListAppendMetricStreamerMarker", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricStreamerClose __zedlllocal ze_result_t ZE_APICALL zetMetricStreamerClose( zet_metric_streamer_handle_t hMetricStreamer ///< [in][release] handle of the metric streamer ) { context.logger->log_trace("zetMetricStreamerClose(hMetricStreamer)"); auto pfnClose = context.zetDdiTable.MetricStreamer.pfnClose; if( nullptr == pfnClose ) return logAndPropagateResult("zetMetricStreamerClose", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricStreamerClosePrologue( hMetricStreamer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricStreamerClose", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricStreamerClosePrologue( hMetricStreamer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricStreamerClose", result); } auto driver_result = pfnClose( hMetricStreamer ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricStreamerCloseEpilogue( hMetricStreamer ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricStreamerClose", result); } return logAndPropagateResult("zetMetricStreamerClose", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricStreamerReadData __zedlllocal ze_result_t ZE_APICALL zetMetricStreamerReadData( zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) { context.logger->log_trace("zetMetricStreamerReadData(hMetricStreamer, maxReportCount, pRawDataSize, pRawData)"); auto pfnReadData = context.zetDdiTable.MetricStreamer.pfnReadData; if( nullptr == pfnReadData ) return logAndPropagateResult("zetMetricStreamerReadData", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricStreamerReadDataPrologue( hMetricStreamer, maxReportCount, pRawDataSize, pRawData ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricStreamerReadData", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricStreamerReadDataPrologue( hMetricStreamer, maxReportCount, pRawDataSize, pRawData ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricStreamerReadData", result); } auto driver_result = pfnReadData( hMetricStreamer, maxReportCount, pRawDataSize, pRawData ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricStreamerReadDataEpilogue( hMetricStreamer, maxReportCount, pRawDataSize, pRawData ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricStreamerReadData", result); } return logAndPropagateResult("zetMetricStreamerReadData", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryPoolCreate __zedlllocal ze_result_t ZE_APICALL zetMetricQueryPoolCreate( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] metric group associated with the query object. const zet_metric_query_pool_desc_t* desc, ///< [in] metric query pool descriptor zet_metric_query_pool_handle_t* phMetricQueryPool ///< [out] handle of metric query pool ) { context.logger->log_trace("zetMetricQueryPoolCreate(hContext, hDevice, hMetricGroup, desc, phMetricQueryPool)"); auto pfnCreate = context.zetDdiTable.MetricQueryPool.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zetMetricQueryPoolCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricQueryPoolCreatePrologue( hContext, hDevice, hMetricGroup, desc, phMetricQueryPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryPoolCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricQueryPoolCreatePrologue( hContext, hDevice, hMetricGroup, desc, phMetricQueryPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryPoolCreate", result); } auto driver_result = pfnCreate( hContext, hDevice, hMetricGroup, desc, phMetricQueryPool ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricQueryPoolCreateEpilogue( hContext, hDevice, hMetricGroup, desc, phMetricQueryPool ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryPoolCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phMetricQueryPool){ context.handleLifetime->addHandle( *phMetricQueryPool ); context.handleLifetime->addDependent( hContext, *phMetricQueryPool ); } } return logAndPropagateResult("zetMetricQueryPoolCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryPoolDestroy __zedlllocal ze_result_t ZE_APICALL zetMetricQueryPoolDestroy( zet_metric_query_pool_handle_t hMetricQueryPool ///< [in][release] handle of the metric query pool ) { context.logger->log_trace("zetMetricQueryPoolDestroy(hMetricQueryPool)"); auto pfnDestroy = context.zetDdiTable.MetricQueryPool.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zetMetricQueryPoolDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricQueryPoolDestroyPrologue( hMetricQueryPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryPoolDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricQueryPoolDestroyPrologue( hMetricQueryPool ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryPoolDestroy", result); } auto driver_result = pfnDestroy( hMetricQueryPool ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricQueryPoolDestroyEpilogue( hMetricQueryPool ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryPoolDestroy", result); } return logAndPropagateResult("zetMetricQueryPoolDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryCreate __zedlllocal ze_result_t ZE_APICALL zetMetricQueryCreate( zet_metric_query_pool_handle_t hMetricQueryPool,///< [in] handle of the metric query pool uint32_t index, ///< [in] index of the query within the pool zet_metric_query_handle_t* phMetricQuery ///< [out] handle of metric query ) { context.logger->log_trace("zetMetricQueryCreate(hMetricQueryPool, index, phMetricQuery)"); auto pfnCreate = context.zetDdiTable.MetricQuery.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zetMetricQueryCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricQueryCreatePrologue( hMetricQueryPool, index, phMetricQuery ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricQueryCreatePrologue( hMetricQueryPool, index, phMetricQuery ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryCreate", result); } auto driver_result = pfnCreate( hMetricQueryPool, index, phMetricQuery ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricQueryCreateEpilogue( hMetricQueryPool, index, phMetricQuery ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phMetricQuery){ context.handleLifetime->addHandle( *phMetricQuery ); context.handleLifetime->addDependent( hMetricQueryPool, *phMetricQuery ); } } return logAndPropagateResult("zetMetricQueryCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryDestroy __zedlllocal ze_result_t ZE_APICALL zetMetricQueryDestroy( zet_metric_query_handle_t hMetricQuery ///< [in][release] handle of metric query ) { context.logger->log_trace("zetMetricQueryDestroy(hMetricQuery)"); auto pfnDestroy = context.zetDdiTable.MetricQuery.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zetMetricQueryDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricQueryDestroyPrologue( hMetricQuery ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricQueryDestroyPrologue( hMetricQuery ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryDestroy", result); } auto driver_result = pfnDestroy( hMetricQuery ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricQueryDestroyEpilogue( hMetricQuery ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryDestroy", result); } return logAndPropagateResult("zetMetricQueryDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryReset __zedlllocal ze_result_t ZE_APICALL zetMetricQueryReset( zet_metric_query_handle_t hMetricQuery ///< [in] handle of metric query ) { context.logger->log_trace("zetMetricQueryReset(hMetricQuery)"); auto pfnReset = context.zetDdiTable.MetricQuery.pfnReset; if( nullptr == pfnReset ) return logAndPropagateResult("zetMetricQueryReset", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricQueryResetPrologue( hMetricQuery ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryReset", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricQueryResetPrologue( hMetricQuery ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryReset", result); } auto driver_result = pfnReset( hMetricQuery ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricQueryResetEpilogue( hMetricQuery ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryReset", result); } return logAndPropagateResult("zetMetricQueryReset", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetCommandListAppendMetricQueryBegin __zedlllocal ze_result_t ZE_APICALL zetCommandListAppendMetricQueryBegin( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery ///< [in] handle of the metric query ) { context.logger->log_trace("zetCommandListAppendMetricQueryBegin(hCommandList, hMetricQuery)"); auto pfnAppendMetricQueryBegin = context.zetDdiTable.CommandList.pfnAppendMetricQueryBegin; if( nullptr == pfnAppendMetricQueryBegin ) return logAndPropagateResult("zetCommandListAppendMetricQueryBegin", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetCommandListAppendMetricQueryBeginPrologue( hCommandList, hMetricQuery ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMetricQueryBegin", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetCommandListAppendMetricQueryBeginPrologue( hCommandList, hMetricQuery ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMetricQueryBegin", result); } auto driver_result = pfnAppendMetricQueryBegin( hCommandList, hMetricQuery ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetCommandListAppendMetricQueryBeginEpilogue( hCommandList, hMetricQuery ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMetricQueryBegin", result); } return logAndPropagateResult("zetCommandListAppendMetricQueryBegin", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetCommandListAppendMetricQueryEnd __zedlllocal ze_result_t ZE_APICALL zetCommandListAppendMetricQueryEnd( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in] must be zero ze_event_handle_t* phWaitEvents ///< [in][mbz] must be nullptr ) { context.logger->log_trace("zetCommandListAppendMetricQueryEnd(hCommandList, hMetricQuery, hSignalEvent, numWaitEvents, phWaitEventsLocal)"); auto pfnAppendMetricQueryEnd = context.zetDdiTable.CommandList.pfnAppendMetricQueryEnd; if( nullptr == pfnAppendMetricQueryEnd ) return logAndPropagateResult("zetCommandListAppendMetricQueryEnd", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetCommandListAppendMetricQueryEndPrologue( hCommandList, hMetricQuery, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMetricQueryEnd", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetCommandListAppendMetricQueryEndPrologue( hCommandList, hMetricQuery, hSignalEvent, numWaitEvents, phWaitEvents ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMetricQueryEnd", result); } auto driver_result = pfnAppendMetricQueryEnd( hCommandList, hMetricQuery, hSignalEvent, numWaitEvents, phWaitEvents ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetCommandListAppendMetricQueryEndEpilogue( hCommandList, hMetricQuery, hSignalEvent, numWaitEvents, phWaitEvents ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMetricQueryEnd", result); } return logAndPropagateResult("zetCommandListAppendMetricQueryEnd", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetCommandListAppendMetricMemoryBarrier __zedlllocal ze_result_t ZE_APICALL zetCommandListAppendMetricMemoryBarrier( zet_command_list_handle_t hCommandList ///< [in] handle of the command list ) { context.logger->log_trace("zetCommandListAppendMetricMemoryBarrier(hCommandList)"); auto pfnAppendMetricMemoryBarrier = context.zetDdiTable.CommandList.pfnAppendMetricMemoryBarrier; if( nullptr == pfnAppendMetricMemoryBarrier ) return logAndPropagateResult("zetCommandListAppendMetricMemoryBarrier", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetCommandListAppendMetricMemoryBarrierPrologue( hCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMetricMemoryBarrier", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetCommandListAppendMetricMemoryBarrierPrologue( hCommandList ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMetricMemoryBarrier", result); } auto driver_result = pfnAppendMetricMemoryBarrier( hCommandList ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetCommandListAppendMetricMemoryBarrierEpilogue( hCommandList ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetCommandListAppendMetricMemoryBarrier", result); } return logAndPropagateResult("zetCommandListAppendMetricMemoryBarrier", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryGetData __zedlllocal ze_result_t ZE_APICALL zetMetricQueryGetData( zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing query ///< reports in raw format ) { context.logger->log_trace("zetMetricQueryGetData(hMetricQuery, pRawDataSize, pRawData)"); auto pfnGetData = context.zetDdiTable.MetricQuery.pfnGetData; if( nullptr == pfnGetData ) return logAndPropagateResult("zetMetricQueryGetData", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricQueryGetDataPrologue( hMetricQuery, pRawDataSize, pRawData ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryGetData", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricQueryGetDataPrologue( hMetricQuery, pRawDataSize, pRawData ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryGetData", result); } auto driver_result = pfnGetData( hMetricQuery, pRawDataSize, pRawData ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricQueryGetDataEpilogue( hMetricQuery, pRawDataSize, pRawData ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricQueryGetData", result); } return logAndPropagateResult("zetMetricQueryGetData", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetKernelGetProfileInfo __zedlllocal ze_result_t ZE_APICALL zetKernelGetProfileInfo( zet_kernel_handle_t hKernel, ///< [in] handle to kernel zet_profile_properties_t* pProfileProperties ///< [out] pointer to profile properties ) { context.logger->log_trace("zetKernelGetProfileInfo(hKernel, pProfileProperties)"); auto pfnGetProfileInfo = context.zetDdiTable.Kernel.pfnGetProfileInfo; if( nullptr == pfnGetProfileInfo ) return logAndPropagateResult("zetKernelGetProfileInfo", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetKernelGetProfileInfoPrologue( hKernel, pProfileProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetKernelGetProfileInfo", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetKernelGetProfileInfoPrologue( hKernel, pProfileProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetKernelGetProfileInfo", result); } auto driver_result = pfnGetProfileInfo( hKernel, pProfileProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetKernelGetProfileInfoEpilogue( hKernel, pProfileProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetKernelGetProfileInfo", result); } return logAndPropagateResult("zetKernelGetProfileInfo", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpCreate __zedlllocal ze_result_t ZE_APICALL zetTracerExpCreate( zet_context_handle_t hContext, ///< [in] handle of the context object const zet_tracer_exp_desc_t* desc, ///< [in] pointer to tracer descriptor zet_tracer_exp_handle_t* phTracer ///< [out] pointer to handle of tracer object created ) { context.logger->log_trace("zetTracerExpCreate(hContext, desc, phTracer)"); auto pfnCreate = context.zetDdiTable.TracerExp.pfnCreate; if( nullptr == pfnCreate ) return logAndPropagateResult("zetTracerExpCreate", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetTracerExpCreatePrologue( hContext, desc, phTracer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpCreate", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetTracerExpCreatePrologue( hContext, desc, phTracer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpCreate", result); } auto driver_result = pfnCreate( hContext, desc, phTracer ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetTracerExpCreateEpilogue( hContext, desc, phTracer ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpCreate", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phTracer){ context.handleLifetime->addHandle( *phTracer ); context.handleLifetime->addDependent( hContext, *phTracer ); } } return logAndPropagateResult("zetTracerExpCreate", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpDestroy __zedlllocal ze_result_t ZE_APICALL zetTracerExpDestroy( zet_tracer_exp_handle_t hTracer ///< [in][release] handle of tracer object to destroy ) { context.logger->log_trace("zetTracerExpDestroy(hTracer)"); auto pfnDestroy = context.zetDdiTable.TracerExp.pfnDestroy; if( nullptr == pfnDestroy ) return logAndPropagateResult("zetTracerExpDestroy", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetTracerExpDestroyPrologue( hTracer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpDestroy", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetTracerExpDestroyPrologue( hTracer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpDestroy", result); } auto driver_result = pfnDestroy( hTracer ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetTracerExpDestroyEpilogue( hTracer ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpDestroy", result); } return logAndPropagateResult("zetTracerExpDestroy", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpSetPrologues __zedlllocal ze_result_t ZE_APICALL zetTracerExpSetPrologues( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { context.logger->log_trace("zetTracerExpSetPrologues(hTracer, pCoreCbs)"); auto pfnSetPrologues = context.zetDdiTable.TracerExp.pfnSetPrologues; if( nullptr == pfnSetPrologues ) return logAndPropagateResult("zetTracerExpSetPrologues", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetTracerExpSetProloguesPrologue( hTracer, pCoreCbs ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpSetPrologues", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetTracerExpSetProloguesPrologue( hTracer, pCoreCbs ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpSetPrologues", result); } auto driver_result = pfnSetPrologues( hTracer, pCoreCbs ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetTracerExpSetProloguesEpilogue( hTracer, pCoreCbs ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpSetPrologues", result); } return logAndPropagateResult("zetTracerExpSetPrologues", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpSetEpilogues __zedlllocal ze_result_t ZE_APICALL zetTracerExpSetEpilogues( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { context.logger->log_trace("zetTracerExpSetEpilogues(hTracer, pCoreCbs)"); auto pfnSetEpilogues = context.zetDdiTable.TracerExp.pfnSetEpilogues; if( nullptr == pfnSetEpilogues ) return logAndPropagateResult("zetTracerExpSetEpilogues", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetTracerExpSetEpiloguesPrologue( hTracer, pCoreCbs ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpSetEpilogues", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetTracerExpSetEpiloguesPrologue( hTracer, pCoreCbs ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpSetEpilogues", result); } auto driver_result = pfnSetEpilogues( hTracer, pCoreCbs ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetTracerExpSetEpiloguesEpilogue( hTracer, pCoreCbs ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpSetEpilogues", result); } return logAndPropagateResult("zetTracerExpSetEpilogues", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpSetEnabled __zedlllocal ze_result_t ZE_APICALL zetTracerExpSetEnabled( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer ze_bool_t enable ///< [in] enable the tracer if true; disable if false ) { context.logger->log_trace("zetTracerExpSetEnabled(hTracer, enable)"); auto pfnSetEnabled = context.zetDdiTable.TracerExp.pfnSetEnabled; if( nullptr == pfnSetEnabled ) return logAndPropagateResult("zetTracerExpSetEnabled", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetTracerExpSetEnabledPrologue( hTracer, enable ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpSetEnabled", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetTracerExpSetEnabledPrologue( hTracer, enable ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpSetEnabled", result); } auto driver_result = pfnSetEnabled( hTracer, enable ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetTracerExpSetEnabledEpilogue( hTracer, enable ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetTracerExpSetEnabled", result); } return logAndPropagateResult("zetTracerExpSetEnabled", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDeviceGetConcurrentMetricGroupsExp __zedlllocal ze_result_t ZE_APICALL zetDeviceGetConcurrentMetricGroupsExp( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t * phMetricGroups, ///< [in,out] metrics groups to be re-arranged to be sets of concurrent ///< groups uint32_t * pMetricGroupsCountPerConcurrentGroup,///< [in,out][optional][*pConcurrentGroupCount] count of metric groups per ///< concurrent group. uint32_t * pConcurrentGroupCount ///< [out] number of concurrent groups. ///< The value of this parameter could be used to determine the number of ///< replays necessary. ) { context.logger->log_trace("zetDeviceGetConcurrentMetricGroupsExp(hDevice, metricGroupCount, phMetricGroups, pMetricGroupsCountPerConcurrentGroup, pConcurrentGroupCount)"); auto pfnGetConcurrentMetricGroupsExp = context.zetDdiTable.DeviceExp.pfnGetConcurrentMetricGroupsExp; if( nullptr == pfnGetConcurrentMetricGroupsExp ) return logAndPropagateResult("zetDeviceGetConcurrentMetricGroupsExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDeviceGetConcurrentMetricGroupsExpPrologue( hDevice, metricGroupCount, phMetricGroups, pMetricGroupsCountPerConcurrentGroup, pConcurrentGroupCount ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceGetConcurrentMetricGroupsExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDeviceGetConcurrentMetricGroupsExpPrologue( hDevice, metricGroupCount, phMetricGroups, pMetricGroupsCountPerConcurrentGroup, pConcurrentGroupCount ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceGetConcurrentMetricGroupsExp", result); } auto driver_result = pfnGetConcurrentMetricGroupsExp( hDevice, metricGroupCount, phMetricGroups, pMetricGroupsCountPerConcurrentGroup, pConcurrentGroupCount ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDeviceGetConcurrentMetricGroupsExpEpilogue( hDevice, metricGroupCount, phMetricGroups, pMetricGroupsCountPerConcurrentGroup, pConcurrentGroupCount ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceGetConcurrentMetricGroupsExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zetDeviceGetConcurrentMetricGroupsExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerCreateExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerCreateExp( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t* phMetricGroups, ///< [in][range(0, metricGroupCount )] handles of the metric groups to ///< trace zet_metric_tracer_exp_desc_t* desc, ///< [in,out] metric tracer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification. Note: ///< If buffer is not drained when the event it flagged, there is a risk of ///< HW event buffer being overrun zet_metric_tracer_exp_handle_t* phMetricTracer ///< [out] handle of the metric tracer ) { context.logger->log_trace("zetMetricTracerCreateExp(hContext, hDevice, metricGroupCount, phMetricGroupsLocal, desc, hNotificationEvent, phMetricTracer)"); auto pfnCreateExp = context.zetDdiTable.MetricTracerExp.pfnCreateExp; if( nullptr == pfnCreateExp ) return logAndPropagateResult("zetMetricTracerCreateExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricTracerCreateExpPrologue( hContext, hDevice, metricGroupCount, phMetricGroups, desc, hNotificationEvent, phMetricTracer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerCreateExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricTracerCreateExpPrologue( hContext, hDevice, metricGroupCount, phMetricGroups, desc, hNotificationEvent, phMetricTracer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerCreateExp", result); } auto driver_result = pfnCreateExp( hContext, hDevice, metricGroupCount, phMetricGroups, desc, hNotificationEvent, phMetricTracer ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricTracerCreateExpEpilogue( hContext, hDevice, metricGroupCount, phMetricGroups, desc, hNotificationEvent, phMetricTracer ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerCreateExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phMetricTracer){ context.handleLifetime->addHandle( *phMetricTracer ); context.handleLifetime->addDependent( hContext, *phMetricTracer ); } } return logAndPropagateResult("zetMetricTracerCreateExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerDestroyExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerDestroyExp( zet_metric_tracer_exp_handle_t hMetricTracer ///< [in] handle of the metric tracer ) { context.logger->log_trace("zetMetricTracerDestroyExp(hMetricTracer)"); auto pfnDestroyExp = context.zetDdiTable.MetricTracerExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) return logAndPropagateResult("zetMetricTracerDestroyExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricTracerDestroyExpPrologue( hMetricTracer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerDestroyExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricTracerDestroyExpPrologue( hMetricTracer ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerDestroyExp", result); } auto driver_result = pfnDestroyExp( hMetricTracer ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricTracerDestroyExpEpilogue( hMetricTracer ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerDestroyExp", result); } return logAndPropagateResult("zetMetricTracerDestroyExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerEnableExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerEnableExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_NOT_READY will be returned ///< when the tracer is inactive. ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active. ) { context.logger->log_trace("zetMetricTracerEnableExp(hMetricTracer, synchronous)"); auto pfnEnableExp = context.zetDdiTable.MetricTracerExp.pfnEnableExp; if( nullptr == pfnEnableExp ) return logAndPropagateResult("zetMetricTracerEnableExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricTracerEnableExpPrologue( hMetricTracer, synchronous ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerEnableExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricTracerEnableExpPrologue( hMetricTracer, synchronous ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerEnableExp", result); } auto driver_result = pfnEnableExp( hMetricTracer, synchronous ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricTracerEnableExpEpilogue( hMetricTracer, synchronous ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerEnableExp", result); } return logAndPropagateResult("zetMetricTracerEnableExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerDisableExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerDisableExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active or when it is inactive but still has data. ///< ::ZE_RESULT_NOT_READY will be returned when the tracer is inactive and ///< has no more data to be retrieved. ) { context.logger->log_trace("zetMetricTracerDisableExp(hMetricTracer, synchronous)"); auto pfnDisableExp = context.zetDdiTable.MetricTracerExp.pfnDisableExp; if( nullptr == pfnDisableExp ) return logAndPropagateResult("zetMetricTracerDisableExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricTracerDisableExpPrologue( hMetricTracer, synchronous ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerDisableExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricTracerDisableExpPrologue( hMetricTracer, synchronous ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerDisableExp", result); } auto driver_result = pfnDisableExp( hMetricTracer, synchronous ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricTracerDisableExpEpilogue( hMetricTracer, synchronous ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerDisableExp", result); } return logAndPropagateResult("zetMetricTracerDisableExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerReadDataExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerReadDataExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all data available. ///< if size is non-zero, then driver will only retrieve that amount of ///< data. ///< if size is larger than size needed for all data, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) { context.logger->log_trace("zetMetricTracerReadDataExp(hMetricTracer, pRawDataSize, pRawData)"); auto pfnReadDataExp = context.zetDdiTable.MetricTracerExp.pfnReadDataExp; if( nullptr == pfnReadDataExp ) return logAndPropagateResult("zetMetricTracerReadDataExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricTracerReadDataExpPrologue( hMetricTracer, pRawDataSize, pRawData ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerReadDataExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricTracerReadDataExpPrologue( hMetricTracer, pRawDataSize, pRawData ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerReadDataExp", result); } auto driver_result = pfnReadDataExp( hMetricTracer, pRawDataSize, pRawData ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricTracerReadDataExpEpilogue( hMetricTracer, pRawDataSize, pRawData ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerReadDataExp", result); } return logAndPropagateResult("zetMetricTracerReadDataExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricDecoderCreateExp __zedlllocal ze_result_t ZE_APICALL zetMetricDecoderCreateExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer zet_metric_decoder_exp_handle_t* phMetricDecoder///< [out] handle of the metric decoder object ) { context.logger->log_trace("zetMetricDecoderCreateExp(hMetricTracer, phMetricDecoder)"); auto pfnCreateExp = context.zetDdiTable.MetricDecoderExp.pfnCreateExp; if( nullptr == pfnCreateExp ) return logAndPropagateResult("zetMetricDecoderCreateExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricDecoderCreateExpPrologue( hMetricTracer, phMetricDecoder ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricDecoderCreateExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricDecoderCreateExpPrologue( hMetricTracer, phMetricDecoder ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricDecoderCreateExp", result); } auto driver_result = pfnCreateExp( hMetricTracer, phMetricDecoder ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricDecoderCreateExpEpilogue( hMetricTracer, phMetricDecoder ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricDecoderCreateExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phMetricDecoder){ context.handleLifetime->addHandle( *phMetricDecoder ); context.handleLifetime->addDependent( hMetricTracer, *phMetricDecoder ); } } return logAndPropagateResult("zetMetricDecoderCreateExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricDecoderDestroyExp __zedlllocal ze_result_t ZE_APICALL zetMetricDecoderDestroyExp( zet_metric_decoder_exp_handle_t phMetricDecoder ///< [in] handle of the metric decoder object ) { context.logger->log_trace("zetMetricDecoderDestroyExp(phMetricDecoder)"); auto pfnDestroyExp = context.zetDdiTable.MetricDecoderExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) return logAndPropagateResult("zetMetricDecoderDestroyExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricDecoderDestroyExpPrologue( phMetricDecoder ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricDecoderDestroyExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricDecoderDestroyExpPrologue( phMetricDecoder ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricDecoderDestroyExp", result); } auto driver_result = pfnDestroyExp( phMetricDecoder ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricDecoderDestroyExpEpilogue( phMetricDecoder ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricDecoderDestroyExp", result); } return logAndPropagateResult("zetMetricDecoderDestroyExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricDecoderGetDecodableMetricsExp __zedlllocal ze_result_t ZE_APICALL zetMetricDecoderGetDecodableMetricsExp( zet_metric_decoder_exp_handle_t hMetricDecoder, ///< [in] handle of the metric decoder object uint32_t* pCount, ///< [in,out] pointer to number of decodable metric in the hMetricDecoder ///< handle. If count is zero, then the driver shall ///< update the value with the total number of decodable metrics available ///< in the decoder. if count is greater than zero ///< but less than the total number of decodable metrics available in the ///< decoder, then only that number will be returned. ///< if count is greater than the number of decodable metrics available in ///< the decoder, then the driver shall update the ///< value with the actual number of decodable metrics available. zet_metric_handle_t* phMetrics ///< [in,out] [range(0, *pCount)] array of handles of decodable metrics in ///< the hMetricDecoder handle provided. ) { context.logger->log_trace("zetMetricDecoderGetDecodableMetricsExp(hMetricDecoder, pCount, phMetrics)"); auto pfnGetDecodableMetricsExp = context.zetDdiTable.MetricDecoderExp.pfnGetDecodableMetricsExp; if( nullptr == pfnGetDecodableMetricsExp ) return logAndPropagateResult("zetMetricDecoderGetDecodableMetricsExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricDecoderGetDecodableMetricsExpPrologue( hMetricDecoder, pCount, phMetrics ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricDecoderGetDecodableMetricsExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricDecoderGetDecodableMetricsExpPrologue( hMetricDecoder, pCount, phMetrics ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricDecoderGetDecodableMetricsExp", result); } auto driver_result = pfnGetDecodableMetricsExp( hMetricDecoder, pCount, phMetrics ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricDecoderGetDecodableMetricsExpEpilogue( hMetricDecoder, pCount, phMetrics ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricDecoderGetDecodableMetricsExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phMetrics) && (i < *pCount); ++i){ if (phMetrics[i]){ context.handleLifetime->addHandle( phMetrics[i] ); context.handleLifetime->addDependent( hMetricDecoder, phMetrics[i] ); } } } return logAndPropagateResult("zetMetricDecoderGetDecodableMetricsExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerDecodeExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerDecodeExp( zet_metric_decoder_exp_handle_t phMetricDecoder,///< [in] handle of the metric decoder object size_t* pRawDataSize, ///< [in,out] size in bytes of raw data buffer. If pMetricEntriesCount is ///< greater than zero but less than total number of ///< decodable metrics available in the raw data buffer, then driver shall ///< update this value with actual number of raw ///< data bytes processed. uint8_t* pRawData, ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format uint32_t metricsCount, ///< [in] number of decodable metrics in the tracer for which the ///< hMetricDecoder handle was provided. See ///< ::zetMetricDecoderGetDecodableMetricsExp(). If metricCount is greater ///< than zero but less than the number decodable ///< metrics available in the raw data buffer, then driver shall only ///< decode those. zet_metric_handle_t* phMetrics, ///< [in] [range(0, metricsCount)] array of handles of decodable metrics in ///< the decoder for which the hMetricDecoder handle was ///< provided. Metrics handles are expected to be for decodable metrics, ///< see ::zetMetricDecoderGetDecodableMetricsExp() uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. If count is zero, then the ///< driver shall update the value with the total ///< number of metric sets to be decoded. If count is greater than the ///< number available in the raw data buffer, then the ///< driver shall update the value with the actual number of metric sets to ///< be decoded. There is a 1:1 relation between ///< the number of sets and sub-devices returned in the decoded entries. uint32_t* pMetricEntriesCountPerSet, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric entries ///< counts per metric set, one value per set. uint32_t* pMetricEntriesCount, ///< [in,out] pointer to the total number of metric entries decoded, for ///< all metric sets. If count is zero, then the ///< driver shall update the value with the total number of metric entries ///< to be decoded. If count is greater than zero ///< but less than the total number of metric entries available in the raw ///< data, then user provided number will be decoded. ///< If count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with ///< the actual number of decodable metric entries decoded. If set to null, ///< then driver will only update the value of ///< pSetCount. zet_metric_entry_exp_t* pMetricEntries ///< [in,out][optional][range(0, *pMetricEntriesCount)] buffer containing ///< decoded metric entries ) { context.logger->log_trace("zetMetricTracerDecodeExp(phMetricDecoder, pRawDataSize, pRawData, metricsCount, phMetricsLocal, pSetCount, pMetricEntriesCountPerSet, pMetricEntriesCount, pMetricEntries)"); auto pfnDecodeExp = context.zetDdiTable.MetricTracerExp.pfnDecodeExp; if( nullptr == pfnDecodeExp ) return logAndPropagateResult("zetMetricTracerDecodeExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricTracerDecodeExpPrologue( phMetricDecoder, pRawDataSize, pRawData, metricsCount, phMetrics, pSetCount, pMetricEntriesCountPerSet, pMetricEntriesCount, pMetricEntries ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerDecodeExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricTracerDecodeExpPrologue( phMetricDecoder, pRawDataSize, pRawData, metricsCount, phMetrics, pSetCount, pMetricEntriesCountPerSet, pMetricEntriesCount, pMetricEntries ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerDecodeExp", result); } auto driver_result = pfnDecodeExp( phMetricDecoder, pRawDataSize, pRawData, metricsCount, phMetrics, pSetCount, pMetricEntriesCountPerSet, pMetricEntriesCount, pMetricEntries ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricTracerDecodeExpEpilogue( phMetricDecoder, pRawDataSize, pRawData, metricsCount, phMetrics, pSetCount, pMetricEntriesCountPerSet, pMetricEntriesCount, pMetricEntries ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricTracerDecodeExp", result); } return logAndPropagateResult("zetMetricTracerDecodeExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCalculateMultipleMetricValuesExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCalculateMultipleMetricValuesExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { context.logger->log_trace("zetMetricGroupCalculateMultipleMetricValuesExp(hMetricGroup, type, rawDataSize, pRawData, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues)"); auto pfnCalculateMultipleMetricValuesExp = context.zetDdiTable.MetricGroupExp.pfnCalculateMultipleMetricValuesExp; if( nullptr == pfnCalculateMultipleMetricValuesExp ) return logAndPropagateResult("zetMetricGroupCalculateMultipleMetricValuesExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupCalculateMultipleMetricValuesExpPrologue( hMetricGroup, type, rawDataSize, pRawData, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCalculateMultipleMetricValuesExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupCalculateMultipleMetricValuesExpPrologue( hMetricGroup, type, rawDataSize, pRawData, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCalculateMultipleMetricValuesExp", result); } auto driver_result = pfnCalculateMultipleMetricValuesExp( hMetricGroup, type, rawDataSize, pRawData, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupCalculateMultipleMetricValuesExpEpilogue( hMetricGroup, type, rawDataSize, pRawData, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCalculateMultipleMetricValuesExp", result); } return logAndPropagateResult("zetMetricGroupCalculateMultipleMetricValuesExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupGetGlobalTimestampsExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupGetGlobalTimestampsExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group ze_bool_t synchronizedWithHost, ///< [in] Returns the timestamps synchronized to the host or the device. uint64_t* globalTimestamp, ///< [out] Device timestamp. uint64_t* metricTimestamp ///< [out] Metric timestamp. ) { context.logger->log_trace("zetMetricGroupGetGlobalTimestampsExp(hMetricGroup, synchronizedWithHost, globalTimestamp, metricTimestamp)"); auto pfnGetGlobalTimestampsExp = context.zetDdiTable.MetricGroupExp.pfnGetGlobalTimestampsExp; if( nullptr == pfnGetGlobalTimestampsExp ) return logAndPropagateResult("zetMetricGroupGetGlobalTimestampsExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupGetGlobalTimestampsExpPrologue( hMetricGroup, synchronizedWithHost, globalTimestamp, metricTimestamp ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupGetGlobalTimestampsExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupGetGlobalTimestampsExpPrologue( hMetricGroup, synchronizedWithHost, globalTimestamp, metricTimestamp ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupGetGlobalTimestampsExp", result); } auto driver_result = pfnGetGlobalTimestampsExp( hMetricGroup, synchronizedWithHost, globalTimestamp, metricTimestamp ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupGetGlobalTimestampsExpEpilogue( hMetricGroup, synchronizedWithHost, globalTimestamp, metricTimestamp ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupGetGlobalTimestampsExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zetMetricGroupGetGlobalTimestampsExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupGetExportDataExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupGetExportDataExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group const uint8_t* pRawData, ///< [in] buffer of raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer size_t* pExportDataSize, ///< [in,out] size in bytes of export data buffer ///< if size is zero, then the driver shall update the value with the ///< number of bytes necessary to store the exported data. ///< if size is greater than required, then the driver shall update the ///< value with the actual number of bytes necessary to store the exported data. uint8_t * pExportData ///< [in,out][optional][range(0, *pExportDataSize)] buffer of exported data. ) { context.logger->log_trace("zetMetricGroupGetExportDataExp(hMetricGroup, pRawData, rawDataSize, pExportDataSize, pExportData)"); auto pfnGetExportDataExp = context.zetDdiTable.MetricGroupExp.pfnGetExportDataExp; if( nullptr == pfnGetExportDataExp ) return logAndPropagateResult("zetMetricGroupGetExportDataExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupGetExportDataExpPrologue( hMetricGroup, pRawData, rawDataSize, pExportDataSize, pExportData ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupGetExportDataExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupGetExportDataExpPrologue( hMetricGroup, pRawData, rawDataSize, pExportDataSize, pExportData ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupGetExportDataExp", result); } auto driver_result = pfnGetExportDataExp( hMetricGroup, pRawData, rawDataSize, pExportDataSize, pExportData ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupGetExportDataExpEpilogue( hMetricGroup, pRawData, rawDataSize, pExportDataSize, pExportData ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupGetExportDataExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zetMetricGroupGetExportDataExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCalculateMetricExportDataExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCalculateMetricExportDataExp( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t exportDataSize, ///< [in] size in bytes of exported data buffer const uint8_t* pExportData, ///< [in][range(0, exportDataSize)] buffer of exported data to calculate zet_metric_calculate_exp_desc_t* pCalculateDescriptor, ///< [in] descriptor specifying calculation specific parameters uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { context.logger->log_trace("zetMetricGroupCalculateMetricExportDataExp(hDriver, type, exportDataSize, pExportData, pCalculateDescriptor, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues)"); auto pfnCalculateMetricExportDataExp = context.zetDdiTable.MetricGroupExp.pfnCalculateMetricExportDataExp; if( nullptr == pfnCalculateMetricExportDataExp ) return logAndPropagateResult("zetMetricGroupCalculateMetricExportDataExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupCalculateMetricExportDataExpPrologue( hDriver, type, exportDataSize, pExportData, pCalculateDescriptor, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCalculateMetricExportDataExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupCalculateMetricExportDataExpPrologue( hDriver, type, exportDataSize, pExportData, pCalculateDescriptor, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCalculateMetricExportDataExp", result); } auto driver_result = pfnCalculateMetricExportDataExp( hDriver, type, exportDataSize, pExportData, pCalculateDescriptor, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupCalculateMetricExportDataExpEpilogue( hDriver, type, exportDataSize, pExportData, pCalculateDescriptor, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCalculateMetricExportDataExp", result); } return logAndPropagateResult("zetMetricGroupCalculateMetricExportDataExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricProgrammableGetExp __zedlllocal ze_result_t ZE_APICALL zetMetricProgrammableGetExp( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric programmable handles. ///< if count is zero, then the driver shall update the value with the ///< total number of metric programmable handles available. ///< if count is greater than the number of metric programmable handles ///< available, then the driver shall update the value with the correct ///< number of metric programmable handles available. zet_metric_programmable_exp_handle_t* phMetricProgrammables ///< [in,out][optional][range(0, *pCount)] array of handle of metric programmables. ///< if count is less than the number of metric programmables available, ///< then driver shall only retrieve that number of metric programmables. ) { context.logger->log_trace("zetMetricProgrammableGetExp(hDevice, pCount, phMetricProgrammables)"); auto pfnGetExp = context.zetDdiTable.MetricProgrammableExp.pfnGetExp; if( nullptr == pfnGetExp ) return logAndPropagateResult("zetMetricProgrammableGetExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricProgrammableGetExpPrologue( hDevice, pCount, phMetricProgrammables ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricProgrammableGetExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricProgrammableGetExpPrologue( hDevice, pCount, phMetricProgrammables ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricProgrammableGetExp", result); } auto driver_result = pfnGetExp( hDevice, pCount, phMetricProgrammables ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricProgrammableGetExpEpilogue( hDevice, pCount, phMetricProgrammables ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricProgrammableGetExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phMetricProgrammables) && (i < *pCount); ++i){ if (phMetricProgrammables[i]){ context.handleLifetime->addHandle( phMetricProgrammables[i] ); context.handleLifetime->addDependent( hDevice, phMetricProgrammables[i] ); } } } return logAndPropagateResult("zetMetricProgrammableGetExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricProgrammableGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zetMetricProgrammableGetPropertiesExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_exp_properties_t* pProperties ///< [in,out] properties of the metric programmable ) { context.logger->log_trace("zetMetricProgrammableGetPropertiesExp(hMetricProgrammable, pProperties)"); auto pfnGetPropertiesExp = context.zetDdiTable.MetricProgrammableExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp ) return logAndPropagateResult("zetMetricProgrammableGetPropertiesExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricProgrammableGetPropertiesExpPrologue( hMetricProgrammable, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricProgrammableGetPropertiesExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricProgrammableGetPropertiesExpPrologue( hMetricProgrammable, pProperties ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricProgrammableGetPropertiesExp", result); } auto driver_result = pfnGetPropertiesExp( hMetricProgrammable, pProperties ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricProgrammableGetPropertiesExpEpilogue( hMetricProgrammable, pProperties ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricProgrammableGetPropertiesExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zetMetricProgrammableGetPropertiesExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricProgrammableGetParamInfoExp __zedlllocal ze_result_t ZE_APICALL zetMetricProgrammableGetParamInfoExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t* pParameterCount, ///< [in,out] count of the parameters to retrieve parameter info. ///< if value pParameterCount is greater than count of parameters ///< available, then pParameterCount will be updated with count of ///< parameters available. ///< The count of parameters available can be queried using ::zetMetricProgrammableGetPropertiesExp. zet_metric_programmable_param_info_exp_t* pParameterInfo///< [in,out][range(1, *pParameterCount)] array of parameter info. ///< if parameterCount is less than the number of parameters available, ///< then driver shall only retrieve that number of parameter info. ) { context.logger->log_trace("zetMetricProgrammableGetParamInfoExp(hMetricProgrammable, pParameterCount, pParameterInfo)"); auto pfnGetParamInfoExp = context.zetDdiTable.MetricProgrammableExp.pfnGetParamInfoExp; if( nullptr == pfnGetParamInfoExp ) return logAndPropagateResult("zetMetricProgrammableGetParamInfoExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricProgrammableGetParamInfoExpPrologue( hMetricProgrammable, pParameterCount, pParameterInfo ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricProgrammableGetParamInfoExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricProgrammableGetParamInfoExpPrologue( hMetricProgrammable, pParameterCount, pParameterInfo ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricProgrammableGetParamInfoExp", result); } auto driver_result = pfnGetParamInfoExp( hMetricProgrammable, pParameterCount, pParameterInfo ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricProgrammableGetParamInfoExpEpilogue( hMetricProgrammable, pParameterCount, pParameterInfo ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricProgrammableGetParamInfoExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zetMetricProgrammableGetParamInfoExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricProgrammableGetParamValueInfoExp __zedlllocal ze_result_t ZE_APICALL zetMetricProgrammableGetParamValueInfoExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterOrdinal, ///< [in] ordinal of the parameter in the metric programmable uint32_t* pValueInfoCount, ///< [in,out] count of parameter value information to retrieve. ///< if value at pValueInfoCount is greater than count of value info ///< available, then pValueInfoCount will be updated with count of value ///< info available. ///< The count of parameter value info available can be queried using ::zetMetricProgrammableGetParamInfoExp. zet_metric_programmable_param_value_info_exp_t* pValueInfo ///< [in,out][range(1, *pValueInfoCount)] array of parameter value info. ///< if pValueInfoCount is less than the number of value info available, ///< then driver shall only retrieve that number of value info. ) { context.logger->log_trace("zetMetricProgrammableGetParamValueInfoExp(hMetricProgrammable, parameterOrdinal, pValueInfoCount, pValueInfo)"); auto pfnGetParamValueInfoExp = context.zetDdiTable.MetricProgrammableExp.pfnGetParamValueInfoExp; if( nullptr == pfnGetParamValueInfoExp ) return logAndPropagateResult("zetMetricProgrammableGetParamValueInfoExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricProgrammableGetParamValueInfoExpPrologue( hMetricProgrammable, parameterOrdinal, pValueInfoCount, pValueInfo ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricProgrammableGetParamValueInfoExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricProgrammableGetParamValueInfoExpPrologue( hMetricProgrammable, parameterOrdinal, pValueInfoCount, pValueInfo ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricProgrammableGetParamValueInfoExp", result); } auto driver_result = pfnGetParamValueInfoExp( hMetricProgrammable, parameterOrdinal, pValueInfoCount, pValueInfo ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricProgrammableGetParamValueInfoExpEpilogue( hMetricProgrammable, parameterOrdinal, pValueInfoCount, pValueInfo ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricProgrammableGetParamValueInfoExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ } return logAndPropagateResult("zetMetricProgrammableGetParamValueInfoExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricCreateFromProgrammableExp2 __zedlllocal ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp2( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ) { context.logger->log_trace("zetMetricCreateFromProgrammableExp2(hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles)"); auto pfnCreateFromProgrammableExp2 = context.zetDdiTable.MetricExp.pfnCreateFromProgrammableExp2; if( nullptr == pfnCreateFromProgrammableExp2 ) return logAndPropagateResult("zetMetricCreateFromProgrammableExp2", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricCreateFromProgrammableExp2Prologue( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricCreateFromProgrammableExp2", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricCreateFromProgrammableExp2Prologue( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricCreateFromProgrammableExp2", result); } auto driver_result = pfnCreateFromProgrammableExp2( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricCreateFromProgrammableExp2Epilogue( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricCreateFromProgrammableExp2", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phMetricHandles) && (i < *pMetricHandleCount); ++i){ if (phMetricHandles[i]){ context.handleLifetime->addHandle( phMetricHandles[i] ); context.handleLifetime->addDependent( hMetricProgrammable, phMetricHandles[i] ); } } } return logAndPropagateResult("zetMetricCreateFromProgrammableExp2", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricCreateFromProgrammableExp __zedlllocal ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. uint32_t parameterCount, ///< [in] Count of parameters to set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ) { context.logger->log_trace("zetMetricCreateFromProgrammableExp(hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles)"); auto pfnCreateFromProgrammableExp = context.zetDdiTable.MetricExp.pfnCreateFromProgrammableExp; if( nullptr == pfnCreateFromProgrammableExp ) return logAndPropagateResult("zetMetricCreateFromProgrammableExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricCreateFromProgrammableExpPrologue( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricCreateFromProgrammableExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricCreateFromProgrammableExpPrologue( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricCreateFromProgrammableExp", result); } auto driver_result = pfnCreateFromProgrammableExp( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricCreateFromProgrammableExpEpilogue( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricCreateFromProgrammableExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phMetricHandles) && (i < *pMetricHandleCount); ++i){ if (phMetricHandles[i]){ context.handleLifetime->addHandle( phMetricHandles[i] ); context.handleLifetime->addDependent( hMetricProgrammable, phMetricHandles[i] ); } } } return logAndPropagateResult("zetMetricCreateFromProgrammableExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDeviceCreateMetricGroupsFromMetricsExp __zedlllocal ze_result_t ZE_APICALL zetDeviceCreateMetricGroupsFromMetricsExp( zet_device_handle_t hDevice, ///< [in] handle of the device. uint32_t metricCount, ///< [in] number of metric handles. zet_metric_handle_t * phMetrics, ///< [in] metric handles to be added to the metric groups. const char * pMetricGroupNamePrefix, ///< [in] prefix to the name created for the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP. const char * pDescription, ///< [in] pointer to description of the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. uint32_t * pMetricGroupCount, ///< [in,out] pointer to the number of metric group handles to be created. ///< if pMetricGroupCount is zero, then the driver shall update the value ///< with the maximum possible number of metric group handles that could be created. ///< if pMetricGroupCount is greater than the number of metric group ///< handles that could be created, then the driver shall update the value ///< with the correct number of metric group handles generated. ///< if pMetricGroupCount is lesser than the number of metric group handles ///< that could be created, then ::ZE_RESULT_ERROR_INVALID_ARGUMENT is returned. zet_metric_group_handle_t* phMetricGroup ///< [in,out][optional][range(0, *pMetricGroupCount)] array of handle of ///< metric group handles. ///< Created Metric group handles. ) { context.logger->log_trace("zetDeviceCreateMetricGroupsFromMetricsExp(hDevice, metricCount, phMetrics, pMetricGroupNamePrefix, pDescription, pMetricGroupCount, phMetricGroup)"); auto pfnCreateMetricGroupsFromMetricsExp = context.zetDdiTable.DeviceExp.pfnCreateMetricGroupsFromMetricsExp; if( nullptr == pfnCreateMetricGroupsFromMetricsExp ) return logAndPropagateResult("zetDeviceCreateMetricGroupsFromMetricsExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDeviceCreateMetricGroupsFromMetricsExpPrologue( hDevice, metricCount, phMetrics, pMetricGroupNamePrefix, pDescription, pMetricGroupCount, phMetricGroup ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceCreateMetricGroupsFromMetricsExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetDeviceCreateMetricGroupsFromMetricsExpPrologue( hDevice, metricCount, phMetrics, pMetricGroupNamePrefix, pDescription, pMetricGroupCount, phMetricGroup ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceCreateMetricGroupsFromMetricsExp", result); } auto driver_result = pfnCreateMetricGroupsFromMetricsExp( hDevice, metricCount, phMetrics, pMetricGroupNamePrefix, pDescription, pMetricGroupCount, phMetricGroup ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetDeviceCreateMetricGroupsFromMetricsExpEpilogue( hDevice, metricCount, phMetrics, pMetricGroupNamePrefix, pDescription, pMetricGroupCount, phMetricGroup ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetDeviceCreateMetricGroupsFromMetricsExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ for (size_t i = 0; ( nullptr != phMetricGroup) && (i < *pMetricGroupCount); ++i){ if (phMetricGroup[i]){ context.handleLifetime->addHandle( phMetricGroup[i] ); context.handleLifetime->addDependent( hDevice, phMetricGroup[i] ); } } } return logAndPropagateResult("zetDeviceCreateMetricGroupsFromMetricsExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCreateExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCreateExp( zet_device_handle_t hDevice, ///< [in] handle of the device const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. const char* pDescription, ///< [in] pointer to metric group description. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. zet_metric_group_sampling_type_flags_t samplingType,///< [in] Sampling type for the metric group. zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle ) { context.logger->log_trace("zetMetricGroupCreateExp(hDevice, pName, pDescription, samplingType, phMetricGroup)"); auto pfnCreateExp = context.zetDdiTable.MetricGroupExp.pfnCreateExp; if( nullptr == pfnCreateExp ) return logAndPropagateResult("zetMetricGroupCreateExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupCreateExpPrologue( hDevice, pName, pDescription, samplingType, phMetricGroup ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCreateExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupCreateExpPrologue( hDevice, pName, pDescription, samplingType, phMetricGroup ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCreateExp", result); } auto driver_result = pfnCreateExp( hDevice, pName, pDescription, samplingType, phMetricGroup ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupCreateExpEpilogue( hDevice, pName, pDescription, samplingType, phMetricGroup ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCreateExp", result); } if( driver_result == ZE_RESULT_SUCCESS && context.enableHandleLifetime ){ if (phMetricGroup){ context.handleLifetime->addHandle( *phMetricGroup ); context.handleLifetime->addDependent( hDevice, *phMetricGroup ); } } return logAndPropagateResult("zetMetricGroupCreateExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupAddMetricExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupAddMetricExp( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric, ///< [in] Metric to be added to the group. size_t * pErrorStringSize, ///< [in,out][optional] Size of the error string to query, if an error was ///< reported during adding the metric handle. ///< if *pErrorStringSize is zero, then the driver shall update the value ///< with the size of the error string in bytes. char* pErrorString ///< [in,out][optional][range(0, *pErrorStringSize)] Error string. ///< if *pErrorStringSize is less than the length of the error string ///< available, then driver shall only retrieve that length of error string. ) { context.logger->log_trace("zetMetricGroupAddMetricExp(hMetricGroup, hMetric, pErrorStringSize, pErrorString)"); auto pfnAddMetricExp = context.zetDdiTable.MetricGroupExp.pfnAddMetricExp; if( nullptr == pfnAddMetricExp ) return logAndPropagateResult("zetMetricGroupAddMetricExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupAddMetricExpPrologue( hMetricGroup, hMetric, pErrorStringSize, pErrorString ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupAddMetricExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupAddMetricExpPrologue( hMetricGroup, hMetric, pErrorStringSize, pErrorString ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupAddMetricExp", result); } auto driver_result = pfnAddMetricExp( hMetricGroup, hMetric, pErrorStringSize, pErrorString ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupAddMetricExpEpilogue( hMetricGroup, hMetric, pErrorStringSize, pErrorString ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupAddMetricExp", result); } return logAndPropagateResult("zetMetricGroupAddMetricExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupRemoveMetricExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupRemoveMetricExp( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric ///< [in] Metric handle to be removed from the metric group. ) { context.logger->log_trace("zetMetricGroupRemoveMetricExp(hMetricGroup, hMetric)"); auto pfnRemoveMetricExp = context.zetDdiTable.MetricGroupExp.pfnRemoveMetricExp; if( nullptr == pfnRemoveMetricExp ) return logAndPropagateResult("zetMetricGroupRemoveMetricExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupRemoveMetricExpPrologue( hMetricGroup, hMetric ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupRemoveMetricExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupRemoveMetricExpPrologue( hMetricGroup, hMetric ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupRemoveMetricExp", result); } auto driver_result = pfnRemoveMetricExp( hMetricGroup, hMetric ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupRemoveMetricExpEpilogue( hMetricGroup, hMetric ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupRemoveMetricExp", result); } return logAndPropagateResult("zetMetricGroupRemoveMetricExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCloseExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCloseExp( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group ) { context.logger->log_trace("zetMetricGroupCloseExp(hMetricGroup)"); auto pfnCloseExp = context.zetDdiTable.MetricGroupExp.pfnCloseExp; if( nullptr == pfnCloseExp ) return logAndPropagateResult("zetMetricGroupCloseExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupCloseExpPrologue( hMetricGroup ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCloseExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupCloseExpPrologue( hMetricGroup ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCloseExp", result); } auto driver_result = pfnCloseExp( hMetricGroup ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupCloseExpEpilogue( hMetricGroup ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupCloseExp", result); } return logAndPropagateResult("zetMetricGroupCloseExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupDestroyExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupDestroyExp( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group to destroy ) { context.logger->log_trace("zetMetricGroupDestroyExp(hMetricGroup)"); auto pfnDestroyExp = context.zetDdiTable.MetricGroupExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) return logAndPropagateResult("zetMetricGroupDestroyExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupDestroyExpPrologue( hMetricGroup ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupDestroyExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricGroupDestroyExpPrologue( hMetricGroup ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupDestroyExp", result); } auto driver_result = pfnDestroyExp( hMetricGroup ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricGroupDestroyExpEpilogue( hMetricGroup ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricGroupDestroyExp", result); } return logAndPropagateResult("zetMetricGroupDestroyExp", driver_result); } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricDestroyExp __zedlllocal ze_result_t ZE_APICALL zetMetricDestroyExp( zet_metric_handle_t hMetric ///< [in] Handle of the metric to destroy ) { context.logger->log_trace("zetMetricDestroyExp(hMetric)"); auto pfnDestroyExp = context.zetDdiTable.MetricExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) return logAndPropagateResult("zetMetricDestroyExp", ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); auto numValHandlers = context.validationHandlers.size(); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricDestroyExpPrologue( hMetric ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricDestroyExp", result); } if( context.enableThreadingValidation ){ //Unimplemented } if(context.enableHandleLifetime ){ auto result = context.handleLifetime->zetHandleLifetime.zetMetricDestroyExpPrologue( hMetric ); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricDestroyExp", result); } auto driver_result = pfnDestroyExp( hMetric ); for (size_t i = 0; i < numValHandlers; i++) { auto result = context.validationHandlers[i]->zetValidation->zetMetricDestroyExpEpilogue( hMetric ,driver_result); if(result!=ZE_RESULT_SUCCESS) return logAndPropagateResult("zetMetricDestroyExp", result); } return logAndPropagateResult("zetMetricDestroyExp", driver_result); } } // namespace validation_layer #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricDecoderExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricDecoderExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_decoder_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.MetricDecoderExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreateExp = pDdiTable->pfnCreateExp; pDdiTable->pfnCreateExp = validation_layer::zetMetricDecoderCreateExp; dditable.pfnDestroyExp = pDdiTable->pfnDestroyExp; pDdiTable->pfnDestroyExp = validation_layer::zetMetricDecoderDestroyExp; dditable.pfnGetDecodableMetricsExp = pDdiTable->pfnGetDecodableMetricsExp; pDdiTable->pfnGetDecodableMetricsExp = validation_layer::zetMetricDecoderGetDecodableMetricsExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricProgrammableExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricProgrammableExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_programmable_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.MetricProgrammableExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetExp = pDdiTable->pfnGetExp; pDdiTable->pfnGetExp = validation_layer::zetMetricProgrammableGetExp; dditable.pfnGetPropertiesExp = pDdiTable->pfnGetPropertiesExp; pDdiTable->pfnGetPropertiesExp = validation_layer::zetMetricProgrammableGetPropertiesExp; dditable.pfnGetParamInfoExp = pDdiTable->pfnGetParamInfoExp; pDdiTable->pfnGetParamInfoExp = validation_layer::zetMetricProgrammableGetParamInfoExp; dditable.pfnGetParamValueInfoExp = pDdiTable->pfnGetParamValueInfoExp; pDdiTable->pfnGetParamValueInfoExp = validation_layer::zetMetricProgrammableGetParamValueInfoExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricTracerExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricTracerExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_tracer_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.MetricTracerExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreateExp = pDdiTable->pfnCreateExp; pDdiTable->pfnCreateExp = validation_layer::zetMetricTracerCreateExp; dditable.pfnDestroyExp = pDdiTable->pfnDestroyExp; pDdiTable->pfnDestroyExp = validation_layer::zetMetricTracerDestroyExp; dditable.pfnEnableExp = pDdiTable->pfnEnableExp; pDdiTable->pfnEnableExp = validation_layer::zetMetricTracerEnableExp; dditable.pfnDisableExp = pDdiTable->pfnDisableExp; pDdiTable->pfnDisableExp = validation_layer::zetMetricTracerDisableExp; dditable.pfnReadDataExp = pDdiTable->pfnReadDataExp; pDdiTable->pfnReadDataExp = validation_layer::zetMetricTracerReadDataExp; dditable.pfnDecodeExp = pDdiTable->pfnDecodeExp; pDdiTable->pfnDecodeExp = validation_layer::zetMetricTracerDecodeExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.Device; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetDebugProperties = pDdiTable->pfnGetDebugProperties; pDdiTable->pfnGetDebugProperties = validation_layer::zetDeviceGetDebugProperties; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.DeviceExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetConcurrentMetricGroupsExp = pDdiTable->pfnGetConcurrentMetricGroupsExp; pDdiTable->pfnGetConcurrentMetricGroupsExp = validation_layer::zetDeviceGetConcurrentMetricGroupsExp; dditable.pfnCreateMetricGroupsFromMetricsExp = pDdiTable->pfnCreateMetricGroupsFromMetricsExp; pDdiTable->pfnCreateMetricGroupsFromMetricsExp = validation_layer::zetDeviceCreateMetricGroupsFromMetricsExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Context table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetContextProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_context_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.Context; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnActivateMetricGroups = pDdiTable->pfnActivateMetricGroups; pDdiTable->pfnActivateMetricGroups = validation_layer::zetContextActivateMetricGroups; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandList table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetCommandListProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_command_list_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.CommandList; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnAppendMetricStreamerMarker = pDdiTable->pfnAppendMetricStreamerMarker; pDdiTable->pfnAppendMetricStreamerMarker = validation_layer::zetCommandListAppendMetricStreamerMarker; dditable.pfnAppendMetricQueryBegin = pDdiTable->pfnAppendMetricQueryBegin; pDdiTable->pfnAppendMetricQueryBegin = validation_layer::zetCommandListAppendMetricQueryBegin; dditable.pfnAppendMetricQueryEnd = pDdiTable->pfnAppendMetricQueryEnd; pDdiTable->pfnAppendMetricQueryEnd = validation_layer::zetCommandListAppendMetricQueryEnd; dditable.pfnAppendMetricMemoryBarrier = pDdiTable->pfnAppendMetricMemoryBarrier; pDdiTable->pfnAppendMetricMemoryBarrier = validation_layer::zetCommandListAppendMetricMemoryBarrier; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Kernel table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetKernelProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_kernel_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.Kernel; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetProfileInfo = pDdiTable->pfnGetProfileInfo; pDdiTable->pfnGetProfileInfo = validation_layer::zetKernelGetProfileInfo; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Module table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetModuleProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_module_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.Module; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGetDebugInfo = pDdiTable->pfnGetDebugInfo; pDdiTable->pfnGetDebugInfo = validation_layer::zetModuleGetDebugInfo; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Debug table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDebugProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_debug_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.Debug; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnAttach = pDdiTable->pfnAttach; pDdiTable->pfnAttach = validation_layer::zetDebugAttach; dditable.pfnDetach = pDdiTable->pfnDetach; pDdiTable->pfnDetach = validation_layer::zetDebugDetach; dditable.pfnReadEvent = pDdiTable->pfnReadEvent; pDdiTable->pfnReadEvent = validation_layer::zetDebugReadEvent; dditable.pfnAcknowledgeEvent = pDdiTable->pfnAcknowledgeEvent; pDdiTable->pfnAcknowledgeEvent = validation_layer::zetDebugAcknowledgeEvent; dditable.pfnInterrupt = pDdiTable->pfnInterrupt; pDdiTable->pfnInterrupt = validation_layer::zetDebugInterrupt; dditable.pfnResume = pDdiTable->pfnResume; pDdiTable->pfnResume = validation_layer::zetDebugResume; dditable.pfnReadMemory = pDdiTable->pfnReadMemory; pDdiTable->pfnReadMemory = validation_layer::zetDebugReadMemory; dditable.pfnWriteMemory = pDdiTable->pfnWriteMemory; pDdiTable->pfnWriteMemory = validation_layer::zetDebugWriteMemory; dditable.pfnGetRegisterSetProperties = pDdiTable->pfnGetRegisterSetProperties; pDdiTable->pfnGetRegisterSetProperties = validation_layer::zetDebugGetRegisterSetProperties; dditable.pfnReadRegisters = pDdiTable->pfnReadRegisters; pDdiTable->pfnReadRegisters = validation_layer::zetDebugReadRegisters; dditable.pfnWriteRegisters = pDdiTable->pfnWriteRegisters; pDdiTable->pfnWriteRegisters = validation_layer::zetDebugWriteRegisters; dditable.pfnGetThreadRegisterSetProperties = pDdiTable->pfnGetThreadRegisterSetProperties; pDdiTable->pfnGetThreadRegisterSetProperties = validation_layer::zetDebugGetThreadRegisterSetProperties; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Metric table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.Metric; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGet = pDdiTable->pfnGet; pDdiTable->pfnGet = validation_layer::zetMetricGet; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zetMetricGetProperties; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.MetricExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreateFromProgrammableExp2 = pDdiTable->pfnCreateFromProgrammableExp2; pDdiTable->pfnCreateFromProgrammableExp2 = validation_layer::zetMetricCreateFromProgrammableExp2; dditable.pfnCreateFromProgrammableExp = pDdiTable->pfnCreateFromProgrammableExp; pDdiTable->pfnCreateFromProgrammableExp = validation_layer::zetMetricCreateFromProgrammableExp; dditable.pfnDestroyExp = pDdiTable->pfnDestroyExp; pDdiTable->pfnDestroyExp = validation_layer::zetMetricDestroyExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricGroup table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricGroupProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_group_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.MetricGroup; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnGet = pDdiTable->pfnGet; pDdiTable->pfnGet = validation_layer::zetMetricGroupGet; dditable.pfnGetProperties = pDdiTable->pfnGetProperties; pDdiTable->pfnGetProperties = validation_layer::zetMetricGroupGetProperties; dditable.pfnCalculateMetricValues = pDdiTable->pfnCalculateMetricValues; pDdiTable->pfnCalculateMetricValues = validation_layer::zetMetricGroupCalculateMetricValues; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricGroupExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricGroupExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_group_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.MetricGroupExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCalculateMultipleMetricValuesExp = pDdiTable->pfnCalculateMultipleMetricValuesExp; pDdiTable->pfnCalculateMultipleMetricValuesExp = validation_layer::zetMetricGroupCalculateMultipleMetricValuesExp; dditable.pfnGetGlobalTimestampsExp = pDdiTable->pfnGetGlobalTimestampsExp; pDdiTable->pfnGetGlobalTimestampsExp = validation_layer::zetMetricGroupGetGlobalTimestampsExp; dditable.pfnGetExportDataExp = pDdiTable->pfnGetExportDataExp; pDdiTable->pfnGetExportDataExp = validation_layer::zetMetricGroupGetExportDataExp; dditable.pfnCalculateMetricExportDataExp = pDdiTable->pfnCalculateMetricExportDataExp; pDdiTable->pfnCalculateMetricExportDataExp = validation_layer::zetMetricGroupCalculateMetricExportDataExp; dditable.pfnCreateExp = pDdiTable->pfnCreateExp; pDdiTable->pfnCreateExp = validation_layer::zetMetricGroupCreateExp; dditable.pfnAddMetricExp = pDdiTable->pfnAddMetricExp; pDdiTable->pfnAddMetricExp = validation_layer::zetMetricGroupAddMetricExp; dditable.pfnRemoveMetricExp = pDdiTable->pfnRemoveMetricExp; pDdiTable->pfnRemoveMetricExp = validation_layer::zetMetricGroupRemoveMetricExp; dditable.pfnCloseExp = pDdiTable->pfnCloseExp; pDdiTable->pfnCloseExp = validation_layer::zetMetricGroupCloseExp; dditable.pfnDestroyExp = pDdiTable->pfnDestroyExp; pDdiTable->pfnDestroyExp = validation_layer::zetMetricGroupDestroyExp; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricQuery table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricQueryProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_query_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.MetricQuery; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zetMetricQueryCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zetMetricQueryDestroy; dditable.pfnReset = pDdiTable->pfnReset; pDdiTable->pfnReset = validation_layer::zetMetricQueryReset; dditable.pfnGetData = pDdiTable->pfnGetData; pDdiTable->pfnGetData = validation_layer::zetMetricQueryGetData; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricQueryPool table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricQueryPoolProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_query_pool_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.MetricQueryPool; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zetMetricQueryPoolCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zetMetricQueryPoolDestroy; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricStreamer table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricStreamerProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_streamer_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.MetricStreamer; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnOpen = pDdiTable->pfnOpen; pDdiTable->pfnOpen = validation_layer::zetMetricStreamerOpen; dditable.pfnClose = pDdiTable->pfnClose; pDdiTable->pfnClose = validation_layer::zetMetricStreamerClose; dditable.pfnReadData = pDdiTable->pfnReadData; pDdiTable->pfnReadData = validation_layer::zetMetricStreamerReadData; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's TracerExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetTracerExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_tracer_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { auto& dditable = validation_layer::context.zetDdiTable.TracerExp; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if (ZE_MAJOR_VERSION(validation_layer::context.version) != ZE_MAJOR_VERSION(version) || ZE_MINOR_VERSION(validation_layer::context.version) > ZE_MINOR_VERSION(version)) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; dditable.pfnCreate = pDdiTable->pfnCreate; pDdiTable->pfnCreate = validation_layer::zetTracerExpCreate; dditable.pfnDestroy = pDdiTable->pfnDestroy; pDdiTable->pfnDestroy = validation_layer::zetTracerExpDestroy; dditable.pfnSetPrologues = pDdiTable->pfnSetPrologues; pDdiTable->pfnSetPrologues = validation_layer::zetTracerExpSetPrologues; dditable.pfnSetEpilogues = pDdiTable->pfnSetEpilogues; pDdiTable->pfnSetEpilogues = validation_layer::zetTracerExpSetEpilogues; dditable.pfnSetEnabled = pDdiTable->pfnSetEnabled; pDdiTable->pfnSetEnabled = validation_layer::zetTracerExpSetEnabled; return result; } #if defined(__cplusplus) }; #endif level-zero-1.20.6/source/level-zero.pc.in000066400000000000000000000005561475521542100202150ustar00rootroot00000000000000prefix=${pcfiledir}/@pkgconfig_prefix@ includedir=${prefix}/@pkgconfig_include_dir@ libdir=${prefix}/@pkgconfig_lib_dir@ Name: Level Zero Description: Level Zero URL: https://github.com/oneapi-src/level-zero Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@ Requires: libze_loader Libs: -L${libdir} CFlags: -I${includedir}/level_zero level-zero-1.20.6/source/lib/000077500000000000000000000000001475521542100157405ustar00rootroot00000000000000level-zero-1.20.6/source/lib/CMakeLists.txt000066400000000000000000000016201475521542100204770ustar00rootroot00000000000000 target_sources(${TARGET_LOADER_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ze_libapi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_libddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zet_libapi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zet_libddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zes_libapi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zes_libddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zel_tracing_libapi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zel_tracing_libddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_lib.h ${CMAKE_CURRENT_SOURCE_DIR}/ze_lib.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_tracing_register_cb_libapi.cpp ) if(WIN32) target_sources(${TARGET_LOADER_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/windows/lib_init.cpp ) else() target_sources(${TARGET_LOADER_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/linux/lib_init.cpp ) endif() level-zero-1.20.6/source/lib/linux/000077500000000000000000000000001475521542100170775ustar00rootroot00000000000000level-zero-1.20.6/source/lib/linux/lib_init.cpp000066400000000000000000000005041475521542100213730ustar00rootroot00000000000000/* * * Copyright (C) 2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "../ze_lib.h" namespace ze_lib { void __attribute__((constructor)) createLibContext() { context = new context_t; } void __attribute__((destructor)) deleteLibContext() { delete context; } }level-zero-1.20.6/source/lib/windows/000077500000000000000000000000001475521542100174325ustar00rootroot00000000000000level-zero-1.20.6/source/lib/windows/lib_init.cpp000066400000000000000000000016701475521542100217330ustar00rootroot00000000000000/* * * Copyright (C) 2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "../ze_lib.h" #ifndef DYNAMIC_LOAD_LOADER #include "../loader/ze_loader_internal.h" #endif namespace ze_lib { #ifdef DYNAMIC_LOAD_LOADER export "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_DETACH) { delete context; } else if (fdwReason == DLL_PROCESS_ATTACH) { context = new context_t; } return TRUE; } #else extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_DETACH) { delete context; delete loader::context; } else if (fdwReason == DLL_PROCESS_ATTACH) { context = new context_t; loader::context = new loader::context_t; } return TRUE; } #endif } level-zero-1.20.6/source/lib/ze_lib.cpp000066400000000000000000000166431475521542100177220ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_lib.cpp * */ #include "ze_lib.h" #ifndef DYNAMIC_LOAD_LOADER #include "../loader/ze_loader_api.h" #endif namespace ze_lib { /////////////////////////////////////////////////////////////////////////////// context_t *context; bool destruction = false; /////////////////////////////////////////////////////////////////////////////// context_t::context_t() { }; /////////////////////////////////////////////////////////////////////////////// context_t::~context_t() { #ifdef DYNAMIC_LOAD_LOADER if (loader) { FREE_DRIVER_LIBRARY( loader ); } #endif ze_lib::destruction = true; }; ////////////////////////////////////////////////////////////////////////// __zedlllocal ze_result_t context_t::Init(ze_init_flags_t flags, bool sysmanOnly, ze_init_driver_type_desc_t* desc) { ze_result_t result; #ifdef DYNAMIC_LOAD_LOADER std::string loaderLibraryPath; #ifdef _WIN32 loaderLibraryPath = readLevelZeroLoaderLibraryPath(); #endif std::string loaderFullLibraryPath = create_library_path(MAKE_LIBRARY_NAME( "ze_loader", L0_LOADER_VERSION), loaderLibraryPath.c_str()); loader = LOAD_DRIVER_LIBRARY(loaderFullLibraryPath.c_str()); if( NULL == loader ) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *loaderInit_t)(); auto loaderInit = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeLoaderInit") ); result = loaderInit(); if( ZE_RESULT_SUCCESS == result ) { typedef HMODULE (ZE_APICALL *getTracing_t)(); auto getTracing = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeLoaderGetTracingHandle") ); tracing_lib = getTracing(); } #else result = zeLoaderInit(); if( ZE_RESULT_SUCCESS == result ) { tracing_lib = zeLoaderGetTracingHandle(); } #endif if ( ZE_RESULT_SUCCESS == result ) { ze_lib::context->zeDdiTable.exchange(&ze_lib::context->initialzeDdiTable); ze_lib::context->zetDdiTable.exchange(&ze_lib::context->initialzetDdiTable); ze_lib::context->zesDdiTable.exchange(&ze_lib::context->initialzesDdiTable); } // Given zesInit, then zesDrivers needs to be used as the sysmanInstanceDrivers; if (sysmanOnly) { loader::context->sysmanInstanceDrivers = &loader::context->zesDrivers; } // Always call the inits for all the ddi tables before checking which drivers are usable to enable Instrumentation correctly. // Init the ZE DDI Tables if( ZE_RESULT_SUCCESS == result ) { result = zeDdiTableInit(); } // Init the ZET DDI Tables if( ZE_RESULT_SUCCESS == result ) { result = zetDdiTableInit(); } // Init the ZES DDI Tables if( ZE_RESULT_SUCCESS == result ) { result = zesDdiTableInit(); } // Init the Tracing API DDI Tables if( ZE_RESULT_SUCCESS == result ) { result = zelTracingDdiTableInit(); } // Init the stored ddi tables for the tracing layer if( ZE_RESULT_SUCCESS == result ) { result = zelLoaderTracingLayerInit(this->pTracingZeDdiTable); } // End DDI Table Inits // Check which drivers and layers can be init on this system. if( ZE_RESULT_SUCCESS == result) { // Check which drivers support the ze_driver_flag_t specified // No need to check if only initializing sysman bool requireDdiReinit = false; result = zelLoaderDriverCheck(flags, desc, &ze_lib::context->initialzeDdiTable.Global, &ze_lib::context->initialzesDdiTable.Global, &requireDdiReinit, sysmanOnly); // If a driver was removed from the driver list, then the ddi tables need to be reinit to allow for passthru directly to the driver. if (requireDdiReinit) { // If a user has already called the core apis, then ddi table reinit is not possible due to handles already being read by the user. if (!sysmanOnly && !ze_lib::context->zeInuse) { // reInit the ZE DDI Tables if( ZE_RESULT_SUCCESS == result ) { result = zeDdiTableInit(); } // reInit the ZET DDI Tables if( ZE_RESULT_SUCCESS == result ) { result = zetDdiTableInit(); } // If ze/zet ddi tables have been reinit and no longer use the intercept layer, then handles passed to zelLoaderTranslateHandleInternal do not require translation. // Setting intercept_enabled==false changes the behavior of zelLoaderTranslateHandleInternal to avoid translation. // Translation is only required if the intercept layer is enabled for the ZE handle types. loader::context->intercept_enabled = false; } // If a user has already called the zes/ze apis, then ddi table reinit is not possible due to handles already being read by the user. if (!(ze_lib::context->zesInuse || ze_lib::context->zeInuse)) { // reInit the ZES DDI Tables if( ZE_RESULT_SUCCESS == result ) { result = zesDdiTableInit(); } } } } if( ZE_RESULT_SUCCESS == result ) { isInitialized = true; } return result; } } // namespace ze_lib extern "C" { ze_result_t ZE_APICALL zelLoaderGetVersions( size_t *num_elems, //Pointer to num versions to get. zel_component_version_t *versions) //Pointer to array of versions. If set to NULL, num_elems is returned { #ifdef DYNAMIC_LOAD_LOADER if(nullptr == ze_lib::context->loader) return ZE_RESULT_ERROR; typedef ze_result_t (ZE_APICALL *zelLoaderGetVersions_t)(size_t *num_elems, zel_component_version_t *versions); auto getVersions = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->loader, "zelLoaderGetVersionsInternal") ); return getVersions(num_elems, versions); #else return zelLoaderGetVersionsInternal(num_elems, versions); #endif } ze_result_t ZE_APICALL zelLoaderTranslateHandle( zel_handle_type_t handleType, void *handleIn, void **handleOut) { return zelLoaderTranslateHandleInternal(handleType, handleIn, handleOut); } ze_result_t ZE_APICALL zelSetDriverTeardown() { ze_result_t result = ZE_RESULT_SUCCESS; if (!ze_lib::destruction) { ze_lib::destruction = true; } return result; } ze_result_t ZE_APICALL zelEnableTracingLayer() { if (ze_lib::context->tracingLayerEnableCounter.fetch_add(1) == 0) { ze_lib::context->zeDdiTable.exchange(ze_lib::context->pTracingZeDdiTable); } return ZE_RESULT_SUCCESS; } ze_result_t ZE_APICALL zelDisableTracingLayer() { if (ze_lib::context->tracingLayerEnableCounter.fetch_sub(1) <= 1) { ze_lib::context->zeDdiTable.exchange(&ze_lib::context->initialzeDdiTable); } return ZE_RESULT_SUCCESS; } } //extern "c"level-zero-1.20.6/source/lib/ze_lib.h000066400000000000000000000033751475521542100173650ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_lib.h * */ #pragma once #include "ze_api.h" #include "ze_ddi.h" #include "zet_api.h" #include "zet_ddi.h" #include "zes_api.h" #include "zes_ddi.h" #include "layers/zel_tracing_api.h" #include "layers/zel_tracing_ddi.h" #include "../utils/logging.h" #include "ze_util.h" #include #include #include namespace ze_lib { /////////////////////////////////////////////////////////////////////////////// class context_t { public: #ifdef DYNAMIC_LOAD_LOADER HMODULE loader = nullptr; #endif context_t(); ~context_t(); std::once_flag initOnce; std::once_flag initOnceDrivers; std::once_flag initOnceSysMan; ze_result_t Init(ze_init_flags_t flags, bool sysmanOnly, ze_init_driver_type_desc_t* desc); ze_result_t zeDdiTableInit(); std::atomic zeDdiTable = {nullptr}; ze_result_t zetDdiTableInit(); std::atomic zetDdiTable = {nullptr}; ze_result_t zesDdiTableInit(); std::atomic zesDdiTable = {nullptr}; ze_result_t zelTracingDdiTableInit(); zel_tracing_dditable_t zelTracingDdiTable = {}; std::atomic pTracingZeDdiTable = {nullptr}; ze_dditable_t initialzeDdiTable; zet_dditable_t initialzetDdiTable; zes_dditable_t initialzesDdiTable; std::atomic_uint32_t tracingLayerEnableCounter{0}; HMODULE tracing_lib = nullptr; bool isInitialized = false; bool zesInuse = false; bool zeInuse = false; }; extern context_t *context; extern bool destruction; } // namespace ze_lib level-zero-1.20.6/source/lib/ze_libapi.cpp000066400000000000000000014253071475521542100204160ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_libapi.cpp * * @brief C++ static library for ze * */ #include "ze_lib.h" extern "C" { /////////////////////////////////////////////////////////////////////////////// /// @brief Initialize the 'oneAPI' driver(s) /// /// @details /// - @deprecated since 1.10. Please use zeInitDrivers() /// - The application must call this function or zeInitDrivers before /// calling any other function. /// - If this function is not called then all other functions will return /// ::ZE_RESULT_ERROR_UNINITIALIZED. /// - Only one instance of each driver 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 driver(s) simultaneously. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < flags` ze_result_t ZE_APICALL zeInit( ze_init_flags_t flags ///< [in] initialization flags. ///< must be 0 (default) or a combination of ::ze_init_flag_t. ) { static ze_result_t result = ZE_RESULT_SUCCESS; std::call_once(ze_lib::context->initOnce, [flags]() { result = ze_lib::context->Init(flags, false, nullptr); if( ZE_RESULT_SUCCESS != result ) return result; if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnInit = ze_lib::context->zeDdiTable.load()->Global.pfnInit; if( nullptr == pfnInit ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } result = pfnInit( flags ); return result; }); if(ze_lib::destruction) { result = ZE_RESULT_ERROR_UNINITIALIZED; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves driver instances /// /// @details /// - @deprecated since 1.10. Please use zeInitDrivers() /// - Usage of zeInitDrivers and zeDriverGet is mutually exclusive and /// should not be used together. Usage of them together will result in /// undefined behavior. /// - A driver represents a collection of physical devices. /// - Multiple calls to this function will return identical driver handles, /// in the same order. /// - The application may pass nullptr for pDrivers when only querying the /// number of drivers. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clGetPlatformIDs /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeDriverGet( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } if (ze_lib::context->zeDdiTable == nullptr) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGet = ze_lib::context->zeDdiTable.load()->Driver.pfnGet; if( nullptr == pfnGet ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } ze_lib::context->zeInuse = true; return pfnGet( pCount, phDrivers ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Initialize the 'oneAPI' driver(s) based on the driver types requested /// and retrieve the driver handles. /// /// @details /// - The application must call this function or zeInit before calling any /// other function. (zeInit is [Deprecated] and is replaced by /// zeInitDrivers) /// - Calls to zeInit[Deprecated] or InitDrivers will not alter the drivers /// retrieved thru either api. /// - Drivers init thru zeInit[Deprecated] or InitDrivers will not be /// reInitialized once init in an application. The Loader will determine /// if the already init driver needs to be delivered to the user thru the /// init type flags. /// - Already init Drivers will not be uninitialized if the call to /// InitDrivers does not include that driver's type. Those init drivers /// which don't match the init flags will not have their driver handles /// returned to the user in that InitDrivers call. /// - If this function or zeInit[Deprecated] is not called, then all other /// functions will return ::ZE_RESULT_ERROR_UNINITIALIZED. /// - Only one instance of each driver will be initialized per process. /// - A driver represents a collection of physical devices. /// - Multiple calls to this function will return identical driver handles, /// in the same order. /// - The drivers returned to the caller will be based on the init types /// which state the drivers to be included. /// - The application may pass nullptr for pDrivers when only querying the /// number of drivers. /// - 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 driver(s) simultaneously. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` /// + `nullptr == desc` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x0 == desc->flags` ze_result_t ZE_APICALL zeInitDrivers( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers, ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ze_init_driver_type_desc_t* desc ///< [in] descriptor containing the driver type initialization details ///< including ::ze_init_driver_type_flag_t combinations. ) { ze_result_t result = ZE_RESULT_SUCCESS; std::call_once(ze_lib::context->initOnceDrivers, [desc,&result]() { result = ze_lib::context->Init(0, false, desc); return result; }); if (result != ZE_RESULT_SUCCESS) { return result; } if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnInitDrivers = ze_lib::context->zeDdiTable.load()->Global.pfnInitDrivers; if( nullptr == pfnInitDrivers ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } result = pfnInitDrivers( pCount, phDrivers, desc ); if (result == ZE_RESULT_SUCCESS) { if (phDrivers) { ze_lib::context->zeInuse = true; } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Returns the API version supported by the specified driver /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == version` ze_result_t ZE_APICALL zeDriverGetApiVersion( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_api_version_t* version ///< [out] api version ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetApiVersion = ze_lib::context->zeDdiTable.load()->Driver.pfnGetApiVersion; if( nullptr == pfnGetApiVersion ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetApiVersion( hDriver, version ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves properties of the driver. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clGetPlatformInfo** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pDriverProperties` ze_result_t ZE_APICALL zeDriverGetProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_properties_t* pDriverProperties ///< [in,out] query result for driver properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zeDdiTable.load()->Driver.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hDriver, pDriverProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves IPC attributes of the driver /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pIpcProperties` ze_result_t ZE_APICALL zeDriverGetIpcProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_ipc_properties_t* pIpcProperties ///< [in,out] query result for IPC properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetIpcProperties = ze_lib::context->zeDdiTable.load()->Driver.pfnGetIpcProperties; if( nullptr == pfnGetIpcProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetIpcProperties( hDriver, pIpcProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves extension properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **vkEnumerateInstanceExtensionProperties** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeDriverGetExtensionProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. ze_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetExtensionProperties = ze_lib::context->zeDdiTable.load()->Driver.pfnGetExtensionProperties; if( nullptr == pfnGetExtensionProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetExtensionProperties( hDriver, pCount, pExtensionProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves function pointer for vendor-specific or experimental /// extensions /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == name` /// + `nullptr == ppFunctionAddress` ze_result_t ZE_APICALL zeDriverGetExtensionFunctionAddress( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetExtensionFunctionAddress = ze_lib::context->zeDdiTable.load()->Driver.pfnGetExtensionFunctionAddress; if( nullptr == pfnGetExtensionFunctionAddress ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetExtensionFunctionAddress( hDriver, name, ppFunctionAddress ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves a string describing the last error code returned by the /// driver in the current thread. /// /// @details /// - String returned is thread local. /// - String is only updated on calls returning an error, i.e., not on calls /// returning ::ZE_RESULT_SUCCESS. /// - String may be empty if driver considers error code is already explicit /// enough to describe cause. /// - Memory pointed to by ppString is owned by the driver. /// - String returned is null-terminated. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ppString` ze_result_t ZE_APICALL zeDriverGetLastErrorDescription( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char** ppString ///< [in,out] pointer to a null-terminated array of characters describing ///< cause of error. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetLastErrorDescription = ze_lib::context->zeDdiTable.load()->Driver.pfnGetLastErrorDescription; if( nullptr == pfnGetLastErrorDescription ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetLastErrorDescription( hDriver, ppString ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves devices within a driver /// /// @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 is /// affected by the ::ZE_AFFINITY_MASK and ::ZE_ENABLE_PCI_ID_DEVICE_ORDER /// environment variables. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeDeviceGet( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of devices. ///< if count is zero, then the driver shall update the value with the ///< total number of devices available. ///< if count is greater than the number of devices available, then the ///< driver shall update the value with the correct number of devices available. ze_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of devices. ///< if count is less than the number of devices available, then driver ///< shall only retrieve that number of devices. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGet = ze_lib::context->zeDdiTable.load()->Device.pfnGet; if( nullptr == pfnGet ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGet( hDriver, pCount, phDevices ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves the root-device of a device handle /// /// @details /// - When the device handle passed does not belong to any root-device, /// nullptr is returned. /// - Multiple calls to this function will return the same device handle. /// - The root-device handle returned by this function does not have access /// automatically to the resources /// created with the associated sub-device, unless those resources have /// been created with a context /// explicitly containing both handles. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phRootDevice` ze_result_t ZE_APICALL zeDeviceGetRootDevice( ze_device_handle_t hDevice, ///< [in] handle of the device object ze_device_handle_t* phRootDevice ///< [in,out] parent root device. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetRootDevice = ze_lib::context->zeDdiTable.load()->Device.pfnGetRootDevice; if( nullptr == pfnGetRootDevice ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetRootDevice( hDevice, phRootDevice ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves a sub-device from a device /// /// @details /// - When the device handle passed does not contain any sub-device, a /// pCount of 0 is returned. /// - Multiple calls to this function will return identical device handles, /// in the same order. /// - The number of handles returned from this function is affected by the /// ::ZE_AFFINITY_MASK environment variable. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clCreateSubDevices /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeDeviceGetSubDevices( ze_device_handle_t hDevice, ///< [in] handle of the device object uint32_t* pCount, ///< [in,out] pointer to the number of sub-devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-devices available. ///< if count is greater than the number of sub-devices available, then the ///< driver shall update the value with the correct number of sub-devices available. ze_device_handle_t* phSubdevices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-devices. ///< if count is less than the number of sub-devices available, then driver ///< shall only retrieve that number of sub-devices. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetSubDevices = ze_lib::context->zeDdiTable.load()->Device.pfnGetSubDevices; if( nullptr == pfnGetSubDevices ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetSubDevices( hDevice, pCount, phSubdevices ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves properties of the device. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clGetDeviceInfo /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pDeviceProperties` ze_result_t ZE_APICALL zeDeviceGetProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_properties_t* pDeviceProperties ///< [in,out] query result for device properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zeDdiTable.load()->Device.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hDevice, pDeviceProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves compute properties of the device. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clGetDeviceInfo /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pComputeProperties` ze_result_t ZE_APICALL zeDeviceGetComputeProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_compute_properties_t* pComputeProperties ///< [in,out] query result for compute properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetComputeProperties = ze_lib::context->zeDdiTable.load()->Device.pfnGetComputeProperties; if( nullptr == pfnGetComputeProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetComputeProperties( hDevice, pComputeProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves module properties of the device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pModuleProperties` ze_result_t ZE_APICALL zeDeviceGetModuleProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_module_properties_t* pModuleProperties///< [in,out] query result for module properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetModuleProperties = ze_lib::context->zeDdiTable.load()->Device.pfnGetModuleProperties; if( nullptr == pfnGetModuleProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetModuleProperties( hDevice, pModuleProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves command queue group properties of the device. /// /// @details /// - Properties are reported for each physical command queue type supported /// by the device. /// - Multiple calls to this function will return properties in the same /// order. /// - The order in which the properties are returned defines the command /// queue group's ordinal. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **vkGetPhysicalDeviceQueueFamilyProperties** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeDeviceGetCommandQueueGroupProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of command queue group properties. ///< if count is zero, then the driver shall update the value with the ///< total number of command queue group properties available. ///< if count is greater than the number of command queue group properties ///< available, then the driver shall update the value with the correct ///< number of command queue group properties available. ze_command_queue_group_properties_t* pCommandQueueGroupProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< command queue group properties. ///< if count is less than the number of command queue group properties ///< available, then driver shall only retrieve that number of command ///< queue group properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetCommandQueueGroupProperties = ze_lib::context->zeDdiTable.load()->Device.pfnGetCommandQueueGroupProperties; if( nullptr == pfnGetCommandQueueGroupProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetCommandQueueGroupProperties( hDevice, pCount, pCommandQueueGroupProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves local memory properties of the device. /// /// @details /// - Properties are reported for each physical memory type supported by the /// device. /// - Multiple calls to this function will return properties in the same /// order. /// - The order in which the properties are returned defines the device's /// local memory ordinal. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clGetDeviceInfo /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeDeviceGetMemoryProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of memory properties. ///< if count is zero, then the driver shall update the value with the ///< total number of memory properties available. ///< if count is greater than the number of memory properties available, ///< then the driver shall update the value with the correct number of ///< memory properties available. ze_device_memory_properties_t* pMemProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< memory properties. ///< if count is less than the number of memory properties available, then ///< driver shall only retrieve that number of memory properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetMemoryProperties = ze_lib::context->zeDdiTable.load()->Device.pfnGetMemoryProperties; if( nullptr == pfnGetMemoryProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetMemoryProperties( hDevice, pCount, pMemProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves memory access properties of the device. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clGetDeviceInfo /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pMemAccessProperties` ze_result_t ZE_APICALL zeDeviceGetMemoryAccessProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_memory_access_properties_t* pMemAccessProperties ///< [in,out] query result for memory access properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetMemoryAccessProperties = ze_lib::context->zeDdiTable.load()->Device.pfnGetMemoryAccessProperties; if( nullptr == pfnGetMemoryAccessProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetMemoryAccessProperties( hDevice, pMemAccessProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves cache properties of the device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clGetDeviceInfo /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeDeviceGetCacheProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of cache properties. ///< if count is zero, then the driver shall update the value with the ///< total number of cache properties available. ///< if count is greater than the number of cache properties available, ///< then the driver shall update the value with the correct number of ///< cache properties available. ze_device_cache_properties_t* pCacheProperties ///< [in,out][optional][range(0, *pCount)] array of query results for cache properties. ///< if count is less than the number of cache properties available, then ///< driver shall only retrieve that number of cache properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetCacheProperties = ze_lib::context->zeDdiTable.load()->Device.pfnGetCacheProperties; if( nullptr == pfnGetCacheProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetCacheProperties( hDevice, pCount, pCacheProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves image properties of the device /// /// @details /// - See ::zeImageGetProperties for format-specific capabilities. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pImageProperties` ze_result_t ZE_APICALL zeDeviceGetImageProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_image_properties_t* pImageProperties ///< [in,out] query result for image properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetImageProperties = ze_lib::context->zeDdiTable.load()->Device.pfnGetImageProperties; if( nullptr == pfnGetImageProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetImageProperties( hDevice, pImageProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves external memory import and export of the device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pExternalMemoryProperties` ze_result_t ZE_APICALL zeDeviceGetExternalMemoryProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_external_memory_properties_t* pExternalMemoryProperties ///< [in,out] query result for external memory properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetExternalMemoryProperties = ze_lib::context->zeDdiTable.load()->Device.pfnGetExternalMemoryProperties; if( nullptr == pfnGetExternalMemoryProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetExternalMemoryProperties( hDevice, pExternalMemoryProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves peer-to-peer properties between one device and a peer /// devices /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// + `nullptr == hPeerDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pP2PProperties` ze_result_t ZE_APICALL zeDeviceGetP2PProperties( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_device_p2p_properties_t* pP2PProperties ///< [in,out] Peer-to-Peer properties between source and peer device ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetP2PProperties = ze_lib::context->zeDdiTable.load()->Device.pfnGetP2PProperties; if( nullptr == pfnGetP2PProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetP2PProperties( hDevice, hPeerDevice, pP2PProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Queries if one device can directly access peer device allocations /// /// @details /// - Any device can access any other device within a node through a /// scale-up fabric. /// - The following are conditions for CanAccessPeer query. /// + If both device and peer device are the same then return true. /// + If both sub-device and peer sub-device are the same then return /// true. /// + If both are sub-devices and share the same parent device then /// return true. /// + If both device and remote device are connected by a direct or /// indirect scale-up fabric or over PCIe (same root complex or shared /// PCIe switch) then true. /// + If both sub-device and remote parent device (and vice-versa) are /// connected by a direct or indirect scale-up fabric or over PCIe /// (same root complex or shared PCIe switch) then true. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// + `nullptr == hPeerDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == value` ze_result_t ZE_APICALL zeDeviceCanAccessPeer( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_bool_t* value ///< [out] returned access capability ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCanAccessPeer = ze_lib::context->zeDdiTable.load()->Device.pfnCanAccessPeer; if( nullptr == pfnCanAccessPeer ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCanAccessPeer( hDevice, hPeerDevice, value ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Returns current status of the device. /// /// @details /// - Once a device is reset, this call will update the OS handle attached /// to the device handle. /// - The application may call this function from simultaneous threads with /// the same device handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_SUCCESS /// + Device is available for use. /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// + Device is lost; must be reset for use. ze_result_t ZE_APICALL zeDeviceGetStatus( ze_device_handle_t hDevice ///< [in] handle of the device ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetStatus = ze_lib::context->zeDdiTable.load()->Device.pfnGetStatus; if( nullptr == pfnGetStatus ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetStatus( hDevice ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Returns synchronized Host and device global timestamps. /// /// @details /// - The application may call this function from simultaneous threads with /// the same device handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == hostTimestamp` /// + `nullptr == deviceTimestamp` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + The feature is not supported by the underlying platform. ze_result_t ZE_APICALL zeDeviceGetGlobalTimestamps( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the ///< Host's global timestamp value. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetGlobalTimestamps = ze_lib::context->zeDdiTable.load()->Device.pfnGetGlobalTimestamps; if( nullptr == pfnGetGlobalTimestamps ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetGlobalTimestamps( hDevice, hostTimestamp, deviceTimestamp ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a context for the driver. /// /// @details /// - The application must only use the context for the driver which was /// provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phContext` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x1 < desc->flags` ze_result_t ZE_APICALL zeContextCreate( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zeDdiTable.load()->Context.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hDriver, desc, phContext ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a context for the driver. /// /// @details /// - The application must only use the context for the driver which was /// provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phContext` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x1 < desc->flags` /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phDevices) && (0 < numDevices)` ze_result_t ZE_APICALL zeContextCreateEx( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< context has visibility. ///< if nullptr, then all devices and any sub-devices supported by the ///< driver instance are ///< visible to the context. ///< otherwise, the context only has visibility to the devices and any ///< sub-devices of the ///< devices in this array. ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreateEx = ze_lib::context->zeDdiTable.load()->Context.pfnCreateEx; if( nullptr == pfnCreateEx ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreateEx( hDriver, desc, numDevices, phDevices, phContext ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a context. /// /// @details /// - The application must ensure the device is not currently referencing /// the context before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this context. /// - The application must **not** call this function from simultaneous /// threads with the same context handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeContextDestroy( ze_context_handle_t hContext ///< [in][release] handle of context object to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zeDdiTable.load()->Context.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hContext ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Returns current status of the context. /// /// @details /// - The application may call this function from simultaneous threads with /// the same context handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_SUCCESS /// + Context is available for use. /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// + Context is invalid; due to device lost or reset. ze_result_t ZE_APICALL zeContextGetStatus( ze_context_handle_t hContext ///< [in] handle of context object ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetStatus = ze_lib::context->zeDdiTable.load()->Context.pfnGetStatus; if( nullptr == pfnGetStatus ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetStatus( hContext ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a command queue on the context. /// /// @details /// - A command queue represents a logical input stream to the device, tied /// to a physical input stream. /// - The application must only use the command queue for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @remarks /// _Analogues_ /// - **clCreateCommandQueue** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phCommandQueue` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// + `::ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS < desc->mode` /// + `::ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH < desc->priority` ze_result_t ZE_APICALL zeCommandQueueCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* desc, ///< [in] pointer to command queue descriptor ze_command_queue_handle_t* phCommandQueue ///< [out] pointer to handle of command queue object created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zeDdiTable.load()->CommandQueue.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hContext, hDevice, desc, phCommandQueue ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a command queue. /// /// @details /// - The application must destroy all fence handles created from the /// command queue before destroying the command queue itself /// - The application must ensure the device is not currently referencing /// the command queue before it is deleted /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this command queue /// - The application must **not** call this function from simultaneous /// threads with the same command queue handle. /// - The implementation of this function must be thread-safe. /// /// @remarks /// _Analogues_ /// - **clReleaseCommandQueue** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandQueue` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeCommandQueueDestroy( ze_command_queue_handle_t hCommandQueue ///< [in][release] handle of command queue object to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zeDdiTable.load()->CommandQueue.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hCommandQueue ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Executes a command list in a command queue. /// /// @details /// - The command lists are submitted to the device in the order they are /// received, whether from multiple calls (on the same or different /// threads) or a single call with multiple command lists. /// - The application must ensure the command lists are accessible by the /// device on which the command queue was created. /// - The application must ensure the device is not currently referencing /// the command list since the implementation is allowed to modify the /// contents of the command list for submission. /// - The application must only execute command lists created with an /// identical command queue group ordinal to the command queue. /// - The application must use a fence created using the same command queue. /// - The application must ensure the command queue, command list and fence /// were created on the same context. /// - The application must ensure the command lists being executed are not /// immediate command lists. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - vkQueueSubmit /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandQueue` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phCommandLists` /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `0 == numCommandLists` /// - ::ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ze_result_t ZE_APICALL zeCommandQueueExecuteCommandLists( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t numCommandLists, ///< [in] number of command lists to execute ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] list of handles of the command lists ///< to execute ze_fence_handle_t hFence ///< [in][optional] handle of the fence to signal on completion ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnExecuteCommandLists = ze_lib::context->zeDdiTable.load()->CommandQueue.pfnExecuteCommandLists; if( nullptr == pfnExecuteCommandLists ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnExecuteCommandLists( hCommandQueue, numCommandLists, phCommandLists, hFence ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Synchronizes a command queue by waiting on the host. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandQueue` /// - ::ZE_RESULT_NOT_READY /// + timeout expired ze_result_t ZE_APICALL zeCommandQueueSynchronize( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the command queue; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSynchronize = ze_lib::context->zeDdiTable.load()->CommandQueue.pfnSynchronize; if( nullptr == pfnSynchronize ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSynchronize( hCommandQueue, timeout ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the command queue group ordinal. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandQueue` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOrdinal` ze_result_t ZE_APICALL zeCommandQueueGetOrdinal( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pOrdinal ///< [out] command queue group ordinal ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetOrdinal = ze_lib::context->zeDdiTable.load()->CommandQueue.pfnGetOrdinal; if( nullptr == pfnGetOrdinal ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetOrdinal( hCommandQueue, pOrdinal ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the command queue index within the group. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandQueue` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pIndex` ze_result_t ZE_APICALL zeCommandQueueGetIndex( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pIndex ///< [out] command queue index within the group ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetIndex = ze_lib::context->zeDdiTable.load()->CommandQueue.pfnGetIndex; if( nullptr == pfnGetIndex ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetIndex( hCommandQueue, pIndex ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a command list on the context. /// /// @details /// - A command list represents a sequence of commands for execution on a /// command queue. /// - The command list is created in the 'open' state. /// - The application must only use the command list for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phCommandList` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x1f < desc->flags` ze_result_t ZE_APICALL zeCommandListCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_list_desc_t* desc, ///< [in] pointer to command list descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zeDdiTable.load()->CommandList.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hContext, hDevice, desc, phCommandList ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates an immediate command list on the context. /// /// @details /// - An immediate command list is used for low-latency submission of /// commands. /// - An immediate command list creates an implicit command queue. /// - Immediate command lists must not be passed to /// ::zeCommandQueueExecuteCommandLists. /// - Commands appended into an immediate command list may execute /// synchronously, by blocking until the command is complete. /// - The command list is created in the 'open' state and never needs to be /// closed. /// - The application must only use the command list for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == altdesc` /// + `nullptr == phCommandList` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < altdesc->flags` /// + `::ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS < altdesc->mode` /// + `::ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH < altdesc->priority` ze_result_t ZE_APICALL zeCommandListCreateImmediate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* altdesc, ///< [in] pointer to command queue descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreateImmediate = ze_lib::context->zeDdiTable.load()->CommandList.pfnCreateImmediate; if( nullptr == pfnCreateImmediate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreateImmediate( hContext, hDevice, altdesc, phCommandList ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a command list. /// /// @details /// - The application must ensure the device is not currently referencing /// the command list before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this command list. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeCommandListDestroy( ze_command_list_handle_t hCommandList ///< [in][release] handle of command list object to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zeDdiTable.load()->CommandList.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hCommandList ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Closes a command list; ready to be executed by a command queue. /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` ze_result_t ZE_APICALL zeCommandListClose( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to close ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnClose = ze_lib::context->zeDdiTable.load()->CommandList.pfnClose; if( nullptr == pfnClose ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnClose( hCommandList ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Reset a command list to initial (empty) state; ready for appending /// commands. /// /// @details /// - The application must ensure the device is not currently referencing /// the command list before it is reset /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` ze_result_t ZE_APICALL zeCommandListReset( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to reset ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReset = ze_lib::context->zeDdiTable.load()->CommandList.pfnReset; if( nullptr == pfnReset ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReset( hCommandList ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Appends a memory write of the device's global timestamp value into a /// command list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The timestamp frequency can be queried from the `timerResolution` /// member of ::ze_device_properties_t. /// - The number of valid bits in the timestamp value can be queried from /// the `timestampValidBits` member of ::ze_device_properties_t. /// - The application must ensure the memory pointed to by dstptr is /// accessible by the device on which the command list was created. /// - The application must ensure the command list and events were created, /// and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendWriteGlobalTimestamp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t* dstptr, ///< [in,out] pointer to memory where timestamp value will be written; must ///< be 8byte-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendWriteGlobalTimestamp = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendWriteGlobalTimestamp; if( nullptr == pfnAppendWriteGlobalTimestamp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendWriteGlobalTimestamp( hCommandList, dstptr, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Synchronizes an immediate command list by waiting on the host for the /// completion of all commands previously submitted to it. /// /// @details /// - The application must call this function only with command lists /// created with ::zeCommandListCreateImmediate. /// - Waiting on one immediate command list shall not block the concurrent /// execution of commands appended to other /// immediate command lists created with either a different ordinal or /// different index. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_NOT_READY /// + timeout expired /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + handle does not correspond to an immediate command list ze_result_t ZE_APICALL zeCommandListHostSynchronize( ze_command_list_handle_t hCommandList, ///< [in] handle of the immediate command list uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the immediate command list; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnHostSynchronize = ze_lib::context->zeDdiTable.load()->CommandList.pfnHostSynchronize; if( nullptr == pfnHostSynchronize ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnHostSynchronize( hCommandList, timeout ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the handle of the device on which the command list was created. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phDevice` ze_result_t ZE_APICALL zeCommandListGetDeviceHandle( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_device_handle_t* phDevice ///< [out] handle of the device on which the command list was created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetDeviceHandle = ze_lib::context->zeDdiTable.load()->CommandList.pfnGetDeviceHandle; if( nullptr == pfnGetDeviceHandle ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetDeviceHandle( hCommandList, phDevice ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the handle of the context on which the command list was created. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phContext` ze_result_t ZE_APICALL zeCommandListGetContextHandle( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_context_handle_t* phContext ///< [out] handle of the context on which the command list was created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetContextHandle = ze_lib::context->zeDdiTable.load()->CommandList.pfnGetContextHandle; if( nullptr == pfnGetContextHandle ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetContextHandle( hCommandList, phContext ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the command queue group ordinal to which the command list is /// submitted. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOrdinal` ze_result_t ZE_APICALL zeCommandListGetOrdinal( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t* pOrdinal ///< [out] command queue group ordinal to which command list is submitted ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetOrdinal = ze_lib::context->zeDdiTable.load()->CommandList.pfnGetOrdinal; if( nullptr == pfnGetOrdinal ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetOrdinal( hCommandList, pOrdinal ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the command queue index within the group to which the immediate /// command list is submitted. /// /// @details /// - The application must call this function only with command lists /// created with ::zeCommandListCreateImmediate. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandListImmediate` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pIndex` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + handle does not correspond to an immediate command list ze_result_t ZE_APICALL zeCommandListImmediateGetIndex( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t* pIndex ///< [out] command queue index within the group to which the immediate ///< command list is submitted ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnImmediateGetIndex = ze_lib::context->zeDdiTable.load()->CommandList.pfnImmediateGetIndex; if( nullptr == pfnImmediateGetIndex ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnImmediateGetIndex( hCommandListImmediate, pIndex ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Query whether a command list is an immediate command list. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pIsImmediate` ze_result_t ZE_APICALL zeCommandListIsImmediate( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_bool_t* pIsImmediate ///< [out] Boolean indicating whether the command list is an immediate ///< command list (true) or not (false) ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnIsImmediate = ze_lib::context->zeDdiTable.load()->CommandList.pfnIsImmediate; if( nullptr == pfnIsImmediate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnIsImmediate( hCommandList, pIsImmediate ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Appends an execution and global memory barrier into a command list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - If numWaitEvents is zero, then all previous commands, enqueued on same /// command queue, must complete prior to the execution of the barrier. /// This is not the case when numWaitEvents is non-zero. /// - If numWaitEvents is non-zero, then only all phWaitEvents must be /// signaled prior to the execution of the barrier. /// - This command blocks all following commands from beginning until the /// execution of the barrier completes. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **vkCmdPipelineBarrier** /// - clEnqueueBarrierWithWaitList /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendBarrier( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendBarrier = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendBarrier; if( nullptr == pfnAppendBarrier ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendBarrier( hCommandList, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Appends a global memory ranges barrier into a command list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - If numWaitEvents is zero, then all previous commands are completed /// prior to the execution of the barrier. /// - If numWaitEvents is non-zero, then then all phWaitEvents must be /// signaled prior to the execution of the barrier. /// - This command blocks all following commands from beginning until the /// execution of the barrier completes. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRangeSizes` /// + `nullptr == pRanges` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendMemoryRangesBarrier( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numRanges, ///< [in] number of memory ranges const size_t* pRangeSizes, ///< [in][range(0, numRanges)] array of sizes of memory range const void** pRanges, ///< [in][range(0, numRanges)] array of memory ranges ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendMemoryRangesBarrier = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendMemoryRangesBarrier; if( nullptr == pfnAppendMemoryRangesBarrier ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendMemoryRangesBarrier( hCommandList, numRanges, pRangeSizes, pRanges, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Ensures in-bound writes to the device are globally observable. /// /// @details /// - This is a special-case system level barrier that can be used to ensure /// global observability of writes; /// typically needed after a producer (e.g., NIC) performs direct writes /// to the device's memory (e.g., Direct RDMA writes). /// This is typically required when the memory corresponding to the writes /// is subsequently accessed from a remote device. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` ze_result_t ZE_APICALL zeContextSystemBarrier( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice ///< [in] handle of the device ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSystemBarrier = ze_lib::context->zeDdiTable.load()->Context.pfnSystemBarrier; if( nullptr == pfnSystemBarrier ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSystemBarrier( hContext, hDevice ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Copies host, device, or shared memory. /// /// @details /// - The application must ensure the memory pointed to by dstptr and srcptr /// is accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by dstptr and /// srcptr as they are free to be modified by either the Host or device up /// until execution. /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the command list and events were created, /// and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clEnqueueCopyBuffer** /// - **clEnqueueReadBuffer** /// - **clEnqueueWriteBuffer** /// - **clEnqueueSVMMemcpy** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// + `nullptr == srcptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendMemoryCopy( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendMemoryCopy = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendMemoryCopy; if( nullptr == pfnAppendMemoryCopy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendMemoryCopy( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Initializes host, device, or shared memory. /// /// @details /// - The application must ensure the memory pointed to by dstptr is /// accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by dstptr as /// it is free to be modified by either the Host or device up until /// execution. /// - The value to initialize memory to is described by the pattern and the /// pattern size. /// - The pattern size must be a power-of-two and less than or equal to the /// `maxMemoryFillPatternSize` member of /// ::ze_command_queue_group_properties_t. /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the command list and events were created, /// and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clEnqueueFillBuffer** /// - **clEnqueueSVMMemFill** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// + `nullptr == pattern` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendMemoryFill( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* ptr, ///< [in] pointer to memory to initialize const void* pattern, ///< [in] pointer to value to initialize memory to size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to size_t size, ///< [in] size in bytes to initialize ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendMemoryFill = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendMemoryFill; if( nullptr == pfnAppendMemoryFill ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendMemoryFill( hCommandList, ptr, pattern, pattern_size, size, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Copies a region from a 2D or 3D array of host, device, or shared /// memory. /// /// @details /// - The application must ensure the memory pointed to by dstptr and srcptr /// is accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by dstptr and /// srcptr as they are free to be modified by either the Host or device up /// until execution. /// - The region width, height, and depth for both src and dst must be same. /// The origins can be different. /// - The src and dst regions cannot be overlapping. /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the command list and events were created, /// and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// + `nullptr == dstRegion` /// + `nullptr == srcptr` /// + `nullptr == srcRegion` /// - ::ZE_RESULT_ERROR_OVERLAPPING_REGIONS /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const ze_copy_region_t* dstRegion, ///< [in] pointer to destination region to copy to uint32_t dstPitch, ///< [in] destination pitch in bytes uint32_t dstSlicePitch, ///< [in] destination slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. const void* srcptr, ///< [in] pointer to source memory to copy from const ze_copy_region_t* srcRegion, ///< [in] pointer to source region to copy from uint32_t srcPitch, ///< [in] source pitch in bytes uint32_t srcSlicePitch, ///< [in] source slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendMemoryCopyRegion = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendMemoryCopyRegion; if( nullptr == pfnAppendMemoryCopyRegion ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendMemoryCopyRegion( hCommandList, dstptr, dstRegion, dstPitch, dstSlicePitch, srcptr, srcRegion, srcPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Copies host, device, or shared memory from another context. /// /// @details /// - The current active and source context must be from the same driver. /// - The application must ensure the memory pointed to by dstptr and srcptr /// is accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by dstptr and /// srcptr as they are free to be modified by either the Host or device up /// until execution. /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the command list and events were created, /// and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hContextSrc` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// + `nullptr == srcptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyFromContext( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_context_handle_t hContextSrc, ///< [in] handle of source context object const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendMemoryCopyFromContext = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendMemoryCopyFromContext; if( nullptr == pfnAppendMemoryCopyFromContext ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendMemoryCopyFromContext( hCommandList, dstptr, hContextSrc, srcptr, size, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Copies an image. /// /// @details /// - The application must ensure the image and events are accessible by the /// device on which the command list was created. /// - The application must ensure the image format descriptors for both /// source and destination images are the same. /// - The application must ensure the command list, images and events were /// created on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clEnqueueCopyImage** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hDstImage` /// + `nullptr == hSrcImage` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendImageCopy( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendImageCopy = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendImageCopy; if( nullptr == pfnAppendImageCopy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendImageCopy( hCommandList, hDstImage, hSrcImage, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Copies a region of an image to another image. /// /// @details /// - The application must ensure the image and events are accessible by the /// device on which the command list was created. /// - The region width and height for both src and dst must be same. The /// origins can be different. /// - The src and dst regions cannot be overlapping. /// - The application must ensure the image format descriptors for both /// source and destination images are the same. /// - The application must ensure the command list, images and events were /// created, and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hDstImage` /// + `nullptr == hSrcImage` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_OVERLAPPING_REGIONS /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendImageCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendImageCopyRegion = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendImageCopyRegion; if( nullptr == pfnAppendImageCopyRegion ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendImageCopyRegion( hCommandList, hDstImage, hSrcImage, pDstRegion, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Copies from an image to device or shared memory. /// /// @details /// - The application must ensure the memory pointed to by dstptr is /// accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by dstptr as /// it is free to be modified by either the Host or device up until /// execution. /// - The application must ensure the image and events are accessible by the /// device on which the command list was created. /// - The application must ensure the image format descriptor for the source /// image is a single-planar format. /// - The application must ensure the command list, image and events were /// created, and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clEnqueueReadImage /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hSrcImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemory( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendImageCopyToMemory = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendImageCopyToMemory; if( nullptr == pfnAppendImageCopyToMemory ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendImageCopyToMemory( hCommandList, dstptr, hSrcImage, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Copies to an image from device or shared memory. /// /// @details /// - The application must ensure the memory pointed to by srcptr is /// accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by srcptr as /// it is free to be modified by either the Host or device up until /// execution. /// - The application must ensure the image and events are accessible by the /// device on which the command list was created. /// - The application must ensure the image format descriptor for the /// destination image is a single-planar format. /// - The application must ensure the command list, image and events were /// created, and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clEnqueueWriteImage /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hDstImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == srcptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendImageCopyFromMemory( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendImageCopyFromMemory = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendImageCopyFromMemory; if( nullptr == pfnAppendImageCopyFromMemory ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendImageCopyFromMemory( hCommandList, hDstImage, srcptr, pDstRegion, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Asynchronously prefetches shared memory to the device associated with /// the specified command list /// /// @details /// - This is a hint to improve performance only and is not required for /// correctness. /// - Only prefetching to the device associated with the specified command /// list is supported. /// Prefetching to the host or to a peer device is not supported. /// - Prefetching may not be supported for all allocation types for all devices. /// If memory prefetching is not supported for the specified memory range /// the prefetch hint may be ignored. /// - Prefetching may only be supported at a device-specific granularity, /// such as at a page boundary. /// In this case, the memory range may be expanded such that the start and /// end of the range satisfy granularity requirements. /// - The application must ensure the memory pointed to by ptr is accessible /// by the device on which the command list was created. /// - The application must ensure the command list was created, and the /// memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clEnqueueSVMMigrateMem /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` ze_result_t ZE_APICALL zeCommandListAppendMemoryPrefetch( ze_command_list_handle_t hCommandList, ///< [in] handle of command list const void* ptr, ///< [in] pointer to start of the memory range to prefetch size_t size ///< [in] size in bytes of the memory range to prefetch ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendMemoryPrefetch = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendMemoryPrefetch; if( nullptr == pfnAppendMemoryPrefetch ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendMemoryPrefetch( hCommandList, ptr, size ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Provides advice about the use of a shared memory range /// /// @details /// - Memory advice is a performance hint only and is not required for /// functional correctness. /// - Memory advice can be used to override driver heuristics to explicitly /// control shared memory behavior. /// - Not all memory advice hints may be supported for all allocation types /// for all devices. /// If a memory advice hint is not supported by the device it will be ignored. /// - Memory advice may only be supported at a device-specific granularity, /// such as at a page boundary. /// In this case, the memory range may be expanded such that the start and /// end of the range satisfy granularity requirements. /// - The application must ensure the memory pointed to by ptr is accessible /// by the device on which the command list was created. /// - The application must ensure the command list was created, and memory /// was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle, and the memory was /// allocated. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_MEMORY_ADVICE_CLEAR_SYSTEM_MEMORY_PREFERRED_LOCATION < advice` ze_result_t ZE_APICALL zeCommandListAppendMemAdvise( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_advice_t advice ///< [in] Memory advice for the memory range ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendMemAdvise = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendMemAdvise; if( nullptr == pfnAppendMemAdvise ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendMemAdvise( hCommandList, hDevice, ptr, size, advice ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a pool of events on the context. /// /// @details /// - The application must only use events within the pool for the /// device(s), or their sub-devices, which were provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phEventPool` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xf < desc->flags` /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `0 == desc->count` /// + `(nullptr == phDevices) && (0 < numDevices)` ze_result_t ZE_APICALL zeEventPoolCreate( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_event_pool_desc_t* desc, ///< [in] pointer to event pool descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< have visibility to the event pool. ///< if nullptr, then event pool is visible to all devices supported by the ///< driver instance. ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zeDdiTable.load()->EventPool.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hContext, desc, numDevices, phDevices, phEventPool ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Deletes an event pool object. /// /// @details /// - The application must destroy all event handles created from the pool /// before destroying the pool itself. /// - The application must ensure the device is not currently referencing /// the any event within the pool before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this event pool. /// - The application must **not** call this function from simultaneous /// threads with the same event pool handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEventPool` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeEventPoolDestroy( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zeDdiTable.load()->EventPool.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hEventPool ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates an event from the pool. /// /// @details /// - An event is used to communicate fine-grain host-to-device, /// device-to-host or device-to-device dependencies have completed. /// - The application must ensure the location in the pool is not being used /// by another event. /// - The application must **not** call this function from simultaneous /// threads with the same event pool handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clCreateUserEvent** /// - vkCreateEvent /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEventPool` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phEvent` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < desc->signal` /// + `0x7 < desc->wait` ze_result_t ZE_APICALL zeEventCreate( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool const ze_event_desc_t* desc, ///< [in] pointer to event descriptor ze_event_handle_t* phEvent ///< [out] pointer to handle of event object created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zeDdiTable.load()->Event.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hEventPool, desc, phEvent ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Deletes an event object. /// /// @details /// - The application must ensure the device is not currently referencing /// the event before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this event. /// - The application must **not** call this function from simultaneous /// threads with the same event handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clReleaseEvent** /// - vkDestroyEvent /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeEventDestroy( ze_event_handle_t hEvent ///< [in][release] handle of event object to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zeDdiTable.load()->Event.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hEvent ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets an IPC event pool handle for the specified event handle that can /// be shared with another process. /// /// @details /// - Event pool must have been created with ::ZE_EVENT_POOL_FLAG_IPC. /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEventPool` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phIpc` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ze_result_t ZE_APICALL zeEventPoolGetIpcHandle( ze_event_pool_handle_t hEventPool, ///< [in] handle of event pool object ze_ipc_event_pool_handle_t* phIpc ///< [out] Returned IPC event handle ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetIpcHandle = ze_lib::context->zeDdiTable.load()->EventPool.pfnGetIpcHandle; if( nullptr == pfnGetIpcHandle ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetIpcHandle( hEventPool, phIpc ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Returns an IPC event pool handle to the driver /// /// @details /// - This call must be used for IPC handles previously obtained with /// ::zeEventPoolGetIpcHandle. /// - Upon call, driver may release any underlying resources associated with /// the IPC handle. /// For instance, it may close the file descriptor contained in the IPC /// handle, if such type of handle is being used by the driver. /// - This call does not destroy the original event pool for which the IPC /// handle was created. /// - This function may **not** be called from simultaneous threads with the /// same IPC handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` ze_result_t ZE_APICALL zeEventPoolPutIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object associated with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc ///< [in] IPC event pool handle ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnPutIpcHandle = ze_lib::context->zeDdiTable.load()->EventPool.pfnPutIpcHandle; if( nullptr == pfnPutIpcHandle ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnPutIpcHandle( hContext, hIpc ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Opens an IPC event pool handle to retrieve an event pool handle from /// another process. /// /// @details /// - Multiple calls to this function with the same IPC handle will return /// unique event pool handles. /// - The event handle in this process should not be freed with /// ::zeEventPoolDestroy, but rather with ::zeEventPoolCloseIpcHandle. /// - If the original event pool has been created for a device containing a /// number of sub-devices, then the event pool /// returned by this call may be used on a device containing the same /// number of sub-devices, or on any of /// those sub-devices. /// - However, if the original event pool has been created for a sub-device, /// then the event pool returned by this call /// cannot be used on a device containing any number of sub-devices, and /// must be used only in a sub-device. This ensures /// functional correctness for any implementation or optimizations the /// underlying Level Zero driver may do on /// event pools and events. /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phEventPool` ze_result_t ZE_APICALL zeEventPoolOpenIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object to associate with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc, ///< [in] IPC event pool handle ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOpenIpcHandle = ze_lib::context->zeDdiTable.load()->EventPool.pfnOpenIpcHandle; if( nullptr == pfnOpenIpcHandle ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOpenIpcHandle( hContext, hIpc, phEventPool ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Closes an IPC event handle in the current process. /// /// @details /// - Closes an IPC event handle by destroying events that were opened in /// this process using ::zeEventPoolOpenIpcHandle. /// - The application must **not** call this function from simultaneous /// threads with the same event pool handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEventPool` ze_result_t ZE_APICALL zeEventPoolCloseIpcHandle( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCloseIpcHandle = ze_lib::context->zeDdiTable.load()->EventPool.pfnCloseIpcHandle; if( nullptr == pfnCloseIpcHandle ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCloseIpcHandle( hEventPool ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Appends a signal of the event from the device into a command list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The duration of an event created from an event pool that was created /// using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP or /// ::ZE_EVENT_POOL_FLAG_KERNEL_MAPPED_TIMESTAMP flags is undefined. /// However, for consistency and orthogonality the event will report /// correctly as signaled when used by other event API functionality. /// - The application must ensure the command list and events were created /// on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clSetUserEventStatus** /// - vkCmdSetEvent /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ze_result_t ZE_APICALL zeCommandListAppendSignalEvent( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendSignalEvent = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendSignalEvent; if( nullptr == pfnAppendSignalEvent ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendSignalEvent( hCommandList, hEvent ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Appends wait on event(s) on the device into a command list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the command list and events were created /// on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phEvents` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ze_result_t ZE_APICALL zeCommandListAppendWaitOnEvents( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] number of events to wait on before continuing ze_event_handle_t* phEvents ///< [in][range(0, numEvents)] handles of the events to wait on before ///< continuing ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendWaitOnEvents = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendWaitOnEvents; if( nullptr == pfnAppendWaitOnEvents ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendWaitOnEvents( hCommandList, numEvents, phEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Signals a event from host. /// /// @details /// - The duration of an event created from an event pool that was created /// using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP or /// ::ZE_EVENT_POOL_FLAG_KERNEL_MAPPED_TIMESTAMP flags is undefined. /// However, for consistency and orthogonality the event will report /// correctly as signaled when used by other event API functionality. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clSetUserEventStatus /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ze_result_t ZE_APICALL zeEventHostSignal( ze_event_handle_t hEvent ///< [in] handle of the event ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnHostSignal = ze_lib::context->zeDdiTable.load()->Event.pfnHostSignal; if( nullptr == pfnHostSignal ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnHostSignal( hEvent ); } /////////////////////////////////////////////////////////////////////////////// /// @brief The current host thread waits on an event to be signaled. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clWaitForEvents /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_NOT_READY /// + timeout expired ze_result_t ZE_APICALL zeEventHostSynchronize( ze_event_handle_t hEvent, ///< [in] handle of the event uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeEventQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnHostSynchronize = ze_lib::context->zeDdiTable.load()->Event.pfnHostSynchronize; if( nullptr == pfnHostSynchronize ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnHostSynchronize( hEvent, timeout ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Queries an event object's status on the host. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **clGetEventInfo** /// - vkGetEventStatus /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_NOT_READY /// + not signaled ze_result_t ZE_APICALL zeEventQueryStatus( ze_event_handle_t hEvent ///< [in] handle of the event ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnQueryStatus = ze_lib::context->zeDdiTable.load()->Event.pfnQueryStatus; if( nullptr == pfnQueryStatus ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnQueryStatus( hEvent ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Appends a reset of an event back to not signaled state into a command /// list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the command list and events were created /// on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - vkResetEvent /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ze_result_t ZE_APICALL zeCommandListAppendEventReset( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendEventReset = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendEventReset; if( nullptr == pfnAppendEventReset ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendEventReset( hCommandList, hEvent ); } /////////////////////////////////////////////////////////////////////////////// /// @brief The current host thread resets an event back to not signaled state. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - vkResetEvent /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ze_result_t ZE_APICALL zeEventHostReset( ze_event_handle_t hEvent ///< [in] handle of the event ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnHostReset = ze_lib::context->zeDdiTable.load()->Event.pfnHostReset; if( nullptr == pfnHostReset ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnHostReset( hEvent ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Queries an event's timestamp value on the host. /// /// @details /// - The application must ensure the event was created from an event pool /// that was created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP or /// ::ZE_EVENT_POOL_FLAG_KERNEL_MAPPED_TIMESTAMP flag. /// - The destination memory will be unmodified if the event has not been /// signaled. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_NOT_READY /// + not signaled ze_result_t ZE_APICALL zeEventQueryKernelTimestamp( ze_event_handle_t hEvent, ///< [in] handle of the event ze_kernel_timestamp_result_t* dstptr ///< [in,out] pointer to memory for where timestamp result will be written. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnQueryKernelTimestamp = ze_lib::context->zeDdiTable.load()->Event.pfnQueryKernelTimestamp; if( nullptr == pfnQueryKernelTimestamp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnQueryKernelTimestamp( hEvent, dstptr ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Appends a query of an events' timestamp value(s) into a command list. /// /// @details /// - The application must ensure the events are accessible by the device on /// which the command list was created. /// - The application must ensure the events were created from an event pool /// that was created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag. /// - The application must ensure the memory pointed to by both dstptr and /// pOffsets is accessible by the device on which the command list was /// created. /// - The value(s) written to the destination buffer are undefined if any /// timestamp event has not been signaled. /// - If pOffsets is nullptr, then multiple results will be appended /// sequentially into memory in the same order as phEvents. /// - The application must ensure the command list and events were created, /// and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phEvents` /// + `nullptr == dstptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendQueryKernelTimestamps( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] the number of timestamp events to query ze_event_handle_t* phEvents, ///< [in][range(0, numEvents)] handles of timestamp events to query void* dstptr, ///< [in,out] pointer to memory where ::ze_kernel_timestamp_result_t will ///< be written; must be size-aligned. const size_t* pOffsets, ///< [in][optional][range(0, numEvents)] offset, in bytes, to write ///< results; address must be 4byte-aligned and offsets must be ///< size-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendQueryKernelTimestamps = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendQueryKernelTimestamps; if( nullptr == pfnAppendQueryKernelTimestamps ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendQueryKernelTimestamps( hCommandList, numEvents, phEvents, dstptr, pOffsets, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the handle of the event pool for the event. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phEventPool` ze_result_t ZE_APICALL zeEventGetEventPool( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_pool_handle_t* phEventPool ///< [out] handle of the event pool for the event ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetEventPool = ze_lib::context->zeDdiTable.load()->Event.pfnGetEventPool; if( nullptr == pfnGetEventPool ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetEventPool( hEvent, phEventPool ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the signal event scope. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSignalScope` ze_result_t ZE_APICALL zeEventGetSignalScope( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pSignalScope ///< [out] signal event scope. This is the scope of relevant cache ///< hierarchies that are flushed on a signal action before the event is ///< triggered. May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetSignalScope = ze_lib::context->zeDdiTable.load()->Event.pfnGetSignalScope; if( nullptr == pfnGetSignalScope ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetSignalScope( hEvent, pSignalScope ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the wait event scope. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pWaitScope` ze_result_t ZE_APICALL zeEventGetWaitScope( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pWaitScope ///< [out] wait event scope. This is the scope of relevant cache ///< hierarchies invalidated on a wait action after the event is complete. ///< May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetWaitScope = ze_lib::context->zeDdiTable.load()->Event.pfnGetWaitScope; if( nullptr == pfnGetWaitScope ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetWaitScope( hEvent, pWaitScope ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the handle of the context on which the event pool was created. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEventPool` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phContext` ze_result_t ZE_APICALL zeEventPoolGetContextHandle( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_context_handle_t* phContext ///< [out] handle of the context on which the event pool was created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetContextHandle = ze_lib::context->zeDdiTable.load()->EventPool.pfnGetContextHandle; if( nullptr == pfnGetContextHandle ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetContextHandle( hEventPool, phContext ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the creation flags used to create the event pool. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEventPool` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pFlags` ze_result_t ZE_APICALL zeEventPoolGetFlags( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_event_pool_flags_t* pFlags ///< [out] creation flags used to create the event pool; may be 0 or a ///< valid combination of ::ze_event_pool_flag_t ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetFlags = ze_lib::context->zeDdiTable.load()->EventPool.pfnGetFlags; if( nullptr == pfnGetFlags ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetFlags( hEventPool, pFlags ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a fence for the command queue. /// /// @details /// - A fence is a heavyweight synchronization primitive used to communicate /// to the host that command list execution has completed. /// - The application must only use the fence for the command queue which /// was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @remarks /// _Analogues_ /// - **vkCreateFence** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandQueue` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phFence` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x1 < desc->flags` ze_result_t ZE_APICALL zeFenceCreate( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of command queue const ze_fence_desc_t* desc, ///< [in] pointer to fence descriptor ze_fence_handle_t* phFence ///< [out] pointer to handle of fence object created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zeDdiTable.load()->Fence.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hCommandQueue, desc, phFence ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Deletes a fence object. /// /// @details /// - The application must ensure the device is not currently referencing /// the fence before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this fence. /// - The application must **not** call this function from simultaneous /// threads with the same fence handle. /// - The implementation of this function must be thread-safe. /// /// @remarks /// _Analogues_ /// - **vkDestroyFence** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFence` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeFenceDestroy( ze_fence_handle_t hFence ///< [in][release] handle of fence object to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zeDdiTable.load()->Fence.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hFence ); } /////////////////////////////////////////////////////////////////////////////// /// @brief The current host thread waits on a fence to be signaled. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **vkWaitForFences** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFence` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_NOT_READY /// + timeout expired ze_result_t ZE_APICALL zeFenceHostSynchronize( ze_fence_handle_t hFence, ///< [in] handle of the fence uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeFenceQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnHostSynchronize = ze_lib::context->zeDdiTable.load()->Fence.pfnHostSynchronize; if( nullptr == pfnHostSynchronize ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnHostSynchronize( hFence, timeout ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Queries a fence object's status. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **vkGetFenceStatus** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFence` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_NOT_READY /// + not signaled ze_result_t ZE_APICALL zeFenceQueryStatus( ze_fence_handle_t hFence ///< [in] handle of the fence ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnQueryStatus = ze_lib::context->zeDdiTable.load()->Fence.pfnQueryStatus; if( nullptr == pfnQueryStatus ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnQueryStatus( hFence ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Reset a fence back to the not signaled state. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - **vkResetFences** /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFence` ze_result_t ZE_APICALL zeFenceReset( ze_fence_handle_t hFence ///< [in] handle of the fence ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReset = ze_lib::context->zeDdiTable.load()->Fence.pfnReset; if( nullptr == pfnReset ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReset( hFence ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves supported properties of an image. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == pImageProperties` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// + `::ZE_IMAGE_TYPE_BUFFER < desc->type` ze_result_t ZE_APICALL zeImageGetProperties( ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_properties_t* pImageProperties ///< [out] pointer to image properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zeDdiTable.load()->Image.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hDevice, desc, pImageProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates an image on the context. /// /// @details /// - The application must only use the image for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @remarks /// _Analogues_ /// - clCreateImage /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phImage` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// + `::ZE_IMAGE_TYPE_BUFFER < desc->type` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT ze_result_t ZE_APICALL zeImageCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t* phImage ///< [out] pointer to handle of image object created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zeDdiTable.load()->Image.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hContext, hDevice, desc, phImage ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Deletes an image object. /// /// @details /// - The application must ensure the device is not currently referencing /// the image before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this image. /// - The application must **not** call this function from simultaneous /// threads with the same image handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hImage` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeImageDestroy( ze_image_handle_t hImage ///< [in][release] handle of image object to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zeDdiTable.load()->Image.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hImage ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Allocates shared memory on the context. /// /// @details /// - Shared allocations share ownership between the host and one or more /// devices. /// - Shared allocations may optionally be associated with a device by /// passing a handle to the device. /// - Devices supporting only single-device shared access capabilities may /// access shared memory associated with the device. /// For these devices, ownership of the allocation is shared between the /// host and the associated device only. /// - Passing nullptr as the device handle does not associate the shared /// allocation with any device. /// For allocations with no associated device, ownership of the allocation /// is shared between the host and all devices supporting cross-device /// shared access capabilities. /// - The application must only use the memory allocation for the context /// and device, or its sub-devices, which was provided during allocation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == device_desc` /// + `nullptr == host_desc` /// + `nullptr == pptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < device_desc->flags` /// + `0xf < host_desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT /// + Must be zero or a power-of-two /// + `0 != (alignment & (alignment - 1))` ze_result_t ZE_APICALL zeMemAllocShared( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in][optional] device handle to associate with void** pptr ///< [out] pointer to shared allocation ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAllocShared = ze_lib::context->zeDdiTable.load()->Mem.pfnAllocShared; if( nullptr == pfnAllocShared ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAllocShared( hContext, device_desc, host_desc, size, alignment, hDevice, pptr ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Allocates device memory on the context. /// /// @details /// - Device allocations are owned by a specific device. /// - In general, a device allocation may only be accessed by the device /// that owns it. /// - The application must only use the memory allocation for the context /// and device, or its sub-devices, which was provided during allocation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == device_desc` /// + `nullptr == pptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < device_desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT /// + Must be zero or a power-of-two /// + `0 != (alignment & (alignment - 1))` ze_result_t ZE_APICALL zeMemAllocDevice( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in] handle of the device void** pptr ///< [out] pointer to device allocation ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAllocDevice = ze_lib::context->zeDdiTable.load()->Mem.pfnAllocDevice; if( nullptr == pfnAllocDevice ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAllocDevice( hContext, device_desc, size, alignment, hDevice, pptr ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Allocates host memory on the context. /// /// @details /// - Host allocations are owned by the host process. /// - Host allocations are accessible by the host and all devices within the /// driver's context. /// - Host allocations are frequently used as staging areas to transfer data /// to or from devices. /// - The application must only use the memory allocation for the context /// which was provided during allocation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == host_desc` /// + `nullptr == pptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xf < host_desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT /// + Must be zero or a power-of-two /// + `0 != (alignment & (alignment - 1))` ze_result_t ZE_APICALL zeMemAllocHost( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two void** pptr ///< [out] pointer to host allocation ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAllocHost = ze_lib::context->zeDdiTable.load()->Mem.pfnAllocHost; if( nullptr == pfnAllocHost ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAllocHost( hContext, host_desc, size, alignment, pptr ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Frees allocated host memory, device memory, or shared memory on the /// context. /// /// @details /// - The application must ensure the device is not currently referencing /// the memory before it is freed /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this memory /// - The application must **not** call this function from simultaneous /// threads with the same pointer. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` ze_result_t ZE_APICALL zeMemFree( ze_context_handle_t hContext, ///< [in] handle of the context object void* ptr ///< [in][release] pointer to memory to free ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnFree = ze_lib::context->zeDdiTable.load()->Mem.pfnFree; if( nullptr == pfnFree ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnFree( hContext, ptr ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves attributes of a memory allocation /// /// @details /// - The application may call this function from simultaneous threads. /// - The application may query attributes of a memory allocation unrelated /// to the context. /// When this occurs, the returned allocation type will be /// ::ZE_MEMORY_TYPE_UNKNOWN, and the returned identifier and associated /// device is unspecified. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// + `nullptr == pMemAllocProperties` ze_result_t ZE_APICALL zeMemGetAllocProperties( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query ze_memory_allocation_properties_t* pMemAllocProperties, ///< [in,out] query result for memory allocation properties ze_device_handle_t* phDevice ///< [out][optional] device associated with this allocation ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetAllocProperties = ze_lib::context->zeDdiTable.load()->Mem.pfnGetAllocProperties; if( nullptr == pfnGetAllocProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetAllocProperties( hContext, ptr, pMemAllocProperties, phDevice ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves the base address and/or size of an allocation /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` ze_result_t ZE_APICALL zeMemGetAddressRange( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query void** pBase, ///< [in,out][optional] base address of the allocation size_t* pSize ///< [in,out][optional] size of the allocation ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetAddressRange = ze_lib::context->zeDdiTable.load()->Mem.pfnGetAddressRange; if( nullptr == pfnGetAddressRange ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetAddressRange( hContext, ptr, pBase, pSize ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates an IPC memory handle for the specified allocation /// /// @details /// - Takes a pointer to a device memory allocation and creates an IPC /// memory handle for exporting it for use in another process. /// - The pointer must be base pointer of a device or host memory /// allocation; i.e. the value returned from ::zeMemAllocDevice or from /// ::zeMemAllocHost, respectively. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// + `nullptr == pIpcHandle` ze_result_t ZE_APICALL zeMemGetIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to the device memory allocation ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetIpcHandle = ze_lib::context->zeDdiTable.load()->Mem.pfnGetIpcHandle; if( nullptr == pfnGetIpcHandle ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetIpcHandle( hContext, ptr, pIpcHandle ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates an IPC memory handle out of a file descriptor /// /// @details /// - Handle passed must be a valid file descriptor obtained with /// ::ze_external_memory_export_fd_t via ::zeMemGetAllocProperties. /// - Returned IPC handle may contain metadata in addition to the file /// descriptor. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pIpcHandle` ze_result_t ZE_APICALL zeMemGetIpcHandleFromFileDescriptorExp( ze_context_handle_t hContext, ///< [in] handle of the context object uint64_t handle, ///< [in] file descriptor ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetIpcHandleFromFileDescriptorExp = ze_lib::context->zeDdiTable.load()->MemExp.pfnGetIpcHandleFromFileDescriptorExp; if( nullptr == pfnGetIpcHandleFromFileDescriptorExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetIpcHandleFromFileDescriptorExp( hContext, handle, pIpcHandle ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Gets the file descriptor contained in an IPC memory handle /// /// @details /// - IPC memory handle must be a valid handle obtained with /// ::zeMemGetIpcHandle. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pHandle` ze_result_t ZE_APICALL zeMemGetFileDescriptorFromIpcHandleExp( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t ipcHandle, ///< [in] IPC memory handle uint64_t* pHandle ///< [out] Returned file descriptor ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetFileDescriptorFromIpcHandleExp = ze_lib::context->zeDdiTable.load()->MemExp.pfnGetFileDescriptorFromIpcHandleExp; if( nullptr == pfnGetFileDescriptorFromIpcHandleExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetFileDescriptorFromIpcHandleExp( hContext, ipcHandle, pHandle ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Returns an IPC memory handle to the driver /// /// @details /// - This call may be used for IPC handles previously obtained with either /// ::zeMemGetIpcHandle or with ::ze_external_memory_export_fd_t via ::zeMemGetAllocProperties. /// - Upon call, driver may release any underlying resources associated with /// the IPC handle. /// For instance, it may close the file descriptor contained in the IPC /// handle, if such type of handle is being used by the driver. /// - This call does not free the original allocation for which the IPC /// handle was created. /// - This function may **not** be called from simultaneous threads with the /// same IPC handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` ze_result_t ZE_APICALL zeMemPutIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t handle ///< [in] IPC memory handle ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnPutIpcHandle = ze_lib::context->zeDdiTable.load()->Mem.pfnPutIpcHandle; if( nullptr == pfnPutIpcHandle ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnPutIpcHandle( hContext, handle ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Opens an IPC memory handle to retrieve a device pointer on the /// context. /// /// @details /// - Takes an IPC memory handle from a remote process and associates it /// with a device pointer usable in this process. /// - The device pointer in this process should not be freed with /// ::zeMemFree, but rather with ::zeMemCloseIpcHandle. /// - Multiple calls to this function with the same IPC handle will return /// unique pointers. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < flags` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pptr` ze_result_t ZE_APICALL zeMemOpenIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device to associate with the IPC memory handle ze_ipc_mem_handle_t handle, ///< [in] IPC memory handle ze_ipc_memory_flags_t flags, ///< [in] flags controlling the operation. ///< must be 0 (default) or a valid combination of ::ze_ipc_memory_flag_t. void** pptr ///< [out] pointer to device allocation in this process ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOpenIpcHandle = ze_lib::context->zeDdiTable.load()->Mem.pfnOpenIpcHandle; if( nullptr == pfnOpenIpcHandle ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOpenIpcHandle( hContext, hDevice, handle, flags, pptr ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Closes an IPC memory handle /// /// @details /// - Closes an IPC memory handle by unmapping memory that was opened in /// this process using ::zeMemOpenIpcHandle. /// - The application must **not** call this function from simultaneous /// threads with the same pointer. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` ze_result_t ZE_APICALL zeMemCloseIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr ///< [in][release] pointer to device allocation in this process ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCloseIpcHandle = ze_lib::context->zeDdiTable.load()->Mem.pfnCloseIpcHandle; if( nullptr == pfnCloseIpcHandle ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCloseIpcHandle( hContext, ptr ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Sets atomic access attributes for a shared allocation /// /// @details /// - If the shared-allocation is owned by multiple devices (i.e. nullptr /// was passed to ::zeMemAllocShared when creating it), then hDevice may be /// passed to set the attributes in that specific device. If nullptr is /// passed in hDevice, then the atomic attributes are set in all devices /// associated with the allocation. /// - If the atomic access attribute select is not supported by the driver, /// ::ZE_RESULT_INVALID_ARGUMENT is returned. /// - The atomic access attribute may be only supported at a device-specific /// granularity, such as at a page boundary. In this case, the memory range /// may be expanded such that the start and end of the range satisfy granularity /// requirements. /// - When calling this function multiple times with different flags, only the /// attributes from last call are honored. /// - The application must not call this function for shared-allocations currently /// being used by the device. /// - The application must **not** call this function from simultaneous threads /// with the same pointer. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7f < attr` ze_result_t ZE_APICALL zeMemSetAtomicAccessAttributeExp( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t attr ///< [in] Atomic access attributes to set for the specified range. ///< Must be 0 (default) or a valid combination of ::ze_memory_atomic_attr_exp_flag_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetAtomicAccessAttributeExp = ze_lib::context->zeDdiTable.load()->MemExp.pfnSetAtomicAccessAttributeExp; if( nullptr == pfnSetAtomicAccessAttributeExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetAtomicAccessAttributeExp( hContext, hDevice, ptr, size, attr ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves the atomic access attributes previously set for a shared /// allocation /// /// @details /// - The application may call this function from simultaneous threads /// with the same pointer. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// + `nullptr == pAttr` ze_result_t ZE_APICALL zeMemGetAtomicAccessAttributeExp( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t* pAttr ///< [out] Atomic access attributes for the specified range ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetAtomicAccessAttributeExp = ze_lib::context->zeDdiTable.load()->MemExp.pfnGetAtomicAccessAttributeExp; if( nullptr == pfnGetAtomicAccessAttributeExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetAtomicAccessAttributeExp( hContext, hDevice, ptr, size, pAttr ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a module on the context. /// /// @details /// - Compiles the module for execution on the device. /// - The application must only use the module for the device, or its /// sub-devices, which was provided during creation. /// - The module can be copied to other devices and contexts within the same /// driver instance by using ::zeModuleGetNativeBinary. /// - A build log can optionally be returned to the caller. The caller is /// responsible for destroying build log using ::zeModuleBuildLogDestroy. /// - The module descriptor constants are only supported for SPIR-V /// specialization constants. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == desc->pInputModule` /// + `nullptr == phModule` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_MODULE_FORMAT_NATIVE < desc->format` /// - ::ZE_RESULT_ERROR_INVALID_NATIVE_BINARY /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `0 == desc->inputSize` /// - ::ZE_RESULT_ERROR_MODULE_BUILD_FAILURE ze_result_t ZE_APICALL zeModuleCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_module_desc_t* desc, ///< [in] pointer to module descriptor ze_module_handle_t* phModule, ///< [out] pointer to handle of module object created ze_module_build_log_handle_t* phBuildLog ///< [out][optional] pointer to handle of module's build log. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zeDdiTable.load()->Module.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hContext, hDevice, desc, phModule, phBuildLog ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys module /// /// @details /// - The application must destroy all kernel handles created from the /// module before destroying the module itself. /// - The application must ensure the device is not currently referencing /// the module before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this module. /// - The application must **not** call this function from simultaneous /// threads with the same module handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeModuleDestroy( ze_module_handle_t hModule ///< [in][release] handle of the module ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zeDdiTable.load()->Module.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hModule ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Dynamically link modules together that share import/export linkage /// dependencies. /// /// @details /// - Modules support SPIR-V import and export linkage types for functions /// and global variables. See the SPIR-V specification for linkage /// details. /// - Modules can have both import and export linkage. /// - Modules that do not have any imports or exports do not need to be /// linked. /// - All module import requirements must be satisfied via linking before /// kernel objects can be created from them. /// - Modules cannot be partially linked. Unsatisfiable import dependencies /// in the set of modules passed to ::zeModuleDynamicLink will result in /// ::ZE_RESULT_ERROR_MODULE_LINK_FAILURE being returned. /// - Modules will only be linked once. A module can be used in multiple /// link calls if it has exports but its imports will not be re-linked. /// - Ambiguous dependencies, where multiple modules satisfy the same import /// dependencies for a module, are not allowed. /// - The application must ensure the modules being linked were created on /// the same context. /// - The application may call this function from simultaneous threads as /// long as the import modules being linked are not the same. /// - ModuleGetNativeBinary can be called on any module regardless of /// whether it is linked or not. /// - A link log can optionally be returned to the caller. The caller is /// responsible for destroying the link log using /// ::zeModuleBuildLogDestroy. /// - The link log may contain a list of the unresolved import dependencies /// if present. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phModules` /// - ::ZE_RESULT_ERROR_MODULE_LINK_FAILURE ze_result_t ZE_APICALL zeModuleDynamicLink( uint32_t numModules, ///< [in] number of modules to be linked pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to ///< dynamically link together. ze_module_build_log_handle_t* phLinkLog ///< [out][optional] pointer to handle of dynamic link log. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDynamicLink = ze_lib::context->zeDdiTable.load()->Module.pfnDynamicLink; if( nullptr == pfnDynamicLink ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDynamicLink( numModules, phModules, phLinkLog ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys module build log object /// /// @details /// - The implementation of this function may immediately free all Host /// allocations associated with this object. /// - The application must **not** call this function from simultaneous /// threads with the same build log handle. /// - The implementation of this function should be lock-free. /// - This function can be called before or after ::zeModuleDestroy for the /// associated module. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModuleBuildLog` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeModuleBuildLogDestroy( ze_module_build_log_handle_t hModuleBuildLog ///< [in][release] handle of the module build log object. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zeDdiTable.load()->ModuleBuildLog.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hModuleBuildLog ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves text string for build log. /// /// @details /// - The caller can pass nullptr for pBuildLog when querying only for size. /// - The caller must provide memory for build log. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModuleBuildLog` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` ze_result_t ZE_APICALL zeModuleBuildLogGetString( ze_module_build_log_handle_t hModuleBuildLog, ///< [in] handle of the module build log object. size_t* pSize, ///< [in,out] size of build log string. char* pBuildLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetString = ze_lib::context->zeDdiTable.load()->ModuleBuildLog.pfnGetString; if( nullptr == pfnGetString ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetString( hModuleBuildLog, pSize, pBuildLog ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve native binary from Module. /// /// @details /// - The native binary output can be cached to disk and new modules can be /// later constructed from the cached copy. /// - The native binary will retain debugging information that is associated /// with a module. /// - The caller can pass nullptr for pModuleNativeBinary when querying only /// for size. /// - The implementation will copy the native binary into a buffer supplied /// by the caller. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` ze_result_t ZE_APICALL zeModuleGetNativeBinary( ze_module_handle_t hModule, ///< [in] handle of the module size_t* pSize, ///< [in,out] size of native binary in bytes. uint8_t* pModuleNativeBinary ///< [in,out][optional] byte pointer to native binary ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetNativeBinary = ze_lib::context->zeDdiTable.load()->Module.pfnGetNativeBinary; if( nullptr == pfnGetNativeBinary ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetNativeBinary( hModule, pSize, pModuleNativeBinary ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve global variable pointer from Module. /// /// @details /// - The application may query global pointer from any module that either /// exports or imports it. /// - The application must dynamically link a module that imports a global /// before the global pointer can be queried from it. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pGlobalName` /// - ::ZE_RESULT_ERROR_INVALID_GLOBAL_NAME ze_result_t ZE_APICALL zeModuleGetGlobalPointer( ze_module_handle_t hModule, ///< [in] handle of the module const char* pGlobalName, ///< [in] name of global variable in module size_t* pSize, ///< [in,out][optional] size of global variable void** pptr ///< [in,out][optional] device visible pointer ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetGlobalPointer = ze_lib::context->zeDdiTable.load()->Module.pfnGetGlobalPointer; if( nullptr == pfnGetGlobalPointer ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetGlobalPointer( hModule, pGlobalName, pSize, pptr ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve all kernel names in the module. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeModuleGetKernelNames( ze_module_handle_t hModule, ///< [in] handle of the module uint32_t* pCount, ///< [in,out] pointer to the number of names. ///< if count is zero, then the driver shall update the value with the ///< total number of names available. ///< if count is greater than the number of names available, then the ///< driver shall update the value with the correct number of names available. const char** pNames ///< [in,out][optional][range(0, *pCount)] array of names of functions. ///< if count is less than the number of names available, then driver shall ///< only retrieve that number of names. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetKernelNames = ze_lib::context->zeDdiTable.load()->Module.pfnGetKernelNames; if( nullptr == pfnGetKernelNames ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetKernelNames( hModule, pCount, pNames ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve module properties. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pModuleProperties` ze_result_t ZE_APICALL zeModuleGetProperties( ze_module_handle_t hModule, ///< [in] handle of the module ze_module_properties_t* pModuleProperties ///< [in,out] query result for module properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zeDdiTable.load()->Module.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hModule, pModuleProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Create a kernel from the module. /// /// @details /// - Modules that have unresolved imports need to be dynamically linked /// before a kernel can be created from them. (See ::zeModuleDynamicLink) /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == desc->pKernelName` /// + `nullptr == phKernel` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// - ::ZE_RESULT_ERROR_INVALID_KERNEL_NAME /// - ::ZE_RESULT_ERROR_INVALID_MODULE_UNLINKED ze_result_t ZE_APICALL zeKernelCreate( ze_module_handle_t hModule, ///< [in] handle of the module const ze_kernel_desc_t* desc, ///< [in] pointer to kernel descriptor ze_kernel_handle_t* phKernel ///< [out] handle of the Function object ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zeDdiTable.load()->Kernel.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hModule, desc, phKernel ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a kernel object /// /// @details /// - The application must ensure the device is not currently referencing /// the kernel before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this kernel. /// - The application must **not** call this function from simultaneous /// threads with the same kernel handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeKernelDestroy( ze_kernel_handle_t hKernel ///< [in][release] handle of the kernel object ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zeDdiTable.load()->Kernel.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hKernel ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve a function pointer from a module by name /// /// @details /// - The function pointer is unique for the device on which the module was /// created. /// - The function pointer is no longer valid if module is destroyed. /// - The function name should only refer to callable functions within the /// module. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pFunctionName` /// + `nullptr == pfnFunction` /// - ::ZE_RESULT_ERROR_INVALID_FUNCTION_NAME ze_result_t ZE_APICALL zeModuleGetFunctionPointer( ze_module_handle_t hModule, ///< [in] handle of the module const char* pFunctionName, ///< [in] Name of function to retrieve function pointer for. void** pfnFunction ///< [out] pointer to function. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetFunctionPointer = ze_lib::context->zeDdiTable.load()->Module.pfnGetFunctionPointer; if( nullptr == pfnGetFunctionPointer ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetFunctionPointer( hModule, pFunctionName, pfnFunction ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set group size for a kernel. /// /// @details /// - The group size will be used when a ::zeCommandListAppendLaunchKernel /// variant is called. /// - The application must **not** call this function from simultaneous /// threads with the same kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION ze_result_t ZE_APICALL zeKernelSetGroupSize( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t groupSizeX, ///< [in] group size for X dimension to use for this kernel uint32_t groupSizeY, ///< [in] group size for Y dimension to use for this kernel uint32_t groupSizeZ ///< [in] group size for Z dimension to use for this kernel ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetGroupSize = ze_lib::context->zeDdiTable.load()->Kernel.pfnSetGroupSize; if( nullptr == pfnSetGroupSize ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetGroupSize( hKernel, groupSizeX, groupSizeY, groupSizeZ ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Query a suggested group size for a kernel given a global size for each /// dimension. /// /// @details /// - This function ignores the group size that is set using /// ::zeKernelSetGroupSize. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == groupSizeX` /// + `nullptr == groupSizeY` /// + `nullptr == groupSizeZ` /// - ::ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION ze_result_t ZE_APICALL zeKernelSuggestGroupSize( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t globalSizeX, ///< [in] global width for X dimension uint32_t globalSizeY, ///< [in] global width for Y dimension uint32_t globalSizeZ, ///< [in] global width for Z dimension uint32_t* groupSizeX, ///< [out] recommended size of group for X dimension uint32_t* groupSizeY, ///< [out] recommended size of group for Y dimension uint32_t* groupSizeZ ///< [out] recommended size of group for Z dimension ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSuggestGroupSize = ze_lib::context->zeDdiTable.load()->Kernel.pfnSuggestGroupSize; if( nullptr == pfnSuggestGroupSize ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSuggestGroupSize( hKernel, globalSizeX, globalSizeY, globalSizeZ, groupSizeX, groupSizeY, groupSizeZ ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Query a suggested max group count for a cooperative kernel. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == totalGroupCount` ze_result_t ZE_APICALL zeKernelSuggestMaxCooperativeGroupCount( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* totalGroupCount ///< [out] recommended total group count. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSuggestMaxCooperativeGroupCount = ze_lib::context->zeDdiTable.load()->Kernel.pfnSuggestMaxCooperativeGroupCount; if( nullptr == pfnSuggestMaxCooperativeGroupCount ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSuggestMaxCooperativeGroupCount( hKernel, totalGroupCount ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set kernel argument for a kernel. /// /// @details /// - The argument values will be used when a /// ::zeCommandListAppendLaunchKernel variant is called. /// - The application must **not** call this function from simultaneous /// threads with the same kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX /// - ::ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE ze_result_t ZE_APICALL zeKernelSetArgumentValue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t argIndex, ///< [in] argument index in range [0, num args - 1] size_t argSize, ///< [in] size of argument type const void* pArgValue ///< [in][optional] argument value represented as matching arg type. If ///< null then argument value is considered null. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetArgumentValue = ze_lib::context->zeDdiTable.load()->Kernel.pfnSetArgumentValue; if( nullptr == pfnSetArgumentValue ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetArgumentValue( hKernel, argIndex, argSize, pArgValue ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Sets kernel indirect access flags. /// /// @details /// - The application should specify which allocations will be indirectly /// accessed by the kernel to allow driver to optimize which allocations /// are made resident /// - This function may **not** be called from simultaneous threads with the /// same Kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < flags` ze_result_t ZE_APICALL zeKernelSetIndirectAccess( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t flags ///< [in] kernel indirect access flags ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetIndirectAccess = ze_lib::context->zeDdiTable.load()->Kernel.pfnSetIndirectAccess; if( nullptr == pfnSetIndirectAccess ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetIndirectAccess( hKernel, flags ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve kernel indirect access flags. /// /// @details /// - This function may be called from simultaneous threads with the same /// Kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pFlags` ze_result_t ZE_APICALL zeKernelGetIndirectAccess( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t* pFlags ///< [out] query result for kernel indirect access flags. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetIndirectAccess = ze_lib::context->zeDdiTable.load()->Kernel.pfnGetIndirectAccess; if( nullptr == pfnGetIndirectAccess ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetIndirectAccess( hKernel, pFlags ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve all declared kernel attributes (i.e. can be specified with /// __attribute__ in runtime language). /// /// @details /// - This function may be called from simultaneous threads with the same /// Kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` ze_result_t ZE_APICALL zeKernelGetSourceAttributes( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* pSize, ///< [in,out] pointer to size of string in bytes, including ///< null-terminating character. char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including ///< a null-terminating character, is returned in pSize. ///< Otherwise, pString must point to valid application memory that is ///< greater than or equal to *pSize bytes in length, and on return the ///< pointed-to string will contain a space-separated list of kernel source attributes. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetSourceAttributes = ze_lib::context->zeDdiTable.load()->Kernel.pfnGetSourceAttributes; if( nullptr == pfnGetSourceAttributes ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetSourceAttributes( hKernel, pSize, pString ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Sets the preferred cache configuration. /// /// @details /// - The cache configuration will be used when a /// ::zeCommandListAppendLaunchKernel variant is called. /// - The application must **not** call this function from simultaneous /// threads with the same kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE ze_result_t ZE_APICALL zeKernelSetCacheConfig( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_cache_config_flags_t flags ///< [in] cache configuration. ///< must be 0 (default configuration) or a valid combination of ::ze_cache_config_flag_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetCacheConfig = ze_lib::context->zeDdiTable.load()->Kernel.pfnSetCacheConfig; if( nullptr == pfnSetCacheConfig ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetCacheConfig( hKernel, flags ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve kernel properties. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pKernelProperties` ze_result_t ZE_APICALL zeKernelGetProperties( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_properties_t* pKernelProperties ///< [in,out] query result for kernel properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zeDdiTable.load()->Kernel.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hKernel, pKernelProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve kernel name from Kernel. /// /// @details /// - The caller can pass nullptr for pName when querying only for size. /// - The implementation will copy the kernel name into a buffer supplied by /// the caller. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` ze_result_t ZE_APICALL zeKernelGetName( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object size_t* pSize, ///< [in,out] size of kernel name string, including null terminator, in ///< bytes. char* pName ///< [in,out][optional] char pointer to kernel name. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetName = ze_lib::context->zeDdiTable.load()->Kernel.pfnGetName; if( nullptr == pfnGetName ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetName( hKernel, pSize, pName ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Launch kernel over one or more work groups. /// /// @details /// - The application must ensure the kernel and events are accessible by /// the device on which the command list was created. /// - This may **only** be called for a command list created with command /// queue group ordinal that supports compute. /// - The application must ensure the command list, kernel and events were /// created on the same context. /// - This function may **not** be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pLaunchFuncArgs` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendLaunchKernel( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendLaunchKernel = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendLaunchKernel; if( nullptr == pfnAppendLaunchKernel ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendLaunchKernel( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Launch kernel cooperatively over one or more work groups. /// /// @details /// - The application must ensure the kernel and events are accessible by /// the device on which the command list was created. /// - This may **only** be called for a command list created with command /// queue group ordinal that supports compute. /// - This may only be used for a command list that are submitted to command /// queue with cooperative flag set. /// - The application must ensure the command list, kernel and events were /// created on the same context. /// - This function may **not** be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// - Use ::zeKernelSuggestMaxCooperativeGroupCount to recommend max group /// count for device for cooperative functions that device supports. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pLaunchFuncArgs` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendLaunchCooperativeKernel( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendLaunchCooperativeKernel = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendLaunchCooperativeKernel; if( nullptr == pfnAppendLaunchCooperativeKernel ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendLaunchCooperativeKernel( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Launch kernel over one or more work groups using indirect arguments. /// /// @details /// - The application must ensure the kernel and events are accessible by /// the device on which the command list was created. /// - The application must ensure the launch arguments are visible to the /// device on which the command list was created. /// - The implementation must not access the contents of the launch /// arguments as they are free to be modified by either the Host or device /// up until execution. /// - This may **only** be called for a command list created with command /// queue group ordinal that supports compute. /// - The application must ensure the command list, kernel and events were /// created, and the memory was allocated, on the same context. /// - This function may **not** be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pLaunchArgumentsBuffer` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendLaunchKernelIndirect( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in] pointer to device buffer that will contain thread group launch ///< arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendLaunchKernelIndirect = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendLaunchKernelIndirect; if( nullptr == pfnAppendLaunchKernelIndirect ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendLaunchKernelIndirect( hCommandList, hKernel, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Launch multiple kernels over one or more work groups using an array of /// indirect arguments. /// /// @details /// - The application must ensure the kernel and events are accessible by /// the device on which the command list was created. /// - The application must ensure the array of launch arguments and count /// buffer are visible to the device on which the command list was /// created. /// - The implementation must not access the contents of the array of launch /// arguments or count buffer as they are free to be modified by either /// the Host or device up until execution. /// - This may **only** be called for a command list created with command /// queue group ordinal that supports compute. /// - The application must enusre the command list, kernel and events were /// created, and the memory was allocated, on the same context. /// - This function may **not** be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phKernels` /// + `nullptr == pCountBuffer` /// + `nullptr == pLaunchArgumentsBuffer` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendLaunchMultipleKernelsIndirect( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] maximum number of kernels to launch ze_kernel_handle_t* phKernels, ///< [in][range(0, numKernels)] handles of the kernel objects const uint32_t* pCountBuffer, ///< [in] pointer to device memory location that will contain the actual ///< number of kernels to launch; value must be less than or equal to ///< numKernels const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in][range(0, numKernels)] pointer to device buffer that will contain ///< a contiguous array of thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendLaunchMultipleKernelsIndirect = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendLaunchMultipleKernelsIndirect; if( nullptr == pfnAppendLaunchMultipleKernelsIndirect ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendLaunchMultipleKernelsIndirect( hCommandList, numKernels, phKernels, pCountBuffer, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Makes memory resident for the device. /// /// @details /// - The application must ensure the memory is resident before being /// referenced by the device /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + ptr is not recognized by the implementation ze_result_t ZE_APICALL zeContextMakeMemoryResident( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to make resident size_t size ///< [in] size in bytes to make resident ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnMakeMemoryResident = ze_lib::context->zeDdiTable.load()->Context.pfnMakeMemoryResident; if( nullptr == pfnMakeMemoryResident ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnMakeMemoryResident( hContext, hDevice, ptr, size ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Allows memory to be evicted from the device. /// /// @details /// - The application must ensure the device is not currently referencing /// the memory before it is evicted /// - The application may free the memory without evicting; the memory is /// implicitly evicted when freed. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` ze_result_t ZE_APICALL zeContextEvictMemory( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to evict size_t size ///< [in] size in bytes to evict ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEvictMemory = ze_lib::context->zeDdiTable.load()->Context.pfnEvictMemory; if( nullptr == pfnEvictMemory ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEvictMemory( hContext, hDevice, ptr, size ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Makes image resident for the device. /// /// @details /// - The application must ensure the image is resident before being /// referenced by the device /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// + `nullptr == hImage` ze_result_t ZE_APICALL zeContextMakeImageResident( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make resident ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnMakeImageResident = ze_lib::context->zeDdiTable.load()->Context.pfnMakeImageResident; if( nullptr == pfnMakeImageResident ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnMakeImageResident( hContext, hDevice, hImage ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Allows image to be evicted from the device. /// /// @details /// - The application must ensure the device is not currently referencing /// the image before it is evicted /// - The application may destroy the image without evicting; the image is /// implicitly evicted when destroyed. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// + `nullptr == hImage` ze_result_t ZE_APICALL zeContextEvictImage( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make evict ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEvictImage = ze_lib::context->zeDdiTable.load()->Context.pfnEvictImage; if( nullptr == pfnEvictImage ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEvictImage( hContext, hDevice, hImage ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates sampler on the context. /// /// @details /// - The application must only use the sampler for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phSampler` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_SAMPLER_ADDRESS_MODE_MIRROR < desc->addressMode` /// + `::ZE_SAMPLER_FILTER_MODE_LINEAR < desc->filterMode` ze_result_t ZE_APICALL zeSamplerCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_sampler_desc_t* desc, ///< [in] pointer to sampler descriptor ze_sampler_handle_t* phSampler ///< [out] handle of the sampler ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zeDdiTable.load()->Sampler.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hContext, hDevice, desc, phSampler ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys sampler object /// /// @details /// - The application must ensure the device is not currently referencing /// the sampler before it is deleted. /// - The implementation of this function may immediately free all Host and /// Device allocations associated with this sampler. /// - The application must **not** call this function from simultaneous /// threads with the same sampler handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hSampler` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeSamplerDestroy( ze_sampler_handle_t hSampler ///< [in][release] handle of the sampler ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zeDdiTable.load()->Sampler.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hSampler ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Reserves pages in virtual address space. /// /// @details /// - The application must only use the memory allocation on the context for /// which it was created. /// - The starting address and size must be page aligned. See /// ::zeVirtualMemQueryPageSize. /// - If pStart is not null then implementation will attempt to reserve /// starting from that address. If not available then will find another /// suitable starting address. /// - The application may call this function from simultaneous threads. /// - The access attributes will default to none to indicate reservation is /// inaccessible. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pptr` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` ze_result_t ZE_APICALL zeVirtualMemReserve( ze_context_handle_t hContext, ///< [in] handle of the context object const void* pStart, ///< [in][optional] pointer to start of region to reserve. If nullptr then ///< implementation will choose a start address. size_t size, ///< [in] size in bytes to reserve; must be page aligned. void** pptr ///< [out] pointer to virtual reservation. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReserve = ze_lib::context->zeDdiTable.load()->VirtualMem.pfnReserve; if( nullptr == pfnReserve ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReserve( hContext, pStart, size, pptr ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Free pages in a reserved virtual address range. /// /// @details /// - Any existing virtual mappings for the range will be unmapped. /// - Physical allocations objects that were mapped to this range will not /// be destroyed. These need to be destroyed explicitly. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT ze_result_t ZE_APICALL zeVirtualMemFree( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to free. size_t size ///< [in] size in bytes to free; must be page aligned. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnFree = ze_lib::context->zeDdiTable.load()->VirtualMem.pfnFree; if( nullptr == pfnFree ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnFree( hContext, ptr, size ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Queries page size to use for aligning virtual memory reservations and /// physical memory allocations. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pagesize` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` ze_result_t ZE_APICALL zeVirtualMemQueryPageSize( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] unaligned allocation size in bytes size_t* pagesize ///< [out] pointer to page size to use for start address and size ///< alignments. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnQueryPageSize = ze_lib::context->zeDdiTable.load()->VirtualMem.pfnQueryPageSize; if( nullptr == pfnQueryPageSize ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnQueryPageSize( hContext, hDevice, size, pagesize ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a physical memory object for the context. /// /// @details /// - The application must only use the physical memory object on the /// context for which it was created. /// - The size must be page aligned. For host memory, the operating system /// page size should be used. For device memory, see /// ::zeVirtualMemQueryPageSize. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phPhysicalMemory` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == desc->size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT ze_result_t ZE_APICALL zePhysicalMemCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zeDdiTable.load()->PhysicalMem.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hContext, hDevice, desc, phPhysicalMemory ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a physical memory object. /// /// @details /// - The application must ensure the device is not currently referencing /// the physical memory object before it is deleted /// - The application must **not** call this function from simultaneous /// threads with the same physical memory handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hPhysicalMemory` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zePhysicalMemDestroy( ze_context_handle_t hContext, ///< [in] handle of the context object ze_physical_mem_handle_t hPhysicalMemory ///< [in][release] handle of physical memory object to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zeDdiTable.load()->PhysicalMem.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hContext, hPhysicalMemory ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Maps pages in virtual address space to pages from physical memory /// object. /// /// @details /// - The virtual address range must have been reserved using /// ::zeVirtualMemReserve. /// - The application must only use the mapped memory allocation on the /// context for which it was created. /// - The virtual start address and size must be page aligned. See /// ::zeVirtualMemQueryPageSize. /// - The application should use, for the starting address and size, the /// same size alignment used for the physical allocation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hPhysicalMemory` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY < access` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT ze_result_t ZE_APICALL zeVirtualMemMap( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address range to map. size_t size, ///< [in] size in bytes of virtual address range to map; must be page ///< aligned. ze_physical_mem_handle_t hPhysicalMemory, ///< [in] handle to physical memory object. size_t offset, ///< [in] offset into physical memory allocation object; must be page ///< aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnMap = ze_lib::context->zeDdiTable.load()->VirtualMem.pfnMap; if( nullptr == pfnMap ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnMap( hContext, ptr, size, hPhysicalMemory, offset, access ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Unmaps pages in virtual address space from pages from a physical /// memory object. /// /// @details /// - The page access attributes for virtual address range will revert back /// to none. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT /// + Address must be page aligned /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// + Size must be page aligned ze_result_t ZE_APICALL zeVirtualMemUnmap( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to unmap. size_t size ///< [in] size in bytes to unmap; must be page aligned. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnUnmap = ze_lib::context->zeDdiTable.load()->VirtualMem.pfnUnmap; if( nullptr == pfnUnmap ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnUnmap( hContext, ptr, size ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set memory access attributes for a virtual address range. /// /// @details /// - This function may be called from simultaneous threads with the same /// function handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_MEMORY_ACCESS_ATTRIBUTE_READONLY < access` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT /// + Address must be page aligned /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// + Size must be page aligned ze_result_t ZE_APICALL zeVirtualMemSetAccessAttribute( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of reserved virtual address region. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetAccessAttribute = ze_lib::context->zeDdiTable.load()->VirtualMem.pfnSetAccessAttribute; if( nullptr == pfnSetAccessAttribute ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetAccessAttribute( hContext, ptr, size, access ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get memory access attribute for a virtual address range. /// /// @details /// - If size and outSize are equal then the pages in the specified virtual /// address range have the same access attributes. /// - This function may be called from simultaneous threads with the same /// function handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// + `nullptr == access` /// + `nullptr == outSize` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT /// + Address must be page aligned /// - ::ZE_RESULT_ERROR_UNSUPPORTED_SIZE /// + `0 == size` /// + Size must be page aligned ze_result_t ZE_APICALL zeVirtualMemGetAccessAttribute( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address region for query. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t* access, ///< [out] query result for page access attribute. size_t* outSize ///< [out] query result for size of virtual address range, starting at ptr, ///< that shares same access attribute. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetAccessAttribute = ze_lib::context->zeDdiTable.load()->VirtualMem.pfnGetAccessAttribute; if( nullptr == pfnGetAccessAttribute ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetAccessAttribute( hContext, ptr, size, access, outSize ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set global work offset for a kernel. /// /// @details /// - The global work offset will be used when a /// ::zeCommandListAppendLaunchKernel() variant is called. /// - The application must **not** call this function from simultaneous /// threads with the same kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` ze_result_t ZE_APICALL zeKernelSetGlobalOffsetExp( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t offsetX, ///< [in] global offset for X dimension to use for this kernel uint32_t offsetY, ///< [in] global offset for Y dimension to use for this kernel uint32_t offsetZ ///< [in] global offset for Z dimension to use for this kernel ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetGlobalOffsetExp = ze_lib::context->zeDdiTable.load()->KernelExp.pfnSetGlobalOffsetExp; if( nullptr == pfnSetGlobalOffsetExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetGlobalOffsetExp( hKernel, offsetX, offsetY, offsetZ ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves kernel binary program data (ISA GEN format). /// /// @details /// - A valid kernel handle must be created with ::zeKernelCreate. /// - Returns Intel Graphics Assembly (GEN ISA) format binary program data /// for kernel handle. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` /// + `nullptr == pKernelBinary` ze_result_t ZE_APICALL zeKernelGetBinaryExp( ze_kernel_handle_t hKernel, ///< [in] Kernel handle. size_t* pSize, ///< [in,out] pointer to variable with size of GEN ISA binary. uint8_t* pKernelBinary ///< [in,out] pointer to storage area for GEN ISA binary function. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetBinaryExp = ze_lib::context->zeDdiTable.load()->KernelExp.pfnGetBinaryExp; if( nullptr == pfnGetBinaryExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetBinaryExp( hKernel, pSize, pKernelBinary ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Import an external semaphore /// /// @details /// - Imports an external semaphore. /// - This function may be called from simultaneous threads with the same /// device handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phSemaphore` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x1ff < desc->flags` ze_result_t ZE_APICALL zeDeviceImportExternalSemaphoreExt( ze_device_handle_t hDevice, ///< [in] The device handle. const ze_external_semaphore_ext_desc_t* desc, ///< [in] The pointer to external semaphore descriptor. ze_external_semaphore_ext_handle_t* phSemaphore ///< [out] The handle of the external semaphore imported. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnImportExternalSemaphoreExt = ze_lib::context->zeDdiTable.load()->Device.pfnImportExternalSemaphoreExt; if( nullptr == pfnImportExternalSemaphoreExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnImportExternalSemaphoreExt( hDevice, desc, phSemaphore ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Release an external semaphore /// /// @details /// - The application must ensure the device is not currently referencing /// the semaphore before it is released. /// - The application must **not** call this function from simultaneous /// threads with the same semaphore handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hSemaphore` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeDeviceReleaseExternalSemaphoreExt( ze_external_semaphore_ext_handle_t hSemaphore ///< [in] The handle of the external semaphore. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReleaseExternalSemaphoreExt = ze_lib::context->zeDdiTable.load()->Device.pfnReleaseExternalSemaphoreExt; if( nullptr == pfnReleaseExternalSemaphoreExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReleaseExternalSemaphoreExt( hSemaphore ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Signal an external semaphore /// /// @details /// - Signals an external semaphore. /// - This function must only be used with an immediate command list. /// - This function may be called from simultaneous threads with the same /// command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phSemaphores` /// + `nullptr == signalParams` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` /// + `(nullptr == phSemaphores) && (0 < numSemaphores)` /// + `(nullptr == signalParams) && (0 < numSemaphores)` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + Commandlist handle does not correspond to an immediate command list ze_result_t ZE_APICALL zeCommandListAppendSignalExternalSemaphoreExt( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in][range(0, numSemaphores)] The vector of external semaphore handles ///< to be appended into command list. ze_external_semaphore_signal_params_ext_t* signalParams,///< [in] Signal parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendSignalExternalSemaphoreExt = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendSignalExternalSemaphoreExt; if( nullptr == pfnAppendSignalExternalSemaphoreExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendSignalExternalSemaphoreExt( hCommandList, numSemaphores, phSemaphores, signalParams, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Wait on external semaphores /// /// @details /// - Waits on external semaphores. /// - This function must only be used with an immediate command list. /// - This function may be called from simultaneous threads with the same /// command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phSemaphores` /// + `nullptr == waitParams` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` /// + `(nullptr == phSemaphores) && (0 < numSemaphores)` /// + `(nullptr == waitParams) && (0 < numSemaphores)` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + Commandlist handle does not correspond to an immediate command list ze_result_t ZE_APICALL zeCommandListAppendWaitExternalSemaphoreExt( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in] [range(0,numSemaphores)] The vector of external semaphore handles ///< to append into command list. ze_external_semaphore_wait_params_ext_t* waitParams,///< [in] Wait parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendWaitExternalSemaphoreExt = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendWaitExternalSemaphoreExt; if( nullptr == pfnAppendWaitExternalSemaphoreExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendWaitExternalSemaphoreExt( hCommandList, numSemaphores, phSemaphores, waitParams, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Reserve Cache on Device /// /// @details /// - The application may call this function but may not be successful as /// some other application may have reserve prior /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` ze_result_t ZE_APICALL zeDeviceReserveCacheExt( ze_device_handle_t hDevice, ///< [in] handle of the device object size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the ///< driver shall default to last level of cache and attempt to reserve in ///< that cache. size_t cacheReservationSize ///< [in] value for reserving size, in bytes. If zero, then the driver ///< shall remove prior reservation ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReserveCacheExt = ze_lib::context->zeDdiTable.load()->Device.pfnReserveCacheExt; if( nullptr == pfnReserveCacheExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReserveCacheExt( hDevice, cacheLevel, cacheReservationSize ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Assign VA section to use reserved section /// /// @details /// - The application may call this function to assign VA to particular /// reservartion region /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_CACHE_EXT_REGION_NON_RESERVED < cacheRegion` ze_result_t ZE_APICALL zeDeviceSetCacheAdviceExt( ze_device_handle_t hDevice, ///< [in] handle of the device object void* ptr, ///< [in] memory pointer to query size_t regionSize, ///< [in] region size, in pages ze_cache_ext_region_t cacheRegion ///< [in] reservation region ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetCacheAdviceExt = ze_lib::context->zeDdiTable.load()->Device.pfnSetCacheAdviceExt; if( nullptr == pfnSetCacheAdviceExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetCacheAdviceExt( hDevice, ptr, regionSize, cacheRegion ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Query event timestamps for a device or sub-device. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support /// ::ZE_experimental_event_query_timestamps. /// - The implementation must return all timestamps for the specified event /// and device pair. /// - The implementation must return all timestamps for all sub-devices when /// device handle is parent device. /// - The implementation may return all timestamps for sub-devices when /// device handle is sub-device or may return 0 for count. /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeEventQueryTimestampsExp( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of timestamp results. ///< if count is zero, then the driver shall update the value with the ///< total number of timestamps available. ///< if count is greater than the number of timestamps available, then the ///< driver shall update the value with the correct number of timestamps available. ze_kernel_timestamp_result_t* pTimestamps ///< [in,out][optional][range(0, *pCount)] array of timestamp results. ///< if count is less than the number of timestamps available, then driver ///< shall only retrieve that number of timestamps. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnQueryTimestampsExp = ze_lib::context->zeDdiTable.load()->EventExp.pfnQueryTimestampsExp; if( nullptr == pfnQueryTimestampsExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnQueryTimestampsExp( hEvent, hDevice, pCount, pTimestamps ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Query image memory properties. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support /// ::ZE_experimental_image_memory_properties extension. /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pMemoryProperties` ze_result_t ZE_APICALL zeImageGetMemoryPropertiesExp( ze_image_handle_t hImage, ///< [in] handle of image object ze_image_memory_properties_exp_t* pMemoryProperties ///< [in,out] query result for image memory properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetMemoryPropertiesExp = ze_lib::context->zeDdiTable.load()->ImageExp.pfnGetMemoryPropertiesExp; if( nullptr == pfnGetMemoryPropertiesExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetMemoryPropertiesExp( hImage, pMemoryProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Create image view on the context. /// /// @details /// - The application must only use the image view for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support ::ZE_extension_image_view extension. /// - Image views are treated as images from the API. /// - Image views provide a mechanism to redescribe how an image is /// interpreted (e.g. different format). /// - Image views become disabled when their corresponding image resource is /// destroyed. /// - Use ::zeImageDestroy to destroy image view objects. /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// + `nullptr == hImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phImageView` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// + `::ZE_IMAGE_TYPE_BUFFER < desc->type` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT ze_result_t ZE_APICALL zeImageViewCreateExt( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnViewCreateExt = ze_lib::context->zeDdiTable.load()->Image.pfnViewCreateExt; if( nullptr == pfnViewCreateExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnViewCreateExt( hContext, hDevice, desc, hImage, phImageView ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Create image view on the context. /// /// @details /// - The application must only use the image view for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support ::ZE_experimental_image_view /// extension. /// - Image views are treated as images from the API. /// - Image views provide a mechanism to redescribe how an image is /// interpreted (e.g. different format). /// - Image views become disabled when their corresponding image resource is /// destroyed. /// - Use ::zeImageDestroy to destroy image view objects. /// - Note: This function is deprecated and replaced by /// ::zeImageViewCreateExt. /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// + `nullptr == hImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phImageView` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < desc->flags` /// + `::ZE_IMAGE_TYPE_BUFFER < desc->type` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT ze_result_t ZE_APICALL zeImageViewCreateExp( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnViewCreateExp = ze_lib::context->zeDdiTable.load()->ImageExp.pfnViewCreateExp; if( nullptr == pfnViewCreateExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnViewCreateExp( hContext, hDevice, desc, hImage, phImageView ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Provide kernel scheduling hints that may improve performance /// /// @details /// - The scheduling hints may improve performance only and are not required /// for correctness. /// - If a specified scheduling hint is unsupported it will be silently /// ignored. /// - If two conflicting scheduling hints are specified there is no defined behavior; /// the hints may be ignored or one hint may be chosen arbitrarily. /// - The application must not call this function from simultaneous threads /// with the same kernel handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pHint` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < pHint->flags` ze_result_t ZE_APICALL zeKernelSchedulingHintExp( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_scheduling_hint_exp_desc_t* pHint ///< [in] pointer to kernel scheduling hint descriptor ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSchedulingHintExp = ze_lib::context->zeDdiTable.load()->KernelExp.pfnSchedulingHintExp; if( nullptr == pfnSchedulingHintExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSchedulingHintExp( hKernel, pHint ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get PCI properties - address, max speed /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pPciProperties` ze_result_t ZE_APICALL zeDevicePciGetPropertiesExt( ze_device_handle_t hDevice, ///< [in] handle of the device object. ze_pci_ext_properties_t* pPciProperties ///< [in,out] returns the PCI properties of the device. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnPciGetPropertiesExt = ze_lib::context->zeDdiTable.load()->Device.pfnPciGetPropertiesExt; if( nullptr == pfnPciGetPropertiesExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnPciGetPropertiesExt( hDevice, pPciProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Copies from an image to device or shared memory. /// /// @details /// - The application must ensure the memory pointed to by dstptr is /// accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by dstptr as /// it is free to be modified by either the Host or device up until /// execution. /// - The application must ensure the image and events are accessible by the /// device on which the command list was created. /// - The application must ensure the image format descriptor for the source /// image is a single-planar format. /// - The application must ensure that the rowPitch is set to 0 if image is /// a 1D image. Otherwise the rowPitch must be greater than or equal to /// the element size in bytes x width. /// - If rowPitch is set to 0, the appropriate row pitch is calculated based /// on the size of each element in bytes multiplied by width /// - The application must ensure that the slicePitch is set to 0 if image /// is a 1D or 2D image. Otherwise this value must be greater than or /// equal to rowPitch x height. /// - If slicePitch is set to 0, the appropriate slice pitch is calculated /// based on the rowPitch x height. /// - The application must ensure the command list, image and events were /// created, and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clEnqueueReadImage /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hSrcImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == dstptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemoryExt( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor uint32_t destRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being written uint32_t destSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being written ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendImageCopyToMemoryExt = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendImageCopyToMemoryExt; if( nullptr == pfnAppendImageCopyToMemoryExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendImageCopyToMemoryExt( hCommandList, dstptr, hSrcImage, pSrcRegion, destRowPitch, destSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Copies to an image from device or shared memory. /// /// @details /// - The application must ensure the memory pointed to by srcptr is /// accessible by the device on which the command list was created. /// - The implementation must not access the memory pointed to by srcptr as /// it is free to be modified by either the Host or device up until /// execution. /// - The application must ensure the image and events are accessible by the /// device on which the command list was created. /// - The application must ensure the image format descriptor for the /// destination image is a single-planar format. /// - The application must ensure that the rowPitch is set to 0 if image is /// a 1D image. Otherwise the rowPitch must be greater than or equal to /// the element size in bytes x width. /// - If rowPitch is set to 0, the appropriate row pitch is calculated based /// on the size of each element in bytes multiplied by width /// - The application must ensure that the slicePitch is set to 0 if image /// is a 1D or 2D image. Otherwise this value must be greater than or /// equal to rowPitch x height. /// - If slicePitch is set to 0, the appropriate slice pitch is calculated /// based on the rowPitch x height. /// - The application must ensure the command list, image and events were /// created, and the memory was allocated, on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - The implementation of this function should be lock-free. /// /// @remarks /// _Analogues_ /// - clEnqueueWriteImage /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hDstImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == srcptr` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zeCommandListAppendImageCopyFromMemoryExt( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor uint32_t srcRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being read uint32_t srcSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being read ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendImageCopyFromMemoryExt = ze_lib::context->zeDdiTable.load()->CommandList.pfnAppendImageCopyFromMemoryExt; if( nullptr == pfnAppendImageCopyFromMemoryExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendImageCopyFromMemoryExt( hCommandList, hDstImage, srcptr, pDstRegion, srcRowPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves attributes of an image allocation /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pImageAllocProperties` ze_result_t ZE_APICALL zeImageGetAllocPropertiesExt( ze_context_handle_t hContext, ///< [in] handle of the context object ze_image_handle_t hImage, ///< [in] handle of image object to query ze_image_allocation_ext_properties_t* pImageAllocProperties ///< [in,out] query result for image allocation properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetAllocPropertiesExt = ze_lib::context->zeDdiTable.load()->Image.pfnGetAllocPropertiesExt; if( nullptr == pfnGetAllocPropertiesExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetAllocPropertiesExt( hContext, hImage, pImageAllocProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief List Imports & Exports /// /// @details /// - List all the import & unresolveable import dependencies & exports of a /// set of modules /// /// @remarks /// _Analogues_ /// - None /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pInspectDesc` /// + `nullptr == phModules` /// + `nullptr == phLog` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < pInspectDesc->flags` ze_result_t ZE_APICALL zeModuleInspectLinkageExt( ze_linkage_inspection_ext_desc_t* pInspectDesc, ///< [in] pointer to linkage inspection descriptor structure. uint32_t numModules, ///< [in] number of modules to be inspected pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to be ///< inspected for import dependencies. ze_module_build_log_handle_t* phLog ///< [out] pointer to handle of linkage inspection log. Log object will ///< contain separate lists of imports, un-resolvable imports, and exports. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnInspectLinkageExt = ze_lib::context->zeDdiTable.load()->Module.pfnInspectLinkageExt; if( nullptr == pfnInspectLinkageExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnInspectLinkageExt( pInspectDesc, numModules, phModules, phLog ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Frees allocated host memory, device memory, or shared memory using the /// specified free policy. /// /// @details /// - The memory free policy is specified by the memory free descriptor. /// - The application must **not** call this function from simultaneous /// threads with the same pointer. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pMemFreeDesc` /// + `nullptr == ptr` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x3 < pMemFreeDesc->freePolicy` ze_result_t ZE_APICALL zeMemFreeExt( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_memory_free_ext_desc_t* pMemFreeDesc, ///< [in] pointer to memory free descriptor void* ptr ///< [in][release] pointer to memory to free ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnFreeExt = ze_lib::context->zeDdiTable.load()->Mem.pfnFreeExt; if( nullptr == pfnFreeExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnFreeExt( hContext, pMemFreeDesc, ptr ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves fabric vertices within a driver /// /// @details /// - A fabric vertex represents either a device or a switch connected to /// other fabric vertices. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeFabricVertexGetExp( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric vertices available. ///< if count is greater than the number of fabric vertices available, then ///< the driver shall update the value with the correct number of fabric ///< vertices available. ze_fabric_vertex_handle_t* phVertices ///< [in,out][optional][range(0, *pCount)] array of handle of fabric vertices. ///< if count is less than the number of fabric vertices available, then ///< driver shall only retrieve that number of fabric vertices. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetExp = ze_lib::context->zeDdiTable.load()->FabricVertexExp.pfnGetExp; if( nullptr == pfnGetExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetExp( hDriver, pCount, phVertices ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves a fabric sub-vertex from a fabric vertex /// /// @details /// - Multiple calls to this function will return identical fabric vertex /// handles, in the same order. /// - The number of handles returned from this function is affected by the /// ::ZE_AFFINITY_MASK environment variable. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVertex` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeFabricVertexGetSubVerticesExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex object uint32_t* pCount, ///< [in,out] pointer to the number of sub-vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-vertices available. ///< if count is greater than the number of sub-vertices available, then ///< the driver shall update the value with the correct number of ///< sub-vertices available. ze_fabric_vertex_handle_t* phSubvertices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-vertices. ///< if count is less than the number of sub-vertices available, then ///< driver shall only retrieve that number of sub-vertices. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetSubVerticesExp = ze_lib::context->zeDdiTable.load()->FabricVertexExp.pfnGetSubVerticesExp; if( nullptr == pfnGetSubVerticesExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetSubVerticesExp( hVertex, pCount, phSubvertices ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves properties of the fabric vertex. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVertex` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pVertexProperties` ze_result_t ZE_APICALL zeFabricVertexGetPropertiesExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_fabric_vertex_exp_properties_t* pVertexProperties///< [in,out] query result for fabric vertex properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetPropertiesExp = ze_lib::context->zeDdiTable.load()->FabricVertexExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetPropertiesExp( hVertex, pVertexProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Returns device handle from fabric vertex handle. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVertex` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phDevice` /// - ::ZE_RESULT_EXP_ERROR_VERTEX_IS_NOT_DEVICE /// + Provided fabric vertex handle does not correspond to a device or subdevice. /// - ::ZE_RESULT_EXP_ERROR_REMOTE_DEVICE /// + Provided fabric vertex handle corresponds to remote device or subdevice. ze_result_t ZE_APICALL zeFabricVertexGetDeviceExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_device_handle_t* phDevice ///< [out] device handle corresponding to fabric vertex ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetDeviceExp = ze_lib::context->zeDdiTable.load()->FabricVertexExp.pfnGetDeviceExp; if( nullptr == pfnGetDeviceExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetDeviceExp( hVertex, phDevice ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Returns fabric vertex handle from device handle. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phVertex` /// - ::ZE_RESULT_EXP_ERROR_DEVICE_IS_NOT_VERTEX /// + Provided device handle does not correspond to a fabric vertex. ze_result_t ZE_APICALL zeDeviceGetFabricVertexExp( ze_device_handle_t hDevice, ///< [in] handle of the device ze_fabric_vertex_handle_t* phVertex ///< [out] fabric vertex handle corresponding to device ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetFabricVertexExp = ze_lib::context->zeDdiTable.load()->DeviceExp.pfnGetFabricVertexExp; if( nullptr == pfnGetFabricVertexExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetFabricVertexExp( hDevice, phVertex ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves all fabric edges between provided pair of fabric vertices /// /// @details /// - A fabric edge represents one or more physical links between two fabric /// vertices. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVertexA` /// + `nullptr == hVertexB` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeFabricEdgeGetExp( ze_fabric_vertex_handle_t hVertexA, ///< [in] handle of first fabric vertex instance ze_fabric_vertex_handle_t hVertexB, ///< [in] handle of second fabric vertex instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric edges. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric edges available. ///< if count is greater than the number of fabric edges available, then ///< the driver shall update the value with the correct number of fabric ///< edges available. ze_fabric_edge_handle_t* phEdges ///< [in,out][optional][range(0, *pCount)] array of handle of fabric edges. ///< if count is less than the number of fabric edges available, then ///< driver shall only retrieve that number of fabric edges. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetExp = ze_lib::context->zeDdiTable.load()->FabricEdgeExp.pfnGetExp; if( nullptr == pfnGetExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetExp( hVertexA, hVertexB, pCount, phEdges ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves fabric vertices connected by a fabric edge /// /// @details /// - A fabric vertex represents either a device or a switch connected to /// other fabric vertices via a fabric edge. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEdge` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phVertexA` /// + `nullptr == phVertexB` ze_result_t ZE_APICALL zeFabricEdgeGetVerticesExp( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge instance ze_fabric_vertex_handle_t* phVertexA, ///< [out] fabric vertex connected to one end of the given fabric edge. ze_fabric_vertex_handle_t* phVertexB ///< [out] fabric vertex connected to other end of the given fabric edge. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetVerticesExp = ze_lib::context->zeDdiTable.load()->FabricEdgeExp.pfnGetVerticesExp; if( nullptr == pfnGetVerticesExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetVerticesExp( hEdge, phVertexA, phVertexB ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves properties of the fabric edge. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEdge` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pEdgeProperties` ze_result_t ZE_APICALL zeFabricEdgeGetPropertiesExp( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge ze_fabric_edge_exp_properties_t* pEdgeProperties///< [in,out] query result for fabric edge properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetPropertiesExp = ze_lib::context->zeDdiTable.load()->FabricEdgeExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetPropertiesExp( hEdge, pEdgeProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Query an event's timestamp value on the host, with domain preference. /// /// @details /// - For collecting *only* kernel timestamps, the application must ensure /// the event was created from an event pool that was created using /// ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag. /// - For collecting synchronized timestamps, the application must ensure /// the event was created from an event pool that was created using /// ::ZE_EVENT_POOL_FLAG_KERNEL_MAPPED_TIMESTAMP flag. Kernel timestamps /// are also available from this type of event pool, but there is a /// performance cost. /// - The destination memory will be unmodified if the event has not been /// signaled. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support /// ::ZE_extension_event_query_kernel_timestamps. /// - The implementation must return all timestamps for the specified event /// and device pair. /// - The implementation must return all timestamps for all sub-devices when /// device handle is parent device. /// - The implementation may return all timestamps for sub-devices when /// device handle is sub-device or may return 0 for count. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEvent` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zeEventQueryKernelTimestampsExt( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of event packets available. ///< - This value is implementation specific. ///< - if `*pCount` is zero, then the driver shall update the value with ///< the total number of event packets available. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver shall update the value with the correct value. ///< - Buffer(s) for query results must be sized by the application to ///< accommodate a minimum of `*pCount` elements. ze_event_query_kernel_timestamps_results_ext_properties_t* pResults ///< [in,out][optional][range(0, *pCount)] pointer to event query ///< properties structure(s). ///< - This parameter may be null when `*pCount` is zero. ///< - if `*pCount` is less than the number of event packets available, ///< the driver may only update `*pCount` elements, starting at element zero. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver may only update the valid elements. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnQueryKernelTimestampsExt = ze_lib::context->zeDdiTable.load()->Event.pfnQueryKernelTimestampsExt; if( nullptr == pfnQueryKernelTimestampsExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnQueryKernelTimestampsExt( hEvent, hDevice, pCount, pResults ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a ray tracing acceleration structure builder object /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support ::ZE_experimental_rtas_builder /// extension. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pDescriptor` /// + `nullptr == phBuilder` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_RTAS_BUILDER_EXP_VERSION_CURRENT < pDescriptor->builderVersion` ze_result_t ZE_APICALL zeRTASBuilderCreateExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object const ze_rtas_builder_exp_desc_t* pDescriptor, ///< [in] pointer to builder descriptor ze_rtas_builder_exp_handle_t* phBuilder ///< [out] handle of builder object ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreateExp = ze_lib::context->zeDdiTable.load()->RTASBuilderExp.pfnCreateExp; if( nullptr == pfnCreateExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreateExp( hDriver, pDescriptor, phBuilder ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves ray tracing acceleration structure builder properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hBuilder` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pBuildOpDescriptor` /// + `nullptr == pProperties` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_RTAS_FORMAT_EXP_INVALID < pBuildOpDescriptor->rtasFormat` /// + `::ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH < pBuildOpDescriptor->buildQuality` /// + `0x3 < pBuildOpDescriptor->buildFlags` ze_result_t ZE_APICALL zeRTASBuilderGetBuildPropertiesExp( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor ze_rtas_builder_exp_properties_t* pProperties ///< [in,out] query result for builder properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetBuildPropertiesExp = ze_lib::context->zeDdiTable.load()->RTASBuilderExp.pfnGetBuildPropertiesExp; if( nullptr == pfnGetBuildPropertiesExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetBuildPropertiesExp( hBuilder, pBuildOpDescriptor, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Checks ray tracing acceleration structure format compatibility /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_RTAS_FORMAT_EXP_INVALID < rtasFormatA` /// + `::ZE_RTAS_FORMAT_EXP_INVALID < rtasFormatB` /// - ::ZE_RESULT_SUCCESS /// + An acceleration structure built with `rtasFormatA` is compatible with devices that report `rtasFormatB`. /// - ::ZE_RESULT_EXP_ERROR_OPERANDS_INCOMPATIBLE /// + An acceleration structure built with `rtasFormatA` is **not** compatible with devices that report `rtasFormatB`. ze_result_t ZE_APICALL zeDriverRTASFormatCompatibilityCheckExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_format_exp_t rtasFormatA, ///< [in] operand A ze_rtas_format_exp_t rtasFormatB ///< [in] operand B ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnRTASFormatCompatibilityCheckExp = ze_lib::context->zeDdiTable.load()->DriverExp.pfnRTASFormatCompatibilityCheckExp; if( nullptr == pfnRTASFormatCompatibilityCheckExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnRTASFormatCompatibilityCheckExp( hDriver, rtasFormatA, rtasFormatB ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Build ray tracing acceleration structure /// /// @details /// - This function builds an acceleration structure of the scene consisting /// of the specified geometry information and writes the acceleration /// structure to the provided destination buffer. All types of geometries /// can get freely mixed inside a scene. /// - It is the user's responsibility to manage the acceleration structure /// buffer allocation, de-allocation, and potential prefetching to the /// device memory. The required size of the acceleration structure buffer /// can be queried with the ::zeRTASBuilderGetBuildPropertiesExp function. /// The acceleration structure buffer must be a shared USM allocation and /// should be present on the host at build time. The referenced scene data /// (index- and vertex- buffers) can be standard host allocations, and /// will not be referenced into by the build acceleration structure. /// - Before an acceleration structure can be built, the user must allocate /// the memory for the acceleration structure buffer and scratch buffer /// using sizes based on a query for the estimated size properties. /// - When using the "worst-case" size for the acceleration structure /// buffer, the acceleration structure construction will never fail with ::ZE_RESULT_EXP_RTAS_BUILD_RETRY. /// - When using the "expected" size for the acceleration structure buffer, /// the acceleration structure construction may fail with /// ::ZE_RESULT_EXP_RTAS_BUILD_RETRY. If this happens, the user may resize /// their acceleration structure buffer using the returned /// `*pRtasBufferSizeBytes` value, which will be updated with an improved /// size estimate that will likely result in a successful build. /// - The acceleration structure construction is run on the host and is /// synchronous, thus after the function returns with a successful result, /// the acceleration structure may be used. /// - All provided data buffers must be host-accessible. /// - The acceleration structure buffer must be a USM allocation. /// - A successfully constructed acceleration structure is entirely /// self-contained. There is no requirement for input data to persist /// beyond build completion. /// - A successfully constructed acceleration structure is non-copyable. /// - Acceleration structure construction may be parallelized by passing a /// valid handle to a parallel operation object and joining that parallel /// operation using ::zeRTASParallelOperationJoinExp with user-provided /// worker threads. /// - **Additional Notes** /// - "The geometry infos array, geometry infos, and scratch buffer must /// all be standard host memory allocations." /// - "A pointer to a geometry info can be a null pointer, in which case /// the geometry is treated as empty." /// - "If no parallel operation handle is provided, the build is run /// sequentially on the current thread." /// - "A parallel operation object may only be associated with a single /// acceleration structure build at a time." /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hBuilder` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pBuildOpDescriptor` /// + `nullptr == pScratchBuffer` /// + `nullptr == pRtasBuffer` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZE_RTAS_FORMAT_EXP_INVALID < pBuildOpDescriptor->rtasFormat` /// + `::ZE_RTAS_BUILDER_BUILD_QUALITY_HINT_EXP_HIGH < pBuildOpDescriptor->buildQuality` /// + `0x3 < pBuildOpDescriptor->buildFlags` /// - ::ZE_RESULT_EXP_RTAS_BUILD_DEFERRED /// + Acceleration structure build completion is deferred to parallel operation join. /// - ::ZE_RESULT_EXP_RTAS_BUILD_RETRY /// + Acceleration structure build failed due to insufficient resources, retry the build operation with a larger acceleration structure buffer allocation. /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + Acceleration structure build failed due to parallel operation object participation in another build operation. ze_result_t ZE_APICALL zeRTASBuilderBuildExp( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used ///< during acceleration structure construction size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes void* pRtasBuffer, ///< [in] pointer to destination buffer size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks ze_rtas_aabb_exp_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration ///< structure bounds size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in ///< bytes ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnBuildExp = ze_lib::context->zeDdiTable.load()->RTASBuilderExp.pfnBuildExp; if( nullptr == pfnBuildExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnBuildExp( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a ray tracing acceleration structure builder object /// /// @details /// - The implementation of this function may immediately release any /// internal Host and Device resources associated with this builder. /// - The application must **not** call this function from simultaneous /// threads with the same builder handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hBuilder` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zeRTASBuilderDestroyExp( ze_rtas_builder_exp_handle_t hBuilder ///< [in][release] handle of builder object to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroyExp = ze_lib::context->zeDdiTable.load()->RTASBuilderExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroyExp( hBuilder ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a ray tracing acceleration structure builder parallel /// operation object /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// - The implementation must support ::ZE_experimental_rtas_builder /// extension. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phParallelOperation` ze_result_t ZE_APICALL zeRTASParallelOperationCreateExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_parallel_operation_exp_handle_t* phParallelOperation///< [out] handle of parallel operation object ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreateExp = ze_lib::context->zeDdiTable.load()->RTASParallelOperationExp.pfnCreateExp; if( nullptr == pfnCreateExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreateExp( hDriver, phParallelOperation ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves ray tracing acceleration structure builder parallel /// operation properties /// /// @details /// - The application must first bind the parallel operation object to a /// build operation before it may query the parallel operation properties. /// In other words, the application must first call /// ::zeRTASBuilderBuildExp with **hParallelOperation** before calling /// this function. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hParallelOperation` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zeRTASParallelOperationGetPropertiesExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in] handle of parallel operation object ze_rtas_parallel_operation_exp_properties_t* pProperties///< [in,out] query result for parallel operation properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetPropertiesExp = ze_lib::context->zeDdiTable.load()->RTASParallelOperationExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetPropertiesExp( hParallelOperation, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Joins a parallel build operation /// /// @details /// - All worker threads return the same error code for the parallel build /// operation upon build completion /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hParallelOperation` ze_result_t ZE_APICALL zeRTASParallelOperationJoinExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in] handle of parallel operation object ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnJoinExp = ze_lib::context->zeDdiTable.load()->RTASParallelOperationExp.pfnJoinExp; if( nullptr == pfnJoinExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnJoinExp( hParallelOperation ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a ray tracing acceleration structure builder parallel /// operation object /// /// @details /// - The implementation of this function may immediately release any /// internal Host and Device resources associated with this parallel /// operation. /// - The application must **not** call this function from simultaneous /// threads with the same parallel operation handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hParallelOperation` ze_result_t ZE_APICALL zeRTASParallelOperationDestroyExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroyExp = ze_lib::context->zeDdiTable.load()->RTASParallelOperationExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroyExp( hParallelOperation ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Allocate pitched USM memory for images /// /// @details /// - Retrieves pitch for 2D image given the width, height and size in bytes /// - The memory is then allocated using ::zeMemAllocDevice by providing /// input size calculated as the returned pitch value multiplied by image height /// - The application may call this function from simultaneous threads /// - The implementation of this function must be thread-safe. /// - The implementation of this function should be lock-free. /// - The implementation must support ::ZE_experimental_bindless_image extension. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` ze_result_t ZE_APICALL zeMemGetPitchFor2dImage( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device size_t imageWidth, ///< [in] imageWidth size_t imageHeight, ///< [in] imageHeight unsigned int elementSizeInBytes, ///< [in] Element size in bytes size_t * rowPitch ///< [out] rowPitch ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetPitchFor2dImage = ze_lib::context->zeDdiTable.load()->Mem.pfnGetPitchFor2dImage; if( nullptr == pfnGetPitchFor2dImage ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetPitchFor2dImage( hContext, hDevice, imageWidth, imageHeight, elementSizeInBytes, rowPitch ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get bindless device offset for image /// /// @details /// - The application may call this function from simultaneous threads /// - The implementation of this function must be thread-safe. /// - The implementation of this function should be lock-free. /// - The implementation must support ::ZE_experimental_bindless_image /// extension. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hImage` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pDeviceOffset` ze_result_t ZE_APICALL zeImageGetDeviceOffsetExp( ze_image_handle_t hImage, ///< [in] handle of the image uint64_t* pDeviceOffset ///< [out] bindless device offset for image ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetDeviceOffsetExp = ze_lib::context->zeDdiTable.load()->ImageExp.pfnGetDeviceOffsetExp; if( nullptr == pfnGetDeviceOffsetExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetDeviceOffsetExp( hImage, pDeviceOffset ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a command list as the clone of another command list. /// /// @details /// - The source command list must be created with the /// ::ZE_COMMAND_LIST_FLAG_EXP_CLONEABLE flag. /// - The source command list must be closed prior to cloning. /// - The source command list may be cloned while it is running on the /// device. /// - The cloned command list inherits all properties of the source command /// list. /// - The cloned command list must be destroyed prior to the source command /// list. /// - The application must only use the command list for the device, or its /// sub-devices, which was provided during creation. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phClonedCommandList` ze_result_t ZE_APICALL zeCommandListCreateCloneExp( ze_command_list_handle_t hCommandList, ///< [in] handle to source command list (the command list to clone) ze_command_list_handle_t* phClonedCommandList ///< [out] pointer to handle of the cloned command list ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreateCloneExp = ze_lib::context->zeDdiTable.load()->CommandListExp.pfnCreateCloneExp; if( nullptr == pfnCreateCloneExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreateCloneExp( hCommandList, phClonedCommandList ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Appends command lists to dispatch from an immediate command list. /// /// @details /// - The application must call this function only with command lists /// created with ::zeCommandListCreateImmediate. /// - The command lists passed to this function in the `phCommandLists` /// argument must be regular command lists (i.e. not immediate command /// lists). /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandListImmediate` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phCommandLists` ze_result_t ZE_APICALL zeCommandListImmediateAppendCommandListsExp( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t numCommandLists, ///< [in] number of command lists ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion ///< - if not null, this event is signaled after the completion of all ///< appended command lists uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended ///< command lists; must be 0 if nullptr == phWaitEvents ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing appended command lists. ///< - if not null, all wait events must be satisfied prior to the start ///< of any appended command list(s) ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnImmediateAppendCommandListsExp = ze_lib::context->zeDdiTable.load()->CommandListExp.pfnImmediateAppendCommandListsExp; if( nullptr == pfnImmediateAppendCommandListsExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnImmediateAppendCommandListsExp( hCommandListImmediate, numCommandLists, phCommandLists, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Returns a unique command identifier for the next command to be /// appended to a command list. /// /// @details /// - This function may only be called for a mutable command list. /// - This function may not be called on a closed command list. /// - This function may be called from simultaneous threads with the same /// command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == pCommandId` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xff < desc->flags` ze_result_t ZE_APICALL zeCommandListGetNextCommandIdExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in] pointer to mutable command identifier descriptor uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetNextCommandIdExp = ze_lib::context->zeDdiTable.load()->CommandListExp.pfnGetNextCommandIdExp; if( nullptr == pfnGetNextCommandIdExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetNextCommandIdExp( hCommandList, desc, pCommandId ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Returns a unique command identifier for the next command to be /// appended to a command list. Provides possible kernel handles for /// kernel mutation when ::ZE_MUTABLE_COMMAND_EXP_FLAG_KERNEL_INSTRUCTION /// flag is present. /// /// @details /// - This function may only be called for a mutable command list. /// - This function may not be called on a closed command list. /// - This function may be called from simultaneous threads with the same /// command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == pCommandId` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xff < desc->flags` ze_result_t ZE_APICALL zeCommandListGetNextCommandIdWithKernelsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in][out] pointer to mutable command identifier descriptor uint32_t numKernels, ///< [in][optional] number of entries on phKernels list ze_kernel_handle_t* phKernels, ///< [in][optional][range(0, numKernels)] list of kernels that user can ///< switch between using ::zeCommandListUpdateMutableCommandKernelsExp ///< call uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetNextCommandIdWithKernelsExp = ze_lib::context->zeDdiTable.load()->CommandListExp.pfnGetNextCommandIdWithKernelsExp; if( nullptr == pfnGetNextCommandIdWithKernelsExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetNextCommandIdWithKernelsExp( hCommandList, desc, numKernels, phKernels, pCommandId ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Updates mutable commands. /// /// @details /// - This function may only be called for a mutable command list. /// - The application must synchronize mutable command list execution before /// calling this function. /// - The application must close a mutable command list after completing all /// updates. /// - This function must not be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + Invalid kernel argument or not matching update descriptor provided ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_commands_exp_desc_t* desc ///< [in] pointer to mutable commands descriptor; multiple descriptors may ///< be chained via `pNext` member ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnUpdateMutableCommandsExp = ze_lib::context->zeDdiTable.load()->CommandListExp.pfnUpdateMutableCommandsExp; if( nullptr == pfnUpdateMutableCommandsExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnUpdateMutableCommandsExp( hCommandList, desc ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Updates the signal event for a mutable command in a mutable command /// list. /// /// @details /// - This function may only be called for a mutable command list. /// - The type, scope and flags of the signal event must match those of the /// source command. /// - The application must synchronize mutable command list execution before /// calling this function. /// - The application must close a mutable command list after completing all /// updates. /// - This function must not be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandSignalEventExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier ze_event_handle_t hSignalEvent ///< [in][optional] handle of the event to signal on completion ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnUpdateMutableCommandSignalEventExp = ze_lib::context->zeDdiTable.load()->CommandListExp.pfnUpdateMutableCommandSignalEventExp; if( nullptr == pfnUpdateMutableCommandSignalEventExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnUpdateMutableCommandSignalEventExp( hCommandList, commandId, hSignalEvent ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Updates the wait events for a mutable command in a mutable command /// list. /// /// @details /// - This function may only be called for a mutable command list. /// - The number of wait events must match that of the source command. /// - The type, scope and flags of the wait events must match those of the /// source command. /// - Passing `nullptr` as the wait events will update the command to not /// wait on any events prior to dispatch. /// - Passing `nullptr` as an event on event wait list will remove event /// dependency from this wait list slot. /// - The application must synchronize mutable command list execution before /// calling this function. /// - The application must close a mutable command list after completing all /// updates. /// - This function must not be called from simultaneous threads with the /// same command list handle. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + The `numWaitEvents` parameter does not match that of the original command. ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandWaitEventsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier uint32_t numWaitEvents, ///< [in][optional] the number of wait events ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnUpdateMutableCommandWaitEventsExp = ze_lib::context->zeDdiTable.load()->CommandListExp.pfnUpdateMutableCommandWaitEventsExp; if( nullptr == pfnUpdateMutableCommandWaitEventsExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnUpdateMutableCommandWaitEventsExp( hCommandList, commandId, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Updates the kernel for a mutable command in a mutable command list. /// /// @details /// - This function may only be called for a mutable command list. /// - The kernel handle must be from the provided list for given command id. /// - The application must synchronize mutable command list execution before /// calling this function. /// - The application must close a mutable command list after completing all /// updates. /// - This function must not be called from simultaneous threads with the /// same command list handle. /// - This function must be called before updating kernel arguments and /// dispatch parameters, when kernel is mutated. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCommandId` /// + `nullptr == phKernels` /// - ::ZE_RESULT_ERROR_INVALID_KERNEL_HANDLE /// + Invalid kernel handle provided for the mutation kernel instruction operation. ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandKernelsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] the number of kernels to update uint64_t* pCommandId, ///< [in][range(0, numKernels)] command identifier ze_kernel_handle_t* phKernels ///< [in][range(0, numKernels)] handle of the kernel for a command ///< identifier to switch to ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnUpdateMutableCommandKernelsExp = ze_lib::context->zeDdiTable.load()->CommandListExp.pfnUpdateMutableCommandKernelsExp; if( nullptr == pfnUpdateMutableCommandKernelsExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnUpdateMutableCommandKernelsExp( hCommandList, numKernels, pCommandId, phKernels ); } } // extern "C" level-zero-1.20.6/source/lib/ze_libddi.cpp000066400000000000000000000337401475521542100204000ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_libddi.cpp * */ #include "ze_lib.h" #ifndef DYNAMIC_LOAD_LOADER #include "ze_ddi.h" #endif namespace ze_lib { /////////////////////////////////////////////////////////////////////////////// #ifdef DYNAMIC_LOAD_LOADER __zedlllocal ze_result_t context_t::zeDdiTableInit() { ze_result_t result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetGlobalProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Global ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetRTASBuilderExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.RTASBuilderExp ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetRTASParallelOperationExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.RTASParallelOperationExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetDriverProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Driver ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetDriverExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.DriverExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetDeviceProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Device ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetDeviceExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.DeviceExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetContextProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Context ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetCommandQueueProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.CommandQueue ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetCommandListProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.CommandList ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetCommandListExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.CommandListExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetEventProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Event ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetEventExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.EventExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetEventPoolProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.EventPool ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetFenceProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Fence ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetImageProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Image ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetImageExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.ImageExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetKernelProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Kernel ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetKernelExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.KernelExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetMemProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Mem ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetMemExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.MemExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetModuleProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Module ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetModuleBuildLogProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.ModuleBuildLog ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetPhysicalMemProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.PhysicalMem ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetSamplerProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Sampler ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetVirtualMemProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.VirtualMem ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetFabricEdgeExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.FabricEdgeExp ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zeGetFabricVertexExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.FabricVertexExp ); } return result; } #else __zedlllocal ze_result_t context_t::zeDdiTableInit() { ze_result_t result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { result = zeGetGlobalProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Global ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zeGetRTASBuilderExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.RTASBuilderExp ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zeGetRTASParallelOperationExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.RTASParallelOperationExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetDriverProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Driver ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zeGetDriverExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.DriverExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetDeviceProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Device ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zeGetDeviceExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.DeviceExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetContextProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Context ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetCommandQueueProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.CommandQueue ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetCommandListProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.CommandList ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zeGetCommandListExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.CommandListExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetEventProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Event ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zeGetEventExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.EventExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetEventPoolProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.EventPool ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetFenceProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Fence ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetImageProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Image ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zeGetImageExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.ImageExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetKernelProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Kernel ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zeGetKernelExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.KernelExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetMemProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Mem ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zeGetMemExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.MemExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetModuleProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Module ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetModuleBuildLogProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.ModuleBuildLog ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetPhysicalMemProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.PhysicalMem ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetSamplerProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.Sampler ); } if( ZE_RESULT_SUCCESS == result ) { result = zeGetVirtualMemProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.VirtualMem ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zeGetFabricEdgeExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.FabricEdgeExp ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zeGetFabricVertexExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzeDdiTable.FabricVertexExp ); } return result; } #endif } // namespace ze_lib level-zero-1.20.6/source/lib/ze_tracing_register_cb_libapi.cpp000066400000000000000000004612131475521542100244700ustar00rootroot00000000000000/* * * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_tracing_register_cb_libapi.cpp * */ #include "ze_lib.h" #include "layers/zel_tracing_api.h" #include "layers/zel_tracing_ddi.h" #include "layers/zel_tracing_register_cb.h" #include "ze_api.h" extern "C" { /// APIs to register callbacks for each core API ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerInitRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnInitCb_t pfnInitCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnInitCb_t pfnInitCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerInitRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnInitCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetCb_t pfnGetCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetCb_t pfnGetCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDriverGetRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerInitDriversRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnInitDriversCb_t pfnInitDriversCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnInitDriversCb_t pfnInitDriversCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerInitDriversRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnInitDriversCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetApiVersionRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetApiVersionCb_t pfnGetApiVersionCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetApiVersionCb_t pfnGetApiVersionCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDriverGetApiVersionRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetApiVersionCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetPropertiesCb_t pfnGetPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetPropertiesCb_t pfnGetPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDriverGetPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetIpcPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetIpcPropertiesCb_t pfnGetIpcPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetIpcPropertiesCb_t pfnGetIpcPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDriverGetIpcPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetIpcPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetExtensionPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetExtensionPropertiesCb_t pfnGetExtensionPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetExtensionPropertiesCb_t pfnGetExtensionPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDriverGetExtensionPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetExtensionPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetExtensionFunctionAddressRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetExtensionFunctionAddressCb_t pfnGetExtensionFunctionAddressCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetExtensionFunctionAddressCb_t pfnGetExtensionFunctionAddressCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDriverGetExtensionFunctionAddressRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetExtensionFunctionAddressCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverGetLastErrorDescriptionRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetLastErrorDescriptionCb_t pfnGetLastErrorDescriptionCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverGetLastErrorDescriptionCb_t pfnGetLastErrorDescriptionCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDriverGetLastErrorDescriptionRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetLastErrorDescriptionCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetCb_t pfnGetCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetCb_t pfnGetCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetRootDeviceRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetRootDeviceCb_t pfnGetRootDeviceCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetRootDeviceCb_t pfnGetRootDeviceCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetRootDeviceRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetRootDeviceCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetSubDevicesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetSubDevicesCb_t pfnGetSubDevicesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetSubDevicesCb_t pfnGetSubDevicesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetSubDevicesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetSubDevicesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetPropertiesCb_t pfnGetPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetPropertiesCb_t pfnGetPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetComputePropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetComputePropertiesCb_t pfnGetComputePropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetComputePropertiesCb_t pfnGetComputePropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetComputePropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetComputePropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetModulePropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetModulePropertiesCb_t pfnGetModulePropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetModulePropertiesCb_t pfnGetModulePropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetModulePropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetModulePropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetCommandQueueGroupPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetCommandQueueGroupPropertiesCb_t pfnGetCommandQueueGroupPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetCommandQueueGroupPropertiesCb_t pfnGetCommandQueueGroupPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetCommandQueueGroupPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetCommandQueueGroupPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetMemoryPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetMemoryPropertiesCb_t pfnGetMemoryPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetMemoryPropertiesCb_t pfnGetMemoryPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetMemoryPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetMemoryPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetMemoryAccessPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetMemoryAccessPropertiesCb_t pfnGetMemoryAccessPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetMemoryAccessPropertiesCb_t pfnGetMemoryAccessPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetMemoryAccessPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetMemoryAccessPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetCachePropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetCachePropertiesCb_t pfnGetCachePropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetCachePropertiesCb_t pfnGetCachePropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetCachePropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetCachePropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetImagePropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetImagePropertiesCb_t pfnGetImagePropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetImagePropertiesCb_t pfnGetImagePropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetImagePropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetImagePropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetExternalMemoryPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetExternalMemoryPropertiesCb_t pfnGetExternalMemoryPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetExternalMemoryPropertiesCb_t pfnGetExternalMemoryPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetExternalMemoryPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetExternalMemoryPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetP2PPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetP2PPropertiesCb_t pfnGetP2PPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetP2PPropertiesCb_t pfnGetP2PPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetP2PPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetP2PPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceCanAccessPeerRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceCanAccessPeerCb_t pfnCanAccessPeerCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceCanAccessPeerCb_t pfnCanAccessPeerCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceCanAccessPeerRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCanAccessPeerCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetStatusRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetStatusCb_t pfnGetStatusCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetStatusCb_t pfnGetStatusCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetStatusRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetStatusCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetGlobalTimestampsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetGlobalTimestampsCb_t pfnGetGlobalTimestampsCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetGlobalTimestampsCb_t pfnGetGlobalTimestampsCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetGlobalTimestampsRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetGlobalTimestampsCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextCreateCb_t pfnCreateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextCreateCb_t pfnCreateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerContextCreateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextCreateExRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextCreateExCb_t pfnCreateExCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextCreateExCb_t pfnCreateExCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerContextCreateExRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateExCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextDestroyCb_t pfnDestroyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextDestroyCb_t pfnDestroyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerContextDestroyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextGetStatusRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextGetStatusCb_t pfnGetStatusCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextGetStatusCb_t pfnGetStatusCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerContextGetStatusRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetStatusCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueCreateCb_t pfnCreateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueCreateCb_t pfnCreateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandQueueCreateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueDestroyCb_t pfnDestroyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueDestroyCb_t pfnDestroyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandQueueDestroyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueExecuteCommandListsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueExecuteCommandListsCb_t pfnExecuteCommandListsCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueExecuteCommandListsCb_t pfnExecuteCommandListsCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandQueueExecuteCommandListsRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnExecuteCommandListsCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueSynchronizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueSynchronizeCb_t pfnSynchronizeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueSynchronizeCb_t pfnSynchronizeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandQueueSynchronizeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSynchronizeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueGetOrdinalRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueGetOrdinalCb_t pfnGetOrdinalCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueGetOrdinalCb_t pfnGetOrdinalCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandQueueGetOrdinalRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetOrdinalCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandQueueGetIndexRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueGetIndexCb_t pfnGetIndexCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandQueueGetIndexCb_t pfnGetIndexCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandQueueGetIndexRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetIndexCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCreateCb_t pfnCreateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCreateCb_t pfnCreateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListCreateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListCreateImmediateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCreateImmediateCb_t pfnCreateImmediateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCreateImmediateCb_t pfnCreateImmediateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListCreateImmediateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateImmediateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListDestroyCb_t pfnDestroyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListDestroyCb_t pfnDestroyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListDestroyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListCloseRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCloseCb_t pfnCloseCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCloseCb_t pfnCloseCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListCloseRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCloseCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListResetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListResetCb_t pfnResetCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListResetCb_t pfnResetCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListResetRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnResetCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendWriteGlobalTimestampRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendWriteGlobalTimestampCb_t pfnAppendWriteGlobalTimestampCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendWriteGlobalTimestampCb_t pfnAppendWriteGlobalTimestampCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendWriteGlobalTimestampRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendWriteGlobalTimestampCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListHostSynchronizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListHostSynchronizeCb_t pfnHostSynchronizeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListHostSynchronizeCb_t pfnHostSynchronizeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListHostSynchronizeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnHostSynchronizeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetDeviceHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetDeviceHandleCb_t pfnGetDeviceHandleCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetDeviceHandleCb_t pfnGetDeviceHandleCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListGetDeviceHandleRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetDeviceHandleCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetContextHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetContextHandleCb_t pfnGetContextHandleCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetContextHandleCb_t pfnGetContextHandleCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListGetContextHandleRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetContextHandleCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetOrdinalRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetOrdinalCb_t pfnGetOrdinalCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetOrdinalCb_t pfnGetOrdinalCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListGetOrdinalRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetOrdinalCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListImmediateGetIndexRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListImmediateGetIndexCb_t pfnImmediateGetIndexCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListImmediateGetIndexCb_t pfnImmediateGetIndexCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListImmediateGetIndexRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnImmediateGetIndexCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListIsImmediateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListIsImmediateCb_t pfnIsImmediateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListIsImmediateCb_t pfnIsImmediateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListIsImmediateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnIsImmediateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendBarrierRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendBarrierCb_t pfnAppendBarrierCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendBarrierCb_t pfnAppendBarrierCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendBarrierRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendBarrierCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryRangesBarrierRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryRangesBarrierCb_t pfnAppendMemoryRangesBarrierCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryRangesBarrierCb_t pfnAppendMemoryRangesBarrierCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendMemoryRangesBarrierRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendMemoryRangesBarrierCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextSystemBarrierRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextSystemBarrierCb_t pfnSystemBarrierCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextSystemBarrierCb_t pfnSystemBarrierCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerContextSystemBarrierRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSystemBarrierCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryCopyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryCopyCb_t pfnAppendMemoryCopyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryCopyCb_t pfnAppendMemoryCopyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendMemoryCopyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendMemoryCopyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryFillRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryFillCb_t pfnAppendMemoryFillCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryFillCb_t pfnAppendMemoryFillCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendMemoryFillRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendMemoryFillCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryCopyRegionRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryCopyRegionCb_t pfnAppendMemoryCopyRegionCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryCopyRegionCb_t pfnAppendMemoryCopyRegionCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendMemoryCopyRegionRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendMemoryCopyRegionCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryCopyFromContextRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryCopyFromContextCb_t pfnAppendMemoryCopyFromContextCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryCopyFromContextCb_t pfnAppendMemoryCopyFromContextCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendMemoryCopyFromContextRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendMemoryCopyFromContextCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyCb_t pfnAppendImageCopyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyCb_t pfnAppendImageCopyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendImageCopyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendImageCopyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyRegionRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyRegionCb_t pfnAppendImageCopyRegionCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyRegionCb_t pfnAppendImageCopyRegionCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendImageCopyRegionRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendImageCopyRegionCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyToMemoryRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyToMemoryCb_t pfnAppendImageCopyToMemoryCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyToMemoryCb_t pfnAppendImageCopyToMemoryCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendImageCopyToMemoryRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendImageCopyToMemoryCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyFromMemoryRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyFromMemoryCb_t pfnAppendImageCopyFromMemoryCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyFromMemoryCb_t pfnAppendImageCopyFromMemoryCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendImageCopyFromMemoryRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendImageCopyFromMemoryCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemoryPrefetchRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryPrefetchCb_t pfnAppendMemoryPrefetchCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemoryPrefetchCb_t pfnAppendMemoryPrefetchCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendMemoryPrefetchRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendMemoryPrefetchCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendMemAdviseRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemAdviseCb_t pfnAppendMemAdviseCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendMemAdviseCb_t pfnAppendMemAdviseCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendMemAdviseRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendMemAdviseCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolCreateCb_t pfnCreateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolCreateCb_t pfnCreateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventPoolCreateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolDestroyCb_t pfnDestroyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolDestroyCb_t pfnDestroyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventPoolDestroyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventCreateCb_t pfnCreateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventCreateCb_t pfnCreateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventCreateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventDestroyCb_t pfnDestroyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventDestroyCb_t pfnDestroyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventDestroyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolGetIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolGetIpcHandleCb_t pfnGetIpcHandleCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolGetIpcHandleCb_t pfnGetIpcHandleCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventPoolGetIpcHandleRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetIpcHandleCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolPutIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolPutIpcHandleCb_t pfnPutIpcHandleCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolPutIpcHandleCb_t pfnPutIpcHandleCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventPoolPutIpcHandleRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnPutIpcHandleCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolOpenIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolOpenIpcHandleCb_t pfnOpenIpcHandleCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolOpenIpcHandleCb_t pfnOpenIpcHandleCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventPoolOpenIpcHandleRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnOpenIpcHandleCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolCloseIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolCloseIpcHandleCb_t pfnCloseIpcHandleCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolCloseIpcHandleCb_t pfnCloseIpcHandleCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventPoolCloseIpcHandleRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCloseIpcHandleCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendSignalEventRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendSignalEventCb_t pfnAppendSignalEventCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendSignalEventCb_t pfnAppendSignalEventCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendSignalEventRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendSignalEventCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendWaitOnEventsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendWaitOnEventsCb_t pfnAppendWaitOnEventsCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendWaitOnEventsCb_t pfnAppendWaitOnEventsCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendWaitOnEventsRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendWaitOnEventsCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventHostSignalRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventHostSignalCb_t pfnHostSignalCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventHostSignalCb_t pfnHostSignalCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventHostSignalRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnHostSignalCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventHostSynchronizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventHostSynchronizeCb_t pfnHostSynchronizeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventHostSynchronizeCb_t pfnHostSynchronizeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventHostSynchronizeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnHostSynchronizeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventQueryStatusRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryStatusCb_t pfnQueryStatusCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryStatusCb_t pfnQueryStatusCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventQueryStatusRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnQueryStatusCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendEventResetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendEventResetCb_t pfnAppendEventResetCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendEventResetCb_t pfnAppendEventResetCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendEventResetRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendEventResetCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventHostResetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventHostResetCb_t pfnHostResetCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventHostResetCb_t pfnHostResetCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventHostResetRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnHostResetCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventQueryKernelTimestampRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryKernelTimestampCb_t pfnQueryKernelTimestampCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryKernelTimestampCb_t pfnQueryKernelTimestampCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventQueryKernelTimestampRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnQueryKernelTimestampCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendQueryKernelTimestampsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendQueryKernelTimestampsCb_t pfnAppendQueryKernelTimestampsCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendQueryKernelTimestampsCb_t pfnAppendQueryKernelTimestampsCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendQueryKernelTimestampsRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendQueryKernelTimestampsCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventGetEventPoolRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventGetEventPoolCb_t pfnGetEventPoolCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventGetEventPoolCb_t pfnGetEventPoolCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventGetEventPoolRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetEventPoolCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventGetSignalScopeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventGetSignalScopeCb_t pfnGetSignalScopeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventGetSignalScopeCb_t pfnGetSignalScopeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventGetSignalScopeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetSignalScopeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventGetWaitScopeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventGetWaitScopeCb_t pfnGetWaitScopeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventGetWaitScopeCb_t pfnGetWaitScopeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventGetWaitScopeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetWaitScopeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolGetContextHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolGetContextHandleCb_t pfnGetContextHandleCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolGetContextHandleCb_t pfnGetContextHandleCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventPoolGetContextHandleRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetContextHandleCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventPoolGetFlagsRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolGetFlagsCb_t pfnGetFlagsCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventPoolGetFlagsCb_t pfnGetFlagsCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventPoolGetFlagsRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetFlagsCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFenceCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceCreateCb_t pfnCreateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceCreateCb_t pfnCreateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerFenceCreateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFenceDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceDestroyCb_t pfnDestroyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceDestroyCb_t pfnDestroyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerFenceDestroyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFenceHostSynchronizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceHostSynchronizeCb_t pfnHostSynchronizeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceHostSynchronizeCb_t pfnHostSynchronizeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerFenceHostSynchronizeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnHostSynchronizeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFenceQueryStatusRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceQueryStatusCb_t pfnQueryStatusCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceQueryStatusCb_t pfnQueryStatusCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerFenceQueryStatusRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnQueryStatusCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFenceResetRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceResetCb_t pfnResetCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFenceResetCb_t pfnResetCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerFenceResetRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnResetCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetPropertiesCb_t pfnGetPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetPropertiesCb_t pfnGetPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerImageGetPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageCreateCb_t pfnCreateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageCreateCb_t pfnCreateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerImageCreateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageDestroyCb_t pfnDestroyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageDestroyCb_t pfnDestroyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerImageDestroyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemAllocSharedRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemAllocSharedCb_t pfnAllocSharedCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemAllocSharedCb_t pfnAllocSharedCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemAllocSharedRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAllocSharedCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemAllocDeviceRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemAllocDeviceCb_t pfnAllocDeviceCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemAllocDeviceCb_t pfnAllocDeviceCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemAllocDeviceRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAllocDeviceCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemAllocHostRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemAllocHostCb_t pfnAllocHostCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemAllocHostCb_t pfnAllocHostCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemAllocHostRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAllocHostCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemFreeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemFreeCb_t pfnFreeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemFreeCb_t pfnFreeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemFreeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnFreeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetAllocPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetAllocPropertiesCb_t pfnGetAllocPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetAllocPropertiesCb_t pfnGetAllocPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemGetAllocPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetAllocPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetAddressRangeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetAddressRangeCb_t pfnGetAddressRangeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetAddressRangeCb_t pfnGetAddressRangeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemGetAddressRangeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetAddressRangeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetIpcHandleCb_t pfnGetIpcHandleCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetIpcHandleCb_t pfnGetIpcHandleCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemGetIpcHandleRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetIpcHandleCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetIpcHandleFromFileDescriptorExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetIpcHandleFromFileDescriptorExpCb_t pfnGetIpcHandleFromFileDescriptorExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetIpcHandleFromFileDescriptorExpCb_t pfnGetIpcHandleFromFileDescriptorExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemGetIpcHandleFromFileDescriptorExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetIpcHandleFromFileDescriptorExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetFileDescriptorFromIpcHandleExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetFileDescriptorFromIpcHandleExpCb_t pfnGetFileDescriptorFromIpcHandleExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetFileDescriptorFromIpcHandleExpCb_t pfnGetFileDescriptorFromIpcHandleExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemGetFileDescriptorFromIpcHandleExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetFileDescriptorFromIpcHandleExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemPutIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemPutIpcHandleCb_t pfnPutIpcHandleCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemPutIpcHandleCb_t pfnPutIpcHandleCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemPutIpcHandleRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnPutIpcHandleCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemOpenIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemOpenIpcHandleCb_t pfnOpenIpcHandleCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemOpenIpcHandleCb_t pfnOpenIpcHandleCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemOpenIpcHandleRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnOpenIpcHandleCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemCloseIpcHandleRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemCloseIpcHandleCb_t pfnCloseIpcHandleCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemCloseIpcHandleCb_t pfnCloseIpcHandleCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemCloseIpcHandleRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCloseIpcHandleCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemSetAtomicAccessAttributeExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemSetAtomicAccessAttributeExpCb_t pfnSetAtomicAccessAttributeExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemSetAtomicAccessAttributeExpCb_t pfnSetAtomicAccessAttributeExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemSetAtomicAccessAttributeExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSetAtomicAccessAttributeExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetAtomicAccessAttributeExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetAtomicAccessAttributeExpCb_t pfnGetAtomicAccessAttributeExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetAtomicAccessAttributeExpCb_t pfnGetAtomicAccessAttributeExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemGetAtomicAccessAttributeExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetAtomicAccessAttributeExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleCreateCb_t pfnCreateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleCreateCb_t pfnCreateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerModuleCreateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleDestroyCb_t pfnDestroyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleDestroyCb_t pfnDestroyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerModuleDestroyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleDynamicLinkRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleDynamicLinkCb_t pfnDynamicLinkCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleDynamicLinkCb_t pfnDynamicLinkCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerModuleDynamicLinkRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDynamicLinkCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleBuildLogDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleBuildLogDestroyCb_t pfnDestroyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleBuildLogDestroyCb_t pfnDestroyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerModuleBuildLogDestroyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleBuildLogGetStringRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleBuildLogGetStringCb_t pfnGetStringCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleBuildLogGetStringCb_t pfnGetStringCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerModuleBuildLogGetStringRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetStringCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleGetNativeBinaryRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetNativeBinaryCb_t pfnGetNativeBinaryCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetNativeBinaryCb_t pfnGetNativeBinaryCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerModuleGetNativeBinaryRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetNativeBinaryCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleGetGlobalPointerRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetGlobalPointerCb_t pfnGetGlobalPointerCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetGlobalPointerCb_t pfnGetGlobalPointerCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerModuleGetGlobalPointerRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetGlobalPointerCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleGetKernelNamesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetKernelNamesCb_t pfnGetKernelNamesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetKernelNamesCb_t pfnGetKernelNamesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerModuleGetKernelNamesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetKernelNamesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetPropertiesCb_t pfnGetPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetPropertiesCb_t pfnGetPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerModuleGetPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelCreateCb_t pfnCreateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelCreateCb_t pfnCreateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelCreateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelDestroyCb_t pfnDestroyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelDestroyCb_t pfnDestroyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelDestroyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleGetFunctionPointerRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetFunctionPointerCb_t pfnGetFunctionPointerCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleGetFunctionPointerCb_t pfnGetFunctionPointerCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerModuleGetFunctionPointerRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetFunctionPointerCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSetGroupSizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetGroupSizeCb_t pfnSetGroupSizeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetGroupSizeCb_t pfnSetGroupSizeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelSetGroupSizeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSetGroupSizeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSuggestGroupSizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSuggestGroupSizeCb_t pfnSuggestGroupSizeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSuggestGroupSizeCb_t pfnSuggestGroupSizeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelSuggestGroupSizeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSuggestGroupSizeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSuggestMaxCooperativeGroupCountRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSuggestMaxCooperativeGroupCountCb_t pfnSuggestMaxCooperativeGroupCountCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSuggestMaxCooperativeGroupCountCb_t pfnSuggestMaxCooperativeGroupCountCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelSuggestMaxCooperativeGroupCountRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSuggestMaxCooperativeGroupCountCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSetArgumentValueRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetArgumentValueCb_t pfnSetArgumentValueCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetArgumentValueCb_t pfnSetArgumentValueCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelSetArgumentValueRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSetArgumentValueCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSetIndirectAccessRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetIndirectAccessCb_t pfnSetIndirectAccessCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetIndirectAccessCb_t pfnSetIndirectAccessCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelSetIndirectAccessRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSetIndirectAccessCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelGetIndirectAccessRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetIndirectAccessCb_t pfnGetIndirectAccessCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetIndirectAccessCb_t pfnGetIndirectAccessCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelGetIndirectAccessRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetIndirectAccessCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelGetSourceAttributesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetSourceAttributesCb_t pfnGetSourceAttributesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetSourceAttributesCb_t pfnGetSourceAttributesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelGetSourceAttributesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetSourceAttributesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSetCacheConfigRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetCacheConfigCb_t pfnSetCacheConfigCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetCacheConfigCb_t pfnSetCacheConfigCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelSetCacheConfigRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSetCacheConfigCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelGetPropertiesRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetPropertiesCb_t pfnGetPropertiesCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetPropertiesCb_t pfnGetPropertiesCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelGetPropertiesRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetPropertiesCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelGetNameRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetNameCb_t pfnGetNameCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetNameCb_t pfnGetNameCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelGetNameRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetNameCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendLaunchKernelRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchKernelCb_t pfnAppendLaunchKernelCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchKernelCb_t pfnAppendLaunchKernelCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendLaunchKernelRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendLaunchKernelCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendLaunchCooperativeKernelRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchCooperativeKernelCb_t pfnAppendLaunchCooperativeKernelCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchCooperativeKernelCb_t pfnAppendLaunchCooperativeKernelCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendLaunchCooperativeKernelRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendLaunchCooperativeKernelCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendLaunchKernelIndirectRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchKernelIndirectCb_t pfnAppendLaunchKernelIndirectCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchKernelIndirectCb_t pfnAppendLaunchKernelIndirectCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendLaunchKernelIndirectRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendLaunchKernelIndirectCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendLaunchMultipleKernelsIndirectRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchMultipleKernelsIndirectCb_t pfnAppendLaunchMultipleKernelsIndirectCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendLaunchMultipleKernelsIndirectCb_t pfnAppendLaunchMultipleKernelsIndirectCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendLaunchMultipleKernelsIndirectRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendLaunchMultipleKernelsIndirectCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextMakeMemoryResidentRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextMakeMemoryResidentCb_t pfnMakeMemoryResidentCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextMakeMemoryResidentCb_t pfnMakeMemoryResidentCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerContextMakeMemoryResidentRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnMakeMemoryResidentCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextEvictMemoryRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextEvictMemoryCb_t pfnEvictMemoryCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextEvictMemoryCb_t pfnEvictMemoryCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerContextEvictMemoryRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnEvictMemoryCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextMakeImageResidentRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextMakeImageResidentCb_t pfnMakeImageResidentCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextMakeImageResidentCb_t pfnMakeImageResidentCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerContextMakeImageResidentRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnMakeImageResidentCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerContextEvictImageRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextEvictImageCb_t pfnEvictImageCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnContextEvictImageCb_t pfnEvictImageCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerContextEvictImageRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnEvictImageCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerSamplerCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnSamplerCreateCb_t pfnCreateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnSamplerCreateCb_t pfnCreateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerSamplerCreateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerSamplerDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnSamplerDestroyCb_t pfnDestroyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnSamplerDestroyCb_t pfnDestroyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerSamplerDestroyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemReserveRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemReserveCb_t pfnReserveCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemReserveCb_t pfnReserveCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerVirtualMemReserveRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnReserveCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemFreeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemFreeCb_t pfnFreeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemFreeCb_t pfnFreeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerVirtualMemFreeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnFreeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemQueryPageSizeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemQueryPageSizeCb_t pfnQueryPageSizeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemQueryPageSizeCb_t pfnQueryPageSizeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerVirtualMemQueryPageSizeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnQueryPageSizeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerPhysicalMemCreateRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnPhysicalMemCreateCb_t pfnCreateCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnPhysicalMemCreateCb_t pfnCreateCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerPhysicalMemCreateRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerPhysicalMemDestroyRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnPhysicalMemDestroyCb_t pfnDestroyCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnPhysicalMemDestroyCb_t pfnDestroyCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerPhysicalMemDestroyRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemMapRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemMapCb_t pfnMapCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemMapCb_t pfnMapCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerVirtualMemMapRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnMapCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemUnmapRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemUnmapCb_t pfnUnmapCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemUnmapCb_t pfnUnmapCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerVirtualMemUnmapRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnUnmapCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemSetAccessAttributeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemSetAccessAttributeCb_t pfnSetAccessAttributeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemSetAccessAttributeCb_t pfnSetAccessAttributeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerVirtualMemSetAccessAttributeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSetAccessAttributeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerVirtualMemGetAccessAttributeRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemGetAccessAttributeCb_t pfnGetAccessAttributeCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnVirtualMemGetAccessAttributeCb_t pfnGetAccessAttributeCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerVirtualMemGetAccessAttributeRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetAccessAttributeCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSetGlobalOffsetExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetGlobalOffsetExpCb_t pfnSetGlobalOffsetExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSetGlobalOffsetExpCb_t pfnSetGlobalOffsetExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelSetGlobalOffsetExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSetGlobalOffsetExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelGetBinaryExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetBinaryExpCb_t pfnGetBinaryExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelGetBinaryExpCb_t pfnGetBinaryExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelGetBinaryExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetBinaryExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceImportExternalSemaphoreExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceImportExternalSemaphoreExtCb_t pfnImportExternalSemaphoreExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceImportExternalSemaphoreExtCb_t pfnImportExternalSemaphoreExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceImportExternalSemaphoreExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnImportExternalSemaphoreExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceReleaseExternalSemaphoreExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceReleaseExternalSemaphoreExtCb_t pfnReleaseExternalSemaphoreExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceReleaseExternalSemaphoreExtCb_t pfnReleaseExternalSemaphoreExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceReleaseExternalSemaphoreExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnReleaseExternalSemaphoreExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendSignalExternalSemaphoreExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendSignalExternalSemaphoreExtCb_t pfnAppendSignalExternalSemaphoreExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendSignalExternalSemaphoreExtCb_t pfnAppendSignalExternalSemaphoreExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendSignalExternalSemaphoreExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendSignalExternalSemaphoreExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendWaitExternalSemaphoreExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendWaitExternalSemaphoreExtCb_t pfnAppendWaitExternalSemaphoreExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendWaitExternalSemaphoreExtCb_t pfnAppendWaitExternalSemaphoreExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendWaitExternalSemaphoreExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendWaitExternalSemaphoreExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceReserveCacheExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceReserveCacheExtCb_t pfnReserveCacheExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceReserveCacheExtCb_t pfnReserveCacheExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceReserveCacheExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnReserveCacheExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceSetCacheAdviceExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceSetCacheAdviceExtCb_t pfnSetCacheAdviceExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceSetCacheAdviceExtCb_t pfnSetCacheAdviceExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceSetCacheAdviceExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSetCacheAdviceExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventQueryTimestampsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryTimestampsExpCb_t pfnQueryTimestampsExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryTimestampsExpCb_t pfnQueryTimestampsExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventQueryTimestampsExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnQueryTimestampsExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageGetMemoryPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetMemoryPropertiesExpCb_t pfnGetMemoryPropertiesExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetMemoryPropertiesExpCb_t pfnGetMemoryPropertiesExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerImageGetMemoryPropertiesExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetMemoryPropertiesExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageViewCreateExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageViewCreateExtCb_t pfnViewCreateExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageViewCreateExtCb_t pfnViewCreateExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerImageViewCreateExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnViewCreateExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageViewCreateExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageViewCreateExpCb_t pfnViewCreateExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageViewCreateExpCb_t pfnViewCreateExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerImageViewCreateExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnViewCreateExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerKernelSchedulingHintExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSchedulingHintExpCb_t pfnSchedulingHintExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnKernelSchedulingHintExpCb_t pfnSchedulingHintExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerKernelSchedulingHintExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnSchedulingHintExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDevicePciGetPropertiesExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDevicePciGetPropertiesExtCb_t pfnPciGetPropertiesExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDevicePciGetPropertiesExtCb_t pfnPciGetPropertiesExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDevicePciGetPropertiesExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnPciGetPropertiesExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyToMemoryExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyToMemoryExtCb_t pfnAppendImageCopyToMemoryExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyToMemoryExtCb_t pfnAppendImageCopyToMemoryExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendImageCopyToMemoryExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendImageCopyToMemoryExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListAppendImageCopyFromMemoryExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyFromMemoryExtCb_t pfnAppendImageCopyFromMemoryExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListAppendImageCopyFromMemoryExtCb_t pfnAppendImageCopyFromMemoryExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListAppendImageCopyFromMemoryExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnAppendImageCopyFromMemoryExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageGetAllocPropertiesExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetAllocPropertiesExtCb_t pfnGetAllocPropertiesExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetAllocPropertiesExtCb_t pfnGetAllocPropertiesExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerImageGetAllocPropertiesExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetAllocPropertiesExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerModuleInspectLinkageExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleInspectLinkageExtCb_t pfnInspectLinkageExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnModuleInspectLinkageExtCb_t pfnInspectLinkageExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerModuleInspectLinkageExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnInspectLinkageExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemFreeExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemFreeExtCb_t pfnFreeExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemFreeExtCb_t pfnFreeExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemFreeExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnFreeExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricVertexGetExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetExpCb_t pfnGetExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetExpCb_t pfnGetExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerFabricVertexGetExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricVertexGetSubVerticesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetSubVerticesExpCb_t pfnGetSubVerticesExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetSubVerticesExpCb_t pfnGetSubVerticesExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerFabricVertexGetSubVerticesExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetSubVerticesExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricVertexGetPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetPropertiesExpCb_t pfnGetPropertiesExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetPropertiesExpCb_t pfnGetPropertiesExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerFabricVertexGetPropertiesExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetPropertiesExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricVertexGetDeviceExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetDeviceExpCb_t pfnGetDeviceExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricVertexGetDeviceExpCb_t pfnGetDeviceExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerFabricVertexGetDeviceExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetDeviceExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDeviceGetFabricVertexExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetFabricVertexExpCb_t pfnGetFabricVertexExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDeviceGetFabricVertexExpCb_t pfnGetFabricVertexExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDeviceGetFabricVertexExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetFabricVertexExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricEdgeGetExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricEdgeGetExpCb_t pfnGetExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricEdgeGetExpCb_t pfnGetExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerFabricEdgeGetExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricEdgeGetVerticesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricEdgeGetVerticesExpCb_t pfnGetVerticesExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricEdgeGetVerticesExpCb_t pfnGetVerticesExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerFabricEdgeGetVerticesExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetVerticesExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerFabricEdgeGetPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricEdgeGetPropertiesExpCb_t pfnGetPropertiesExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnFabricEdgeGetPropertiesExpCb_t pfnGetPropertiesExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerFabricEdgeGetPropertiesExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetPropertiesExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerEventQueryKernelTimestampsExtRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryKernelTimestampsExtCb_t pfnQueryKernelTimestampsExtCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnEventQueryKernelTimestampsExtCb_t pfnQueryKernelTimestampsExtCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerEventQueryKernelTimestampsExtRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnQueryKernelTimestampsExtCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASBuilderCreateExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderCreateExpCb_t pfnCreateExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderCreateExpCb_t pfnCreateExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASBuilderCreateExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASBuilderGetBuildPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderGetBuildPropertiesExpCb_t pfnGetBuildPropertiesExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderGetBuildPropertiesExpCb_t pfnGetBuildPropertiesExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASBuilderGetBuildPropertiesExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetBuildPropertiesExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerDriverRTASFormatCompatibilityCheckExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverRTASFormatCompatibilityCheckExpCb_t pfnRTASFormatCompatibilityCheckExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnDriverRTASFormatCompatibilityCheckExpCb_t pfnRTASFormatCompatibilityCheckExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerDriverRTASFormatCompatibilityCheckExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnRTASFormatCompatibilityCheckExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASBuilderBuildExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderBuildExpCb_t pfnBuildExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderBuildExpCb_t pfnBuildExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASBuilderBuildExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnBuildExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASBuilderDestroyExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderDestroyExpCb_t pfnDestroyExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASBuilderDestroyExpCb_t pfnDestroyExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASBuilderDestroyExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASParallelOperationCreateExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationCreateExpCb_t pfnCreateExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationCreateExpCb_t pfnCreateExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASParallelOperationCreateExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASParallelOperationGetPropertiesExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationGetPropertiesExpCb_t pfnGetPropertiesExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationGetPropertiesExpCb_t pfnGetPropertiesExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASParallelOperationGetPropertiesExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetPropertiesExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASParallelOperationJoinExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationJoinExpCb_t pfnJoinExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationJoinExpCb_t pfnJoinExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASParallelOperationJoinExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnJoinExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerRTASParallelOperationDestroyExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationDestroyExpCb_t pfnDestroyExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnRTASParallelOperationDestroyExpCb_t pfnDestroyExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerRTASParallelOperationDestroyExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnDestroyExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerMemGetPitchFor2dImageRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetPitchFor2dImageCb_t pfnGetPitchFor2dImageCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnMemGetPitchFor2dImageCb_t pfnGetPitchFor2dImageCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerMemGetPitchFor2dImageRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetPitchFor2dImageCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerImageGetDeviceOffsetExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetDeviceOffsetExpCb_t pfnGetDeviceOffsetExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnImageGetDeviceOffsetExpCb_t pfnGetDeviceOffsetExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerImageGetDeviceOffsetExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetDeviceOffsetExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListCreateCloneExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCreateCloneExpCb_t pfnCreateCloneExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListCreateCloneExpCb_t pfnCreateCloneExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListCreateCloneExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnCreateCloneExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListImmediateAppendCommandListsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListImmediateAppendCommandListsExpCb_t pfnImmediateAppendCommandListsExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListImmediateAppendCommandListsExpCb_t pfnImmediateAppendCommandListsExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListImmediateAppendCommandListsExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnImmediateAppendCommandListsExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetNextCommandIdExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetNextCommandIdExpCb_t pfnGetNextCommandIdExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetNextCommandIdExpCb_t pfnGetNextCommandIdExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListGetNextCommandIdExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetNextCommandIdExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListGetNextCommandIdWithKernelsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetNextCommandIdWithKernelsExpCb_t pfnGetNextCommandIdWithKernelsExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListGetNextCommandIdWithKernelsExpCb_t pfnGetNextCommandIdWithKernelsExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListGetNextCommandIdWithKernelsExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnGetNextCommandIdWithKernelsExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListUpdateMutableCommandsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandsExpCb_t pfnUpdateMutableCommandsExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandsExpCb_t pfnUpdateMutableCommandsExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListUpdateMutableCommandsExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnUpdateMutableCommandsExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListUpdateMutableCommandSignalEventExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandSignalEventExpCb_t pfnUpdateMutableCommandSignalEventExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandSignalEventExpCb_t pfnUpdateMutableCommandSignalEventExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListUpdateMutableCommandSignalEventExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnUpdateMutableCommandSignalEventExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListUpdateMutableCommandWaitEventsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandWaitEventsExpCb_t pfnUpdateMutableCommandWaitEventsExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandWaitEventsExpCb_t pfnUpdateMutableCommandWaitEventsExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListUpdateMutableCommandWaitEventsExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnUpdateMutableCommandWaitEventsExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } ZE_APIEXPORT ze_result_t ZE_APICALL zelTracerCommandListUpdateMutableCommandKernelsExpRegisterCallback( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandKernelsExpCb_t pfnUpdateMutableCommandKernelsExpCb ) { if(!ze_lib::context->tracing_lib) return ZE_RESULT_ERROR_UNINITIALIZED; typedef ze_result_t (ZE_APICALL *ze_pfnSetCallback_t)( zel_tracer_handle_t hTracer, zel_tracer_reg_t callback_type, ze_pfnCommandListUpdateMutableCommandKernelsExpCb_t pfnUpdateMutableCommandKernelsExpCb ); auto func = reinterpret_cast( GET_FUNCTION_PTR(ze_lib::context->tracing_lib, "zelTracerCommandListUpdateMutableCommandKernelsExpRegisterCallback") ); if(func) return func(hTracer, callback_type, pfnUpdateMutableCommandKernelsExpCb); return ZE_RESULT_ERROR_UNINITIALIZED; } } //Extern Clevel-zero-1.20.6/source/lib/zel_tracing_libapi.cpp000066400000000000000000000146151475521542100222740ustar00rootroot00000000000000/* * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_tracing_libapi.cpp * * @brief C++ static library for zel tracing layer API. * * Perhaps generate this from scripts in the future. */ #include "ze_lib.h" extern "C" { /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a tracer on the context. /// /// @details /// - The tracer is created in the disabled state. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == desc->pUserData` /// + `nullptr == phTracer` /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY ze_result_t ZE_APICALL zelTracerCreate( const zel_tracer_desc_t* desc, ///< [in] pointer to tracer descriptor zel_tracer_handle_t* phTracer ///< [out] pointer to handle of tracer object created ) { if(ze_lib::destruction) return ZE_RESULT_ERROR_UNINITIALIZED; auto pfnCreate = ze_lib::context->zelTracingDdiTable.Tracer.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; return pfnCreate( desc, phTracer ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a tracer. /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// - The implementation of this function must be thread-safe. /// - The implementation of this function will stall and wait on any /// outstanding threads executing callbacks before freeing any Host /// allocations associated with this tracer. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zelTracerDestroy( zel_tracer_handle_t hTracer ///< [in][release] handle of tracer object to destroy ) { if(ze_lib::destruction) return ZE_RESULT_ERROR_UNINITIALIZED; auto pfnDestroy = ze_lib::context->zelTracingDdiTable.Tracer.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; return pfnDestroy( hTracer ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Sets the collection of callbacks to be executed **before** driver /// execution. /// /// @details /// - The application only needs to set the function pointers it is /// interested in receiving; all others should be 'nullptr' /// - The application must ensure that no other threads are executing /// functions for which the tracing functions are changing. /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCoreCbs` ze_result_t ZE_APICALL zelTracerSetPrologues( zel_tracer_handle_t hTracer, ///< [in] handle of the tracer zel_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { if(ze_lib::destruction) return ZE_RESULT_ERROR_UNINITIALIZED; auto pfnSetPrologues = ze_lib::context->zelTracingDdiTable.Tracer.pfnSetPrologues; if( nullptr == pfnSetPrologues ) return ZE_RESULT_ERROR_UNINITIALIZED; return pfnSetPrologues( hTracer, pCoreCbs ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Sets the collection of callbacks to be executed **after** driver /// execution. /// /// @details /// - The application only needs to set the function pointers it is /// interested in receiving; all others should be 'nullptr' /// - The application must ensure that no other threads are executing /// functions for which the tracing functions are changing. /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCoreCbs` ze_result_t ZE_APICALL zelTracerSetEpilogues( zel_tracer_handle_t hTracer, ///< [in] handle of the tracer zel_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { if(ze_lib::destruction) return ZE_RESULT_ERROR_UNINITIALIZED; auto pfnSetEpilogues = ze_lib::context->zelTracingDdiTable.Tracer.pfnSetEpilogues; if( nullptr == pfnSetEpilogues ) return ZE_RESULT_ERROR_UNINITIALIZED; return pfnSetEpilogues( hTracer, pCoreCbs ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Enables (or disables) the tracer /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` ze_result_t ZE_APICALL zelTracerSetEnabled( zel_tracer_handle_t hTracer, ///< [in] handle of the tracer ze_bool_t enable ///< [in] enable the tracer if true; disable if false ) { if(ze_lib::destruction) return ZE_RESULT_ERROR_UNINITIALIZED; auto pfnSetEnabled = ze_lib::context->zelTracingDdiTable.Tracer.pfnSetEnabled; if( nullptr == pfnSetEnabled ) return ZE_RESULT_ERROR_UNINITIALIZED; return pfnSetEnabled( hTracer, enable ); } } // extern "C" level-zero-1.20.6/source/lib/zel_tracing_libddi.cpp000066400000000000000000000020641475521542100222560ustar00rootroot00000000000000/* * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_tracing_libddi.cpp * Perhaps have this generated at some point. * */ #include "ze_lib.h" #include "layers/zel_tracing_ddi.h" namespace ze_lib { /////////////////////////////////////////////////////////////////////////////// #ifdef DYNAMIC_LOAD_LOADER __zedlllocal ze_result_t context_t::zelTracingDdiTableInit() { ze_result_t result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zelGetTracerApiProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &zelTracingDdiTable.Tracer); } return result; } #else __zedlllocal ze_result_t context_t::zelTracingDdiTableInit() { ze_result_t result; result = zelGetTracerApiProcAddrTable( ZE_API_VERSION_CURRENT, &zelTracingDdiTable.Tracer); return result; } #endif } // namespace ze_lib level-zero-1.20.6/source/lib/zes_libapi.cpp000066400000000000000000010725721475521542100206030ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_libapi.cpp * * @brief C++ static library for zes * */ #include "ze_lib.h" extern "C" { /////////////////////////////////////////////////////////////////////////////// /// @brief Initialize 'oneAPI' System Resource Management (sysman) /// /// @details /// - The application must call this function or ::zeInit with the /// ::ZES_ENABLE_SYSMAN environment variable set before calling any other /// sysman function. /// - If this function is not called then all other sysman functions will /// return ::ZE_RESULT_ERROR_UNINITIALIZED. /// - This function will only initialize sysman. To initialize other /// functions, call ::zeInit. /// - There is no requirement to call this function before or after /// ::zeInit. /// - Only one instance of sysman will be initialized per process. /// - 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 sysman simultaneously. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x1 < flags` /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY ze_result_t ZE_APICALL zesInit( zes_init_flags_t flags ///< [in] initialization flags. ///< currently unused, must be 0 (default). ) { static ze_result_t result = ZE_RESULT_SUCCESS; std::call_once(ze_lib::context->initOnceSysMan, [flags]() { result = ze_lib::context->Init(flags, true, nullptr); }); if( ZE_RESULT_SUCCESS != result ) return result; if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnInit = ze_lib::context->zesDdiTable.load()->Global.pfnInit; if( nullptr == pfnInit ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnInit( flags ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves sysman driver instances /// /// @details /// - A sysman driver represents a collection of physical devices. /// - Multiple calls to this function will return identical sysman driver /// handles, in the same order. /// - The application may pass nullptr for pDrivers when only querying the /// number of sysman drivers. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDriverGet( uint32_t* pCount, ///< [in,out] pointer to the number of sysman driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of sysman drivers available. ///< if count is greater than the number of sysman drivers available, then ///< the loader shall update the value with the correct number of sysman ///< drivers available. zes_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of sysman driver instance handles. ///< if count is less than the number of sysman drivers available, then the ///< loader shall only retrieve that number of sysman drivers. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } if (ze_lib::context->zesDdiTable == nullptr) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGet = ze_lib::context->zesDdiTable.load()->Driver.pfnGet; if( nullptr == pfnGet ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } ze_lib::context->zesInuse = true; return pfnGet( pCount, phDrivers ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves extension properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDriverGetExtensionProperties( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. zes_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetExtensionProperties = ze_lib::context->zesDdiTable.load()->Driver.pfnGetExtensionProperties; if( nullptr == pfnGetExtensionProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetExtensionProperties( hDriver, pCount, pExtensionProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves function pointer for vendor-specific or experimental /// extensions /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == name` /// + `nullptr == ppFunctionAddress` ze_result_t ZE_APICALL zesDriverGetExtensionFunctionAddress( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetExtensionFunctionAddress = ze_lib::context->zesDdiTable.load()->Driver.pfnGetExtensionFunctionAddress; if( nullptr == pfnGetExtensionFunctionAddress ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetExtensionFunctionAddress( hDriver, name, ppFunctionAddress ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves sysman devices within a sysman driver /// /// @details /// - Multiple calls to this function will return identical sysman device /// handles, in the same order. /// - The number and order of handles returned from this function is NOT /// affected by the ::ZE_AFFINITY_MASK, ::ZE_ENABLE_PCI_ID_DEVICE_ORDER, /// or ::ZE_FLAT_DEVICE_HIERARCHY environment variables. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceGet( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance uint32_t* pCount, ///< [in,out] pointer to the number of sysman devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sysman devices available. ///< if count is greater than the number of sysman devices available, then ///< the driver shall update the value with the correct number of sysman ///< devices available. zes_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of sysman devices. ///< if count is less than the number of sysman devices available, then ///< driver shall only retrieve that number of sysman devices. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGet = ze_lib::context->zesDdiTable.load()->Device.pfnGet; if( nullptr == pfnGet ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGet( hDriver, pCount, phDevices ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get properties about the device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesDeviceGetProperties( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_properties_t* pProperties ///< [in,out] Structure that will contain information about the device. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Device.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hDevice, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get information about the state of the device - if a reset is /// required, reasons for the reset and if the device has been repaired /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ze_result_t ZE_APICALL zesDeviceGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_state_t* pState ///< [in,out] Structure that will contain information about the device. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetState = ze_lib::context->zesDdiTable.load()->Device.pfnGetState; if( nullptr == pfnGetState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetState( hDevice, pState ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Reset device /// /// @details /// - Performs a PCI bus reset of the device. This will result in all /// current device state being lost. /// - All applications using the device should be stopped before calling /// this function. /// - If the force argument is specified, all applications using the device /// will be forcibly killed. /// - The function will block until the device has restarted or an /// implementation defined timeout occurred waiting for the reset to /// complete. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to perform this operation. /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + Reset cannot be performed because applications are using this device. /// - ::ZE_RESULT_ERROR_UNKNOWN /// + There were problems unloading the device driver, performing a bus reset or reloading the device driver. ze_result_t ZE_APICALL zesDeviceReset( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device ze_bool_t force ///< [in] If set to true, all applications that are currently using the ///< device will be forcibly killed. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReset = ze_lib::context->zesDdiTable.load()->Device.pfnReset; if( nullptr == pfnReset ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReset( hDevice, force ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Reset device extension /// /// @details /// - Performs a PCI bus reset of the device. This will result in all /// current device state being lost. /// - Prior to calling this function, user is responsible for closing /// applications using the device unless force argument is specified. /// - If the force argument is specified, all applications using the device /// will be forcibly killed. /// - The function will block until the device has restarted or a /// implementation specific timeout occurred waiting for the reset to /// complete. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to perform this operation. /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + Reset cannot be performed because applications are using this device. /// - ::ZE_RESULT_ERROR_UNKNOWN /// + There were problems unloading the device driver, performing a bus reset or reloading the device driver. ze_result_t ZE_APICALL zesDeviceResetExt( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device zes_reset_properties_t* pProperties ///< [in] Device reset properties to apply ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnResetExt = ze_lib::context->zesDdiTable.load()->Device.pfnResetExt; if( nullptr == pfnResetExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnResetExt( hDevice, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get information about host processes using the device /// /// @details /// - The number of processes connected to the device is dynamic. This means /// that between a call to determine the value of pCount and the /// subsequent call, the number of processes may have increased or /// decreased. It is recommended that a large array be passed in so as to /// avoid receiving the error ::ZE_RESULT_ERROR_INVALID_SIZE. Also, always /// check the returned value in pCount since it may be less than the /// earlier call to get the required array size. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + The provided value of pCount is not big enough to store information about all the processes currently attached to the device. ze_result_t ZE_APICALL zesDeviceProcessesGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device uint32_t* pCount, ///< [in,out] pointer to the number of processes. ///< if count is zero, then the driver shall update the value with the ///< total number of processes currently attached to the device. ///< if count is greater than the number of processes currently attached to ///< the device, then the driver shall update the value with the correct ///< number of processes. zes_process_state_t* pProcesses ///< [in,out][optional][range(0, *pCount)] array of process information. ///< if count is less than the number of processes currently attached to ///< the device, then the driver shall only retrieve information about that ///< number of processes. In this case, the return code will ::ZE_RESULT_ERROR_INVALID_SIZE. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnProcessesGetState = ze_lib::context->zesDdiTable.load()->Device.pfnProcessesGetState; if( nullptr == pfnProcessesGetState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnProcessesGetState( hDevice, pCount, pProcesses ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get PCI properties - address, max speed /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesDevicePciGetProperties( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_properties_t* pProperties ///< [in,out] Will contain the PCI properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnPciGetProperties = ze_lib::context->zesDdiTable.load()->Device.pfnPciGetProperties; if( nullptr == pfnPciGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnPciGetProperties( hDevice, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get current PCI state - current speed /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ze_result_t ZE_APICALL zesDevicePciGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_state_t* pState ///< [in,out] Will contain the PCI properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnPciGetState = ze_lib::context->zesDdiTable.load()->Device.pfnPciGetState; if( nullptr == pfnPciGetState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnPciGetState( hDevice, pState ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get information about each configured bar /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDevicePciGetBars( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of PCI bars. ///< if count is zero, then the driver shall update the value with the ///< total number of PCI bars that are setup. ///< if count is greater than the number of PCI bars that are setup, then ///< the driver shall update the value with the correct number of PCI bars. zes_pci_bar_properties_t* pProperties ///< [in,out][optional][range(0, *pCount)] array of information about setup ///< PCI bars. ///< if count is less than the number of PCI bars that are setup, then the ///< driver shall only retrieve information about that number of PCI bars. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnPciGetBars = ze_lib::context->zesDdiTable.load()->Device.pfnPciGetBars; if( nullptr == pfnPciGetBars ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnPciGetBars( hDevice, pCount, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get PCI stats - bandwidth, number of packets, number of replays /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pStats` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to query this telemetry. ze_result_t ZE_APICALL zesDevicePciGetStats( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_stats_t* pStats ///< [in,out] Will contain a snapshot of the latest stats. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnPciGetStats = ze_lib::context->zesDdiTable.load()->Device.pfnPciGetStats; if( nullptr == pfnPciGetStats ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnPciGetStats( hDevice, pStats ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set the overclock waiver.The overclock waiver setting is persistent /// until the next pcode boot /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This product does not support overclocking ze_result_t ZE_APICALL zesDeviceSetOverclockWaiver( zes_device_handle_t hDevice ///< [in] Sysman handle of the device. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetOverclockWaiver = ze_lib::context->zesDdiTable.load()->Device.pfnSetOverclockWaiver; if( nullptr == pfnSetOverclockWaiver ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetOverclockWaiver( hDevice ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the list of supported overclock domains for this device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOverclockDomains` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesDeviceGetOverclockDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pOverclockDomains ///< [in,out] Returns the overclock domains that are supported (a bit for ///< each of enum ::zes_overclock_domain_t). If no bits are set, the device ///< doesn't support overclocking. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetOverclockDomains = ze_lib::context->zesDdiTable.load()->Device.pfnGetOverclockDomains; if( nullptr == pfnGetOverclockDomains ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetOverclockDomains( hDevice, pOverclockDomains ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the list of supported overclock controls available for one of the /// supported overclock domains on the device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OVERCLOCK_DOMAIN_ADM < domainType` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pAvailableControls` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesDeviceGetOverclockControls( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_domain_t domainType, ///< [in] Domain type. uint32_t* pAvailableControls ///< [in,out] Returns the overclock controls that are supported for the ///< specified overclock domain (a bit for each of enum ///< ::zes_overclock_control_t). ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetOverclockControls = ze_lib::context->zesDdiTable.load()->Device.pfnGetOverclockControls; if( nullptr == pfnGetOverclockControls ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetOverclockControls( hDevice, domainType, pAvailableControls ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Reset all overclock settings to default values (shipped = 1 or /// manufacturing =0) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesDeviceResetOverclockSettings( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. ze_bool_t onShippedState ///< [in] True will reset to shipped state; false will reset to ///< manufacturing state ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnResetOverclockSettings = ze_lib::context->zesDdiTable.load()->Device.pfnResetOverclockSettings; if( nullptr == pfnResetOverclockSettings ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnResetOverclockSettings( hDevice, onShippedState ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Determine the state of overclocking /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOverclockMode` /// + `nullptr == pWaiverSetting` /// + `nullptr == pOverclockState` /// + `nullptr == pPendingAction` /// + `nullptr == pPendingReset` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesDeviceReadOverclockState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_mode_t* pOverclockMode, ///< [out] One of overclock mode. ze_bool_t* pWaiverSetting, ///< [out] Waiver setting: 0 = Waiver not set, 1 = waiver has been set. ze_bool_t* pOverclockState, ///< [out] Current settings 0 =manufacturing state, 1= shipped state).. zes_pending_action_t* pPendingAction, ///< [out] This enum is returned when the driver attempts to set an ///< overclock control or reset overclock settings. ze_bool_t* pPendingReset ///< [out] Pending reset 0 =manufacturing state, 1= shipped state).. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReadOverclockState = ze_lib::context->zesDdiTable.load()->Device.pfnReadOverclockState; if( nullptr == pfnReadOverclockState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReadOverclockState( hDevice, pOverclockMode, pWaiverSetting, pOverclockState, pPendingAction, pPendingReset ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of overclock domains /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumOverclockDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_overclock_handle_t* phDomainHandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumOverclockDomains = ze_lib::context->zesDdiTable.load()->Device.pfnEnumOverclockDomains; if( nullptr == pfnEnumOverclockDomains ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumOverclockDomains( hDevice, pCount, phDomainHandle ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get overclock domain control properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pDomainProperties` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesOverclockGetDomainProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_properties_t* pDomainProperties ///< [in,out] The overclock properties for the specified domain. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetDomainProperties = ze_lib::context->zesDdiTable.load()->Overclock.pfnGetDomainProperties; if( nullptr == pfnGetDomainProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetDomainProperties( hDomainHandle, pDomainProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Read overclock VF min,max and step values /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pVFProperties` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesOverclockGetDomainVFProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_property_t* pVFProperties ///< [in,out] The VF min,max,step for a specified domain. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetDomainVFProperties = ze_lib::context->zesDdiTable.load()->Overclock.pfnGetDomainVFProperties; if( nullptr == pfnGetDomainVFProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetDomainVFProperties( hDomainHandle, pVFProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Read overclock control values - min/max/step/default/ref /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pControlProperties` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesOverclockGetDomainControlProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Handle for the component. zes_control_property_t* pControlProperties ///< [in,out] overclock control values. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetDomainControlProperties = ze_lib::context->zesDdiTable.load()->Overclock.pfnGetDomainControlProperties; if( nullptr == pfnGetDomainControlProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetDomainControlProperties( hDomainHandle, DomainControl, pControlProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Read the current value for a given overclock control /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pValue` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesOverclockGetControlCurrentValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [in,out] Getting overclock control value for the specified control. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetControlCurrentValue = ze_lib::context->zesDdiTable.load()->Overclock.pfnGetControlCurrentValue; if( nullptr == pfnGetControlCurrentValue ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetControlCurrentValue( hDomainHandle, DomainControl, pValue ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Read the the reset pending value for a given overclock control /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pValue` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesOverclockGetControlPendingValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [out] Returns the pending value for a given control. The units and ///< format of the value depend on the control type. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetControlPendingValue = ze_lib::context->zesDdiTable.load()->Overclock.pfnGetControlPendingValue; if( nullptr == pfnGetControlPendingValue ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetControlPendingValue( hDomainHandle, DomainControl, pValue ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set the value for a given overclock control /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pPendingAction` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesOverclockSetControlUserValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. double pValue, ///< [in] The new value of the control. The units and format of the value ///< depend on the control type. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetControlUserValue = ze_lib::context->zesDdiTable.load()->Overclock.pfnSetControlUserValue; if( nullptr == pfnSetControlUserValue ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetControlUserValue( hDomainHandle, DomainControl, pValue, pPendingAction ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Determine the state of an overclock control /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OVERCLOCK_CONTROL_ACM_DISABLE < DomainControl` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pControlState` /// + `nullptr == pPendingAction` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesOverclockGetControlState( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. zes_control_state_t* pControlState, ///< [out] Current overclock control state. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetControlState = ze_lib::context->zesDdiTable.load()->Overclock.pfnGetControlState; if( nullptr == pfnGetControlState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetControlState( hDomainHandle, DomainControl, pControlState, pPendingAction ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Read the frequency or voltage of a V-F point from the default or /// custom V-F curve. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_VF_TYPE_FREQ < VFType` /// + `::ZES_VF_ARRAY_TYPE_LIVE_VF_ARRAY < VFArrayType` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == PointValue` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesOverclockGetVFPointValues( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. zes_vf_array_type_t VFArrayType, ///< [in] User,Default or Live VF array to read from uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t* PointValue ///< [out] Returns the frequency in 1kHz units or voltage in millivolt ///< units from the custom V-F curve at the specified zero-based index ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetVFPointValues = ze_lib::context->zesDdiTable.load()->Overclock.pfnGetVFPointValues; if( nullptr == pfnGetVFPointValues ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetVFPointValues( hDomainHandle, VFType, VFArrayType, PointIndex, PointValue ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Write the frequency or voltage of a V-F point to custom V-F curve. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDomainHandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_VF_TYPE_FREQ < VFType` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this control domain ze_result_t ZE_APICALL zesOverclockSetVFPointValues( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t PointValue ///< [in] Writes frequency in 1kHz units or voltage in millivolt units to ///< custom V-F curve at the specified zero-based index ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetVFPointValues = ze_lib::context->zesDdiTable.load()->Overclock.pfnSetVFPointValues; if( nullptr == pfnSetVFPointValues ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetVFPointValues( hDomainHandle, VFType, PointIndex, PointValue ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of diagnostics test suites /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumDiagnosticTestSuites( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_diag_handle_t* phDiagnostics ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumDiagnosticTestSuites = ze_lib::context->zesDdiTable.load()->Device.pfnEnumDiagnosticTestSuites; if( nullptr == pfnEnumDiagnosticTestSuites ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumDiagnosticTestSuites( hDevice, pCount, phDiagnostics ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get properties of a diagnostics test suite /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDiagnostics` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesDiagnosticsGetProperties( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. zes_diag_properties_t* pProperties ///< [in,out] Structure describing the properties of a diagnostics test ///< suite ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Diagnostics.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hDiagnostics, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get individual tests that can be run separately. Not all test suites /// permit running individual tests, check the `haveTests` member of /// ::zes_diag_properties_t. /// /// @details /// - The list of available tests is returned in order of increasing test /// index (see the `index` member of ::zes_diag_test_t). /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDiagnostics` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDiagnosticsGetTests( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of tests. ///< if count is zero, then the driver shall update the value with the ///< total number of tests that are available. ///< if count is greater than the number of tests that are available, then ///< the driver shall update the value with the correct number of tests. zes_diag_test_t* pTests ///< [in,out][optional][range(0, *pCount)] array of information about ///< individual tests sorted by increasing value of the `index` member of ::zes_diag_test_t. ///< if count is less than the number of tests that are available, then the ///< driver shall only retrieve that number of tests. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetTests = ze_lib::context->zesDdiTable.load()->Diagnostics.pfnGetTests; if( nullptr == pfnGetTests ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetTests( hDiagnostics, pCount, pTests ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Run a diagnostics test suite, either all tests or a subset of tests. /// /// @details /// - WARNING: Running diagnostics may destroy current device state /// information. Gracefully close any running workloads before initiating. /// - To run all tests in a test suite, set start = /// ::ZES_DIAG_FIRST_TEST_INDEX and end = ::ZES_DIAG_LAST_TEST_INDEX. /// - If the test suite permits running individual tests, the `haveTests` /// member of ::zes_diag_properties_t will be true. In this case, the /// function ::zesDiagnosticsGetTests() can be called to get the list of /// tests and corresponding indices that can be supplied to the arguments /// start and end in this function. /// - This function will block until the diagnostics have completed and /// force reset based on result /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDiagnostics` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pResult` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to perform diagnostics. ze_result_t ZE_APICALL zesDiagnosticsRunTests( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t startIndex, ///< [in] The index of the first test to run. Set to ///< ::ZES_DIAG_FIRST_TEST_INDEX to start from the beginning. uint32_t endIndex, ///< [in] The index of the last test to run. Set to ///< ::ZES_DIAG_LAST_TEST_INDEX to complete all tests after the start test. zes_diag_result_t* pResult ///< [in,out] The result of the diagnostics ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnRunTests = ze_lib::context->zesDdiTable.load()->Diagnostics.pfnRunTests; if( nullptr == pfnRunTests ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnRunTests( hDiagnostics, startIndex, endIndex, pResult ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Is ECC functionality available - true or false? /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pAvailable` ze_result_t ZE_APICALL zesDeviceEccAvailable( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pAvailable ///< [out] ECC functionality is available (true)/unavailable (false). ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEccAvailable = ze_lib::context->zesDdiTable.load()->Device.pfnEccAvailable; if( nullptr == pfnEccAvailable ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEccAvailable( hDevice, pAvailable ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Is ECC support configurable - true or false? /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfigurable` ze_result_t ZE_APICALL zesDeviceEccConfigurable( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pConfigurable ///< [out] ECC can be enabled/disabled (true)/enabled/disabled (false). ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEccConfigurable = ze_lib::context->zesDdiTable.load()->Device.pfnEccConfigurable; if( nullptr == pfnEccConfigurable ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEccConfigurable( hDevice, pConfigurable ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get current ECC state, pending state, and pending action /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ze_result_t ZE_APICALL zesDeviceGetEccState( zes_device_handle_t hDevice, ///< [in] Handle for the component. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetEccState = ze_lib::context->zesDdiTable.load()->Device.pfnGetEccState; if( nullptr == pfnGetEccState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetEccState( hDevice, pState ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set new ECC state /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - ::zesDeviceGetState should be called to determine pending action /// required to implement state change. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == newState` /// + `nullptr == pState` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_DEVICE_ECC_STATE_DISABLED < newState->state` /// - ::ZE_RESULT_WARNING_ACTION_REQUIRED /// + User must look at the pendingAction attribute of pState & perform the action required to complete the ECC state change. ze_result_t ZE_APICALL zesDeviceSetEccState( zes_device_handle_t hDevice, ///< [in] Handle for the component. const zes_device_ecc_desc_t* newState, ///< [in] Pointer to desired ECC state. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetEccState = ze_lib::context->zesDdiTable.load()->Device.pfnSetEccState; if( nullptr == pfnSetEccState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetEccState( hDevice, newState, pState ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of engine groups /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumEngineGroups( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_engine_handle_t* phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumEngineGroups = ze_lib::context->zesDdiTable.load()->Device.pfnEnumEngineGroups; if( nullptr == pfnEnumEngineGroups ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumEngineGroups( hDevice, pCount, phEngine ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get engine group properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEngine` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesEngineGetProperties( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_properties_t* pProperties ///< [in,out] The properties for the specified engine group. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Engine.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hEngine, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the activity stats for an engine group. /// /// @details /// - This function also returns the engine activity inside a Virtual /// Machine (VM), in the presence of hardware virtualization (SRIOV) /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEngine` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pStats` ze_result_t ZE_APICALL zesEngineGetActivity( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_stats_t* pStats ///< [in,out] Will contain a snapshot of the engine group activity ///< counters. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetActivity = ze_lib::context->zesDdiTable.load()->Engine.pfnGetActivity; if( nullptr == pfnGetActivity ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetActivity( hEngine, pStats ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Specify the list of events to listen to for a given device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xffff < events` ze_result_t ZE_APICALL zesDeviceEventRegister( zes_device_handle_t hDevice, ///< [in] The device handle. zes_event_type_flags_t events ///< [in] List of events to listen to. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEventRegister = ze_lib::context->zesDdiTable.load()->Device.pfnEventRegister; if( nullptr == pfnEventRegister ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEventRegister( hDevice, events ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Wait for events to be received from a one or more devices. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phDevices` /// + `nullptr == pNumDeviceEvents` /// + `nullptr == pEvents` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to listen to events. /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + One or more of the supplied device handles belongs to a different driver. ze_result_t ZE_APICALL zesDriverEventListen( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT32_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEventListen = ze_lib::context->zesDdiTable.load()->Driver.pfnEventListen; if( nullptr == pfnEventListen ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEventListen( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Wait for events to be received from a one or more devices. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phDevices` /// + `nullptr == pNumDeviceEvents` /// + `nullptr == pEvents` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to listen to events. /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + One or more of the supplied device handles belongs to a different driver. ze_result_t ZE_APICALL zesDriverEventListenEx( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT64_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEventListenEx = ze_lib::context->zesDdiTable.load()->Driver.pfnEventListenEx; if( nullptr == pfnEventListenEx ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEventListenEx( hDriver, timeout, count, phDevices, pNumDeviceEvents, pEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of Fabric ports in a device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumFabricPorts( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fabric_port_handle_t* phPort ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumFabricPorts = ze_lib::context->zesDdiTable.load()->Device.pfnEnumFabricPorts; if( nullptr == pfnEnumFabricPorts ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumFabricPorts( hDevice, pCount, phPort ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric port properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesFabricPortGetProperties( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_properties_t* pProperties ///< [in,out] Will contain properties of the Fabric Port. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->FabricPort.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hPort, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric port link type /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pLinkType` ze_result_t ZE_APICALL zesFabricPortGetLinkType( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_link_type_t* pLinkType ///< [in,out] Will contain details about the link attached to the Fabric ///< port. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetLinkType = ze_lib::context->zesDdiTable.load()->FabricPort.pfnGetLinkType; if( nullptr == pfnGetLinkType ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetLinkType( hPort, pLinkType ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric port configuration /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` ze_result_t ZE_APICALL zesFabricPortGetConfig( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_config_t* pConfig ///< [in,out] Will contain configuration of the Fabric Port. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetConfig = ze_lib::context->zesDdiTable.load()->FabricPort.pfnGetConfig; if( nullptr == pfnGetConfig ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetConfig( hPort, pConfig ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set Fabric port configuration /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesFabricPortSetConfig( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. const zes_fabric_port_config_t* pConfig ///< [in] Contains new configuration of the Fabric Port. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetConfig = ze_lib::context->zesDdiTable.load()->FabricPort.pfnSetConfig; if( nullptr == pfnSetConfig ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetConfig( hPort, pConfig ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric port state - status (health/degraded/failed/disabled), /// reasons for link degradation or instability, current rx/tx speed /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ze_result_t ZE_APICALL zesFabricPortGetState( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_state_t* pState ///< [in,out] Will contain the current state of the Fabric Port ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetState = ze_lib::context->zesDdiTable.load()->FabricPort.pfnGetState; if( nullptr == pfnGetState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetState( hPort, pState ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric port throughput /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pThroughput` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to query this telemetry. ze_result_t ZE_APICALL zesFabricPortGetThroughput( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_throughput_t* pThroughput ///< [in,out] Will contain the Fabric port throughput counters. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetThroughput = ze_lib::context->zesDdiTable.load()->FabricPort.pfnGetThroughput; if( nullptr == pfnGetThroughput ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetThroughput( hPort, pThroughput ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric Port Error Counters /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - The memory backing the arrays for phPorts and ppThroughputs must be /// allocated in system memory by the user who is also responsible for /// releasing them when they are no longer needed. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPort` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pErrors` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to query this telemetry. ze_result_t ZE_APICALL zesFabricPortGetFabricErrorCounters( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_error_counters_t* pErrors ///< [in,out] Will contain the Fabric port Error counters. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetFabricErrorCounters = ze_lib::context->zesDdiTable.load()->FabricPort.pfnGetFabricErrorCounters; if( nullptr == pfnGetFabricErrorCounters ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetFabricErrorCounters( hPort, pErrors ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get Fabric port throughput from multiple ports in a single call /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phPort` /// + `nullptr == pThroughput` ze_result_t ZE_APICALL zesFabricPortGetMultiPortThroughput( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t numPorts, ///< [in] Number of ports enumerated in function ::zesDeviceEnumFabricPorts zes_fabric_port_handle_t* phPort, ///< [in][range(0, numPorts)] array of fabric port handles provided by user ///< to gather throughput values. zes_fabric_port_throughput_t** pThroughput ///< [out][range(0, numPorts)] array of fabric port throughput counters ///< from multiple ports of type ::zes_fabric_port_throughput_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetMultiPortThroughput = ze_lib::context->zesDdiTable.load()->FabricPort.pfnGetMultiPortThroughput; if( nullptr == pfnGetMultiPortThroughput ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetMultiPortThroughput( hDevice, numPorts, phPort, pThroughput ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of fans /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumFans( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fan_handle_t* phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumFans = ze_lib::context->zesDdiTable.load()->Device.pfnEnumFans; if( nullptr == pfnEnumFans ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumFans( hDevice, pCount, phFan ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get fan properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFan` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesFanGetProperties( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_properties_t* pProperties ///< [in,out] Will contain the properties of the fan. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Fan.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hFan, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get fan configurations and the current fan speed mode (default, fixed, /// temp-speed table) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFan` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` ze_result_t ZE_APICALL zesFanGetConfig( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_config_t* pConfig ///< [in,out] Will contain the current configuration of the fan. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetConfig = ze_lib::context->zesDdiTable.load()->Fan.pfnGetConfig; if( nullptr == pfnGetConfig ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetConfig( hFan, pConfig ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Configure the fan to run with hardware factory settings (set mode to /// ::ZES_FAN_SPEED_MODE_DEFAULT) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFan` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesFanSetDefaultMode( zes_fan_handle_t hFan ///< [in] Handle for the component. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetDefaultMode = ze_lib::context->zesDdiTable.load()->Fan.pfnSetDefaultMode; if( nullptr == pfnSetDefaultMode ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetDefaultMode( hFan ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Configure the fan to rotate at a fixed speed (set mode to /// ::ZES_FAN_SPEED_MODE_FIXED) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFan` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == speed` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Fixing the fan speed not supported by the hardware or the fan speed units are not supported. See the `supportedModes` and `supportedUnits` members of ::zes_fan_properties_t. ze_result_t ZE_APICALL zesFanSetFixedSpeedMode( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_t* speed ///< [in] The fixed fan speed setting ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetFixedSpeedMode = ze_lib::context->zesDdiTable.load()->Fan.pfnSetFixedSpeedMode; if( nullptr == pfnSetFixedSpeedMode ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetFixedSpeedMode( hFan, speed ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Configure the fan to adjust speed based on a temperature/speed table /// (set mode to ::ZES_FAN_SPEED_MODE_TABLE) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFan` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == speedTable` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + The temperature/speed pairs in the array are not sorted on temperature from lowest to highest. /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Fan speed table not supported by the hardware or the fan speed units are not supported. See the `supportedModes` and `supportedUnits` members of ::zes_fan_properties_t. ze_result_t ZE_APICALL zesFanSetSpeedTableMode( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_table_t* speedTable ///< [in] A table containing temperature/speed pairs. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetSpeedTableMode = ze_lib::context->zesDdiTable.load()->Fan.pfnSetSpeedTableMode; if( nullptr == pfnSetSpeedTableMode ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetSpeedTableMode( hFan, speedTable ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get current state of a fan - current mode and speed /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFan` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_FAN_SPEED_UNITS_PERCENT < units` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSpeed` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + The requested fan speed units are not supported. See the `supportedUnits` member of ::zes_fan_properties_t. ze_result_t ZE_APICALL zesFanGetState( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned. int32_t* pSpeed ///< [in,out] Will contain the current speed of the fan in the units ///< requested. A value of -1 indicates that the fan speed cannot be ///< measured. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetState = ze_lib::context->zesDdiTable.load()->Fan.pfnGetState; if( nullptr == pfnGetState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetState( hFan, units, pSpeed ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of firmwares /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumFirmwares( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_firmware_handle_t* phFirmware ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumFirmwares = ze_lib::context->zesDdiTable.load()->Device.pfnEnumFirmwares; if( nullptr == pfnEnumFirmwares ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumFirmwares( hDevice, pCount, phFirmware ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get firmware properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFirmware` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesFirmwareGetProperties( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. zes_firmware_properties_t* pProperties ///< [in,out] Pointer to an array that will hold the properties of the ///< firmware ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Firmware.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hFirmware, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Flash a new firmware image /// /// @details /// - Any running workload must be gracefully closed before invoking this /// function. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - This is a non-blocking call. Application may call /// ::zesFirmwareGetFlashProgress to get completion status. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFirmware` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pImage` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to perform this operation. ze_result_t ZE_APICALL zesFirmwareFlash( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. void* pImage, ///< [in] Image of the new firmware to flash. uint32_t size ///< [in] Size of the flash image. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnFlash = ze_lib::context->zesDdiTable.load()->Firmware.pfnFlash; if( nullptr == pfnFlash ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnFlash( hFirmware, pImage, size ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get Firmware Flash Progress /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFirmware` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCompletionPercent` ze_result_t ZE_APICALL zesFirmwareGetFlashProgress( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. uint32_t* pCompletionPercent ///< [in,out] Pointer to the Completion Percentage of Firmware Update ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetFlashProgress = ze_lib::context->zesDdiTable.load()->Firmware.pfnGetFlashProgress; if( nullptr == pfnGetFlashProgress ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetFlashProgress( hFirmware, pCompletionPercent ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get Firmware Console Logs /// /// @details /// - The caller may pass nullptr for pFirmwareLog and set pSize to zero /// when querying only for size. /// - The caller must provide memory for Firmware log. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFirmware` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` ze_result_t ZE_APICALL zesFirmwareGetConsoleLogs( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. size_t* pSize, ///< [in,out] size of firmware log char* pFirmwareLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetConsoleLogs = ze_lib::context->zesDdiTable.load()->Firmware.pfnGetConsoleLogs; if( nullptr == pfnGetConsoleLogs ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetConsoleLogs( hFirmware, pSize, pFirmwareLog ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of frequency domains /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumFrequencyDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_freq_handle_t* phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumFrequencyDomains = ze_lib::context->zesDdiTable.load()->Device.pfnEnumFrequencyDomains; if( nullptr == pfnEnumFrequencyDomains ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumFrequencyDomains( hDevice, pCount, phFrequency ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get frequency properties - available frequencies /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesFrequencyGetProperties( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_properties_t* pProperties ///< [in,out] The frequency properties for the specified domain. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Frequency.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hFrequency, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get available non-overclocked hardware clock frequencies for the /// frequency domain /// /// @details /// - The list of available frequencies is returned in order of slowest to /// fastest. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesFrequencyGetAvailableClocks( zes_freq_handle_t hFrequency, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of frequencies. ///< if count is zero, then the driver shall update the value with the ///< total number of frequencies that are available. ///< if count is greater than the number of frequencies that are available, ///< then the driver shall update the value with the correct number of frequencies. double* phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of ///< MHz and sorted from slowest to fastest. ///< if count is less than the number of frequencies that are available, ///< then the driver shall only retrieve that number of frequencies. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetAvailableClocks = ze_lib::context->zesDdiTable.load()->Frequency.pfnGetAvailableClocks; if( nullptr == pfnGetAvailableClocks ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetAvailableClocks( hFrequency, pCount, phFrequency ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get current frequency limits /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pLimits` ze_result_t ZE_APICALL zesFrequencyGetRange( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_range_t* pLimits ///< [in,out] The range between which the hardware can operate for the ///< specified domain. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetRange = ze_lib::context->zesDdiTable.load()->Frequency.pfnGetRange; if( nullptr == pfnGetRange ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetRange( hFrequency, pLimits ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set frequency range between which the hardware can operate. /// /// @details /// - The application may call this function with the frequency range min /// and max values set to `-1` to request the frequency be (re)set to the /// default values. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pLimits` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesFrequencySetRange( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. const zes_freq_range_t* pLimits ///< [in] The limits between which the hardware can operate for the ///< specified domain. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetRange = ze_lib::context->zesDdiTable.load()->Frequency.pfnSetRange; if( nullptr == pfnSetRange ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetRange( hFrequency, pLimits ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get current frequency state - frequency request, actual frequency, TDP /// limits /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ze_result_t ZE_APICALL zesFrequencyGetState( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_state_t* pState ///< [in,out] Frequency state for the specified domain. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetState = ze_lib::context->zesDdiTable.load()->Frequency.pfnGetState; if( nullptr == pfnGetState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetState( hFrequency, pState ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get frequency throttle time /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pThrottleTime` ze_result_t ZE_APICALL zesFrequencyGetThrottleTime( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_throttle_time_t* pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the ///< specified domain. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetThrottleTime = ze_lib::context->zesDdiTable.load()->Frequency.pfnGetThrottleTime; if( nullptr == pfnGetThrottleTime ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetThrottleTime( hFrequency, pThrottleTime ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the overclocking capabilities. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOcCapabilities` ze_result_t ZE_APICALL zesFrequencyOcGetCapabilities( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_capabilities_t* pOcCapabilities ///< [in,out] Pointer to the capabilities structure. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOcGetCapabilities = ze_lib::context->zesDdiTable.load()->Frequency.pfnOcGetCapabilities; if( nullptr == pfnOcGetCapabilities ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOcGetCapabilities( hFrequency, pOcCapabilities ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the current overclocking frequency target, if extended moded is /// supported, will returned in 1 Mhz granularity. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCurrentOcFrequency` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). /// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesFrequencyOcGetFrequencyTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentOcFrequency ///< [out] Overclocking Frequency in MHz, if extended moded is supported, ///< will returned in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOcGetFrequencyTarget = ze_lib::context->zesDdiTable.load()->Frequency.pfnOcGetFrequencyTarget; if( nullptr == pfnOcGetFrequencyTarget ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOcGetFrequencyTarget( hFrequency, pCurrentOcFrequency ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set the current overclocking frequency target, if extended moded is /// supported, can be set in 1 Mhz granularity. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). /// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesFrequencyOcSetFrequencyTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentOcFrequency ///< [in] Overclocking Frequency in MHz, if extended moded is supported, it ///< could be set in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOcSetFrequencyTarget = ze_lib::context->zesDdiTable.load()->Frequency.pfnOcSetFrequencyTarget; if( nullptr == pfnOcSetFrequencyTarget ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOcSetFrequencyTarget( hFrequency, CurrentOcFrequency ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the current overclocking voltage settings. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCurrentVoltageTarget` /// + `nullptr == pCurrentVoltageOffset` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). /// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesFrequencyOcGetVoltageTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentVoltageTarget, ///< [out] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double* pCurrentVoltageOffset ///< [out] This voltage offset is applied to all points on the ///< voltage/frequency curve, including the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOcGetVoltageTarget = ze_lib::context->zesDdiTable.load()->Frequency.pfnOcGetVoltageTarget; if( nullptr == pfnOcGetVoltageTarget ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOcGetVoltageTarget( hFrequency, pCurrentVoltageTarget, pCurrentVoltageOffset ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set the current overclocking voltage settings. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). /// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesFrequencyOcSetVoltageTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentVoltageTarget, ///< [in] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double CurrentVoltageOffset ///< [in] This voltage offset is applied to all points on the ///< voltage/frequency curve, include the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOcSetVoltageTarget = ze_lib::context->zesDdiTable.load()->Frequency.pfnOcSetVoltageTarget; if( nullptr == pfnOcSetVoltageTarget ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOcSetVoltageTarget( hFrequency, CurrentVoltageTarget, CurrentVoltageOffset ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set the current overclocking mode. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_OC_MODE_FIXED < CurrentOcMode` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). /// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesFrequencyOcSetMode( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t CurrentOcMode ///< [in] Current Overclocking Mode ::zes_oc_mode_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOcSetMode = ze_lib::context->zesDdiTable.load()->Frequency.pfnOcSetMode; if( nullptr == pfnOcSetMode ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOcSetMode( hFrequency, CurrentOcMode ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the current overclocking mode. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCurrentOcMode` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The specified voltage and/or frequency overclock settings exceed the hardware values (see the `maxOcFrequency`, `maxOcVoltage`, `minOcVoltageOffset` and `maxOcVoltageOffset` members of ::zes_oc_capabilities_t). /// + Requested voltage overclock is very high but the `isHighVoltModeEnabled` member of ::zes_oc_capabilities_t is not enabled for the device. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesFrequencyOcGetMode( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t* pCurrentOcMode ///< [out] Current Overclocking Mode ::zes_oc_mode_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOcGetMode = ze_lib::context->zesDdiTable.load()->Frequency.pfnOcGetMode; if( nullptr == pfnOcGetMode ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOcGetMode( hFrequency, pCurrentOcMode ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the maximum current limit setting. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOcIccMax` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + Capability the `isIccMaxSupported` member of ::zes_oc_capabilities_t is false for this frequency domain. ze_result_t ZE_APICALL zesFrequencyOcGetIccMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcIccMax ///< [in,out] Will contain the maximum current limit in Amperes on ///< successful return. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOcGetIccMax = ze_lib::context->zesDdiTable.load()->Frequency.pfnOcGetIccMax; if( nullptr == pfnOcGetIccMax ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOcGetIccMax( hFrequency, pOcIccMax ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Change the maximum current limit setting. /// /// @details /// - Setting ocIccMax to 0.0 will return the value to the factory default. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The `isIccMaxSupported` member of ::zes_oc_capabilities_t is false for this frequency domain. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + The specified current limit is too low or too high. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesFrequencyOcSetIccMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocIccMax ///< [in] The new maximum current limit in Amperes. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOcSetIccMax = ze_lib::context->zesDdiTable.load()->Frequency.pfnOcSetIccMax; if( nullptr == pfnOcSetIccMax ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOcSetIccMax( hFrequency, ocIccMax ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the maximum temperature limit setting. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pOcTjMax` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). ze_result_t ZE_APICALL zesFrequencyOcGetTjMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcTjMax ///< [in,out] Will contain the maximum temperature limit in degrees Celsius ///< on successful return. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOcGetTjMax = ze_lib::context->zesDdiTable.load()->Frequency.pfnOcGetTjMax; if( nullptr == pfnOcGetTjMax ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOcGetTjMax( hFrequency, pOcTjMax ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Change the maximum temperature limit setting. /// /// @details /// - Setting ocTjMax to 0.0 will return the value to the factory default. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFrequency` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Overclocking is not supported on this frequency domain (see the `isOcSupported` member of ::zes_oc_capabilities_t). /// + The `isTjMaxSupported` member of ::zes_oc_capabilities_t is false for this frequency domain. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Overclocking feature is locked on this frequency domain. /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + The specified temperature limit is too high. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesFrequencyOcSetTjMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocTjMax ///< [in] The new maximum temperature limit in degrees Celsius. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOcSetTjMax = ze_lib::context->zesDdiTable.load()->Frequency.pfnOcSetTjMax; if( nullptr == pfnOcSetTjMax ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOcSetTjMax( hFrequency, ocTjMax ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of LEDs /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumLeds( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_led_handle_t* phLed ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumLeds = ze_lib::context->zesDdiTable.load()->Device.pfnEnumLeds; if( nullptr == pfnEnumLeds ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumLeds( hDevice, pCount, phLed ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get LED properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hLed` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesLedGetProperties( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_properties_t* pProperties ///< [in,out] Will contain the properties of the LED. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Led.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hLed, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get current state of a LED - on/off, color /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hLed` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ze_result_t ZE_APICALL zesLedGetState( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_state_t* pState ///< [in,out] Will contain the current state of the LED. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetState = ze_lib::context->zesDdiTable.load()->Led.pfnGetState; if( nullptr == pfnGetState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetState( hLed, pState ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Turn the LED on/off /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hLed` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesLedSetState( zes_led_handle_t hLed, ///< [in] Handle for the component. ze_bool_t enable ///< [in] Set to TRUE to turn the LED on, FALSE to turn off. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetState = ze_lib::context->zesDdiTable.load()->Led.pfnSetState; if( nullptr == pfnSetState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetState( hLed, enable ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set the color of the LED /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hLed` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pColor` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This LED doesn't not support color changes. See the `haveRGB` member of ::zes_led_properties_t. ze_result_t ZE_APICALL zesLedSetColor( zes_led_handle_t hLed, ///< [in] Handle for the component. const zes_led_color_t* pColor ///< [in] New color of the LED. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetColor = ze_lib::context->zesDdiTable.load()->Led.pfnSetColor; if( nullptr == pfnSetColor ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetColor( hLed, pColor ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of memory modules /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumMemoryModules( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_mem_handle_t* phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumMemoryModules = ze_lib::context->zesDdiTable.load()->Device.pfnEnumMemoryModules; if( nullptr == pfnEnumMemoryModules ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumMemoryModules( hDevice, pCount, phMemory ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get memory properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMemory` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesMemoryGetProperties( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_properties_t* pProperties ///< [in,out] Will contain memory properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Memory.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hMemory, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get memory state - health, allocated /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMemory` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ze_result_t ZE_APICALL zesMemoryGetState( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_state_t* pState ///< [in,out] Will contain the current health and allocated memory. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetState = ze_lib::context->zesDdiTable.load()->Memory.pfnGetState; if( nullptr == pfnGetState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetState( hMemory, pState ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get memory bandwidth /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMemory` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pBandwidth` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to query this telemetry. ze_result_t ZE_APICALL zesMemoryGetBandwidth( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_bandwidth_t* pBandwidth ///< [in,out] Will contain the total number of bytes read from and written ///< to memory, as well as the current maximum bandwidth. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetBandwidth = ze_lib::context->zesDdiTable.load()->Memory.pfnGetBandwidth; if( nullptr == pfnGetBandwidth ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetBandwidth( hMemory, pBandwidth ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handles to accelerator domains whose performance can be optimized /// via a Performance Factor /// /// @details /// - A Performance Factor should be tuned for each workload. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumPerformanceFactorDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_perf_handle_t* phPerf ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumPerformanceFactorDomains = ze_lib::context->zesDdiTable.load()->Device.pfnEnumPerformanceFactorDomains; if( nullptr == pfnEnumPerformanceFactorDomains ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumPerformanceFactorDomains( hDevice, pCount, phPerf ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get properties about a Performance Factor domain /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPerf` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesPerformanceFactorGetProperties( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. zes_perf_properties_t* pProperties ///< [in,out] Will contain information about the specified Performance ///< Factor domain. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->PerformanceFactor.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hPerf, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get current Performance Factor for a given domain /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPerf` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pFactor` ze_result_t ZE_APICALL zesPerformanceFactorGetConfig( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double* pFactor ///< [in,out] Will contain the actual Performance Factor being used by the ///< hardware (may not be the same as the requested Performance Factor). ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetConfig = ze_lib::context->zesDdiTable.load()->PerformanceFactor.pfnGetConfig; if( nullptr == pfnGetConfig ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetConfig( hPerf, pFactor ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Change the performance factor for a domain /// /// @details /// - The Performance Factor is a number between 0 and 100. /// - A Performance Factor is a hint to the hardware. Depending on the /// hardware, the request may not be granted. Follow up this function with /// a call to ::zesPerformanceFactorGetConfig() to determine the actual /// factor being used by the hardware. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPerf` ze_result_t ZE_APICALL zesPerformanceFactorSetConfig( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double factor ///< [in] The new Performance Factor. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetConfig = ze_lib::context->zesDdiTable.load()->PerformanceFactor.pfnSetConfig; if( nullptr == pfnSetConfig ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetConfig( hPerf, factor ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of power domains /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumPowerDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_pwr_handle_t* phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumPowerDomains = ze_lib::context->zesDdiTable.load()->Device.pfnEnumPowerDomains; if( nullptr == pfnEnumPowerDomains ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumPowerDomains( hDevice, pCount, phPower ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of the PCIe card-level power /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phPower` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + The device does not provide access to card level power controls or telemetry. An invalid power domain handle will be returned in phPower. ze_result_t ZE_APICALL zesDeviceGetCardPowerDomain( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pwr_handle_t* phPower ///< [in,out] power domain handle for the entire PCIe card. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetCardPowerDomain = ze_lib::context->zesDdiTable.load()->Device.pfnGetCardPowerDomain; if( nullptr == pfnGetCardPowerDomain ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetCardPowerDomain( hDevice, phPower ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get properties related to a power domain /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesPowerGetProperties( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_properties_t* pProperties ///< [in,out] Structure that will contain property data. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Power.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hPower, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get energy counter /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pEnergy` ze_result_t ZE_APICALL zesPowerGetEnergyCounter( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_energy_counter_t* pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and ///< timestamp when the last counter value was measured. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetEnergyCounter = ze_lib::context->zesDdiTable.load()->Power.pfnGetEnergyCounter; if( nullptr == pfnGetEnergyCounter ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetEnergyCounter( hPower, pEnergy ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get power limits /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] Use ::zesPowerGetLimitsExt. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` ze_result_t ZE_APICALL zesPowerGetLimits( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_sustained_limit_t* pSustained, ///< [in,out][optional] The sustained power limit. If this is null, the ///< current sustained power limits will not be returned. zes_power_burst_limit_t* pBurst, ///< [in,out][optional] The burst power limit. If this is null, the current ///< peak power limits will not be returned. zes_power_peak_limit_t* pPeak ///< [in,out][optional] The peak power limit. If this is null, the peak ///< power limits will not be returned. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetLimits = ze_lib::context->zesDdiTable.load()->Power.pfnGetLimits; if( nullptr == pfnGetLimits ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetLimits( hPower, pSustained, pBurst, pPeak ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set power limits /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] Use ::zesPowerSetLimitsExt. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + The device is in use, meaning that the GPU is under Over clocking, applying power limits under overclocking is not supported. ze_result_t ZE_APICALL zesPowerSetLimits( zes_pwr_handle_t hPower, ///< [in] Handle for the component. const zes_power_sustained_limit_t* pSustained, ///< [in][optional] The sustained power limit. If this is null, no changes ///< will be made to the sustained power limits. const zes_power_burst_limit_t* pBurst, ///< [in][optional] The burst power limit. If this is null, no changes will ///< be made to the burst power limits. const zes_power_peak_limit_t* pPeak ///< [in][optional] The peak power limit. If this is null, no changes will ///< be made to the peak power limits. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetLimits = ze_lib::context->zesDdiTable.load()->Power.pfnSetLimits; if( nullptr == pfnSetLimits ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetLimits( hPower, pSustained, pBurst, pPeak ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get energy threshold /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pThreshold` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Energy threshold not supported on this power domain (check the `isEnergyThresholdSupported` member of ::zes_power_properties_t). /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to request this feature. ze_result_t ZE_APICALL zesPowerGetEnergyThreshold( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_energy_threshold_t* pThreshold ///< [in,out] Returns information about the energy threshold setting - ///< enabled/energy threshold/process ID. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetEnergyThreshold = ze_lib::context->zesDdiTable.load()->Power.pfnGetEnergyThreshold; if( nullptr == pfnGetEnergyThreshold ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetEnergyThreshold( hPower, pThreshold ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set energy threshold /// /// @details /// - An event ::ZES_EVENT_TYPE_FLAG_ENERGY_THRESHOLD_CROSSED will be /// generated when the delta energy consumed starting from this call /// exceeds the specified threshold. Use the function /// ::zesDeviceEventRegister() to start receiving the event. /// - Only one running process can control the energy threshold at a given /// time. If another process attempts to change the energy threshold, the /// error ::ZE_RESULT_ERROR_NOT_AVAILABLE will be returned. The function /// ::zesPowerGetEnergyThreshold() to determine the process ID currently /// controlling this setting. /// - Calling this function will remove any pending energy thresholds and /// start counting from the time of this call. /// - Once the energy threshold has been reached and the event generated, /// the threshold is automatically removed. It is up to the application to /// request a new threshold. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Energy threshold not supported on this power domain (check the `isEnergyThresholdSupported` member of ::zes_power_properties_t). /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to request this feature. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Another running process has set the energy threshold. ze_result_t ZE_APICALL zesPowerSetEnergyThreshold( zes_pwr_handle_t hPower, ///< [in] Handle for the component. double threshold ///< [in] The energy threshold to be set in joules. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetEnergyThreshold = ze_lib::context->zesDdiTable.load()->Power.pfnSetEnergyThreshold; if( nullptr == pfnSetEnergyThreshold ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetEnergyThreshold( hPower, threshold ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of power supplies /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumPsus( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_psu_handle_t* phPsu ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumPsus = ze_lib::context->zesDdiTable.load()->Device.pfnEnumPsus; if( nullptr == pfnEnumPsus ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumPsus( hDevice, pCount, phPsu ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get power supply properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPsu` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesPsuGetProperties( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_properties_t* pProperties ///< [in,out] Will contain the properties of the power supply. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Psu.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hPsu, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get current power supply state /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPsu` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` ze_result_t ZE_APICALL zesPsuGetState( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_state_t* pState ///< [in,out] Will contain the current state of the power supply. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetState = ze_lib::context->zesDdiTable.load()->Psu.pfnGetState; if( nullptr == pfnGetState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetState( hPsu, pState ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of all RAS error sets on a device /// /// @details /// - A RAS error set is a collection of RAS error counters of a given type /// (correctable/uncorrectable) from hardware blocks contained within a /// sub-device or within the device. /// - A device without sub-devices will typically return two handles, one /// for correctable errors sets and one for uncorrectable error sets. /// - A device with sub-devices will return RAS error sets for each /// sub-device and possibly RAS error sets for hardware blocks outside the /// sub-devices. /// - If the function completes successfully but pCount is set to 0, RAS /// features are not available/enabled on this device. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumRasErrorSets( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_ras_handle_t* phRas ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumRasErrorSets = ze_lib::context->zesDdiTable.load()->Device.pfnEnumRasErrorSets; if( nullptr == pfnEnumRasErrorSets ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumRasErrorSets( hDevice, pCount, phRas ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get RAS properties of a given RAS error set - this enables discovery /// of the type of RAS error set (correctable/uncorrectable) and if /// located on a sub-device /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesRasGetProperties( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_properties_t* pProperties ///< [in,out] Structure describing RAS properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Ras.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hRas, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get RAS error thresholds that control when RAS events are generated /// /// @details /// - The driver maintains counters for all RAS error sets and error /// categories. Events are generated when errors occur. The configuration /// enables setting thresholds to limit when events are sent. /// - When a particular RAS correctable error counter exceeds the configured /// threshold, the event ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS will /// be triggered. /// - When a particular RAS uncorrectable error counter exceeds the /// configured threshold, the event /// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS will be triggered. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` ze_result_t ZE_APICALL zesRasGetConfig( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_config_t* pConfig ///< [in,out] Will be populed with the current RAS configuration - ///< thresholds used to trigger events ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetConfig = ze_lib::context->zesDdiTable.load()->Ras.pfnGetConfig; if( nullptr == pfnGetConfig ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetConfig( hRas, pConfig ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set RAS error thresholds that control when RAS events are generated /// /// @details /// - The driver maintains counters for all RAS error sets and error /// categories. Events are generated when errors occur. The configuration /// enables setting thresholds to limit when events are sent. /// - When a particular RAS correctable error counter exceeds the specified /// threshold, the event ::ZES_EVENT_TYPE_FLAG_RAS_CORRECTABLE_ERRORS will /// be generated. /// - When a particular RAS uncorrectable error counter exceeds the /// specified threshold, the event /// ::ZES_EVENT_TYPE_FLAG_RAS_UNCORRECTABLE_ERRORS will be generated. /// - Call ::zesRasGetState() and set the clear flag to true to restart /// event generation once counters have exceeded thresholds. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Another running process is controlling these settings. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + Don't have permissions to set thresholds. ze_result_t ZE_APICALL zesRasSetConfig( zes_ras_handle_t hRas, ///< [in] Handle for the component. const zes_ras_config_t* pConfig ///< [in] Change the RAS configuration - thresholds used to trigger events ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetConfig = ze_lib::context->zesDdiTable.load()->Ras.pfnSetConfig; if( nullptr == pfnSetConfig ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetConfig( hRas, pConfig ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the current value of RAS error counters for a particular error set /// /// @details /// - Clearing errors will affect other threads/applications - the counter /// values will start from zero. /// - Clearing errors requires write permissions. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pState` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + Don't have permissions to clear error counters. ze_result_t ZE_APICALL zesRasGetState( zes_ras_handle_t hRas, ///< [in] Handle for the component. ze_bool_t clear, ///< [in] Set to 1 to clear the counters of this type zes_ras_state_t* pState ///< [in,out] Breakdown of where errors have occurred ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetState = ze_lib::context->zesDdiTable.load()->Ras.pfnGetState; if( nullptr == pfnGetState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetState( hRas, clear, pState ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Returns handles to scheduler components. /// /// @details /// - Each scheduler component manages the distribution of work across one /// or more accelerator engines. /// - If an application wishes to change the scheduler behavior for all /// accelerator engines of a specific type (e.g. compute), it should /// select all the handles where the `engines` member /// ::zes_sched_properties_t contains that type. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumSchedulers( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_sched_handle_t* phScheduler ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumSchedulers = ze_lib::context->zesDdiTable.load()->Device.pfnEnumSchedulers; if( nullptr == pfnEnumSchedulers ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumSchedulers( hDevice, pCount, phScheduler ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get properties related to a scheduler component /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesSchedulerGetProperties( zes_sched_handle_t hScheduler, ///< [in] Handle for the component. zes_sched_properties_t* pProperties ///< [in,out] Structure that will contain property data. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Scheduler.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hScheduler, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get current scheduling mode in effect on a scheduler component. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pMode` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. ze_result_t ZE_APICALL zesSchedulerGetCurrentMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_mode_t* pMode ///< [in,out] Will contain the current scheduler mode. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetCurrentMode = ze_lib::context->zesDdiTable.load()->Scheduler.pfnGetCurrentMode; if( nullptr == pfnGetCurrentMode ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetCurrentMode( hScheduler, pMode ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get scheduler config for mode ::ZES_SCHED_MODE_TIMEOUT /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. ze_result_t ZE_APICALL zesSchedulerGetTimeoutModeProperties( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeout_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetTimeoutModeProperties = ze_lib::context->zesDdiTable.load()->Scheduler.pfnGetTimeoutModeProperties; if( nullptr == pfnGetTimeoutModeProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetTimeoutModeProperties( hScheduler, getDefaults, pConfig ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get scheduler config for mode ::ZES_SCHED_MODE_TIMESLICE /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. ze_result_t ZE_APICALL zesSchedulerGetTimesliceModeProperties( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeslice_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetTimesliceModeProperties = ze_lib::context->zesDdiTable.load()->Scheduler.pfnGetTimesliceModeProperties; if( nullptr == pfnGetTimesliceModeProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetTimesliceModeProperties( hScheduler, getDefaults, pConfig ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Change scheduler mode to ::ZES_SCHED_MODE_TIMEOUT or update scheduler /// mode parameters if already running in this mode. /// /// @details /// - This mode is optimized for multiple applications or contexts /// submitting work to the hardware. When higher priority work arrives, /// the scheduler attempts to pause the current executing work within some /// timeout interval, then submits the other work. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` /// + `nullptr == pNeedReload` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make this modification. ze_result_t ZE_APICALL zesSchedulerSetTimeoutMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeout_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetTimeoutMode = ze_lib::context->zesDdiTable.load()->Scheduler.pfnSetTimeoutMode; if( nullptr == pfnSetTimeoutMode ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetTimeoutMode( hScheduler, pProperties, pNeedReload ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Change scheduler mode to ::ZES_SCHED_MODE_TIMESLICE or update /// scheduler mode parameters if already running in this mode. /// /// @details /// - This mode is optimized to provide fair sharing of hardware execution /// time between multiple contexts submitting work to the hardware /// concurrently. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` /// + `nullptr == pNeedReload` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make this modification. ze_result_t ZE_APICALL zesSchedulerSetTimesliceMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeslice_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetTimesliceMode = ze_lib::context->zesDdiTable.load()->Scheduler.pfnSetTimesliceMode; if( nullptr == pfnSetTimesliceMode ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetTimesliceMode( hScheduler, pProperties, pNeedReload ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Change scheduler mode to ::ZES_SCHED_MODE_EXCLUSIVE /// /// @details /// - This mode is optimized for single application/context use-cases. It /// permits a context to run indefinitely on the hardware without being /// preempted or terminated. All pending work for other contexts must wait /// until the running context completes with no further submitted work. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pNeedReload` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make this modification. ze_result_t ZE_APICALL zesSchedulerSetExclusiveMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetExclusiveMode = ze_lib::context->zesDdiTable.load()->Scheduler.pfnSetExclusiveMode; if( nullptr == pfnSetExclusiveMode ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetExclusiveMode( hScheduler, pNeedReload ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Change scheduler mode to ::ZES_SCHED_MODE_COMPUTE_UNIT_DEBUG /// /// @details /// - This is a special mode that must ben enabled when debugging an /// application that uses this device e.g. using the Level0 Debug API. /// - It ensures that only one command queue can execute work on the /// hardware at a given time. Work is permitted to run as long as needed /// without enforcing any scheduler fairness policies. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - [DEPRECATED] No longer supported. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hScheduler` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pNeedReload` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + This scheduler component does not support scheduler modes. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make this modification. ze_result_t ZE_APICALL zesSchedulerSetComputeUnitDebugMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetComputeUnitDebugMode = ze_lib::context->zesDdiTable.load()->Scheduler.pfnSetComputeUnitDebugMode; if( nullptr == pfnSetComputeUnitDebugMode ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetComputeUnitDebugMode( hScheduler, pNeedReload ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of standby controls /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumStandbyDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_standby_handle_t* phStandby ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumStandbyDomains = ze_lib::context->zesDdiTable.load()->Device.pfnEnumStandbyDomains; if( nullptr == pfnEnumStandbyDomains ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumStandbyDomains( hDevice, pCount, phStandby ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get standby hardware component properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hStandby` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesStandbyGetProperties( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_properties_t* pProperties ///< [in,out] Will contain the standby hardware properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Standby.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hStandby, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the current standby promotion mode /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hStandby` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pMode` ze_result_t ZE_APICALL zesStandbyGetMode( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t* pMode ///< [in,out] Will contain the current standby mode. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetMode = ze_lib::context->zesDdiTable.load()->Standby.pfnGetMode; if( nullptr == pfnGetMode ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetMode( hStandby, pMode ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set standby promotion mode /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hStandby` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_STANDBY_PROMO_MODE_NEVER < mode` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. ze_result_t ZE_APICALL zesStandbySetMode( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t mode ///< [in] New standby mode. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetMode = ze_lib::context->zesDdiTable.load()->Standby.pfnSetMode; if( nullptr == pfnSetMode ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetMode( hStandby, mode ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of temperature sensors /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumTemperatureSensors( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_temp_handle_t* phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumTemperatureSensors = ze_lib::context->zesDdiTable.load()->Device.pfnEnumTemperatureSensors; if( nullptr == pfnEnumTemperatureSensors ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumTemperatureSensors( hDevice, pCount, phTemperature ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get temperature sensor properties /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTemperature` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesTemperatureGetProperties( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_properties_t* pProperties ///< [in,out] Will contain the temperature sensor properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zesDdiTable.load()->Temperature.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hTemperature, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get temperature configuration for this sensor - which events are /// triggered and the trigger conditions /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTemperature` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Temperature thresholds are not supported on this temperature sensor. Generally this is only supported for temperature sensor ::ZES_TEMP_SENSORS_GLOBAL. /// + One or both of the thresholds is not supported. Check the `isThreshold1Supported` and `isThreshold2Supported` members of ::zes_temp_properties_t. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to request this feature. ze_result_t ZE_APICALL zesTemperatureGetConfig( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_config_t* pConfig ///< [in,out] Returns current configuration. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetConfig = ze_lib::context->zesDdiTable.load()->Temperature.pfnGetConfig; if( nullptr == pfnGetConfig ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetConfig( hTemperature, pConfig ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set temperature configuration for this sensor - indicates which events /// are triggered and the trigger conditions /// /// @details /// - Events ::ZES_EVENT_TYPE_FLAG_TEMP_CRITICAL will be triggered when /// temperature reaches the critical range. Use the function /// ::zesDeviceEventRegister() to start receiving this event. /// - Events ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD1 and /// ::ZES_EVENT_TYPE_FLAG_TEMP_THRESHOLD2 will be generated when /// temperature cross the thresholds set using this function. Use the /// function ::zesDeviceEventRegister() to start receiving these events. /// - Only one running process can set the temperature configuration at a /// time. If another process attempts to change the configuration, the /// error ::ZE_RESULT_ERROR_NOT_AVAILABLE will be returned. The function /// ::zesTemperatureGetConfig() will return the process ID currently /// controlling these settings. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTemperature` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pConfig` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + Temperature thresholds are not supported on this temperature sensor. Generally they are only supported for temperature sensor ::ZES_TEMP_SENSORS_GLOBAL. /// + Enabling the critical temperature event is not supported. Check the `isCriticalTempSupported` member of ::zes_temp_properties_t. /// + One or both of the thresholds is not supported. Check the `isThreshold1Supported` and `isThreshold2Supported` members of ::zes_temp_properties_t. /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to request this feature. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + Another running process is controlling these settings. /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + One or both the thresholds is above TjMax (see ::zesFrequencyOcGetTjMax()). Temperature thresholds must be below this value. ze_result_t ZE_APICALL zesTemperatureSetConfig( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. const zes_temp_config_t* pConfig ///< [in] New configuration. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetConfig = ze_lib::context->zesDdiTable.load()->Temperature.pfnSetConfig; if( nullptr == pfnSetConfig ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetConfig( hTemperature, pConfig ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the temperature from a specified sensor /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTemperature` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pTemperature` ze_result_t ZE_APICALL zesTemperatureGetState( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. double* pTemperature ///< [in,out] Will contain the temperature read from the specified sensor ///< in degrees Celsius. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetState = ze_lib::context->zesDdiTable.load()->Temperature.pfnGetState; if( nullptr == pfnGetState ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetState( hTemperature, pTemperature ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get power limits /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - This function returns all the power limits associated with the /// supplied power domain. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesPowerGetLimitsExt( zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. uint32_t* pCount, ///< [in,out] Pointer to the number of power limit descriptors. If count is ///< zero, then the driver shall update the value with the total number of ///< components of this type that are available. If count is greater than ///< the number of components of this type that are available, then the ///< driver shall update the value with the correct number of components. zes_power_limit_ext_desc_t* pSustained ///< [in,out][optional][range(0, *pCount)] Array of query results for power ///< limit descriptors. If count is less than the number of components of ///< this type that are available, then the driver shall only retrieve that ///< number of components. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetLimitsExt = ze_lib::context->zesDdiTable.load()->Power.pfnGetLimitsExt; if( nullptr == pfnGetLimitsExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetLimitsExt( hPower, pCount, pSustained ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set power limits /// /// @details /// - The application can only modify unlocked members of the limit /// descriptors returned by ::zesPowerGetLimitsExt. /// - Not all the limits returned by ::zesPowerGetLimitsExt need to be /// supplied to this function. /// - Limits do not have to be supplied in the same order as returned by /// ::zesPowerGetLimitsExt. /// - The same limit can be supplied multiple times. Limits are applied in /// the order in which they are supplied. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hPower` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + User does not have permissions to make these modifications. /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + The device is in use, meaning that the GPU is under Over clocking, applying power limits under overclocking is not supported. ze_result_t ZE_APICALL zesPowerSetLimitsExt( zes_pwr_handle_t hPower, ///< [in] Handle for the component. uint32_t* pCount, ///< [in] Pointer to the number of power limit descriptors. zes_power_limit_ext_desc_t* pSustained ///< [in][optional][range(0, *pCount)] Array of power limit descriptors. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetLimitsExt = ze_lib::context->zesDdiTable.load()->Power.pfnSetLimitsExt; if( nullptr == pfnSetLimitsExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetLimitsExt( hPower, pCount, pSustained ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get activity stats for Physical Function (PF) and each Virtual /// Function (VF) associated with engine group. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hEngine` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE - "Engine activity extension is not supported in the environment." ze_result_t ZE_APICALL zesEngineGetActivityExt( zes_engine_handle_t hEngine, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_engine_stats_t* pStats ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector with engine stat for ///< PF at index 0 of the vector followed by user provided pCount-1 number ///< of VF engine stats. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetActivityExt = ze_lib::context->zesDdiTable.load()->Engine.pfnGetActivityExt; if( nullptr == pfnGetActivityExt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetActivityExt( hEngine, pCount, pStats ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Ras Get State /// /// @details /// - This function retrieves error counters for different RAS error /// categories. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesRasGetStateExp( zes_ras_handle_t hRas, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of RAS state structures that can be retrieved. ///< if count is zero, then the driver shall update the value with the ///< total number of error categories for which state can be retrieved. ///< if count is greater than the number of RAS states available, then the ///< driver shall update the value with the correct number of RAS states available. zes_ras_state_exp_t* pState ///< [in,out][optional][range(0, *pCount)] array of query results for RAS ///< error states for different categories. ///< if count is less than the number of RAS states available, then driver ///< shall only retrieve that number of RAS states. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetStateExp = ze_lib::context->zesDdiTable.load()->RasExp.pfnGetStateExp; if( nullptr == pfnGetStateExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetStateExp( hRas, pCount, pState ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Ras Clear State /// /// @details /// - This function clears error counters for a RAS error category. /// - Clearing errors will affect other threads/applications - the counter /// values will start from zero. /// - Clearing errors requires write permissions. /// - The application should not call this function from simultaneous /// threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hRas` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZES_RAS_ERROR_CATEGORY_EXP_L3FABRIC_ERRORS < category` /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + Don't have permissions to clear error counters. ze_result_t ZE_APICALL zesRasClearStateExp( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_error_category_exp_t category ///< [in] category for which error counter is to be cleared. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnClearStateExp = ze_lib::context->zesDdiTable.load()->RasExp.pfnClearStateExp; if( nullptr == pfnClearStateExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnClearStateExp( hRas, category ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the firmware security version number of the currently running /// firmware /// /// @details /// - The application should create a character array of size /// ::ZES_STRING_PROPERTY_SIZE and reference it for the `pVersion` /// parameter. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFirmware` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pVersion` ze_result_t ZE_APICALL zesFirmwareGetSecurityVersionExp( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. char* pVersion ///< [in,out] NULL terminated string value. The string "unknown" will be ///< returned if this property cannot be determined. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetSecurityVersionExp = ze_lib::context->zesDdiTable.load()->FirmwareExp.pfnGetSecurityVersionExp; if( nullptr == pfnGetSecurityVersionExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetSecurityVersionExp( hFirmware, pVersion ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set the firmware security version number /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hFirmware` ze_result_t ZE_APICALL zesFirmwareSetSecurityVersionExp( zes_firmware_handle_t hFirmware ///< [in] Handle for the component. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetSecurityVersionExp = ze_lib::context->zesDdiTable.load()->FirmwareExp.pfnSetSecurityVersionExp; if( nullptr == pfnSetSecurityVersionExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetSecurityVersionExp( hFirmware ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves sub device properties for the given sysman device handle /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceGetSubDevicePropertiesExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of sub devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub devices currently attached to the device. ///< if count is greater than the number of sub devices currently attached ///< to the device, then the driver shall update the value with the correct ///< number of sub devices. zes_subdevice_exp_properties_t* pSubdeviceProps ///< [in,out][optional][range(0, *pCount)] array of sub device property structures. ///< if count is less than the number of sysman sub devices available, then ///< the driver shall only retrieve that number of sub device property structures. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetSubDevicePropertiesExp = ze_lib::context->zesDdiTable.load()->DeviceExp.pfnGetSubDevicePropertiesExp; if( nullptr == pfnGetSubDevicePropertiesExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetSubDevicePropertiesExp( hDevice, pCount, pSubdeviceProps ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves sysman device and subdevice index for the given UUID and /// sysman driver /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phDevice` /// + `nullptr == onSubdevice` /// + `nullptr == subdeviceId` ze_result_t ZE_APICALL zesDriverGetDeviceByUuidExp( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance zes_uuid_t uuid, ///< [in] universal unique identifier. zes_device_handle_t* phDevice, ///< [out] Sysman handle of the device. ze_bool_t* onSubdevice, ///< [out] True if the UUID belongs to the sub-device; false means that ///< UUID belongs to the root device. uint32_t* subdeviceId ///< [out] If onSubdevice is true, this gives the ID of the sub-device ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetDeviceByUuidExp = ze_lib::context->zesDdiTable.load()->DriverExp.pfnGetDeviceByUuidExp; if( nullptr == pfnGetDeviceByUuidExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetDeviceByUuidExp( hDriver, uuid, phDevice, onSubdevice, subdeviceId ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of virtual function modules /// /// @details /// - [DEPRECATED] No longer supported. Use ::zesDeviceEnumEnabledVFExp. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumActiveVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumActiveVFExp = ze_lib::context->zesDdiTable.load()->DeviceExp.pfnEnumActiveVFExp; if( nullptr == pfnEnumActiveVFExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumActiveVFExp( hDevice, pCount, phVFhandle ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get virtual function management properties /// /// @details /// - [DEPRECATED] No longer supported. Use /// ::zesVFManagementGetVFCapabilitiesExp. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zesVFManagementGetVFPropertiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetVFPropertiesExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnGetVFPropertiesExp; if( nullptr == pfnGetVFPropertiesExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetVFPropertiesExp( hVFhandle, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get memory activity stats for each available memory types associated /// with Virtual Function (VF) /// /// @details /// - [DEPRECATED] No longer supported. Use /// ::zesVFManagementGetVFMemoryUtilizationExp2. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesVFManagementGetVFMemoryUtilizationExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetVFMemoryUtilizationExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnGetVFMemoryUtilizationExp; if( nullptr == pfnGetVFMemoryUtilizationExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetVFMemoryUtilizationExp( hVFhandle, pCount, pMemUtil ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get engine activity stats for each available engine group associated /// with Virtual Function (VF) /// /// @details /// - [DEPRECATED] No longer supported. Use /// ::zesVFManagementGetVFEngineUtilizationExp2. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesVFManagementGetVFEngineUtilizationExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetVFEngineUtilizationExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnGetVFEngineUtilizationExp; if( nullptr == pfnGetVFEngineUtilizationExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetVFEngineUtilizationExp( hVFhandle, pCount, pEngineUtil ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Configure utilization telemetry enabled or disabled associated with /// Virtual Function (VF) /// /// @details /// - [DEPRECATED] No longer supported. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xf < flags` ze_result_t ZE_APICALL zesVFManagementSetVFTelemetryModeExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. ze_bool_t enable ///< [in] Enable utilization telemetry. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetVFTelemetryModeExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnSetVFTelemetryModeExp; if( nullptr == pfnSetVFTelemetryModeExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetVFTelemetryModeExp( hVFhandle, flags, enable ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Set sampling interval to monitor for a particular utilization /// telemetry associated with Virtual Function (VF) /// /// @details /// - [DEPRECATED] No longer supported. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0xf < flag` ze_result_t ZE_APICALL zesVFManagementSetVFTelemetrySamplingIntervalExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. uint64_t samplingInterval ///< [in] Sampling interval value. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetVFTelemetrySamplingIntervalExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnSetVFTelemetrySamplingIntervalExp; if( nullptr == pfnSetVFTelemetrySamplingIntervalExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetVFTelemetrySamplingIntervalExp( hVFhandle, flag, samplingInterval ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get handle of virtual function modules /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesDeviceEnumEnabledVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnumEnabledVFExp = ze_lib::context->zesDdiTable.load()->DeviceExp.pfnEnumEnabledVFExp; if( nullptr == pfnEnumEnabledVFExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnumEnabledVFExp( hDevice, pCount, phVFhandle ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get virtual function management capabilities /// /// @details /// - [DEPRECATED] No longer supported. Use /// ::zesVFManagementGetVFCapabilitiesExp2. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCapability` ze_result_t ZE_APICALL zesVFManagementGetVFCapabilitiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetVFCapabilitiesExp = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnGetVFCapabilitiesExp; if( nullptr == pfnGetVFCapabilitiesExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetVFCapabilitiesExp( hVFhandle, pCapability ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get memory activity stats for each available memory types associated /// with Virtual Function (VF) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - If VF is disable/pause/not active, utilization will give zero value. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesVFManagementGetVFMemoryUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetVFMemoryUtilizationExp2 = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnGetVFMemoryUtilizationExp2; if( nullptr == pfnGetVFMemoryUtilizationExp2 ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetVFMemoryUtilizationExp2( hVFhandle, pCount, pMemUtil ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get engine activity stats for each available engine group associated /// with Virtual Function (VF) /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// - If VF is disable/pause/not active, utilization will give zero value. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zesVFManagementGetVFEngineUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetVFEngineUtilizationExp2 = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnGetVFEngineUtilizationExp2; if( nullptr == pfnGetVFEngineUtilizationExp2 ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetVFEngineUtilizationExp2( hVFhandle, pCount, pEngineUtil ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get virtual function management capabilities /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hVFhandle` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCapability` ze_result_t ZE_APICALL zesVFManagementGetVFCapabilitiesExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp2_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetVFCapabilitiesExp2 = ze_lib::context->zesDdiTable.load()->VFManagementExp.pfnGetVFCapabilitiesExp2; if( nullptr == pfnGetVFCapabilitiesExp2 ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetVFCapabilitiesExp2( hVFhandle, pCapability ); } } // extern "C" level-zero-1.20.6/source/lib/zes_libddi.cpp000066400000000000000000000277161475521542100205710ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_libddi.cpp * */ #include "ze_lib.h" #ifndef DYNAMIC_LOAD_LOADER #include "zes_ddi.h" #endif namespace ze_lib { /////////////////////////////////////////////////////////////////////////////// #ifdef DYNAMIC_LOAD_LOADER __zedlllocal ze_result_t context_t::zesDdiTableInit() { ze_result_t result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetGlobalProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Global ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetDeviceProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Device ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetDeviceExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DeviceExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetDriverProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Driver ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetDriverExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DriverExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetDiagnosticsProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Diagnostics ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetEngineProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Engine ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetFabricPortProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.FabricPort ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetFanProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Fan ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetFirmwareProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Firmware ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetFirmwareExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.FirmwareExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetFrequencyProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Frequency ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetLedProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Led ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetMemoryProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Memory ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetOverclockProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Overclock ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetPerformanceFactorProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.PerformanceFactor ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetPowerProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Power ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetPsuProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Psu ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetRasProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Ras ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetRasExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.RasExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetSchedulerProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Scheduler ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetStandbyProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Standby ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetTemperatureProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Temperature ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zesGetVFManagementExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.VFManagementExp ); } return result; } #else __zedlllocal ze_result_t context_t::zesDdiTableInit() { ze_result_t result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { // Optional zesGetGlobalProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Global ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetDeviceProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Device ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zesGetDeviceExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DeviceExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetDriverProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Driver ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zesGetDriverExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.DriverExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetDiagnosticsProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Diagnostics ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetEngineProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Engine ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetFabricPortProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.FabricPort ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetFanProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Fan ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetFirmwareProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Firmware ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zesGetFirmwareExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.FirmwareExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetFrequencyProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Frequency ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetLedProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Led ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetMemoryProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Memory ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zesGetOverclockProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Overclock ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetPerformanceFactorProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.PerformanceFactor ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetPowerProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Power ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetPsuProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Psu ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetRasProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Ras ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zesGetRasExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.RasExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetSchedulerProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Scheduler ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetStandbyProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Standby ); } if( ZE_RESULT_SUCCESS == result ) { result = zesGetTemperatureProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.Temperature ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zesGetVFManagementExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzesDdiTable.VFManagementExp ); } return result; } #endif } // namespace ze_lib level-zero-1.20.6/source/lib/zet_libapi.cpp000066400000000000000000004173101475521542100205740ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_libapi.cpp * * @brief C++ static library for zet * */ #include "ze_lib.h" extern "C" { /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve debug info from module. /// /// @details /// - The caller can pass nullptr for pDebugInfo when querying only for /// size. /// - The implementation will copy the native binary into a buffer supplied /// by the caller. /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hModule` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_MODULE_DEBUG_INFO_FORMAT_ELF_DWARF < format` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pSize` ze_result_t ZE_APICALL zetModuleGetDebugInfo( zet_module_handle_t hModule, ///< [in] handle of the module zet_module_debug_info_format_t format, ///< [in] debug info format requested size_t* pSize, ///< [in,out] size of debug info in bytes uint8_t* pDebugInfo ///< [in,out][optional] byte pointer to debug info ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetDebugInfo = ze_lib::context->zetDdiTable.load()->Module.pfnGetDebugInfo; if( nullptr == pfnGetDebugInfo ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetDebugInfo( hModule, format, pSize, pDebugInfo ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves debug properties of the device. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pDebugProperties` ze_result_t ZE_APICALL zetDeviceGetDebugProperties( zet_device_handle_t hDevice, ///< [in] device handle zet_device_debug_properties_t* pDebugProperties ///< [in,out] query result for debug properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetDebugProperties = ze_lib::context->zetDdiTable.load()->Device.pfnGetDebugProperties; if( nullptr == pfnGetDebugProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetDebugProperties( hDevice, pDebugProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Attach to a device. /// /// @details /// - The device must be enabled for debug; see /// ::zesSchedulerSetComputeUnitDebugMode. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == config` /// + `nullptr == phDebug` /// - ::ZE_RESULT_ERROR_UNSUPPORTED_FEATURE /// + attaching to this device is not supported /// - ::ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS /// + caller does not have sufficient permissions /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + a debugger is already attached ze_result_t ZE_APICALL zetDebugAttach( zet_device_handle_t hDevice, ///< [in] device handle const zet_debug_config_t* config, ///< [in] the debug configuration zet_debug_session_handle_t* phDebug ///< [out] debug session handle ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAttach = ze_lib::context->zetDdiTable.load()->Debug.pfnAttach; if( nullptr == pfnAttach ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAttach( hDevice, config, phDebug ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Close a debug session. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` ze_result_t ZE_APICALL zetDebugDetach( zet_debug_session_handle_t hDebug ///< [in][release] debug session handle ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDetach = ze_lib::context->zetDdiTable.load()->Debug.pfnDetach; if( nullptr == pfnDetach ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDetach( hDebug ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Read the topmost debug event. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == event` /// - ::ZE_RESULT_NOT_READY /// + the timeout expired ze_result_t ZE_APICALL zetDebugReadEvent( zet_debug_session_handle_t hDebug, ///< [in] debug session handle uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the event; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. zet_debug_event_t* event ///< [in,out] a pointer to a ::zet_debug_event_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReadEvent = ze_lib::context->zetDdiTable.load()->Debug.pfnReadEvent; if( nullptr == pfnReadEvent ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReadEvent( hDebug, timeout, event ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Acknowledge a debug event. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == event` ze_result_t ZE_APICALL zetDebugAcknowledgeEvent( zet_debug_session_handle_t hDebug, ///< [in] debug session handle const zet_debug_event_t* event ///< [in] a pointer to a ::zet_debug_event_t. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAcknowledgeEvent = ze_lib::context->zetDdiTable.load()->Debug.pfnAcknowledgeEvent; if( nullptr == pfnAcknowledgeEvent ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAcknowledgeEvent( hDebug, event ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Interrupt device threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is already stopped or unavailable ze_result_t ZE_APICALL zetDebugInterrupt( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to interrupt ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnInterrupt = ze_lib::context->zetDdiTable.load()->Debug.pfnInterrupt; if( nullptr == pfnInterrupt ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnInterrupt( hDebug, thread ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Resume device threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is already running or unavailable ze_result_t ZE_APICALL zetDebugResume( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to resume ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnResume = ze_lib::context->zetDdiTable.load()->Debug.pfnResume; if( nullptr == pfnResume ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnResume( hDebug, thread ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Read memory. /// /// @details /// - The thread identifier 'all' can be used for accessing the default /// memory space, e.g. for setting breakpoints. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == buffer` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_DEBUG_MEMORY_SPACE_TYPE_ELF < desc->type` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is running or unavailable /// + the memory cannot be accessed from the supplied thread ze_result_t ZE_APICALL zetDebugReadMemory( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to read void* buffer ///< [in,out] a buffer to hold a copy of the memory ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReadMemory = ze_lib::context->zetDdiTable.load()->Debug.pfnReadMemory; if( nullptr == pfnReadMemory ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReadMemory( hDebug, thread, desc, size, buffer ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Write memory. /// /// @details /// - The thread identifier 'all' can be used for accessing the default /// memory space, e.g. for setting breakpoints. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == buffer` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_DEBUG_MEMORY_SPACE_TYPE_ELF < desc->type` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is running or unavailable /// + the memory cannot be accessed from the supplied thread ze_result_t ZE_APICALL zetDebugWriteMemory( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to write const void* buffer ///< [in] a buffer holding the pattern to write ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnWriteMemory = ze_lib::context->zetDdiTable.load()->Debug.pfnWriteMemory; if( nullptr == pfnWriteMemory ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnWriteMemory( hDebug, thread, desc, size, buffer ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves debug register set properties. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zetDebugGetRegisterSetProperties( zet_device_handle_t hDevice, ///< [in] device handle uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetRegisterSetProperties = ze_lib::context->zetDdiTable.load()->Debug.pfnGetRegisterSetProperties; if( nullptr == pfnGetRegisterSetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetRegisterSetProperties( hDevice, pCount, pRegisterSetProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves debug register set properties for a given thread. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is running or unavailable /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + the thread argument specifies more than one or a non-existant thread ze_result_t ZE_APICALL zetDebugGetThreadRegisterSetProperties( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier specifying a single stopped thread uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetThreadRegisterSetProperties = ze_lib::context->zetDdiTable.load()->Debug.pfnGetThreadRegisterSetProperties; if( nullptr == pfnGetThreadRegisterSetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetThreadRegisterSetProperties( hDebug, thread, pCount, pRegisterSetProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Read register state. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is running or unavailable ze_result_t ZE_APICALL zetDebugReadRegisters( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or ///< equal to the `count` member of ::zet_debug_register_group_properties_t ///< for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReadRegisters = ze_lib::context->zetDdiTable.load()->Debug.pfnReadRegisters; if( nullptr == pfnReadRegisters ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReadRegisters( hDebug, thread, type, start, count, pRegisterValues ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Write register state. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDebug` /// - ::ZE_RESULT_ERROR_NOT_AVAILABLE /// + the thread is running or unavailable ze_result_t ZE_APICALL zetDebugWriteRegisters( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than ///< or equal to the `count` member of ///< ::zet_debug_register_group_properties_t for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnWriteRegisters = ze_lib::context->zetDdiTable.load()->Debug.pfnWriteRegisters; if( nullptr == pfnWriteRegisters ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnWriteRegisters( hDebug, thread, type, start, count, pRegisterValues ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves metric group for a device. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zetMetricGroupGet( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric groups. ///< if count is zero, then the driver shall update the value with the ///< total number of metric groups available. ///< if count is greater than the number of metric groups available, then ///< the driver shall update the value with the correct number of metric ///< groups available. zet_metric_group_handle_t* phMetricGroups ///< [in,out][optional][range(0, *pCount)] array of handle of metric groups. ///< if count is less than the number of metric groups available, then ///< driver shall only retrieve that number of metric groups. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGet = ze_lib::context->zetDdiTable.load()->MetricGroup.pfnGet; if( nullptr == pfnGet ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGet( hDevice, pCount, phMetricGroups ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves attributes of a metric group. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zetMetricGroupGetProperties( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_properties_t* pProperties ///< [in,out] metric group properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zetDdiTable.load()->MetricGroup.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hMetricGroup, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Calculates metric values from raw data. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawData` /// + `nullptr == pMetricValueCount` ze_result_t ZE_APICALL zetMetricGroupCalculateMetricValues( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pMetricValueCount, ///< [in,out] pointer to number of metric values calculated. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pMetricValueCount)] buffer of calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCalculateMetricValues = ze_lib::context->zetDdiTable.load()->MetricGroup.pfnCalculateMetricValues; if( nullptr == pfnCalculateMetricValues ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCalculateMetricValues( hMetricGroup, type, rawDataSize, pRawData, pMetricValueCount, pMetricValues ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves metric from a metric group. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zetMetricGet( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group uint32_t* pCount, ///< [in,out] pointer to the number of metrics. ///< if count is zero, then the driver shall update the value with the ///< total number of metrics available. ///< if count is greater than the number of metrics available, then the ///< driver shall update the value with the correct number of metrics available. zet_metric_handle_t* phMetrics ///< [in,out][optional][range(0, *pCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metrics. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGet = ze_lib::context->zetDdiTable.load()->Metric.pfnGet; if( nullptr == pfnGet ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGet( hMetricGroup, pCount, phMetrics ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves attributes of a metric. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetric` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zetMetricGetProperties( zet_metric_handle_t hMetric, ///< [in] handle of the metric zet_metric_properties_t* pProperties ///< [in,out] metric properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProperties = ze_lib::context->zetDdiTable.load()->Metric.pfnGetProperties; if( nullptr == pfnGetProperties ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProperties( hMetric, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Activates metric groups. /// /// @details /// - Immediately reconfigures the device to activate only those metric /// groups provided. /// - Any metric groups previously activated but not provided will be /// deactivated. /// - Deactivating metric groups that are still in-use will result in /// undefined behavior. /// - All metric groups must have different domains, see /// ::zet_metric_group_properties_t. /// - The application must **not** call this function from simultaneous /// threads with the same device handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phMetricGroups) && (0 < count)` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + Multiple metric groups share the same domain ze_result_t ZE_APICALL zetContextActivateMetricGroups( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t count, ///< [in] metric group count to activate; must be 0 if `nullptr == ///< phMetricGroups` zet_metric_group_handle_t* phMetricGroups ///< [in][optional][range(0, count)] handles of the metric groups to activate. ///< nullptr deactivates all previously used metric groups. ///< all metrics groups must come from a different domains. ///< metric query and metric stream must use activated metric groups. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnActivateMetricGroups = ze_lib::context->zetDdiTable.load()->Context.pfnActivateMetricGroups; if( nullptr == pfnActivateMetricGroups ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnActivateMetricGroups( hContext, hDevice, count, phMetricGroups ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Opens metric streamer for a device. /// /// @details /// - The notification event must have been created from an event pool that /// was created using ::ZE_EVENT_POOL_FLAG_HOST_VISIBLE flag. /// - The duration of the signal event created from an event pool that was /// created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined. /// However, for consistency and orthogonality the event will report /// correctly as signaled when used by other event API functionality. /// - The application must **not** call this function from simultaneous /// threads with the same device handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phMetricStreamer` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ze_result_t ZE_APICALL zetMetricStreamerOpen( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_streamer_desc_t* desc, ///< [in,out] metric streamer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification zet_metric_streamer_handle_t* phMetricStreamer ///< [out] handle of metric streamer ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnOpen = ze_lib::context->zetDdiTable.load()->MetricStreamer.pfnOpen; if( nullptr == pfnOpen ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnOpen( hContext, hDevice, hMetricGroup, desc, hNotificationEvent, phMetricStreamer ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Append metric streamer marker into a command list. /// /// @details /// - The application must ensure the metric streamer is accessible by the /// device on which the command list was created. /// - The application must ensure the command list and metric streamer were /// created on the same context. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// - Allow to associate metric stream time based metrics with executed /// workload. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hMetricStreamer` ze_result_t ZE_APICALL zetCommandListAppendMetricStreamerMarker( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t value ///< [in] streamer marker value ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendMetricStreamerMarker = ze_lib::context->zetDdiTable.load()->CommandList.pfnAppendMetricStreamerMarker; if( nullptr == pfnAppendMetricStreamerMarker ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendMetricStreamerMarker( hCommandList, hMetricStreamer, value ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Closes metric streamer. /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same metric streamer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricStreamer` ze_result_t ZE_APICALL zetMetricStreamerClose( zet_metric_streamer_handle_t hMetricStreamer ///< [in][release] handle of the metric streamer ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnClose = ze_lib::context->zetDdiTable.load()->MetricStreamer.pfnClose; if( nullptr == pfnClose ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnClose( hMetricStreamer ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Reads data from metric streamer. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricStreamer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawDataSize` /// - ::ZE_RESULT_WARNING_DROPPED_DATA /// + Metric streamer data may have been dropped. Reduce sampling period. ze_result_t ZE_APICALL zetMetricStreamerReadData( zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReadData = ze_lib::context->zetDdiTable.load()->MetricStreamer.pfnReadData; if( nullptr == pfnReadData ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReadData( hMetricStreamer, maxReportCount, pRawDataSize, pRawData ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a pool of metric queries on the context. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == phMetricQueryPool` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_METRIC_QUERY_POOL_TYPE_EXECUTION < desc->type` ze_result_t ZE_APICALL zetMetricQueryPoolCreate( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] metric group associated with the query object. const zet_metric_query_pool_desc_t* desc, ///< [in] metric query pool descriptor zet_metric_query_pool_handle_t* phMetricQueryPool ///< [out] handle of metric query pool ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zetDdiTable.load()->MetricQueryPool.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hContext, hDevice, hMetricGroup, desc, phMetricQueryPool ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Deletes a query pool object. /// /// @details /// - The application must destroy all query handles created from the pool /// before destroying the pool itself. /// - The application must ensure the device is not currently referencing /// the any query within the pool before it is deleted. /// - The application must **not** call this function from simultaneous /// threads with the same query pool handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricQueryPool` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zetMetricQueryPoolDestroy( zet_metric_query_pool_handle_t hMetricQueryPool ///< [in][release] handle of the metric query pool ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zetDdiTable.load()->MetricQueryPool.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hMetricQueryPool ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates metric query from the pool. /// /// @details /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricQueryPool` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phMetricQuery` ze_result_t ZE_APICALL zetMetricQueryCreate( zet_metric_query_pool_handle_t hMetricQueryPool,///< [in] handle of the metric query pool uint32_t index, ///< [in] index of the query within the pool zet_metric_query_handle_t* phMetricQuery ///< [out] handle of metric query ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zetDdiTable.load()->MetricQuery.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hMetricQueryPool, index, phMetricQuery ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Deletes a metric query object. /// /// @details /// - The application must ensure the device is not currently referencing /// the query before it is deleted. /// - The application must **not** call this function from simultaneous /// threads with the same query handle. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricQuery` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zetMetricQueryDestroy( zet_metric_query_handle_t hMetricQuery ///< [in][release] handle of metric query ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zetDdiTable.load()->MetricQuery.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hMetricQuery ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Resets a metric query object back to initial state. /// /// @details /// - The application must ensure the device is not currently referencing /// the query before it is reset /// - The application must **not** call this function from simultaneous /// threads with the same query handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricQuery` ze_result_t ZE_APICALL zetMetricQueryReset( zet_metric_query_handle_t hMetricQuery ///< [in] handle of metric query ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReset = ze_lib::context->zetDdiTable.load()->MetricQuery.pfnReset; if( nullptr == pfnReset ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReset( hMetricQuery ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Appends metric query begin into a command list. /// /// @details /// - The application must ensure the metric query is accessible by the /// device on which the command list was created. /// - The application must ensure the command list and metric query were /// created on the same context. /// - This command blocks all following commands from beginning until the /// execution of the query completes. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hMetricQuery` ze_result_t ZE_APICALL zetCommandListAppendMetricQueryBegin( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery ///< [in] handle of the metric query ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendMetricQueryBegin = ze_lib::context->zetDdiTable.load()->CommandList.pfnAppendMetricQueryBegin; if( nullptr == pfnAppendMetricQueryBegin ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendMetricQueryBegin( hCommandList, hMetricQuery ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Appends metric query end into a command list. /// /// @details /// - The application must ensure the metric query and events are accessible /// by the device on which the command list was created. /// - The application must ensure the command list, events and metric query /// were created on the same context. /// - The duration of the signal event created from an event pool that was /// created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined. /// However, for consistency and orthogonality the event will report /// correctly as signaled when used by other event API functionality. /// - If numWaitEvents is zero, then all previous commands are completed /// prior to the execution of the query. /// - If numWaitEvents is non-zero, then all phWaitEvents must be signaled /// prior to the execution of the query. /// - This command blocks all following commands from beginning until the /// execution of the query completes. /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` /// + `nullptr == hMetricQuery` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT /// - ::ZE_RESULT_ERROR_INVALID_SIZE /// + `(nullptr == phWaitEvents) && (0 < numWaitEvents)` ze_result_t ZE_APICALL zetCommandListAppendMetricQueryEnd( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in] must be zero ze_event_handle_t* phWaitEvents ///< [in][mbz] must be nullptr ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendMetricQueryEnd = ze_lib::context->zetDdiTable.load()->CommandList.pfnAppendMetricQueryEnd; if( nullptr == pfnAppendMetricQueryEnd ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendMetricQueryEnd( hCommandList, hMetricQuery, hSignalEvent, numWaitEvents, phWaitEvents ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Appends metric query commands to flush all caches. /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same command list handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hCommandList` ze_result_t ZE_APICALL zetCommandListAppendMetricMemoryBarrier( zet_command_list_handle_t hCommandList ///< [in] handle of the command list ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAppendMetricMemoryBarrier = ze_lib::context->zetDdiTable.load()->CommandList.pfnAppendMetricMemoryBarrier; if( nullptr == pfnAppendMetricMemoryBarrier ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAppendMetricMemoryBarrier( hCommandList ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves raw data for a given metric query. /// /// @details /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricQuery` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawDataSize` ze_result_t ZE_APICALL zetMetricQueryGetData( zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing query ///< reports in raw format ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetData = ze_lib::context->zetDdiTable.load()->MetricQuery.pfnGetData; if( nullptr == pfnGetData ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetData( hMetricQuery, pRawDataSize, pRawData ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieve profiling information generated for the kernel. /// /// @details /// - Module must be created using the following build option: /// + "-zet-profile-flags " - enable generation of profile /// information /// + "" must be a combination of ::zet_profile_flag_t, in hex /// - The application may call this function from simultaneous threads. /// - The implementation of this function should be lock-free. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hKernel` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProfileProperties` ze_result_t ZE_APICALL zetKernelGetProfileInfo( zet_kernel_handle_t hKernel, ///< [in] handle to kernel zet_profile_properties_t* pProfileProperties ///< [out] pointer to profile properties ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetProfileInfo = ze_lib::context->zetDdiTable.load()->Kernel.pfnGetProfileInfo; if( nullptr == pfnGetProfileInfo ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetProfileInfo( hKernel, pProfileProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Creates a tracer on the context. /// /// @details /// - The application must only use the tracer for the context which was /// provided during creation. /// - The tracer is created in the disabled state. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == desc` /// + `nullptr == desc->pUserData` /// + `nullptr == phTracer` ze_result_t ZE_APICALL zetTracerExpCreate( zet_context_handle_t hContext, ///< [in] handle of the context object const zet_tracer_exp_desc_t* desc, ///< [in] pointer to tracer descriptor zet_tracer_exp_handle_t* phTracer ///< [out] pointer to handle of tracer object created ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreate = ze_lib::context->zetDdiTable.load()->TracerExp.pfnCreate; if( nullptr == pfnCreate ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreate( hContext, desc, phTracer ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroys a tracer. /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// - The implementation of this function must be thread-safe. /// - The implementation of this function will stall and wait on any /// outstanding threads executing callbacks before freeing any Host /// allocations associated with this tracer. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE ze_result_t ZE_APICALL zetTracerExpDestroy( zet_tracer_exp_handle_t hTracer ///< [in][release] handle of tracer object to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroy = ze_lib::context->zetDdiTable.load()->TracerExp.pfnDestroy; if( nullptr == pfnDestroy ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroy( hTracer ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Sets the collection of callbacks to be executed **before** driver /// execution. /// /// @details /// - The application only needs to set the function pointers it is /// interested in receiving; all others should be 'nullptr' /// - The application must ensure that no other threads are executing /// functions for which the tracing functions are changing. /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCoreCbs` ze_result_t ZE_APICALL zetTracerExpSetPrologues( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetPrologues = ze_lib::context->zetDdiTable.load()->TracerExp.pfnSetPrologues; if( nullptr == pfnSetPrologues ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetPrologues( hTracer, pCoreCbs ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Sets the collection of callbacks to be executed **after** driver /// execution. /// /// @details /// - The application only needs to set the function pointers it is /// interested in receiving; all others should be 'nullptr' /// - The application must ensure that no other threads are executing /// functions for which the tracing functions are changing. /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCoreCbs` ze_result_t ZE_APICALL zetTracerExpSetEpilogues( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetEpilogues = ze_lib::context->zetDdiTable.load()->TracerExp.pfnSetEpilogues; if( nullptr == pfnSetEpilogues ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetEpilogues( hTracer, pCoreCbs ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Enables (or disables) the tracer /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hTracer` ze_result_t ZE_APICALL zetTracerExpSetEnabled( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer ze_bool_t enable ///< [in] enable the tracer if true; disable if false ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnSetEnabled = ze_lib::context->zetDdiTable.load()->TracerExp.pfnSetEnabled; if( nullptr == pfnSetEnabled ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnSetEnabled( hTracer, enable ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get sets of metric groups which could be collected concurrently. /// /// @details /// - Re-arrange the input metric groups to provide sets of concurrent /// metric groups. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// + `nullptr == phMetricGroups` ze_result_t ZE_APICALL zetDeviceGetConcurrentMetricGroupsExp( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t * phMetricGroups, ///< [in,out] metrics groups to be re-arranged to be sets of concurrent ///< groups uint32_t * pMetricGroupsCountPerConcurrentGroup,///< [in,out][optional][*pConcurrentGroupCount] count of metric groups per ///< concurrent group. uint32_t * pConcurrentGroupCount ///< [out] number of concurrent groups. ///< The value of this parameter could be used to determine the number of ///< replays necessary. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetConcurrentMetricGroupsExp = ze_lib::context->zetDdiTable.load()->DeviceExp.pfnGetConcurrentMetricGroupsExp; if( nullptr == pfnGetConcurrentMetricGroupsExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetConcurrentMetricGroupsExp( hDevice, metricGroupCount, phMetricGroups, pMetricGroupsCountPerConcurrentGroup, pConcurrentGroupCount ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Create a metric tracer for a device. /// /// @details /// - The notification event must have been created from an event pool that /// was created using ::ZE_EVENT_POOL_FLAG_HOST_VISIBLE flag. /// - The duration of the signal event created from an event pool that was /// created using ::ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP flag is undefined. /// However, for consistency and orthogonality the event will report /// correctly as signaled when used by other event API functionality. /// - The application must **not** call this function from simultaneous /// threads with the same device handle. /// - The metric tracer is created in disabled state /// - Metric groups must support sampling type /// ZET_METRIC_SAMPLING_TYPE_EXP_FLAG_TRACER_BASED /// - All metric groups must be first activated /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hContext` /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phMetricGroups` /// + `nullptr == desc` /// + `nullptr == phMetricTracer` /// - ::ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT ze_result_t ZE_APICALL zetMetricTracerCreateExp( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t* phMetricGroups, ///< [in][range(0, metricGroupCount )] handles of the metric groups to ///< trace zet_metric_tracer_exp_desc_t* desc, ///< [in,out] metric tracer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification. Note: ///< If buffer is not drained when the event it flagged, there is a risk of ///< HW event buffer being overrun zet_metric_tracer_exp_handle_t* phMetricTracer ///< [out] handle of the metric tracer ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreateExp = ze_lib::context->zetDdiTable.load()->MetricTracerExp.pfnCreateExp; if( nullptr == pfnCreateExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreateExp( hContext, hDevice, metricGroupCount, phMetricGroups, desc, hNotificationEvent, phMetricTracer ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroy a metric tracer. /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same metric tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricTracer` ze_result_t ZE_APICALL zetMetricTracerDestroyExp( zet_metric_tracer_exp_handle_t hMetricTracer ///< [in] handle of the metric tracer ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroyExp = ze_lib::context->zetDdiTable.load()->MetricTracerExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroyExp( hMetricTracer ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Start events collection /// /// @details /// - Driver implementations must make this API call have as minimal /// overhead as possible, to allow applications start/stop event /// collection at any point during execution /// - The application must **not** call this function from simultaneous /// threads with the same metric tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricTracer` ze_result_t ZE_APICALL zetMetricTracerEnableExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_NOT_READY will be returned ///< when the tracer is inactive. ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnEnableExp = ze_lib::context->zetDdiTable.load()->MetricTracerExp.pfnEnableExp; if( nullptr == pfnEnableExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnEnableExp( hMetricTracer, synchronous ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Stop events collection /// /// @details /// - Driver implementations must make this API call have as minimal /// overhead as possible, to allow applications start/stop event /// collection at any point during execution /// - The application must **not** call this function from simultaneous /// threads with the same metric tracer handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricTracer` ze_result_t ZE_APICALL zetMetricTracerDisableExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active or when it is inactive but still has data. ///< ::ZE_RESULT_NOT_READY will be returned when the tracer is inactive and ///< has no more data to be retrieved. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDisableExp = ze_lib::context->zetDdiTable.load()->MetricTracerExp.pfnDisableExp; if( nullptr == pfnDisableExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDisableExp( hMetricTracer, synchronous ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Read data from the metric tracer /// /// @details /// - The application must **not** call this function from simultaneous /// threads with the same metric tracer handle. /// - Data can be retrieved after tracer is disabled. When buffers are /// drained ::ZE_RESULT_NOT_READY will be returned /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricTracer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawDataSize` /// - ::ZE_RESULT_WARNING_DROPPED_DATA /// + Metric tracer data may have been dropped. /// - ::ZE_RESULT_NOT_READY /// + Metric tracer is disabled and no data is available to read. ze_result_t ZE_APICALL zetMetricTracerReadDataExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all data available. ///< if size is non-zero, then driver will only retrieve that amount of ///< data. ///< if size is larger than size needed for all data, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnReadDataExp = ze_lib::context->zetDdiTable.load()->MetricTracerExp.pfnReadDataExp; if( nullptr == pfnReadDataExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnReadDataExp( hMetricTracer, pRawDataSize, pRawData ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Create a metric decoder for a given metric tracer. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricTracer` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == phMetricDecoder` ze_result_t ZE_APICALL zetMetricDecoderCreateExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer zet_metric_decoder_exp_handle_t* phMetricDecoder///< [out] handle of the metric decoder object ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreateExp = ze_lib::context->zetDdiTable.load()->MetricDecoderExp.pfnCreateExp; if( nullptr == pfnCreateExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreateExp( hMetricTracer, phMetricDecoder ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroy a metric decoder. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == phMetricDecoder` ze_result_t ZE_APICALL zetMetricDecoderDestroyExp( zet_metric_decoder_exp_handle_t phMetricDecoder ///< [in] handle of the metric decoder object ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroyExp = ze_lib::context->zetDdiTable.load()->MetricDecoderExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroyExp( phMetricDecoder ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Return the list of the decodable metrics from the decoder. /// /// @details /// - The decodable metrics handles returned by this API are defined by the /// metric groups in the tracer on which the decoder was created. /// - The decodable metrics handles returned by this API are only valid to /// decode metrics raw data with ::zetMetricTracerDecodeExp(). Decodable /// metric handles are not valid to compare with metrics handles included /// in metric groups. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricDecoder` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` /// + `nullptr == phMetrics` ze_result_t ZE_APICALL zetMetricDecoderGetDecodableMetricsExp( zet_metric_decoder_exp_handle_t hMetricDecoder, ///< [in] handle of the metric decoder object uint32_t* pCount, ///< [in,out] pointer to number of decodable metric in the hMetricDecoder ///< handle. If count is zero, then the driver shall ///< update the value with the total number of decodable metrics available ///< in the decoder. if count is greater than zero ///< but less than the total number of decodable metrics available in the ///< decoder, then only that number will be returned. ///< if count is greater than the number of decodable metrics available in ///< the decoder, then the driver shall update the ///< value with the actual number of decodable metrics available. zet_metric_handle_t* phMetrics ///< [in,out] [range(0, *pCount)] array of handles of decodable metrics in ///< the hMetricDecoder handle provided. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetDecodableMetricsExp = ze_lib::context->zetDdiTable.load()->MetricDecoderExp.pfnGetDecodableMetricsExp; if( nullptr == pfnGetDecodableMetricsExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetDecodableMetricsExp( hMetricDecoder, pCount, phMetrics ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Decode raw events collected from a tracer. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == phMetricDecoder` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawDataSize` /// + `nullptr == phMetrics` /// + `nullptr == pSetCount` /// + `nullptr == pMetricEntriesCount` ze_result_t ZE_APICALL zetMetricTracerDecodeExp( zet_metric_decoder_exp_handle_t phMetricDecoder,///< [in] handle of the metric decoder object size_t* pRawDataSize, ///< [in,out] size in bytes of raw data buffer. If pMetricEntriesCount is ///< greater than zero but less than total number of ///< decodable metrics available in the raw data buffer, then driver shall ///< update this value with actual number of raw ///< data bytes processed. uint8_t* pRawData, ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format uint32_t metricsCount, ///< [in] number of decodable metrics in the tracer for which the ///< hMetricDecoder handle was provided. See ///< ::zetMetricDecoderGetDecodableMetricsExp(). If metricCount is greater ///< than zero but less than the number decodable ///< metrics available in the raw data buffer, then driver shall only ///< decode those. zet_metric_handle_t* phMetrics, ///< [in] [range(0, metricsCount)] array of handles of decodable metrics in ///< the decoder for which the hMetricDecoder handle was ///< provided. Metrics handles are expected to be for decodable metrics, ///< see ::zetMetricDecoderGetDecodableMetricsExp() uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. If count is zero, then the ///< driver shall update the value with the total ///< number of metric sets to be decoded. If count is greater than the ///< number available in the raw data buffer, then the ///< driver shall update the value with the actual number of metric sets to ///< be decoded. There is a 1:1 relation between ///< the number of sets and sub-devices returned in the decoded entries. uint32_t* pMetricEntriesCountPerSet, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric entries ///< counts per metric set, one value per set. uint32_t* pMetricEntriesCount, ///< [in,out] pointer to the total number of metric entries decoded, for ///< all metric sets. If count is zero, then the ///< driver shall update the value with the total number of metric entries ///< to be decoded. If count is greater than zero ///< but less than the total number of metric entries available in the raw ///< data, then user provided number will be decoded. ///< If count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with ///< the actual number of decodable metric entries decoded. If set to null, ///< then driver will only update the value of ///< pSetCount. zet_metric_entry_exp_t* pMetricEntries ///< [in,out][optional][range(0, *pMetricEntriesCount)] buffer containing ///< decoded metric entries ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDecodeExp = ze_lib::context->zetDdiTable.load()->MetricTracerExp.pfnDecodeExp; if( nullptr == pfnDecodeExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDecodeExp( phMetricDecoder, pRawDataSize, pRawData, metricsCount, phMetrics, pSetCount, pMetricEntriesCountPerSet, pMetricEntriesCount, pMetricEntries ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Calculate one or more sets of metric values from raw data. /// /// @details /// - This function is similar to ::zetMetricGroupCalculateMetricValues /// except it may calculate more than one set of metric values from a /// single data buffer. There may be one set of metric values for each /// sub-device, for example. /// - Each set of metric values may consist of a different number of metric /// values, returned as the metric value count. /// - All metric values are calculated into a single buffer; use the metric /// counts to determine which metric values belong to which set. /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawData` /// + `nullptr == pSetCount` /// + `nullptr == pTotalMetricValueCount` ze_result_t ZE_APICALL zetMetricGroupCalculateMultipleMetricValuesExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCalculateMultipleMetricValuesExp = ze_lib::context->zetDdiTable.load()->MetricGroupExp.pfnCalculateMultipleMetricValuesExp; if( nullptr == pfnCalculateMultipleMetricValuesExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCalculateMultipleMetricValuesExp( hMetricGroup, type, rawDataSize, pRawData, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Returns metric timestamps synchronized with global device timestamps, /// optionally synchronized with host /// /// @details /// - The application may call this function from simultaneous threads. /// - By default, the global and metrics timestamps are synchronized to the /// device. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == globalTimestamp` /// + `nullptr == metricTimestamp` ze_result_t ZE_APICALL zetMetricGroupGetGlobalTimestampsExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group ze_bool_t synchronizedWithHost, ///< [in] Returns the timestamps synchronized to the host or the device. uint64_t* globalTimestamp, ///< [out] Device timestamp. uint64_t* metricTimestamp ///< [out] Metric timestamp. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetGlobalTimestampsExp = ze_lib::context->zetDdiTable.load()->MetricGroupExp.pfnGetGlobalTimestampsExp; if( nullptr == pfnGetGlobalTimestampsExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetGlobalTimestampsExp( hMetricGroup, synchronizedWithHost, globalTimestamp, metricTimestamp ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Export Metrics Data for system independent calculation. /// /// @details /// - This function exports raw data and necessary information to perform /// metrics calculation of collected data in a different system than where /// data was collected, which may or may not have accelerators. /// - Implementations can choose to describe the data arrangement of the /// exported data, using any mechanism which allows users to read and /// process them. /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pRawData` /// + `nullptr == pExportDataSize` ze_result_t ZE_APICALL zetMetricGroupGetExportDataExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group const uint8_t* pRawData, ///< [in] buffer of raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer size_t* pExportDataSize, ///< [in,out] size in bytes of export data buffer ///< if size is zero, then the driver shall update the value with the ///< number of bytes necessary to store the exported data. ///< if size is greater than required, then the driver shall update the ///< value with the actual number of bytes necessary to store the exported data. uint8_t * pExportData ///< [in,out][optional][range(0, *pExportDataSize)] buffer of exported data. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetExportDataExp = ze_lib::context->zetDdiTable.load()->MetricGroupExp.pfnGetExportDataExp; if( nullptr == pfnGetExportDataExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetExportDataExp( hMetricGroup, pRawData, rawDataSize, pExportDataSize, pExportData ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Calculate one or more sets of metric values from exported raw data. /// /// @details /// - Calculate metrics values using exported data returned by /// ::zetMetricGroupGetExportDataExp. /// - This function is similar to /// ::zetMetricGroupCalculateMultipleMetricValuesExp except it would /// calculate from exported metric data. /// - This function could be used to calculate metrics on a system different /// from where the metric raw data was collected. /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDriver` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `::ZET_METRIC_GROUP_CALCULATION_TYPE_MAX_METRIC_VALUES < type` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pExportData` /// + `nullptr == pCalculateDescriptor` /// + `nullptr == pSetCount` /// + `nullptr == pTotalMetricValueCount` ze_result_t ZE_APICALL zetMetricGroupCalculateMetricExportDataExp( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t exportDataSize, ///< [in] size in bytes of exported data buffer const uint8_t* pExportData, ///< [in][range(0, exportDataSize)] buffer of exported data to calculate zet_metric_calculate_exp_desc_t* pCalculateDescriptor, ///< [in] descriptor specifying calculation specific parameters uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCalculateMetricExportDataExp = ze_lib::context->zetDdiTable.load()->MetricGroupExp.pfnCalculateMetricExportDataExp; if( nullptr == pfnCalculateMetricExportDataExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCalculateMetricExportDataExp( hDriver, type, exportDataSize, pExportData, pCalculateDescriptor, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Query and get the available metric programmable handles. /// /// @details /// - Query the available programmable handles using *pCount = 0. /// - Returns all programmable metric handles available in the device. /// - The application may call this function from simultaneous threads. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pCount` ze_result_t ZE_APICALL zetMetricProgrammableGetExp( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric programmable handles. ///< if count is zero, then the driver shall update the value with the ///< total number of metric programmable handles available. ///< if count is greater than the number of metric programmable handles ///< available, then the driver shall update the value with the correct ///< number of metric programmable handles available. zet_metric_programmable_exp_handle_t* phMetricProgrammables ///< [in,out][optional][range(0, *pCount)] array of handle of metric programmables. ///< if count is less than the number of metric programmables available, ///< then driver shall only retrieve that number of metric programmables. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetExp = ze_lib::context->zetDdiTable.load()->MetricProgrammableExp.pfnGetExp; if( nullptr == pfnGetExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetExp( hDevice, pCount, phMetricProgrammables ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the properties of the metric programmable. /// /// @details /// - Returns the properties of the metric programmable. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricProgrammable` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pProperties` ze_result_t ZE_APICALL zetMetricProgrammableGetPropertiesExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_exp_properties_t* pProperties ///< [in,out] properties of the metric programmable ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetPropertiesExp = ze_lib::context->zetDdiTable.load()->MetricProgrammableExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetPropertiesExp( hMetricProgrammable, pProperties ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the information about the parameters of the metric programmable. /// /// @details /// - Returns information about the parameters of the metric programmable /// handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricProgrammable` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pParameterCount` /// + `nullptr == pParameterInfo` ze_result_t ZE_APICALL zetMetricProgrammableGetParamInfoExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t* pParameterCount, ///< [in,out] count of the parameters to retrieve parameter info. ///< if value pParameterCount is greater than count of parameters ///< available, then pParameterCount will be updated with count of ///< parameters available. ///< The count of parameters available can be queried using ::zetMetricProgrammableGetPropertiesExp. zet_metric_programmable_param_info_exp_t* pParameterInfo///< [in,out][range(1, *pParameterCount)] array of parameter info. ///< if parameterCount is less than the number of parameters available, ///< then driver shall only retrieve that number of parameter info. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetParamInfoExp = ze_lib::context->zetDdiTable.load()->MetricProgrammableExp.pfnGetParamInfoExp; if( nullptr == pfnGetParamInfoExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetParamInfoExp( hMetricProgrammable, pParameterCount, pParameterInfo ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Get the information about the parameter value of the metric /// programmable. /// /// @details /// - Returns the value-information about the parameter at the specific /// ordinal of the metric programmable handle. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricProgrammable` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pValueInfoCount` /// + `nullptr == pValueInfo` ze_result_t ZE_APICALL zetMetricProgrammableGetParamValueInfoExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterOrdinal, ///< [in] ordinal of the parameter in the metric programmable uint32_t* pValueInfoCount, ///< [in,out] count of parameter value information to retrieve. ///< if value at pValueInfoCount is greater than count of value info ///< available, then pValueInfoCount will be updated with count of value ///< info available. ///< The count of parameter value info available can be queried using ::zetMetricProgrammableGetParamInfoExp. zet_metric_programmable_param_value_info_exp_t* pValueInfo ///< [in,out][range(1, *pValueInfoCount)] array of parameter value info. ///< if pValueInfoCount is less than the number of value info available, ///< then driver shall only retrieve that number of value info. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnGetParamValueInfoExp = ze_lib::context->zetDdiTable.load()->MetricProgrammableExp.pfnGetParamValueInfoExp; if( nullptr == pfnGetParamValueInfoExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnGetParamValueInfoExp( hMetricProgrammable, parameterOrdinal, pValueInfoCount, pValueInfo ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Create metric handles by applying parameter values on the metric /// programmable handle. /// /// @details /// - Multiple parameter values could be used to prepare a metric. /// - If parameterCount = 0, the default value of the metric programmable /// would be used for all parameters. /// - The implementation can post-fix a C string to the metric name and /// description, based on the parameter values chosen. /// - ::zetMetricProgrammableGetParamInfoExp() returns a list of parameters /// in a defined order. /// - Therefore, the list of values passed in to the API should respect the /// same order such that the desired parameter is set with expected value /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricProgrammable` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pParameterValues` /// + `nullptr == pName` /// + `nullptr == pDescription` /// + `nullptr == pMetricHandleCount` ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp2( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreateFromProgrammableExp2 = ze_lib::context->zetDdiTable.load()->MetricExp.pfnCreateFromProgrammableExp2; if( nullptr == pfnCreateFromProgrammableExp2 ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreateFromProgrammableExp2( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Create metric handles by applying parameter values on the metric /// programmable handle. /// /// @details /// - This API is deprecated. Please use /// ::zetMetricCreateFromProgrammableExp2() /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricProgrammable` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pParameterValues` /// + `nullptr == pName` /// + `nullptr == pDescription` /// + `nullptr == pMetricHandleCount` ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. uint32_t parameterCount, ///< [in] Count of parameters to set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreateFromProgrammableExp = ze_lib::context->zetDdiTable.load()->MetricExp.pfnCreateFromProgrammableExp; if( nullptr == pfnCreateFromProgrammableExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreateFromProgrammableExp( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Create multiple metric group handles from metric handles. /// /// @details /// - Creates multiple metric groups from metrics which were created using /// ::zetMetricCreateFromProgrammableExp2(). /// - Metrics whose Hardware resources do not overlap are added to same /// metric group. /// - The metric groups created using this API are managed by the /// application and cannot be retrieved using ::zetMetricGroupGet(). /// - The created metric groups are ready for activation and collection. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// + `nullptr == phMetrics` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + metricGroupCount is lesser than the number of metric group handles that could be created. ze_result_t ZE_APICALL zetDeviceCreateMetricGroupsFromMetricsExp( zet_device_handle_t hDevice, ///< [in] handle of the device. uint32_t metricCount, ///< [in] number of metric handles. zet_metric_handle_t * phMetrics, ///< [in] metric handles to be added to the metric groups. const char * pMetricGroupNamePrefix, ///< [in] prefix to the name created for the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP. const char * pDescription, ///< [in] pointer to description of the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. uint32_t * pMetricGroupCount, ///< [in,out] pointer to the number of metric group handles to be created. ///< if pMetricGroupCount is zero, then the driver shall update the value ///< with the maximum possible number of metric group handles that could be created. ///< if pMetricGroupCount is greater than the number of metric group ///< handles that could be created, then the driver shall update the value ///< with the correct number of metric group handles generated. ///< if pMetricGroupCount is lesser than the number of metric group handles ///< that could be created, then ::ZE_RESULT_ERROR_INVALID_ARGUMENT is returned. zet_metric_group_handle_t* phMetricGroup ///< [in,out][optional][range(0, *pMetricGroupCount)] array of handle of ///< metric group handles. ///< Created Metric group handles. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreateMetricGroupsFromMetricsExp = ze_lib::context->zetDdiTable.load()->DeviceExp.pfnCreateMetricGroupsFromMetricsExp; if( nullptr == pfnCreateMetricGroupsFromMetricsExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreateMetricGroupsFromMetricsExp( hDevice, metricCount, phMetrics, pMetricGroupNamePrefix, pDescription, pMetricGroupCount, phMetricGroup ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Create metric group handle. /// /// @details /// - This API is deprecated. Please use /// ::zetDeviceCreateMetricGroupsFromMetricsExp /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hDevice` /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// + `nullptr == pName` /// + `nullptr == pDescription` /// + `nullptr == phMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_ENUMERATION /// + `0x7 < samplingType` ze_result_t ZE_APICALL zetMetricGroupCreateExp( zet_device_handle_t hDevice, ///< [in] handle of the device const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. const char* pDescription, ///< [in] pointer to metric group description. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. zet_metric_group_sampling_type_flags_t samplingType,///< [in] Sampling type for the metric group. zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCreateExp = ze_lib::context->zetDdiTable.load()->MetricGroupExp.pfnCreateExp; if( nullptr == pfnCreateExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCreateExp( hDevice, pName, pDescription, samplingType, phMetricGroup ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Add a metric handle to the metric group handle created using /// ::zetDeviceCreateMetricGroupsFromMetricsExp. /// /// @details /// - Reasons for failing to add the metric could be queried using /// pErrorString /// - Multiple additions of same metric would add the metric only once to /// the hMetricGroup /// - Metric handles from multiple domains may be used in a single metric /// group. /// - Metric handles from different sourceIds (refer /// ::zet_metric_programmable_exp_properties_t) are not allowed in a /// single metric group. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// + `nullptr == hMetric` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + If a Metric handle from a pre-defined metric group is requested to be added. /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + If the metric group is currently activated. ze_result_t ZE_APICALL zetMetricGroupAddMetricExp( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric, ///< [in] Metric to be added to the group. size_t * pErrorStringSize, ///< [in,out][optional] Size of the error string to query, if an error was ///< reported during adding the metric handle. ///< if *pErrorStringSize is zero, then the driver shall update the value ///< with the size of the error string in bytes. char* pErrorString ///< [in,out][optional][range(0, *pErrorStringSize)] Error string. ///< if *pErrorStringSize is less than the length of the error string ///< available, then driver shall only retrieve that length of error string. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnAddMetricExp = ze_lib::context->zetDdiTable.load()->MetricGroupExp.pfnAddMetricExp; if( nullptr == pfnAddMetricExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnAddMetricExp( hMetricGroup, hMetric, pErrorStringSize, pErrorString ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Remove a metric from the metric group handle created using /// ::zetDeviceCreateMetricGroupsFromMetricsExp. /// /// @details /// - Remove an already added metric handle from the metric group. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// + `nullptr == hMetric` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + If trying to remove a metric not previously added to the metric group /// + If the input metric group is a pre-defined metric group /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + If the metric group is currently activated ze_result_t ZE_APICALL zetMetricGroupRemoveMetricExp( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric ///< [in] Metric handle to be removed from the metric group. ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnRemoveMetricExp = ze_lib::context->zetDdiTable.load()->MetricGroupExp.pfnRemoveMetricExp; if( nullptr == pfnRemoveMetricExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnRemoveMetricExp( hMetricGroup, hMetric ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Closes a created metric group using /// ::zetDeviceCreateMetricGroupsFromMetricsExp, so that it can be /// activated. /// /// @details /// - Finalizes the ::zetMetricGroupAddMetricExp and /// ::zetMetricGroupRemoveMetricExp operations on the metric group. /// - This is a necessary step before activation of the created metric /// group. /// - Add / Remove of metrics is possible after ::zetMetricGroupCloseExp. /// However, a call to ::zetMetricGroupCloseExp is necessary after /// modifying the metric group. /// - Implementations could choose to add new metrics to the group during /// ::zetMetricGroupCloseExp, which are related and might add value to the /// metrics already added by the application /// - Applications can query the list of metrics in the metric group using /// ::zetMetricGet /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + If the input metric group is a pre-defined metric group /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + If the metric group is currently activated ze_result_t ZE_APICALL zetMetricGroupCloseExp( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnCloseExp = ze_lib::context->zetDdiTable.load()->MetricGroupExp.pfnCloseExp; if( nullptr == pfnCloseExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnCloseExp( hMetricGroup ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroy a metric group created using /// ::zetDeviceCreateMetricGroupsFromMetricsExp. /// /// @details /// - Metric handles created using ::zetMetricCreateFromProgrammableExp2 and /// are part of the metricGroup are not destroyed. /// - It is necessary to call ::zetMetricDestroyExp for each of the metric /// handles (created from ::zetMetricCreateFromProgrammableExp2) to /// destroy them. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetricGroup` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + If trying to destroy a pre-defined metric group /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + If trying to destroy an activated metric group ze_result_t ZE_APICALL zetMetricGroupDestroyExp( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroyExp = ze_lib::context->zetDdiTable.load()->MetricGroupExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroyExp( hMetricGroup ); } /////////////////////////////////////////////////////////////////////////////// /// @brief Destroy a metric created using ::zetMetricCreateFromProgrammableExp2. /// /// @details /// - If a metric is added to a metric group, the metric has to be removed /// using ::zetMetricGroupRemoveMetricExp before it can be destroyed. /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_DEVICE_LOST /// - ::ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY /// - ::ZE_RESULT_ERROR_INVALID_NULL_HANDLE /// + `nullptr == hMetric` /// - ::ZE_RESULT_ERROR_INVALID_ARGUMENT /// + If trying to destroy a metric from pre-defined metric group /// - ::ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE /// + If trying to destroy a metric currently added to a metric group ze_result_t ZE_APICALL zetMetricDestroyExp( zet_metric_handle_t hMetric ///< [in] Handle of the metric to destroy ) { if(ze_lib::destruction) { return ZE_RESULT_ERROR_UNINITIALIZED; } auto pfnDestroyExp = ze_lib::context->zetDdiTable.load()->MetricExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) { if(!ze_lib::context->isInitialized) return ZE_RESULT_ERROR_UNINITIALIZED; else return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE; } return pfnDestroyExp( hMetric ); } } // extern "C" level-zero-1.20.6/source/lib/zet_libddi.cpp000066400000000000000000000226151475521542100205630ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_libddi.cpp * */ #include "ze_lib.h" #ifndef DYNAMIC_LOAD_LOADER #include "zet_ddi.h" #endif namespace ze_lib { /////////////////////////////////////////////////////////////////////////////// #ifdef DYNAMIC_LOAD_LOADER __zedlllocal ze_result_t context_t::zetDdiTableInit() { ze_result_t result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetMetricDecoderExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricDecoderExp ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetMetricProgrammableExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricProgrammableExp ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetMetricTracerExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricTracerExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetDeviceProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.Device ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetDeviceExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.DeviceExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetContextProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.Context ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetCommandListProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.CommandList ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetKernelProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.Kernel ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetModuleProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.Module ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetDebugProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.Debug ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetMetricProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.Metric ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetMetricExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetMetricGroupProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricGroup ); } if( ZE_RESULT_SUCCESS == result ) { // Optional auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetMetricGroupExpProcAddrTable") ); getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricGroupExp ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetMetricQueryProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricQuery ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetMetricQueryPoolProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricQueryPool ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetMetricStreamerProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricStreamer ); } if( ZE_RESULT_SUCCESS == result ) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader, "zetGetTracerExpProcAddrTable") ); result = getTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.TracerExp ); } return result; } #else __zedlllocal ze_result_t context_t::zetDdiTableInit() { ze_result_t result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { // Optional zetGetMetricDecoderExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricDecoderExp ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zetGetMetricProgrammableExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricProgrammableExp ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zetGetMetricTracerExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricTracerExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zetGetDeviceProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.Device ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zetGetDeviceExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.DeviceExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zetGetContextProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.Context ); } if( ZE_RESULT_SUCCESS == result ) { result = zetGetCommandListProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.CommandList ); } if( ZE_RESULT_SUCCESS == result ) { result = zetGetKernelProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.Kernel ); } if( ZE_RESULT_SUCCESS == result ) { result = zetGetModuleProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.Module ); } if( ZE_RESULT_SUCCESS == result ) { result = zetGetDebugProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.Debug ); } if( ZE_RESULT_SUCCESS == result ) { result = zetGetMetricProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.Metric ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zetGetMetricExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zetGetMetricGroupProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricGroup ); } if( ZE_RESULT_SUCCESS == result ) { // Optional zetGetMetricGroupExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricGroupExp ); } if( ZE_RESULT_SUCCESS == result ) { result = zetGetMetricQueryProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricQuery ); } if( ZE_RESULT_SUCCESS == result ) { result = zetGetMetricQueryPoolProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricQueryPool ); } if( ZE_RESULT_SUCCESS == result ) { result = zetGetMetricStreamerProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.MetricStreamer ); } if( ZE_RESULT_SUCCESS == result ) { result = zetGetTracerExpProcAddrTable( ZE_API_VERSION_CURRENT, &initialzetDdiTable.TracerExp ); } return result; } #endif } // namespace ze_lib level-zero-1.20.6/source/libze_loader.pc.in000066400000000000000000000006051475521542100205570ustar00rootroot00000000000000prefix=${pcfiledir}/@pkgconfig_prefix@ includedir=${prefix}/@pkgconfig_include_dir@ libdir=${prefix}/@pkgconfig_lib_dir@ Name: Level Zero Loader Description: Runtime Library Loader for Level Zero URL: https://github.com/oneapi-src/level-zero Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@ Requires: Libs: -L${libdir} -lze_loader CFlags: -I${includedir} level-zero-1.20.6/source/loader/000077500000000000000000000000001475521542100164405ustar00rootroot00000000000000level-zero-1.20.6/source/loader/CMakeLists.txt000066400000000000000000000022171475521542100212020ustar00rootroot00000000000000# Copyright (C) 2020 Intel Corporation # SPDX-License-Identifier: MIT target_sources(${TARGET_LOADER_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ze_object.h ${CMAKE_CURRENT_SOURCE_DIR}/ze_loader_internal.h ${CMAKE_CURRENT_SOURCE_DIR}/ze_loader.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_loader_api.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ze_ldrddi.h ${CMAKE_CURRENT_SOURCE_DIR}/ze_ldrddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zet_ldrddi.h ${CMAKE_CURRENT_SOURCE_DIR}/zet_ldrddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zes_ldrddi.h ${CMAKE_CURRENT_SOURCE_DIR}/zes_ldrddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/zel_tracing_ldrddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/driver_discovery.h ) if(WIN32) target_sources(${TARGET_LOADER_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/windows/driver_discovery_win.cpp ${CMAKE_CURRENT_SOURCE_DIR}/windows/loader_init.cpp ) else() target_sources(${TARGET_LOADER_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/linux/driver_discovery_lin.cpp ${CMAKE_CURRENT_SOURCE_DIR}/linux/loader_init.cpp ) endif() level-zero-1.20.6/source/loader/driver_discovery.h000066400000000000000000000004301475521542100221700ustar00rootroot00000000000000/* * * Copyright (C) 2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include #include namespace loader { using DriverLibraryPath = std::string; std::vector discoverEnabledDrivers(); } // namespace loader level-zero-1.20.6/source/loader/linux/000077500000000000000000000000001475521542100175775ustar00rootroot00000000000000level-zero-1.20.6/source/loader/linux/driver_discovery_lin.cpp000066400000000000000000000020641475521542100245310ustar00rootroot00000000000000/* * * Copyright (C) 2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "source/loader/driver_discovery.h" #include "source/inc/ze_util.h" #include #include #include namespace loader { static const char *knownDriverNames[] = { MAKE_LIBRARY_NAME("ze_intel_gpu", "1"), MAKE_LIBRARY_NAME("ze_intel_gpu_legacy1", "1"), MAKE_LIBRARY_NAME("ze_intel_vpu", "1"), MAKE_LIBRARY_NAME("ze_intel_npu", "1"), }; std::vector discoverEnabledDrivers() { std::vector enabledDrivers; const char *altDrivers = nullptr; // ZE_ENABLE_ALT_DRIVERS is for development/debug only altDrivers = getenv("ZE_ENABLE_ALT_DRIVERS"); if (altDrivers == nullptr) { for (auto path : knownDriverNames) { enabledDrivers.emplace_back(path); } } else { std::stringstream ss(altDrivers); while (ss.good()) { std::string substr; getline(ss, substr, ','); enabledDrivers.emplace_back(substr); } } return enabledDrivers; } } // namespace loader level-zero-1.20.6/source/loader/linux/loader_init.cpp000066400000000000000000000005241475521542100225750ustar00rootroot00000000000000/* * * Copyright (C) 2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "../ze_loader_internal.h" namespace loader { void __attribute__((constructor)) createLoaderContext() { context = new context_t; } void __attribute__((destructor)) deleteLoaderContext() { delete context; } }level-zero-1.20.6/source/loader/windows/000077500000000000000000000000001475521542100201325ustar00rootroot00000000000000level-zero-1.20.6/source/loader/windows/driver_discovery_win.cpp000066400000000000000000000160541475521542100251030ustar00rootroot00000000000000/* * * Copyright (C) 2020 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "source/loader/driver_discovery.h" #include #include #include #include #include #include #include #include namespace loader { std::vector discoverDriversBasedOnDisplayAdapters(const GUID rguid); std::vector discoverEnabledDrivers() { std::vector enabledDrivers; DWORD envBufferSize = 65535; std::string altDrivers; altDrivers.resize(envBufferSize); // ZE_ENABLE_ALT_DRIVERS is for development/debug only envBufferSize = GetEnvironmentVariable("ZE_ENABLE_ALT_DRIVERS", &altDrivers[0], envBufferSize); if (!envBufferSize) { auto displayDrivers = discoverDriversBasedOnDisplayAdapters(GUID_DEVCLASS_DISPLAY); auto computeDrivers = discoverDriversBasedOnDisplayAdapters(GUID_DEVCLASS_COMPUTEACCELERATOR); enabledDrivers.insert(enabledDrivers.end(), displayDrivers.begin(), displayDrivers.end()); enabledDrivers.insert(enabledDrivers.end(), computeDrivers.begin(), computeDrivers.end()); } else { std::stringstream ss(altDrivers.c_str()); while (ss.good()) { std::string substr; getline(ss, substr, ','); enabledDrivers.emplace_back(substr); } } return enabledDrivers; } bool isStagedDriverPathSetForDisplayAdapter(DEVINST dnDevNode) { static constexpr char stagedDriverPathKey[] = "LevelZeroStagedDriverPath"; HKEY hkey = {}; CONFIGRET configErr = CM_Open_DevNode_Key(dnDevNode, KEY_QUERY_VALUE, 0, RegDisposition_OpenExisting, &hkey, CM_REGISTRY_SOFTWARE); if (CR_SUCCESS != configErr) { assert(false && "CM_Open_DevNode_Key failed"); return false; } DWORD regValueType = {}; DWORD pathSize = {}; LSTATUS regOpStatus = RegQueryValueExA(hkey, stagedDriverPathKey, NULL, ®ValueType, NULL, &pathSize); bool isStagedDriverPathSet = false; if (ERROR_SUCCESS == regOpStatus) { isStagedDriverPathSet = true; } regOpStatus = RegCloseKey(hkey); assert((ERROR_SUCCESS == regOpStatus) && "RegCloseKey failed"); return isStagedDriverPathSet; } bool isDeviceAvailable(DEVINST devnode) { ULONG devStatus = {}; ULONG devProblem = {}; auto configErr = CM_Get_DevNode_Status(&devStatus, &devProblem, devnode, 0); if (CR_SUCCESS != configErr) { assert(false && "CM_Get_DevNode_Status failed"); return false; } bool isInInvalidState = (devStatus & DN_HAS_PROBLEM) && (devProblem == CM_PROB_NEED_RESTART); if (! isStagedDriverPathSetForDisplayAdapter(devnode)) { isInInvalidState |= (DN_NEED_RESTART == (devStatus & DN_NEED_RESTART)); } isInInvalidState |= (devStatus & DN_HAS_PROBLEM) && (devProblem == CM_PROB_DISABLED); return false == isInInvalidState; } DriverLibraryPath readDriverPathForDisplayAdapter(DEVINST dnDevNode) { static constexpr char levelZeroDriverPathKey[] = "LevelZeroDriverPath"; HKEY hkey = {}; CONFIGRET configErr = CM_Open_DevNode_Key(dnDevNode, KEY_QUERY_VALUE, 0, RegDisposition_OpenExisting, &hkey, CM_REGISTRY_SOFTWARE); if (CR_SUCCESS != configErr) { assert(false && "CM_Open_DevNode_Key failed"); return ""; } DWORD regValueType = {}; DWORD pathSize = {}; LSTATUS regOpStatus = RegQueryValueExA(hkey, levelZeroDriverPathKey, NULL, ®ValueType, NULL, &pathSize); std::string driverPath; if ((ERROR_SUCCESS == regOpStatus) && (REG_SZ == regValueType)) { driverPath.resize(pathSize); regOpStatus = RegQueryValueExA(hkey, levelZeroDriverPathKey, NULL, ®ValueType, (LPBYTE) & *driverPath.begin(), &pathSize); if (ERROR_SUCCESS != regOpStatus) { assert(false && "RegQueryValueExA failed"); driverPath.clear(); } } regOpStatus = RegCloseKey(hkey); assert((ERROR_SUCCESS == regOpStatus) && "RegCloseKey failed"); return driverPath; } std::wstring readDisplayAdaptersDeviceIdsList(const GUID rguid) { OLECHAR displayGuidStr[MAX_GUID_STRING_LEN]; int strFromGuidErr = StringFromGUID2(rguid, displayGuidStr, MAX_GUID_STRING_LEN); if (MAX_GUID_STRING_LEN != strFromGuidErr) { assert(false && "StringFromGUID2 failed"); return L""; } std::wstring deviceIdList; CONFIGRET getDeviceIdListErr = CR_BUFFER_SMALL; while (CR_BUFFER_SMALL == getDeviceIdListErr) { ULONG deviceIdListSize = {}; ULONG deviceIdListFlags = CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT; auto getDeviceIdListSizeErr = CM_Get_Device_ID_List_SizeW(&deviceIdListSize, displayGuidStr, deviceIdListFlags); if (CR_SUCCESS != getDeviceIdListSizeErr) { assert(false && "CM_Get_Device_ID_List_size failed"); break; } deviceIdList.resize(deviceIdListSize); getDeviceIdListErr = CM_Get_Device_ID_ListW(displayGuidStr, &*deviceIdList.begin(), deviceIdListSize, deviceIdListFlags); } return deviceIdList; } std::vector discoverDriversBasedOnDisplayAdapters(const GUID rguid) { std::vector enabledDrivers; auto deviceIdList = readDisplayAdaptersDeviceIdsList(rguid); if (deviceIdList.empty()) { return enabledDrivers; } auto isNotDeviceListEnd = [](wchar_t *it) { return '\0' != it[0]; }; auto getNextDeviceInList = [](wchar_t *it) { return it + wcslen(it) + 1; }; auto deviceIdIt = &*deviceIdList.begin(); for (; isNotDeviceListEnd(deviceIdIt); deviceIdIt = getNextDeviceInList(deviceIdIt)) { DEVINST devinst = {}; if (CR_SUCCESS != CM_Locate_DevNodeW(&devinst, deviceIdIt, 0)) { assert(false && "CM_Locate_DevNodeW failed"); continue; } if (false == isDeviceAvailable(devinst)) { continue; } auto driverPath = readDriverPathForDisplayAdapter(devinst); if (driverPath.empty()) { continue; } bool alreadyOnTheList = (enabledDrivers.end() != std::find(enabledDrivers.begin(), enabledDrivers.end(), driverPath)); if (alreadyOnTheList) { continue; } enabledDrivers.push_back(std::move(driverPath)); } return enabledDrivers; } } // namespace loader level-zero-1.20.6/source/loader/windows/loader_init.cpp000066400000000000000000000007361475521542100231350ustar00rootroot00000000000000/* * * Copyright (C) 2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "../ze_loader_internal.h" namespace loader { #ifdef DYNAMIC_LOAD_LOADER extern "C" BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_DETACH) { delete context; } else if (fdwReason == DLL_PROCESS_ATTACH) { context = new context_t; } return TRUE; } #endif }level-zero-1.20.6/source/loader/ze_ldrddi.cpp000066400000000000000000014674371475521542100211320ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_ldrddi.cpp * */ #include "ze_loader_internal.h" namespace loader { /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeInit __zedlllocal ze_result_t ZE_APICALL zeInit( ze_init_flags_t flags ///< [in] initialization flags. ///< must be 0 (default) or a combination of ::ze_init_flag_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; drv.initStatus = drv.dditable.ze.Global.pfnInit( flags ); if(drv.initStatus == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; } if(!atLeastOneDriverValid) result=ZE_RESULT_ERROR_UNINITIALIZED; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGet __zedlllocal ze_result_t ZE_APICALL zeDriverGet( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ) { ze_result_t result = ZE_RESULT_SUCCESS; uint32_t total_driver_handle_count = 0; for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; if( ( 0 < *pCount ) && ( *pCount == total_driver_handle_count)) break; uint32_t library_driver_handle_count = 0; result = drv.dditable.ze.Driver.pfnGet( &library_driver_handle_count, nullptr ); if( ZE_RESULT_SUCCESS != result ) { // If Get Drivers fails with Uninitialized, then update the driver init status to prevent reporting this driver in the next get call. if (ZE_RESULT_ERROR_UNINITIALIZED == result) { drv.initStatus = result; } continue; } if( nullptr != phDrivers && *pCount !=0) { if( total_driver_handle_count + library_driver_handle_count > *pCount) { library_driver_handle_count = *pCount - total_driver_handle_count; } result = drv.dditable.ze.Driver.pfnGet( &library_driver_handle_count, &phDrivers[ total_driver_handle_count ] ); if( ZE_RESULT_SUCCESS != result ) break; drv.driverInuse = true; try { for( uint32_t i = 0; i < library_driver_handle_count; ++i ) { uint32_t driver_index = total_driver_handle_count + i; phDrivers[ driver_index ] = reinterpret_cast( context->ze_driver_factory.getInstance( phDrivers[ driver_index ], &drv.dditable ) ); } } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } } total_driver_handle_count += library_driver_handle_count; } // If the last driver get failed, but at least one driver succeeded, then return success with total count. if( ZE_RESULT_SUCCESS == result || total_driver_handle_count > 0) *pCount = total_driver_handle_count; if (total_driver_handle_count > 0) { result = ZE_RESULT_SUCCESS; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeInitDrivers __zedlllocal ze_result_t ZE_APICALL zeInitDrivers( uint32_t* pCount, ///< [in,out] pointer to the number of driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of drivers available. ///< if count is greater than the number of drivers available, then the ///< loader shall update the value with the correct number of drivers available. ze_driver_handle_t* phDrivers, ///< [in,out][optional][range(0, *pCount)] array of driver instance handles. ///< if count is less than the number of drivers available, then the loader ///< shall only retrieve that number of drivers. ze_init_driver_type_desc_t* desc ///< [in] descriptor containing the driver type initialization details ///< including ::ze_init_driver_type_flag_t combinations. ) { ze_result_t result = ZE_RESULT_SUCCESS; uint32_t total_driver_handle_count = 0; for( auto& drv : loader::context->zeDrivers ) { if (!drv.dditable.ze.Global.pfnInitDrivers) { drv.initDriversStatus = ZE_RESULT_ERROR_UNINITIALIZED; continue; } if( ( 0 < *pCount ) && ( *pCount == total_driver_handle_count)) break; uint32_t library_driver_handle_count = 0; result = drv.dditable.ze.Global.pfnInitDrivers( &library_driver_handle_count, nullptr, desc ); if( ZE_RESULT_SUCCESS != result ) { // If Get Drivers fails with Uninitialized, then update the driver init status to prevent reporting this driver in the next get call. if (ZE_RESULT_ERROR_UNINITIALIZED == result) { drv.initDriversStatus = result; } continue; } if( nullptr != phDrivers && *pCount !=0) { if( total_driver_handle_count + library_driver_handle_count > *pCount) { library_driver_handle_count = *pCount - total_driver_handle_count; } result = drv.dditable.ze.Global.pfnInitDrivers( &library_driver_handle_count, &phDrivers[ total_driver_handle_count ], desc ); if( ZE_RESULT_SUCCESS != result ) break; drv.driverInuse = true; try { for( uint32_t i = 0; i < library_driver_handle_count; ++i ) { uint32_t driver_index = total_driver_handle_count + i; phDrivers[ driver_index ] = reinterpret_cast( context->ze_driver_factory.getInstance( phDrivers[ driver_index ], &drv.dditable ) ); } } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } } total_driver_handle_count += library_driver_handle_count; } // If the last driver get failed, but at least one driver succeeded, then return success with total count. if( ZE_RESULT_SUCCESS == result || total_driver_handle_count > 0) *pCount = total_driver_handle_count; if (total_driver_handle_count > 0) { result = ZE_RESULT_SUCCESS; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetApiVersion __zedlllocal ze_result_t ZE_APICALL zeDriverGetApiVersion( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_api_version_t* version ///< [out] api version ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnGetApiVersion = dditable->ze.Driver.pfnGetApiVersion; if( nullptr == pfnGetApiVersion ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnGetApiVersion( hDriver, version ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetProperties __zedlllocal ze_result_t ZE_APICALL zeDriverGetProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_properties_t* pDriverProperties ///< [in,out] query result for driver properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnGetProperties = dditable->ze.Driver.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnGetProperties( hDriver, pDriverProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetIpcProperties __zedlllocal ze_result_t ZE_APICALL zeDriverGetIpcProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance ze_driver_ipc_properties_t* pIpcProperties ///< [in,out] query result for IPC properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnGetIpcProperties = dditable->ze.Driver.pfnGetIpcProperties; if( nullptr == pfnGetIpcProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnGetIpcProperties( hDriver, pIpcProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetExtensionProperties __zedlllocal ze_result_t ZE_APICALL zeDriverGetExtensionProperties( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. ze_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnGetExtensionProperties = dditable->ze.Driver.pfnGetExtensionProperties; if( nullptr == pfnGetExtensionProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnGetExtensionProperties( hDriver, pCount, pExtensionProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetExtensionFunctionAddress __zedlllocal ze_result_t ZE_APICALL zeDriverGetExtensionFunctionAddress( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnGetExtensionFunctionAddress = dditable->ze.Driver.pfnGetExtensionFunctionAddress; if( nullptr == pfnGetExtensionFunctionAddress ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnGetExtensionFunctionAddress( hDriver, name, ppFunctionAddress ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverGetLastErrorDescription __zedlllocal ze_result_t ZE_APICALL zeDriverGetLastErrorDescription( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance const char** ppString ///< [in,out] pointer to a null-terminated array of characters describing ///< cause of error. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnGetLastErrorDescription = dditable->ze.Driver.pfnGetLastErrorDescription; if( nullptr == pfnGetLastErrorDescription ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnGetLastErrorDescription( hDriver, ppString ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGet __zedlllocal ze_result_t ZE_APICALL zeDeviceGet( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of devices. ///< if count is zero, then the driver shall update the value with the ///< total number of devices available. ///< if count is greater than the number of devices available, then the ///< driver shall update the value with the correct number of devices available. ze_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of devices. ///< if count is less than the number of devices available, then driver ///< shall only retrieve that number of devices. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnGet = dditable->ze.Device.pfnGet; if( nullptr == pfnGet ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnGet( hDriver, pCount, phDevices ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phDevices ) && ( i < *pCount ); ++i ) phDevices[ i ] = reinterpret_cast( context->ze_device_factory.getInstance( phDevices[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetRootDevice __zedlllocal ze_result_t ZE_APICALL zeDeviceGetRootDevice( ze_device_handle_t hDevice, ///< [in] handle of the device object ze_device_handle_t* phRootDevice ///< [in,out] parent root device. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetRootDevice = dditable->ze.Device.pfnGetRootDevice; if( nullptr == pfnGetRootDevice ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetRootDevice( hDevice, phRootDevice ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phRootDevice = reinterpret_cast( context->ze_device_factory.getInstance( *phRootDevice, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetSubDevices __zedlllocal ze_result_t ZE_APICALL zeDeviceGetSubDevices( ze_device_handle_t hDevice, ///< [in] handle of the device object uint32_t* pCount, ///< [in,out] pointer to the number of sub-devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-devices available. ///< if count is greater than the number of sub-devices available, then the ///< driver shall update the value with the correct number of sub-devices available. ze_device_handle_t* phSubdevices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-devices. ///< if count is less than the number of sub-devices available, then driver ///< shall only retrieve that number of sub-devices. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetSubDevices = dditable->ze.Device.pfnGetSubDevices; if( nullptr == pfnGetSubDevices ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetSubDevices( hDevice, pCount, phSubdevices ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phSubdevices ) && ( i < *pCount ); ++i ) phSubdevices[ i ] = reinterpret_cast( context->ze_device_factory.getInstance( phSubdevices[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_properties_t* pDeviceProperties ///< [in,out] query result for device properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetProperties = dditable->ze.Device.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetProperties( hDevice, pDeviceProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetComputeProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetComputeProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_compute_properties_t* pComputeProperties ///< [in,out] query result for compute properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetComputeProperties = dditable->ze.Device.pfnGetComputeProperties; if( nullptr == pfnGetComputeProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetComputeProperties( hDevice, pComputeProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetModuleProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetModuleProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_module_properties_t* pModuleProperties///< [in,out] query result for module properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetModuleProperties = dditable->ze.Device.pfnGetModuleProperties; if( nullptr == pfnGetModuleProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetModuleProperties( hDevice, pModuleProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetCommandQueueGroupProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetCommandQueueGroupProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of command queue group properties. ///< if count is zero, then the driver shall update the value with the ///< total number of command queue group properties available. ///< if count is greater than the number of command queue group properties ///< available, then the driver shall update the value with the correct ///< number of command queue group properties available. ze_command_queue_group_properties_t* pCommandQueueGroupProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< command queue group properties. ///< if count is less than the number of command queue group properties ///< available, then driver shall only retrieve that number of command ///< queue group properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetCommandQueueGroupProperties = dditable->ze.Device.pfnGetCommandQueueGroupProperties; if( nullptr == pfnGetCommandQueueGroupProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetCommandQueueGroupProperties( hDevice, pCount, pCommandQueueGroupProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetMemoryProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetMemoryProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of memory properties. ///< if count is zero, then the driver shall update the value with the ///< total number of memory properties available. ///< if count is greater than the number of memory properties available, ///< then the driver shall update the value with the correct number of ///< memory properties available. ze_device_memory_properties_t* pMemProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< memory properties. ///< if count is less than the number of memory properties available, then ///< driver shall only retrieve that number of memory properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetMemoryProperties = dditable->ze.Device.pfnGetMemoryProperties; if( nullptr == pfnGetMemoryProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetMemoryProperties( hDevice, pCount, pMemProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetMemoryAccessProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetMemoryAccessProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_memory_access_properties_t* pMemAccessProperties ///< [in,out] query result for memory access properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetMemoryAccessProperties = dditable->ze.Device.pfnGetMemoryAccessProperties; if( nullptr == pfnGetMemoryAccessProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetMemoryAccessProperties( hDevice, pMemAccessProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetCacheProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetCacheProperties( ze_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of cache properties. ///< if count is zero, then the driver shall update the value with the ///< total number of cache properties available. ///< if count is greater than the number of cache properties available, ///< then the driver shall update the value with the correct number of ///< cache properties available. ze_device_cache_properties_t* pCacheProperties ///< [in,out][optional][range(0, *pCount)] array of query results for cache properties. ///< if count is less than the number of cache properties available, then ///< driver shall only retrieve that number of cache properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetCacheProperties = dditable->ze.Device.pfnGetCacheProperties; if( nullptr == pfnGetCacheProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetCacheProperties( hDevice, pCount, pCacheProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetImageProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetImageProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_image_properties_t* pImageProperties ///< [in,out] query result for image properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetImageProperties = dditable->ze.Device.pfnGetImageProperties; if( nullptr == pfnGetImageProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetImageProperties( hDevice, pImageProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetExternalMemoryProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetExternalMemoryProperties( ze_device_handle_t hDevice, ///< [in] handle of the device ze_device_external_memory_properties_t* pExternalMemoryProperties ///< [in,out] query result for external memory properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetExternalMemoryProperties = dditable->ze.Device.pfnGetExternalMemoryProperties; if( nullptr == pfnGetExternalMemoryProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetExternalMemoryProperties( hDevice, pExternalMemoryProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetP2PProperties __zedlllocal ze_result_t ZE_APICALL zeDeviceGetP2PProperties( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_device_p2p_properties_t* pP2PProperties ///< [in,out] Peer-to-Peer properties between source and peer device ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetP2PProperties = dditable->ze.Device.pfnGetP2PProperties; if( nullptr == pfnGetP2PProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // convert loader handle to driver handle hPeerDevice = reinterpret_cast( hPeerDevice )->handle; // forward to device-driver result = pfnGetP2PProperties( hDevice, hPeerDevice, pP2PProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceCanAccessPeer __zedlllocal ze_result_t ZE_APICALL zeDeviceCanAccessPeer( ze_device_handle_t hDevice, ///< [in] handle of the device performing the access ze_device_handle_t hPeerDevice, ///< [in] handle of the peer device with the allocation ze_bool_t* value ///< [out] returned access capability ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnCanAccessPeer = dditable->ze.Device.pfnCanAccessPeer; if( nullptr == pfnCanAccessPeer ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // convert loader handle to driver handle hPeerDevice = reinterpret_cast( hPeerDevice )->handle; // forward to device-driver result = pfnCanAccessPeer( hDevice, hPeerDevice, value ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetStatus __zedlllocal ze_result_t ZE_APICALL zeDeviceGetStatus( ze_device_handle_t hDevice ///< [in] handle of the device ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetStatus = dditable->ze.Device.pfnGetStatus; if( nullptr == pfnGetStatus ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetStatus( hDevice ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetGlobalTimestamps __zedlllocal ze_result_t ZE_APICALL zeDeviceGetGlobalTimestamps( ze_device_handle_t hDevice, ///< [in] handle of the device uint64_t* hostTimestamp, ///< [out] value of the Host's global timestamp that correlates with the ///< Device's global timestamp value. uint64_t* deviceTimestamp ///< [out] value of the Device's global timestamp that correlates with the ///< Host's global timestamp value. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetGlobalTimestamps = dditable->ze.Device.pfnGetGlobalTimestamps; if( nullptr == pfnGetGlobalTimestamps ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetGlobalTimestamps( hDevice, hostTimestamp, deviceTimestamp ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreate __zedlllocal ze_result_t ZE_APICALL zeContextCreate( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnCreate = dditable->ze.Context.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnCreate( hDriver, desc, phContext ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phContext = reinterpret_cast( context->ze_context_factory.getInstance( *phContext, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextCreateEx __zedlllocal ze_result_t ZE_APICALL zeContextCreateEx( ze_driver_handle_t hDriver, ///< [in] handle of the driver object const ze_context_desc_t* desc, ///< [in] pointer to context descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< context has visibility. ///< if nullptr, then all devices and any sub-devices supported by the ///< driver instance are ///< visible to the context. ///< otherwise, the context only has visibility to the devices and any ///< sub-devices of the ///< devices in this array. ze_context_handle_t* phContext ///< [out] pointer to handle of context object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnCreateEx = dditable->ze.Context.pfnCreateEx; if( nullptr == pfnCreateEx ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // convert loader handles to driver handles auto phDevicesLocal = new ze_device_handle_t [numDevices]; for( size_t i = 0; ( nullptr != phDevices ) && ( i < numDevices ); ++i ) phDevicesLocal[ i ] = reinterpret_cast( phDevices[ i ] )->handle; // forward to device-driver result = pfnCreateEx( hDriver, desc, numDevices, phDevicesLocal, phContext ); delete []phDevicesLocal; if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phContext = reinterpret_cast( context->ze_context_factory.getInstance( *phContext, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextDestroy __zedlllocal ze_result_t ZE_APICALL zeContextDestroy( ze_context_handle_t hContext ///< [in][release] handle of context object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnDestroy = dditable->ze.Context.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnDestroy( hContext ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_context_factory.release( hContext ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextGetStatus __zedlllocal ze_result_t ZE_APICALL zeContextGetStatus( ze_context_handle_t hContext ///< [in] handle of context object ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnGetStatus = dditable->ze.Context.pfnGetStatus; if( nullptr == pfnGetStatus ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnGetStatus( hContext ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueCreate __zedlllocal ze_result_t ZE_APICALL zeCommandQueueCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* desc, ///< [in] pointer to command queue descriptor ze_command_queue_handle_t* phCommandQueue ///< [out] pointer to handle of command queue object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnCreate = dditable->ze.CommandQueue.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnCreate( hContext, hDevice, desc, phCommandQueue ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phCommandQueue = reinterpret_cast( context->ze_command_queue_factory.getInstance( *phCommandQueue, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueDestroy __zedlllocal ze_result_t ZE_APICALL zeCommandQueueDestroy( ze_command_queue_handle_t hCommandQueue ///< [in][release] handle of command queue object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandQueue )->dditable; auto pfnDestroy = dditable->ze.CommandQueue.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandQueue = reinterpret_cast( hCommandQueue )->handle; // forward to device-driver result = pfnDestroy( hCommandQueue ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_command_queue_factory.release( hCommandQueue ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueExecuteCommandLists __zedlllocal ze_result_t ZE_APICALL zeCommandQueueExecuteCommandLists( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t numCommandLists, ///< [in] number of command lists to execute ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] list of handles of the command lists ///< to execute ze_fence_handle_t hFence ///< [in][optional] handle of the fence to signal on completion ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandQueue )->dditable; auto pfnExecuteCommandLists = dditable->ze.CommandQueue.pfnExecuteCommandLists; if( nullptr == pfnExecuteCommandLists ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandQueue = reinterpret_cast( hCommandQueue )->handle; // convert loader handles to driver handles auto phCommandListsLocal = new ze_command_list_handle_t [numCommandLists]; for( size_t i = 0; ( nullptr != phCommandLists ) && ( i < numCommandLists ); ++i ) phCommandListsLocal[ i ] = reinterpret_cast( phCommandLists[ i ] )->handle; // convert loader handle to driver handle hFence = ( hFence ) ? reinterpret_cast( hFence )->handle : nullptr; // forward to device-driver result = pfnExecuteCommandLists( hCommandQueue, numCommandLists, phCommandListsLocal, hFence ); delete []phCommandListsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueSynchronize __zedlllocal ze_result_t ZE_APICALL zeCommandQueueSynchronize( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the command queue; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandQueue )->dditable; auto pfnSynchronize = dditable->ze.CommandQueue.pfnSynchronize; if( nullptr == pfnSynchronize ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandQueue = reinterpret_cast( hCommandQueue )->handle; // forward to device-driver result = pfnSynchronize( hCommandQueue, timeout ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueGetOrdinal __zedlllocal ze_result_t ZE_APICALL zeCommandQueueGetOrdinal( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pOrdinal ///< [out] command queue group ordinal ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandQueue )->dditable; auto pfnGetOrdinal = dditable->ze.CommandQueue.pfnGetOrdinal; if( nullptr == pfnGetOrdinal ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandQueue = reinterpret_cast( hCommandQueue )->handle; // forward to device-driver result = pfnGetOrdinal( hCommandQueue, pOrdinal ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandQueueGetIndex __zedlllocal ze_result_t ZE_APICALL zeCommandQueueGetIndex( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of the command queue uint32_t* pIndex ///< [out] command queue index within the group ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandQueue )->dditable; auto pfnGetIndex = dditable->ze.CommandQueue.pfnGetIndex; if( nullptr == pfnGetIndex ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandQueue = reinterpret_cast( hCommandQueue )->handle; // forward to device-driver result = pfnGetIndex( hCommandQueue, pIndex ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListCreate __zedlllocal ze_result_t ZE_APICALL zeCommandListCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_list_desc_t* desc, ///< [in] pointer to command list descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnCreate = dditable->ze.CommandList.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnCreate( hContext, hDevice, desc, phCommandList ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phCommandList = reinterpret_cast( context->ze_command_list_factory.getInstance( *phCommandList, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListCreateImmediate __zedlllocal ze_result_t ZE_APICALL zeCommandListCreateImmediate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object const ze_command_queue_desc_t* altdesc, ///< [in] pointer to command queue descriptor ze_command_list_handle_t* phCommandList ///< [out] pointer to handle of command list object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnCreateImmediate = dditable->ze.CommandList.pfnCreateImmediate; if( nullptr == pfnCreateImmediate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnCreateImmediate( hContext, hDevice, altdesc, phCommandList ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phCommandList = reinterpret_cast( context->ze_command_list_factory.getInstance( *phCommandList, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListDestroy __zedlllocal ze_result_t ZE_APICALL zeCommandListDestroy( ze_command_list_handle_t hCommandList ///< [in][release] handle of command list object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnDestroy = dditable->ze.CommandList.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnDestroy( hCommandList ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_command_list_factory.release( hCommandList ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListClose __zedlllocal ze_result_t ZE_APICALL zeCommandListClose( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to close ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnClose = dditable->ze.CommandList.pfnClose; if( nullptr == pfnClose ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnClose( hCommandList ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListReset __zedlllocal ze_result_t ZE_APICALL zeCommandListReset( ze_command_list_handle_t hCommandList ///< [in] handle of command list object to reset ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnReset = dditable->ze.CommandList.pfnReset; if( nullptr == pfnReset ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnReset( hCommandList ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendWriteGlobalTimestamp __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendWriteGlobalTimestamp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t* dstptr, ///< [in,out] pointer to memory where timestamp value will be written; must ///< be 8byte-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendWriteGlobalTimestamp = dditable->ze.CommandList.pfnAppendWriteGlobalTimestamp; if( nullptr == pfnAppendWriteGlobalTimestamp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendWriteGlobalTimestamp( hCommandList, dstptr, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListHostSynchronize __zedlllocal ze_result_t ZE_APICALL zeCommandListHostSynchronize( ze_command_list_handle_t hCommandList, ///< [in] handle of the immediate command list uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the immediate command list; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnHostSynchronize = dditable->ze.CommandList.pfnHostSynchronize; if( nullptr == pfnHostSynchronize ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnHostSynchronize( hCommandList, timeout ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetDeviceHandle __zedlllocal ze_result_t ZE_APICALL zeCommandListGetDeviceHandle( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_device_handle_t* phDevice ///< [out] handle of the device on which the command list was created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnGetDeviceHandle = dditable->ze.CommandList.pfnGetDeviceHandle; if( nullptr == pfnGetDeviceHandle ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnGetDeviceHandle( hCommandList, phDevice ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phDevice = reinterpret_cast( context->ze_device_factory.getInstance( *phDevice, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetContextHandle __zedlllocal ze_result_t ZE_APICALL zeCommandListGetContextHandle( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_context_handle_t* phContext ///< [out] handle of the context on which the command list was created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnGetContextHandle = dditable->ze.CommandList.pfnGetContextHandle; if( nullptr == pfnGetContextHandle ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnGetContextHandle( hCommandList, phContext ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phContext = reinterpret_cast( context->ze_context_factory.getInstance( *phContext, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetOrdinal __zedlllocal ze_result_t ZE_APICALL zeCommandListGetOrdinal( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t* pOrdinal ///< [out] command queue group ordinal to which command list is submitted ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnGetOrdinal = dditable->ze.CommandList.pfnGetOrdinal; if( nullptr == pfnGetOrdinal ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnGetOrdinal( hCommandList, pOrdinal ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListImmediateGetIndex __zedlllocal ze_result_t ZE_APICALL zeCommandListImmediateGetIndex( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t* pIndex ///< [out] command queue index within the group to which the immediate ///< command list is submitted ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandListImmediate )->dditable; auto pfnImmediateGetIndex = dditable->ze.CommandList.pfnImmediateGetIndex; if( nullptr == pfnImmediateGetIndex ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandListImmediate = reinterpret_cast( hCommandListImmediate )->handle; // forward to device-driver result = pfnImmediateGetIndex( hCommandListImmediate, pIndex ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListIsImmediate __zedlllocal ze_result_t ZE_APICALL zeCommandListIsImmediate( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_bool_t* pIsImmediate ///< [out] Boolean indicating whether the command list is an immediate ///< command list (true) or not (false) ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnIsImmediate = dditable->ze.CommandList.pfnIsImmediate; if( nullptr == pfnIsImmediate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnIsImmediate( hCommandList, pIsImmediate ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendBarrier __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendBarrier( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendBarrier = dditable->ze.CommandList.pfnAppendBarrier; if( nullptr == pfnAppendBarrier ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendBarrier( hCommandList, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryRangesBarrier __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryRangesBarrier( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numRanges, ///< [in] number of memory ranges const size_t* pRangeSizes, ///< [in][range(0, numRanges)] array of sizes of memory range const void** pRanges, ///< [in][range(0, numRanges)] array of memory ranges ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing barrier; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing barrier ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendMemoryRangesBarrier = dditable->ze.CommandList.pfnAppendMemoryRangesBarrier; if( nullptr == pfnAppendMemoryRangesBarrier ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendMemoryRangesBarrier( hCommandList, numRanges, pRangeSizes, pRanges, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextSystemBarrier __zedlllocal ze_result_t ZE_APICALL zeContextSystemBarrier( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice ///< [in] handle of the device ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnSystemBarrier = dditable->ze.Context.pfnSystemBarrier; if( nullptr == pfnSystemBarrier ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnSystemBarrier( hContext, hDevice ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopy __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopy( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendMemoryCopy = dditable->ze.CommandList.pfnAppendMemoryCopy; if( nullptr == pfnAppendMemoryCopy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendMemoryCopy( hCommandList, dstptr, srcptr, size, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryFill __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryFill( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* ptr, ///< [in] pointer to memory to initialize const void* pattern, ///< [in] pointer to value to initialize memory to size_t pattern_size, ///< [in] size in bytes of the value to initialize memory to size_t size, ///< [in] size in bytes to initialize ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendMemoryFill = dditable->ze.CommandList.pfnAppendMemoryFill; if( nullptr == pfnAppendMemoryFill ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendMemoryFill( hCommandList, ptr, pattern, pattern_size, size, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyRegion __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to const ze_copy_region_t* dstRegion, ///< [in] pointer to destination region to copy to uint32_t dstPitch, ///< [in] destination pitch in bytes uint32_t dstSlicePitch, ///< [in] destination slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. const void* srcptr, ///< [in] pointer to source memory to copy from const ze_copy_region_t* srcRegion, ///< [in] pointer to source region to copy from uint32_t srcPitch, ///< [in] source pitch in bytes uint32_t srcSlicePitch, ///< [in] source slice pitch in bytes. This is required for 3D region ///< copies where the `depth` member of ::ze_copy_region_t is not 0, ///< otherwise it's ignored. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendMemoryCopyRegion = dditable->ze.CommandList.pfnAppendMemoryCopyRegion; if( nullptr == pfnAppendMemoryCopyRegion ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendMemoryCopyRegion( hCommandList, dstptr, dstRegion, dstPitch, dstSlicePitch, srcptr, srcRegion, srcPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryCopyFromContext __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryCopyFromContext( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_context_handle_t hContextSrc, ///< [in] handle of source context object const void* srcptr, ///< [in] pointer to source memory to copy from size_t size, ///< [in] size in bytes to copy ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendMemoryCopyFromContext = dditable->ze.CommandList.pfnAppendMemoryCopyFromContext; if( nullptr == pfnAppendMemoryCopyFromContext ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hContextSrc = reinterpret_cast( hContextSrc )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendMemoryCopyFromContext( hCommandList, dstptr, hContextSrc, srcptr, size, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopy __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopy( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendImageCopy = dditable->ze.CommandList.pfnAppendImageCopy; if( nullptr == pfnAppendImageCopy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hDstImage = reinterpret_cast( hDstImage )->handle; // convert loader handle to driver handle hSrcImage = reinterpret_cast( hSrcImage )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendImageCopy( hCommandList, hDstImage, hSrcImage, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyRegion __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyRegion( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendImageCopyRegion = dditable->ze.CommandList.pfnAppendImageCopyRegion; if( nullptr == pfnAppendImageCopyRegion ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hDstImage = reinterpret_cast( hDstImage )->handle; // convert loader handle to driver handle hSrcImage = reinterpret_cast( hSrcImage )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendImageCopyRegion( hCommandList, hDstImage, hSrcImage, pDstRegion, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyToMemory __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemory( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendImageCopyToMemory = dditable->ze.CommandList.pfnAppendImageCopyToMemory; if( nullptr == pfnAppendImageCopyToMemory ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hSrcImage = reinterpret_cast( hSrcImage )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendImageCopyToMemory( hCommandList, dstptr, hSrcImage, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyFromMemory __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyFromMemory( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendImageCopyFromMemory = dditable->ze.CommandList.pfnAppendImageCopyFromMemory; if( nullptr == pfnAppendImageCopyFromMemory ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hDstImage = reinterpret_cast( hDstImage )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendImageCopyFromMemory( hCommandList, hDstImage, srcptr, pDstRegion, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemoryPrefetch __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemoryPrefetch( ze_command_list_handle_t hCommandList, ///< [in] handle of command list const void* ptr, ///< [in] pointer to start of the memory range to prefetch size_t size ///< [in] size in bytes of the memory range to prefetch ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendMemoryPrefetch = dditable->ze.CommandList.pfnAppendMemoryPrefetch; if( nullptr == pfnAppendMemoryPrefetch ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnAppendMemoryPrefetch( hCommandList, ptr, size ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendMemAdvise __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendMemAdvise( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_advice_t advice ///< [in] Memory advice for the memory range ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendMemAdvise = dditable->ze.CommandList.pfnAppendMemAdvise; if( nullptr == pfnAppendMemAdvise ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnAppendMemAdvise( hCommandList, hDevice, ptr, size, advice ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolCreate __zedlllocal ze_result_t ZE_APICALL zeEventPoolCreate( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_event_pool_desc_t* desc, ///< [in] pointer to event pool descriptor uint32_t numDevices, ///< [in][optional] number of device handles; must be 0 if `nullptr == ///< phDevices` ze_device_handle_t* phDevices, ///< [in][optional][range(0, numDevices)] array of device handles which ///< have visibility to the event pool. ///< if nullptr, then event pool is visible to all devices supported by the ///< driver instance. ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnCreate = dditable->ze.EventPool.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handles to driver handles auto phDevicesLocal = new ze_device_handle_t [numDevices]; for( size_t i = 0; ( nullptr != phDevices ) && ( i < numDevices ); ++i ) phDevicesLocal[ i ] = reinterpret_cast( phDevices[ i ] )->handle; // forward to device-driver result = pfnCreate( hContext, desc, numDevices, phDevicesLocal, phEventPool ); delete []phDevicesLocal; if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phEventPool = reinterpret_cast( context->ze_event_pool_factory.getInstance( *phEventPool, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolDestroy __zedlllocal ze_result_t ZE_APICALL zeEventPoolDestroy( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEventPool )->dditable; auto pfnDestroy = dditable->ze.EventPool.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEventPool = reinterpret_cast( hEventPool )->handle; // forward to device-driver result = pfnDestroy( hEventPool ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_event_pool_factory.release( hEventPool ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventCreate __zedlllocal ze_result_t ZE_APICALL zeEventCreate( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool const ze_event_desc_t* desc, ///< [in] pointer to event descriptor ze_event_handle_t* phEvent ///< [out] pointer to handle of event object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEventPool )->dditable; auto pfnCreate = dditable->ze.Event.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEventPool = reinterpret_cast( hEventPool )->handle; // forward to device-driver result = pfnCreate( hEventPool, desc, phEvent ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phEvent = reinterpret_cast( context->ze_event_factory.getInstance( *phEvent, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventDestroy __zedlllocal ze_result_t ZE_APICALL zeEventDestroy( ze_event_handle_t hEvent ///< [in][release] handle of event object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEvent )->dditable; auto pfnDestroy = dditable->ze.Event.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // forward to device-driver result = pfnDestroy( hEvent ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_event_factory.release( hEvent ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolGetIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolGetIpcHandle( ze_event_pool_handle_t hEventPool, ///< [in] handle of event pool object ze_ipc_event_pool_handle_t* phIpc ///< [out] Returned IPC event handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEventPool )->dditable; auto pfnGetIpcHandle = dditable->ze.EventPool.pfnGetIpcHandle; if( nullptr == pfnGetIpcHandle ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEventPool = reinterpret_cast( hEventPool )->handle; // forward to device-driver result = pfnGetIpcHandle( hEventPool, phIpc ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolPutIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolPutIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object associated with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc ///< [in] IPC event pool handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnPutIpcHandle = dditable->ze.EventPool.pfnPutIpcHandle; if( nullptr == pfnPutIpcHandle ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnPutIpcHandle( hContext, hIpc ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolOpenIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolOpenIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object to associate with the IPC event pool ///< handle ze_ipc_event_pool_handle_t hIpc, ///< [in] IPC event pool handle ze_event_pool_handle_t* phEventPool ///< [out] pointer handle of event pool object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnOpenIpcHandle = dditable->ze.EventPool.pfnOpenIpcHandle; if( nullptr == pfnOpenIpcHandle ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnOpenIpcHandle( hContext, hIpc, phEventPool ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phEventPool = reinterpret_cast( context->ze_event_pool_factory.getInstance( *phEventPool, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolCloseIpcHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolCloseIpcHandle( ze_event_pool_handle_t hEventPool ///< [in][release] handle of event pool object ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEventPool )->dditable; auto pfnCloseIpcHandle = dditable->ze.EventPool.pfnCloseIpcHandle; if( nullptr == pfnCloseIpcHandle ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEventPool = reinterpret_cast( hEventPool )->handle; // forward to device-driver result = pfnCloseIpcHandle( hEventPool ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_event_pool_factory.release( hEventPool ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendSignalEvent __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendSignalEvent( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendSignalEvent = dditable->ze.CommandList.pfnAppendSignalEvent; if( nullptr == pfnAppendSignalEvent ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // forward to device-driver result = pfnAppendSignalEvent( hCommandList, hEvent ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendWaitOnEvents __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendWaitOnEvents( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] number of events to wait on before continuing ze_event_handle_t* phEvents ///< [in][range(0, numEvents)] handles of the events to wait on before ///< continuing ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendWaitOnEvents = dditable->ze.CommandList.pfnAppendWaitOnEvents; if( nullptr == pfnAppendWaitOnEvents ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handles to driver handles auto phEventsLocal = new ze_event_handle_t [numEvents]; for( size_t i = 0; ( nullptr != phEvents ) && ( i < numEvents ); ++i ) phEventsLocal[ i ] = reinterpret_cast( phEvents[ i ] )->handle; // forward to device-driver result = pfnAppendWaitOnEvents( hCommandList, numEvents, phEventsLocal ); delete []phEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventHostSignal __zedlllocal ze_result_t ZE_APICALL zeEventHostSignal( ze_event_handle_t hEvent ///< [in] handle of the event ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEvent )->dditable; auto pfnHostSignal = dditable->ze.Event.pfnHostSignal; if( nullptr == pfnHostSignal ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // forward to device-driver result = pfnHostSignal( hEvent ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventHostSynchronize __zedlllocal ze_result_t ZE_APICALL zeEventHostSynchronize( ze_event_handle_t hEvent, ///< [in] handle of the event uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeEventQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEvent )->dditable; auto pfnHostSynchronize = dditable->ze.Event.pfnHostSynchronize; if( nullptr == pfnHostSynchronize ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // forward to device-driver result = pfnHostSynchronize( hEvent, timeout ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryStatus __zedlllocal ze_result_t ZE_APICALL zeEventQueryStatus( ze_event_handle_t hEvent ///< [in] handle of the event ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEvent )->dditable; auto pfnQueryStatus = dditable->ze.Event.pfnQueryStatus; if( nullptr == pfnQueryStatus ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // forward to device-driver result = pfnQueryStatus( hEvent ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendEventReset __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendEventReset( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_event_handle_t hEvent ///< [in] handle of the event ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendEventReset = dditable->ze.CommandList.pfnAppendEventReset; if( nullptr == pfnAppendEventReset ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // forward to device-driver result = pfnAppendEventReset( hCommandList, hEvent ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventHostReset __zedlllocal ze_result_t ZE_APICALL zeEventHostReset( ze_event_handle_t hEvent ///< [in] handle of the event ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEvent )->dditable; auto pfnHostReset = dditable->ze.Event.pfnHostReset; if( nullptr == pfnHostReset ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // forward to device-driver result = pfnHostReset( hEvent ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryKernelTimestamp __zedlllocal ze_result_t ZE_APICALL zeEventQueryKernelTimestamp( ze_event_handle_t hEvent, ///< [in] handle of the event ze_kernel_timestamp_result_t* dstptr ///< [in,out] pointer to memory for where timestamp result will be written. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEvent )->dditable; auto pfnQueryKernelTimestamp = dditable->ze.Event.pfnQueryKernelTimestamp; if( nullptr == pfnQueryKernelTimestamp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // forward to device-driver result = pfnQueryKernelTimestamp( hEvent, dstptr ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendQueryKernelTimestamps __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendQueryKernelTimestamps( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numEvents, ///< [in] the number of timestamp events to query ze_event_handle_t* phEvents, ///< [in][range(0, numEvents)] handles of timestamp events to query void* dstptr, ///< [in,out] pointer to memory where ::ze_kernel_timestamp_result_t will ///< be written; must be size-aligned. const size_t* pOffsets, ///< [in][optional][range(0, numEvents)] offset, in bytes, to write ///< results; address must be 4byte-aligned and offsets must be ///< size-aligned. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing query; ///< must be 0 if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing query ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendQueryKernelTimestamps = dditable->ze.CommandList.pfnAppendQueryKernelTimestamps; if( nullptr == pfnAppendQueryKernelTimestamps ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handles to driver handles auto phEventsLocal = new ze_event_handle_t [numEvents]; for( size_t i = 0; ( nullptr != phEvents ) && ( i < numEvents ); ++i ) phEventsLocal[ i ] = reinterpret_cast( phEvents[ i ] )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendQueryKernelTimestamps( hCommandList, numEvents, phEventsLocal, dstptr, pOffsets, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phEventsLocal; delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventGetEventPool __zedlllocal ze_result_t ZE_APICALL zeEventGetEventPool( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_pool_handle_t* phEventPool ///< [out] handle of the event pool for the event ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEvent )->dditable; auto pfnGetEventPool = dditable->ze.Event.pfnGetEventPool; if( nullptr == pfnGetEventPool ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // forward to device-driver result = pfnGetEventPool( hEvent, phEventPool ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phEventPool = reinterpret_cast( context->ze_event_pool_factory.getInstance( *phEventPool, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventGetSignalScope __zedlllocal ze_result_t ZE_APICALL zeEventGetSignalScope( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pSignalScope ///< [out] signal event scope. This is the scope of relevant cache ///< hierarchies that are flushed on a signal action before the event is ///< triggered. May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEvent )->dditable; auto pfnGetSignalScope = dditable->ze.Event.pfnGetSignalScope; if( nullptr == pfnGetSignalScope ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // forward to device-driver result = pfnGetSignalScope( hEvent, pSignalScope ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventGetWaitScope __zedlllocal ze_result_t ZE_APICALL zeEventGetWaitScope( ze_event_handle_t hEvent, ///< [in] handle of the event ze_event_scope_flags_t* pWaitScope ///< [out] wait event scope. This is the scope of relevant cache ///< hierarchies invalidated on a wait action after the event is complete. ///< May be 0 or a valid combination of ::ze_event_scope_flag_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEvent )->dditable; auto pfnGetWaitScope = dditable->ze.Event.pfnGetWaitScope; if( nullptr == pfnGetWaitScope ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // forward to device-driver result = pfnGetWaitScope( hEvent, pWaitScope ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolGetContextHandle __zedlllocal ze_result_t ZE_APICALL zeEventPoolGetContextHandle( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_context_handle_t* phContext ///< [out] handle of the context on which the event pool was created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEventPool )->dditable; auto pfnGetContextHandle = dditable->ze.EventPool.pfnGetContextHandle; if( nullptr == pfnGetContextHandle ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEventPool = reinterpret_cast( hEventPool )->handle; // forward to device-driver result = pfnGetContextHandle( hEventPool, phContext ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phContext = reinterpret_cast( context->ze_context_factory.getInstance( *phContext, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventPoolGetFlags __zedlllocal ze_result_t ZE_APICALL zeEventPoolGetFlags( ze_event_pool_handle_t hEventPool, ///< [in] handle of the event pool ze_event_pool_flags_t* pFlags ///< [out] creation flags used to create the event pool; may be 0 or a ///< valid combination of ::ze_event_pool_flag_t ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEventPool )->dditable; auto pfnGetFlags = dditable->ze.EventPool.pfnGetFlags; if( nullptr == pfnGetFlags ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEventPool = reinterpret_cast( hEventPool )->handle; // forward to device-driver result = pfnGetFlags( hEventPool, pFlags ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceCreate __zedlllocal ze_result_t ZE_APICALL zeFenceCreate( ze_command_queue_handle_t hCommandQueue, ///< [in] handle of command queue const ze_fence_desc_t* desc, ///< [in] pointer to fence descriptor ze_fence_handle_t* phFence ///< [out] pointer to handle of fence object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandQueue )->dditable; auto pfnCreate = dditable->ze.Fence.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandQueue = reinterpret_cast( hCommandQueue )->handle; // forward to device-driver result = pfnCreate( hCommandQueue, desc, phFence ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phFence = reinterpret_cast( context->ze_fence_factory.getInstance( *phFence, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceDestroy __zedlllocal ze_result_t ZE_APICALL zeFenceDestroy( ze_fence_handle_t hFence ///< [in][release] handle of fence object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFence )->dditable; auto pfnDestroy = dditable->ze.Fence.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFence = reinterpret_cast( hFence )->handle; // forward to device-driver result = pfnDestroy( hFence ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_fence_factory.release( hFence ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceHostSynchronize __zedlllocal ze_result_t ZE_APICALL zeFenceHostSynchronize( ze_fence_handle_t hFence, ///< [in] handle of the fence uint64_t timeout ///< [in] if non-zero, then indicates the maximum time (in nanoseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then operates exactly like ::zeFenceQueryStatus; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFence )->dditable; auto pfnHostSynchronize = dditable->ze.Fence.pfnHostSynchronize; if( nullptr == pfnHostSynchronize ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFence = reinterpret_cast( hFence )->handle; // forward to device-driver result = pfnHostSynchronize( hFence, timeout ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceQueryStatus __zedlllocal ze_result_t ZE_APICALL zeFenceQueryStatus( ze_fence_handle_t hFence ///< [in] handle of the fence ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFence )->dditable; auto pfnQueryStatus = dditable->ze.Fence.pfnQueryStatus; if( nullptr == pfnQueryStatus ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFence = reinterpret_cast( hFence )->handle; // forward to device-driver result = pfnQueryStatus( hFence ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFenceReset __zedlllocal ze_result_t ZE_APICALL zeFenceReset( ze_fence_handle_t hFence ///< [in] handle of the fence ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFence )->dditable; auto pfnReset = dditable->ze.Fence.pfnReset; if( nullptr == pfnReset ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFence = reinterpret_cast( hFence )->handle; // forward to device-driver result = pfnReset( hFence ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetProperties __zedlllocal ze_result_t ZE_APICALL zeImageGetProperties( ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_properties_t* pImageProperties ///< [out] pointer to image properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetProperties = dditable->ze.Image.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetProperties( hDevice, desc, pImageProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageCreate __zedlllocal ze_result_t ZE_APICALL zeImageCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t* phImage ///< [out] pointer to handle of image object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnCreate = dditable->ze.Image.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnCreate( hContext, hDevice, desc, phImage ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle ze_image_handle_t internalHandlePtr = *phImage; *phImage = reinterpret_cast( context->ze_image_factory.getInstance( *phImage, dditable ) ); // convert loader handle to driver handle and store in map { std::lock_guard lock(context->image_handle_map_lock); context->image_handle_map.insert({context->ze_image_factory.getInstance( internalHandlePtr, dditable ), internalHandlePtr}); } } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageDestroy __zedlllocal ze_result_t ZE_APICALL zeImageDestroy( ze_image_handle_t hImage ///< [in][release] handle of image object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hImage )->dditable; auto pfnDestroy = dditable->ze.Image.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // remove the handle from the kernel arugment map { std::lock_guard lock(context->image_handle_map_lock); context->image_handle_map.erase(reinterpret_cast(hImage)); } // convert loader handle to driver handle hImage = reinterpret_cast( hImage )->handle; // forward to device-driver result = pfnDestroy( hImage ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_image_factory.release( hImage ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemAllocShared __zedlllocal ze_result_t ZE_APICALL zeMemAllocShared( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in][optional] device handle to associate with void** pptr ///< [out] pointer to shared allocation ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnAllocShared = dditable->ze.Mem.pfnAllocShared; if( nullptr == pfnAllocShared ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = ( hDevice ) ? reinterpret_cast( hDevice )->handle : nullptr; // forward to device-driver result = pfnAllocShared( hContext, device_desc, host_desc, size, alignment, hDevice, pptr ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemAllocDevice __zedlllocal ze_result_t ZE_APICALL zeMemAllocDevice( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_device_mem_alloc_desc_t* device_desc, ///< [in] pointer to device memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two ze_device_handle_t hDevice, ///< [in] handle of the device void** pptr ///< [out] pointer to device allocation ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnAllocDevice = dditable->ze.Mem.pfnAllocDevice; if( nullptr == pfnAllocDevice ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnAllocDevice( hContext, device_desc, size, alignment, hDevice, pptr ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemAllocHost __zedlllocal ze_result_t ZE_APICALL zeMemAllocHost( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_host_mem_alloc_desc_t* host_desc, ///< [in] pointer to host memory allocation descriptor size_t size, ///< [in] size in bytes to allocate; must be less than or equal to the ///< `maxMemAllocSize` member of ::ze_device_properties_t size_t alignment, ///< [in] minimum alignment in bytes for the allocation; must be a power of ///< two void** pptr ///< [out] pointer to host allocation ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnAllocHost = dditable->ze.Mem.pfnAllocHost; if( nullptr == pfnAllocHost ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnAllocHost( hContext, host_desc, size, alignment, pptr ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemFree __zedlllocal ze_result_t ZE_APICALL zeMemFree( ze_context_handle_t hContext, ///< [in] handle of the context object void* ptr ///< [in][release] pointer to memory to free ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnFree = dditable->ze.Mem.pfnFree; if( nullptr == pfnFree ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnFree( hContext, ptr ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetAllocProperties __zedlllocal ze_result_t ZE_APICALL zeMemGetAllocProperties( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query ze_memory_allocation_properties_t* pMemAllocProperties, ///< [in,out] query result for memory allocation properties ze_device_handle_t* phDevice ///< [out][optional] device associated with this allocation ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnGetAllocProperties = dditable->ze.Mem.pfnGetAllocProperties; if( nullptr == pfnGetAllocProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnGetAllocProperties( hContext, ptr, pMemAllocProperties, phDevice ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle if( nullptr != phDevice ) *phDevice = reinterpret_cast( context->ze_device_factory.getInstance( *phDevice, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetAddressRange __zedlllocal ze_result_t ZE_APICALL zeMemGetAddressRange( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] memory pointer to query void** pBase, ///< [in,out][optional] base address of the allocation size_t* pSize ///< [in,out][optional] size of the allocation ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnGetAddressRange = dditable->ze.Mem.pfnGetAddressRange; if( nullptr == pfnGetAddressRange ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnGetAddressRange( hContext, ptr, pBase, pSize ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemGetIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to the device memory allocation ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnGetIpcHandle = dditable->ze.Mem.pfnGetIpcHandle; if( nullptr == pfnGetIpcHandle ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnGetIpcHandle( hContext, ptr, pIpcHandle ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetIpcHandleFromFileDescriptorExp __zedlllocal ze_result_t ZE_APICALL zeMemGetIpcHandleFromFileDescriptorExp( ze_context_handle_t hContext, ///< [in] handle of the context object uint64_t handle, ///< [in] file descriptor ze_ipc_mem_handle_t* pIpcHandle ///< [out] Returned IPC memory handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnGetIpcHandleFromFileDescriptorExp = dditable->ze.MemExp.pfnGetIpcHandleFromFileDescriptorExp; if( nullptr == pfnGetIpcHandleFromFileDescriptorExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnGetIpcHandleFromFileDescriptorExp( hContext, handle, pIpcHandle ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetFileDescriptorFromIpcHandleExp __zedlllocal ze_result_t ZE_APICALL zeMemGetFileDescriptorFromIpcHandleExp( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t ipcHandle, ///< [in] IPC memory handle uint64_t* pHandle ///< [out] Returned file descriptor ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnGetFileDescriptorFromIpcHandleExp = dditable->ze.MemExp.pfnGetFileDescriptorFromIpcHandleExp; if( nullptr == pfnGetFileDescriptorFromIpcHandleExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnGetFileDescriptorFromIpcHandleExp( hContext, ipcHandle, pHandle ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemPutIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemPutIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object ze_ipc_mem_handle_t handle ///< [in] IPC memory handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnPutIpcHandle = dditable->ze.Mem.pfnPutIpcHandle; if( nullptr == pfnPutIpcHandle ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnPutIpcHandle( hContext, handle ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemOpenIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemOpenIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device to associate with the IPC memory handle ze_ipc_mem_handle_t handle, ///< [in] IPC memory handle ze_ipc_memory_flags_t flags, ///< [in] flags controlling the operation. ///< must be 0 (default) or a valid combination of ::ze_ipc_memory_flag_t. void** pptr ///< [out] pointer to device allocation in this process ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnOpenIpcHandle = dditable->ze.Mem.pfnOpenIpcHandle; if( nullptr == pfnOpenIpcHandle ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnOpenIpcHandle( hContext, hDevice, handle, flags, pptr ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemCloseIpcHandle __zedlllocal ze_result_t ZE_APICALL zeMemCloseIpcHandle( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr ///< [in][release] pointer to device allocation in this process ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnCloseIpcHandle = dditable->ze.Mem.pfnCloseIpcHandle; if( nullptr == pfnCloseIpcHandle ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnCloseIpcHandle( hContext, ptr ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemSetAtomicAccessAttributeExp __zedlllocal ze_result_t ZE_APICALL zeMemSetAtomicAccessAttributeExp( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t attr ///< [in] Atomic access attributes to set for the specified range. ///< Must be 0 (default) or a valid combination of ::ze_memory_atomic_attr_exp_flag_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnSetAtomicAccessAttributeExp = dditable->ze.MemExp.pfnSetAtomicAccessAttributeExp; if( nullptr == pfnSetAtomicAccessAttributeExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnSetAtomicAccessAttributeExp( hContext, hDevice, ptr, size, attr ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetAtomicAccessAttributeExp __zedlllocal ze_result_t ZE_APICALL zeMemGetAtomicAccessAttributeExp( ze_context_handle_t hContext, ///< [in] handle of context ze_device_handle_t hDevice, ///< [in] device associated with the memory advice const void* ptr, ///< [in] Pointer to the start of the memory range size_t size, ///< [in] Size in bytes of the memory range ze_memory_atomic_attr_exp_flags_t* pAttr ///< [out] Atomic access attributes for the specified range ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnGetAtomicAccessAttributeExp = dditable->ze.MemExp.pfnGetAtomicAccessAttributeExp; if( nullptr == pfnGetAtomicAccessAttributeExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetAtomicAccessAttributeExp( hContext, hDevice, ptr, size, pAttr ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleCreate __zedlllocal ze_result_t ZE_APICALL zeModuleCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_module_desc_t* desc, ///< [in] pointer to module descriptor ze_module_handle_t* phModule, ///< [out] pointer to handle of module object created ze_module_build_log_handle_t* phBuildLog ///< [out][optional] pointer to handle of module's build log. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnCreate = dditable->ze.Module.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnCreate( hContext, hDevice, desc, phModule, phBuildLog ); try { // convert driver handle to loader handle *phModule = reinterpret_cast( context->ze_module_factory.getInstance( *phModule, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle if( nullptr != phBuildLog ) *phBuildLog = reinterpret_cast( context->ze_module_build_log_factory.getInstance( *phBuildLog, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleDestroy __zedlllocal ze_result_t ZE_APICALL zeModuleDestroy( ze_module_handle_t hModule ///< [in][release] handle of the module ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hModule )->dditable; auto pfnDestroy = dditable->ze.Module.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hModule = reinterpret_cast( hModule )->handle; // forward to device-driver result = pfnDestroy( hModule ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_module_factory.release( hModule ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleDynamicLink __zedlllocal ze_result_t ZE_APICALL zeModuleDynamicLink( uint32_t numModules, ///< [in] number of modules to be linked pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to ///< dynamically link together. ze_module_build_log_handle_t* phLinkLog ///< [out][optional] pointer to handle of dynamic link log. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( phModules[ 0 ] )->dditable; auto pfnDynamicLink = dditable->ze.Module.pfnDynamicLink; if( nullptr == pfnDynamicLink ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handles to driver handles auto phModulesLocal = new ze_module_handle_t [numModules]; for( size_t i = 0; ( nullptr != phModules ) && ( i < numModules ); ++i ) phModulesLocal[ i ] = reinterpret_cast( phModules[ i ] )->handle; // forward to device-driver result = pfnDynamicLink( numModules, phModulesLocal, phLinkLog ); delete []phModulesLocal; try { // convert driver handle to loader handle if( nullptr != phLinkLog ) *phLinkLog = reinterpret_cast( context->ze_module_build_log_factory.getInstance( *phLinkLog, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } if( ZE_RESULT_SUCCESS != result ) return result; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleBuildLogDestroy __zedlllocal ze_result_t ZE_APICALL zeModuleBuildLogDestroy( ze_module_build_log_handle_t hModuleBuildLog ///< [in][release] handle of the module build log object. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hModuleBuildLog )->dditable; auto pfnDestroy = dditable->ze.ModuleBuildLog.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hModuleBuildLog = reinterpret_cast( hModuleBuildLog )->handle; // forward to device-driver result = pfnDestroy( hModuleBuildLog ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_module_build_log_factory.release( hModuleBuildLog ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleBuildLogGetString __zedlllocal ze_result_t ZE_APICALL zeModuleBuildLogGetString( ze_module_build_log_handle_t hModuleBuildLog, ///< [in] handle of the module build log object. size_t* pSize, ///< [in,out] size of build log string. char* pBuildLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hModuleBuildLog )->dditable; auto pfnGetString = dditable->ze.ModuleBuildLog.pfnGetString; if( nullptr == pfnGetString ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hModuleBuildLog = reinterpret_cast( hModuleBuildLog )->handle; // forward to device-driver result = pfnGetString( hModuleBuildLog, pSize, pBuildLog ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetNativeBinary __zedlllocal ze_result_t ZE_APICALL zeModuleGetNativeBinary( ze_module_handle_t hModule, ///< [in] handle of the module size_t* pSize, ///< [in,out] size of native binary in bytes. uint8_t* pModuleNativeBinary ///< [in,out][optional] byte pointer to native binary ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hModule )->dditable; auto pfnGetNativeBinary = dditable->ze.Module.pfnGetNativeBinary; if( nullptr == pfnGetNativeBinary ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hModule = reinterpret_cast( hModule )->handle; // forward to device-driver result = pfnGetNativeBinary( hModule, pSize, pModuleNativeBinary ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetGlobalPointer __zedlllocal ze_result_t ZE_APICALL zeModuleGetGlobalPointer( ze_module_handle_t hModule, ///< [in] handle of the module const char* pGlobalName, ///< [in] name of global variable in module size_t* pSize, ///< [in,out][optional] size of global variable void** pptr ///< [in,out][optional] device visible pointer ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hModule )->dditable; auto pfnGetGlobalPointer = dditable->ze.Module.pfnGetGlobalPointer; if( nullptr == pfnGetGlobalPointer ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hModule = reinterpret_cast( hModule )->handle; // forward to device-driver result = pfnGetGlobalPointer( hModule, pGlobalName, pSize, pptr ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetKernelNames __zedlllocal ze_result_t ZE_APICALL zeModuleGetKernelNames( ze_module_handle_t hModule, ///< [in] handle of the module uint32_t* pCount, ///< [in,out] pointer to the number of names. ///< if count is zero, then the driver shall update the value with the ///< total number of names available. ///< if count is greater than the number of names available, then the ///< driver shall update the value with the correct number of names available. const char** pNames ///< [in,out][optional][range(0, *pCount)] array of names of functions. ///< if count is less than the number of names available, then driver shall ///< only retrieve that number of names. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hModule )->dditable; auto pfnGetKernelNames = dditable->ze.Module.pfnGetKernelNames; if( nullptr == pfnGetKernelNames ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hModule = reinterpret_cast( hModule )->handle; // forward to device-driver result = pfnGetKernelNames( hModule, pCount, pNames ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetProperties __zedlllocal ze_result_t ZE_APICALL zeModuleGetProperties( ze_module_handle_t hModule, ///< [in] handle of the module ze_module_properties_t* pModuleProperties ///< [in,out] query result for module properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hModule )->dditable; auto pfnGetProperties = dditable->ze.Module.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hModule = reinterpret_cast( hModule )->handle; // forward to device-driver result = pfnGetProperties( hModule, pModuleProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelCreate __zedlllocal ze_result_t ZE_APICALL zeKernelCreate( ze_module_handle_t hModule, ///< [in] handle of the module const ze_kernel_desc_t* desc, ///< [in] pointer to kernel descriptor ze_kernel_handle_t* phKernel ///< [out] handle of the Function object ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hModule )->dditable; auto pfnCreate = dditable->ze.Kernel.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hModule = reinterpret_cast( hModule )->handle; // forward to device-driver result = pfnCreate( hModule, desc, phKernel ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phKernel = reinterpret_cast( context->ze_kernel_factory.getInstance( *phKernel, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelDestroy __zedlllocal ze_result_t ZE_APICALL zeKernelDestroy( ze_kernel_handle_t hKernel ///< [in][release] handle of the kernel object ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnDestroy = dditable->ze.Kernel.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnDestroy( hKernel ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_kernel_factory.release( hKernel ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleGetFunctionPointer __zedlllocal ze_result_t ZE_APICALL zeModuleGetFunctionPointer( ze_module_handle_t hModule, ///< [in] handle of the module const char* pFunctionName, ///< [in] Name of function to retrieve function pointer for. void** pfnFunction ///< [out] pointer to function. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hModule )->dditable; auto pfnGetFunctionPointer = dditable->ze.Module.pfnGetFunctionPointer; if( nullptr == pfnGetFunctionPointer ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hModule = reinterpret_cast( hModule )->handle; // forward to device-driver result = pfnGetFunctionPointer( hModule, pFunctionName, pfnFunction ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetGroupSize __zedlllocal ze_result_t ZE_APICALL zeKernelSetGroupSize( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t groupSizeX, ///< [in] group size for X dimension to use for this kernel uint32_t groupSizeY, ///< [in] group size for Y dimension to use for this kernel uint32_t groupSizeZ ///< [in] group size for Z dimension to use for this kernel ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnSetGroupSize = dditable->ze.Kernel.pfnSetGroupSize; if( nullptr == pfnSetGroupSize ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnSetGroupSize( hKernel, groupSizeX, groupSizeY, groupSizeZ ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSuggestGroupSize __zedlllocal ze_result_t ZE_APICALL zeKernelSuggestGroupSize( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t globalSizeX, ///< [in] global width for X dimension uint32_t globalSizeY, ///< [in] global width for Y dimension uint32_t globalSizeZ, ///< [in] global width for Z dimension uint32_t* groupSizeX, ///< [out] recommended size of group for X dimension uint32_t* groupSizeY, ///< [out] recommended size of group for Y dimension uint32_t* groupSizeZ ///< [out] recommended size of group for Z dimension ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnSuggestGroupSize = dditable->ze.Kernel.pfnSuggestGroupSize; if( nullptr == pfnSuggestGroupSize ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnSuggestGroupSize( hKernel, globalSizeX, globalSizeY, globalSizeZ, groupSizeX, groupSizeY, groupSizeZ ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSuggestMaxCooperativeGroupCount __zedlllocal ze_result_t ZE_APICALL zeKernelSuggestMaxCooperativeGroupCount( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* totalGroupCount ///< [out] recommended total group count. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnSuggestMaxCooperativeGroupCount = dditable->ze.Kernel.pfnSuggestMaxCooperativeGroupCount; if( nullptr == pfnSuggestMaxCooperativeGroupCount ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnSuggestMaxCooperativeGroupCount( hKernel, totalGroupCount ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetArgumentValue __zedlllocal ze_result_t ZE_APICALL zeKernelSetArgumentValue( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t argIndex, ///< [in] argument index in range [0, num args - 1] size_t argSize, ///< [in] size of argument type const void* pArgValue ///< [in][optional] argument value represented as matching arg type. If ///< null then argument value is considered null. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnSetArgumentValue = dditable->ze.Kernel.pfnSetArgumentValue; if( nullptr == pfnSetArgumentValue ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // convert pArgValue to correct handle if applicable void *internalArgValue = const_cast(pArgValue); if (pArgValue) { // check if the arg value is a translated handle ze_image_object_t **imageHandle = static_cast(internalArgValue); ze_sampler_object_t **samplerHandle = static_cast(internalArgValue); { std::lock_guard image_lock(context->image_handle_map_lock); std::lock_guard sampler_lock(context->sampler_handle_map_lock); if( context->image_handle_map.find(*imageHandle) != context->image_handle_map.end() ) { internalArgValue = &context->image_handle_map[*imageHandle]; } else if( context->sampler_handle_map.find(*samplerHandle) != context->sampler_handle_map.end() ) { internalArgValue = &context->sampler_handle_map[*samplerHandle]; } } } // forward to device-driver result = pfnSetArgumentValue( hKernel, argIndex, argSize, const_cast(internalArgValue) ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetIndirectAccess __zedlllocal ze_result_t ZE_APICALL zeKernelSetIndirectAccess( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t flags ///< [in] kernel indirect access flags ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnSetIndirectAccess = dditable->ze.Kernel.pfnSetIndirectAccess; if( nullptr == pfnSetIndirectAccess ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnSetIndirectAccess( hKernel, flags ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetIndirectAccess __zedlllocal ze_result_t ZE_APICALL zeKernelGetIndirectAccess( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_indirect_access_flags_t* pFlags ///< [out] query result for kernel indirect access flags. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnGetIndirectAccess = dditable->ze.Kernel.pfnGetIndirectAccess; if( nullptr == pfnGetIndirectAccess ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnGetIndirectAccess( hKernel, pFlags ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetSourceAttributes __zedlllocal ze_result_t ZE_APICALL zeKernelGetSourceAttributes( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t* pSize, ///< [in,out] pointer to size of string in bytes, including ///< null-terminating character. char** pString ///< [in,out][optional] pointer to application-managed character array ///< (string data). ///< If NULL, the string length of the kernel source attributes, including ///< a null-terminating character, is returned in pSize. ///< Otherwise, pString must point to valid application memory that is ///< greater than or equal to *pSize bytes in length, and on return the ///< pointed-to string will contain a space-separated list of kernel source attributes. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnGetSourceAttributes = dditable->ze.Kernel.pfnGetSourceAttributes; if( nullptr == pfnGetSourceAttributes ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnGetSourceAttributes( hKernel, pSize, pString ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetCacheConfig __zedlllocal ze_result_t ZE_APICALL zeKernelSetCacheConfig( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_cache_config_flags_t flags ///< [in] cache configuration. ///< must be 0 (default configuration) or a valid combination of ::ze_cache_config_flag_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnSetCacheConfig = dditable->ze.Kernel.pfnSetCacheConfig; if( nullptr == pfnSetCacheConfig ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnSetCacheConfig( hKernel, flags ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetProperties __zedlllocal ze_result_t ZE_APICALL zeKernelGetProperties( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_kernel_properties_t* pKernelProperties ///< [in,out] query result for kernel properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnGetProperties = dditable->ze.Kernel.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnGetProperties( hKernel, pKernelProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetName __zedlllocal ze_result_t ZE_APICALL zeKernelGetName( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object size_t* pSize, ///< [in,out] size of kernel name string, including null terminator, in ///< bytes. char* pName ///< [in,out][optional] char pointer to kernel name. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnGetName = dditable->ze.Kernel.pfnGetName; if( nullptr == pfnGetName ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnGetName( hKernel, pSize, pName ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchKernel __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchKernel( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendLaunchKernel = dditable->ze.CommandList.pfnAppendLaunchKernel; if( nullptr == pfnAppendLaunchKernel ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendLaunchKernel( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchCooperativeKernel __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchCooperativeKernel( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchFuncArgs, ///< [in] thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendLaunchCooperativeKernel = dditable->ze.CommandList.pfnAppendLaunchCooperativeKernel; if( nullptr == pfnAppendLaunchCooperativeKernel ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendLaunchCooperativeKernel( hCommandList, hKernel, pLaunchFuncArgs, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchKernelIndirect __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchKernelIndirect( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in] pointer to device buffer that will contain thread group launch ///< arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendLaunchKernelIndirect = dditable->ze.CommandList.pfnAppendLaunchKernelIndirect; if( nullptr == pfnAppendLaunchKernelIndirect ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendLaunchKernelIndirect( hCommandList, hKernel, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendLaunchMultipleKernelsIndirect __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendLaunchMultipleKernelsIndirect( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] maximum number of kernels to launch ze_kernel_handle_t* phKernels, ///< [in][range(0, numKernels)] handles of the kernel objects const uint32_t* pCountBuffer, ///< [in] pointer to device memory location that will contain the actual ///< number of kernels to launch; value must be less than or equal to ///< numKernels const ze_group_count_t* pLaunchArgumentsBuffer, ///< [in][range(0, numKernels)] pointer to device buffer that will contain ///< a contiguous array of thread group launch arguments ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendLaunchMultipleKernelsIndirect = dditable->ze.CommandList.pfnAppendLaunchMultipleKernelsIndirect; if( nullptr == pfnAppendLaunchMultipleKernelsIndirect ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handles to driver handles auto phKernelsLocal = new ze_kernel_handle_t [numKernels]; for( size_t i = 0; ( nullptr != phKernels ) && ( i < numKernels ); ++i ) phKernelsLocal[ i ] = reinterpret_cast( phKernels[ i ] )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendLaunchMultipleKernelsIndirect( hCommandList, numKernels, phKernelsLocal, pCountBuffer, pLaunchArgumentsBuffer, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phKernelsLocal; delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextMakeMemoryResident __zedlllocal ze_result_t ZE_APICALL zeContextMakeMemoryResident( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to make resident size_t size ///< [in] size in bytes to make resident ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnMakeMemoryResident = dditable->ze.Context.pfnMakeMemoryResident; if( nullptr == pfnMakeMemoryResident ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnMakeMemoryResident( hContext, hDevice, ptr, size ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextEvictMemory __zedlllocal ze_result_t ZE_APICALL zeContextEvictMemory( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device void* ptr, ///< [in] pointer to memory to evict size_t size ///< [in] size in bytes to evict ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnEvictMemory = dditable->ze.Context.pfnEvictMemory; if( nullptr == pfnEvictMemory ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEvictMemory( hContext, hDevice, ptr, size ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextMakeImageResident __zedlllocal ze_result_t ZE_APICALL zeContextMakeImageResident( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make resident ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnMakeImageResident = dditable->ze.Context.pfnMakeImageResident; if( nullptr == pfnMakeImageResident ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // convert loader handle to driver handle hImage = reinterpret_cast( hImage )->handle; // forward to device-driver result = pfnMakeImageResident( hContext, hDevice, hImage ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeContextEvictImage __zedlllocal ze_result_t ZE_APICALL zeContextEvictImage( ze_context_handle_t hContext, ///< [in] handle of context object ze_device_handle_t hDevice, ///< [in] handle of the device ze_image_handle_t hImage ///< [in] handle of image to make evict ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnEvictImage = dditable->ze.Context.pfnEvictImage; if( nullptr == pfnEvictImage ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // convert loader handle to driver handle hImage = reinterpret_cast( hImage )->handle; // forward to device-driver result = pfnEvictImage( hContext, hDevice, hImage ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeSamplerCreate __zedlllocal ze_result_t ZE_APICALL zeSamplerCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_sampler_desc_t* desc, ///< [in] pointer to sampler descriptor ze_sampler_handle_t* phSampler ///< [out] handle of the sampler ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnCreate = dditable->ze.Sampler.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnCreate( hContext, hDevice, desc, phSampler ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle ze_sampler_handle_t internalHandlePtr = *phSampler; *phSampler = reinterpret_cast( context->ze_sampler_factory.getInstance( *phSampler, dditable ) ); // convert loader handle to driver handle and store in map { std::lock_guard lock(context->sampler_handle_map_lock); context->sampler_handle_map.insert({context->ze_sampler_factory.getInstance( internalHandlePtr, dditable ), internalHandlePtr}); } } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeSamplerDestroy __zedlllocal ze_result_t ZE_APICALL zeSamplerDestroy( ze_sampler_handle_t hSampler ///< [in][release] handle of the sampler ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hSampler )->dditable; auto pfnDestroy = dditable->ze.Sampler.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // remove the handle from the kernel arugment map { std::lock_guard lock(context->sampler_handle_map_lock); context->sampler_handle_map.erase(reinterpret_cast(hSampler)); } // convert loader handle to driver handle hSampler = reinterpret_cast( hSampler )->handle; // forward to device-driver result = pfnDestroy( hSampler ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_sampler_factory.release( hSampler ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemReserve __zedlllocal ze_result_t ZE_APICALL zeVirtualMemReserve( ze_context_handle_t hContext, ///< [in] handle of the context object const void* pStart, ///< [in][optional] pointer to start of region to reserve. If nullptr then ///< implementation will choose a start address. size_t size, ///< [in] size in bytes to reserve; must be page aligned. void** pptr ///< [out] pointer to virtual reservation. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnReserve = dditable->ze.VirtualMem.pfnReserve; if( nullptr == pfnReserve ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnReserve( hContext, pStart, size, pptr ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemFree __zedlllocal ze_result_t ZE_APICALL zeVirtualMemFree( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to free. size_t size ///< [in] size in bytes to free; must be page aligned. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnFree = dditable->ze.VirtualMem.pfnFree; if( nullptr == pfnFree ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnFree( hContext, ptr, size ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemQueryPageSize __zedlllocal ze_result_t ZE_APICALL zeVirtualMemQueryPageSize( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object size_t size, ///< [in] unaligned allocation size in bytes size_t* pagesize ///< [out] pointer to page size to use for start address and size ///< alignments. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnQueryPageSize = dditable->ze.VirtualMem.pfnQueryPageSize; if( nullptr == pfnQueryPageSize ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnQueryPageSize( hContext, hDevice, size, pagesize ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zePhysicalMemCreate __zedlllocal ze_result_t ZE_APICALL zePhysicalMemCreate( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device object, can be `nullptr` if creating ///< physical host memory. ze_physical_mem_desc_t* desc, ///< [in] pointer to physical memory descriptor. ze_physical_mem_handle_t* phPhysicalMemory ///< [out] pointer to handle of physical memory object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnCreate = dditable->ze.PhysicalMem.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnCreate( hContext, hDevice, desc, phPhysicalMemory ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phPhysicalMemory = reinterpret_cast( context->ze_physical_mem_factory.getInstance( *phPhysicalMemory, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zePhysicalMemDestroy __zedlllocal ze_result_t ZE_APICALL zePhysicalMemDestroy( ze_context_handle_t hContext, ///< [in] handle of the context object ze_physical_mem_handle_t hPhysicalMemory ///< [in][release] handle of physical memory object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnDestroy = dditable->ze.PhysicalMem.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hPhysicalMemory = reinterpret_cast( hPhysicalMemory )->handle; // forward to device-driver result = pfnDestroy( hContext, hPhysicalMemory ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_physical_mem_factory.release( hPhysicalMemory ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemMap __zedlllocal ze_result_t ZE_APICALL zeVirtualMemMap( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address range to map. size_t size, ///< [in] size in bytes of virtual address range to map; must be page ///< aligned. ze_physical_mem_handle_t hPhysicalMemory, ///< [in] handle to physical memory object. size_t offset, ///< [in] offset into physical memory allocation object; must be page ///< aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnMap = dditable->ze.VirtualMem.pfnMap; if( nullptr == pfnMap ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hPhysicalMemory = reinterpret_cast( hPhysicalMemory )->handle; // forward to device-driver result = pfnMap( hContext, ptr, size, hPhysicalMemory, offset, access ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemUnmap __zedlllocal ze_result_t ZE_APICALL zeVirtualMemUnmap( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of region to unmap. size_t size ///< [in] size in bytes to unmap; must be page aligned. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnUnmap = dditable->ze.VirtualMem.pfnUnmap; if( nullptr == pfnUnmap ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnUnmap( hContext, ptr, size ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemSetAccessAttribute __zedlllocal ze_result_t ZE_APICALL zeVirtualMemSetAccessAttribute( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of reserved virtual address region. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t access ///< [in] specifies page access attributes to apply to the virtual address ///< range. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnSetAccessAttribute = dditable->ze.VirtualMem.pfnSetAccessAttribute; if( nullptr == pfnSetAccessAttribute ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnSetAccessAttribute( hContext, ptr, size, access ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeVirtualMemGetAccessAttribute __zedlllocal ze_result_t ZE_APICALL zeVirtualMemGetAccessAttribute( ze_context_handle_t hContext, ///< [in] handle of the context object const void* ptr, ///< [in] pointer to start of virtual address region for query. size_t size, ///< [in] size in bytes; must be page aligned. ze_memory_access_attribute_t* access, ///< [out] query result for page access attribute. size_t* outSize ///< [out] query result for size of virtual address range, starting at ptr, ///< that shares same access attribute. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnGetAccessAttribute = dditable->ze.VirtualMem.pfnGetAccessAttribute; if( nullptr == pfnGetAccessAttribute ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnGetAccessAttribute( hContext, ptr, size, access, outSize ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSetGlobalOffsetExp __zedlllocal ze_result_t ZE_APICALL zeKernelSetGlobalOffsetExp( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object uint32_t offsetX, ///< [in] global offset for X dimension to use for this kernel uint32_t offsetY, ///< [in] global offset for Y dimension to use for this kernel uint32_t offsetZ ///< [in] global offset for Z dimension to use for this kernel ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnSetGlobalOffsetExp = dditable->ze.KernelExp.pfnSetGlobalOffsetExp; if( nullptr == pfnSetGlobalOffsetExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnSetGlobalOffsetExp( hKernel, offsetX, offsetY, offsetZ ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelGetBinaryExp __zedlllocal ze_result_t ZE_APICALL zeKernelGetBinaryExp( ze_kernel_handle_t hKernel, ///< [in] Kernel handle. size_t* pSize, ///< [in,out] pointer to variable with size of GEN ISA binary. uint8_t* pKernelBinary ///< [in,out] pointer to storage area for GEN ISA binary function. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnGetBinaryExp = dditable->ze.KernelExp.pfnGetBinaryExp; if( nullptr == pfnGetBinaryExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnGetBinaryExp( hKernel, pSize, pKernelBinary ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceImportExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeDeviceImportExternalSemaphoreExt( ze_device_handle_t hDevice, ///< [in] The device handle. const ze_external_semaphore_ext_desc_t* desc, ///< [in] The pointer to external semaphore descriptor. ze_external_semaphore_ext_handle_t* phSemaphore ///< [out] The handle of the external semaphore imported. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnImportExternalSemaphoreExt = dditable->ze.Device.pfnImportExternalSemaphoreExt; if( nullptr == pfnImportExternalSemaphoreExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnImportExternalSemaphoreExt( hDevice, desc, phSemaphore ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phSemaphore = reinterpret_cast( context->ze_external_semaphore_ext_factory.getInstance( *phSemaphore, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceReleaseExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeDeviceReleaseExternalSemaphoreExt( ze_external_semaphore_ext_handle_t hSemaphore ///< [in] The handle of the external semaphore. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hSemaphore )->dditable; auto pfnReleaseExternalSemaphoreExt = dditable->ze.Device.pfnReleaseExternalSemaphoreExt; if( nullptr == pfnReleaseExternalSemaphoreExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hSemaphore = reinterpret_cast( hSemaphore )->handle; // forward to device-driver result = pfnReleaseExternalSemaphoreExt( hSemaphore ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendSignalExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendSignalExternalSemaphoreExt( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in][range(0, numSemaphores)] The vector of external semaphore handles ///< to be appended into command list. ze_external_semaphore_signal_params_ext_t* signalParams,///< [in] Signal parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendSignalExternalSemaphoreExt = dditable->ze.CommandList.pfnAppendSignalExternalSemaphoreExt; if( nullptr == pfnAppendSignalExternalSemaphoreExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handles to driver handles auto phSemaphoresLocal = new ze_external_semaphore_ext_handle_t [numSemaphores]; for( size_t i = 0; ( nullptr != phSemaphores ) && ( i < numSemaphores ); ++i ) phSemaphoresLocal[ i ] = reinterpret_cast( phSemaphores[ i ] )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendSignalExternalSemaphoreExt( hCommandList, numSemaphores, phSemaphoresLocal, signalParams, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phSemaphoresLocal; delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendWaitExternalSemaphoreExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendWaitExternalSemaphoreExt( ze_command_list_handle_t hCommandList, ///< [in] The command list handle. uint32_t numSemaphores, ///< [in] The number of external semaphores. ze_external_semaphore_ext_handle_t* phSemaphores, ///< [in] [range(0,numSemaphores)] The vector of external semaphore handles ///< to append into command list. ze_external_semaphore_wait_params_ext_t* waitParams,///< [in] Wait parameters. ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendWaitExternalSemaphoreExt = dditable->ze.CommandList.pfnAppendWaitExternalSemaphoreExt; if( nullptr == pfnAppendWaitExternalSemaphoreExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handles to driver handles auto phSemaphoresLocal = new ze_external_semaphore_ext_handle_t [numSemaphores]; for( size_t i = 0; ( nullptr != phSemaphores ) && ( i < numSemaphores ); ++i ) phSemaphoresLocal[ i ] = reinterpret_cast( phSemaphores[ i ] )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendWaitExternalSemaphoreExt( hCommandList, numSemaphores, phSemaphoresLocal, waitParams, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phSemaphoresLocal; delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceReserveCacheExt __zedlllocal ze_result_t ZE_APICALL zeDeviceReserveCacheExt( ze_device_handle_t hDevice, ///< [in] handle of the device object size_t cacheLevel, ///< [in] cache level where application want to reserve. If zero, then the ///< driver shall default to last level of cache and attempt to reserve in ///< that cache. size_t cacheReservationSize ///< [in] value for reserving size, in bytes. If zero, then the driver ///< shall remove prior reservation ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnReserveCacheExt = dditable->ze.Device.pfnReserveCacheExt; if( nullptr == pfnReserveCacheExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnReserveCacheExt( hDevice, cacheLevel, cacheReservationSize ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceSetCacheAdviceExt __zedlllocal ze_result_t ZE_APICALL zeDeviceSetCacheAdviceExt( ze_device_handle_t hDevice, ///< [in] handle of the device object void* ptr, ///< [in] memory pointer to query size_t regionSize, ///< [in] region size, in pages ze_cache_ext_region_t cacheRegion ///< [in] reservation region ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnSetCacheAdviceExt = dditable->ze.Device.pfnSetCacheAdviceExt; if( nullptr == pfnSetCacheAdviceExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnSetCacheAdviceExt( hDevice, ptr, regionSize, cacheRegion ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryTimestampsExp __zedlllocal ze_result_t ZE_APICALL zeEventQueryTimestampsExp( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of timestamp results. ///< if count is zero, then the driver shall update the value with the ///< total number of timestamps available. ///< if count is greater than the number of timestamps available, then the ///< driver shall update the value with the correct number of timestamps available. ze_kernel_timestamp_result_t* pTimestamps ///< [in,out][optional][range(0, *pCount)] array of timestamp results. ///< if count is less than the number of timestamps available, then driver ///< shall only retrieve that number of timestamps. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEvent )->dditable; auto pfnQueryTimestampsExp = dditable->ze.EventExp.pfnQueryTimestampsExp; if( nullptr == pfnQueryTimestampsExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnQueryTimestampsExp( hEvent, hDevice, pCount, pTimestamps ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetMemoryPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeImageGetMemoryPropertiesExp( ze_image_handle_t hImage, ///< [in] handle of image object ze_image_memory_properties_exp_t* pMemoryProperties ///< [in,out] query result for image memory properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hImage )->dditable; auto pfnGetMemoryPropertiesExp = dditable->ze.ImageExp.pfnGetMemoryPropertiesExp; if( nullptr == pfnGetMemoryPropertiesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hImage = reinterpret_cast( hImage )->handle; // forward to device-driver result = pfnGetMemoryPropertiesExp( hImage, pMemoryProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageViewCreateExt __zedlllocal ze_result_t ZE_APICALL zeImageViewCreateExt( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnViewCreateExt = dditable->ze.Image.pfnViewCreateExt; if( nullptr == pfnViewCreateExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // convert loader handle to driver handle hImage = reinterpret_cast( hImage )->handle; // forward to device-driver result = pfnViewCreateExt( hContext, hDevice, desc, hImage, phImageView ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phImageView = reinterpret_cast( context->ze_image_factory.getInstance( *phImageView, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageViewCreateExp __zedlllocal ze_result_t ZE_APICALL zeImageViewCreateExp( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device const ze_image_desc_t* desc, ///< [in] pointer to image descriptor ze_image_handle_t hImage, ///< [in] handle of image object to create view from ze_image_handle_t* phImageView ///< [out] pointer to handle of image object created for view ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnViewCreateExp = dditable->ze.ImageExp.pfnViewCreateExp; if( nullptr == pfnViewCreateExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // convert loader handle to driver handle hImage = reinterpret_cast( hImage )->handle; // forward to device-driver result = pfnViewCreateExp( hContext, hDevice, desc, hImage, phImageView ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle ze_image_handle_t internalHandlePtr = *phImageView; *phImageView = reinterpret_cast( context->ze_image_factory.getInstance( *phImageView, dditable ) ); // convert loader handle to driver handle and store in map { std::lock_guard lock(context->image_handle_map_lock); context->image_handle_map.insert({context->ze_image_factory.getInstance( internalHandlePtr, dditable ), internalHandlePtr}); } } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeKernelSchedulingHintExp __zedlllocal ze_result_t ZE_APICALL zeKernelSchedulingHintExp( ze_kernel_handle_t hKernel, ///< [in] handle of the kernel object ze_scheduling_hint_exp_desc_t* pHint ///< [in] pointer to kernel scheduling hint descriptor ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnSchedulingHintExp = dditable->ze.KernelExp.pfnSchedulingHintExp; if( nullptr == pfnSchedulingHintExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnSchedulingHintExp( hKernel, pHint ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDevicePciGetPropertiesExt __zedlllocal ze_result_t ZE_APICALL zeDevicePciGetPropertiesExt( ze_device_handle_t hDevice, ///< [in] handle of the device object. ze_pci_ext_properties_t* pPciProperties ///< [in,out] returns the PCI properties of the device. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnPciGetPropertiesExt = dditable->ze.Device.pfnPciGetPropertiesExt; if( nullptr == pfnPciGetPropertiesExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnPciGetPropertiesExt( hDevice, pPciProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyToMemoryExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyToMemoryExt( ze_command_list_handle_t hCommandList, ///< [in] handle of command list void* dstptr, ///< [in] pointer to destination memory to copy to ze_image_handle_t hSrcImage, ///< [in] handle of source image to copy from const ze_image_region_t* pSrcRegion, ///< [in][optional] source region descriptor uint32_t destRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being written uint32_t destSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being written ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendImageCopyToMemoryExt = dditable->ze.CommandList.pfnAppendImageCopyToMemoryExt; if( nullptr == pfnAppendImageCopyToMemoryExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hSrcImage = reinterpret_cast( hSrcImage )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendImageCopyToMemoryExt( hCommandList, dstptr, hSrcImage, pSrcRegion, destRowPitch, destSlicePitch, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListAppendImageCopyFromMemoryExt __zedlllocal ze_result_t ZE_APICALL zeCommandListAppendImageCopyFromMemoryExt( ze_command_list_handle_t hCommandList, ///< [in] handle of command list ze_image_handle_t hDstImage, ///< [in] handle of destination image to copy to const void* srcptr, ///< [in] pointer to source memory to copy from const ze_image_region_t* pDstRegion, ///< [in][optional] destination region descriptor uint32_t srcRowPitch, ///< [in] size in bytes of the 1D slice of the 2D region of a 2D or 3D ///< image or each image of a 1D or 2D image array being read uint32_t srcSlicePitch, ///< [in] size in bytes of the 2D slice of the 3D region of a 3D image or ///< each image of a 1D or 2D image array being read ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before launching; must be 0 ///< if `nullptr == phWaitEvents` ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendImageCopyFromMemoryExt = dditable->ze.CommandList.pfnAppendImageCopyFromMemoryExt; if( nullptr == pfnAppendImageCopyFromMemoryExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hDstImage = reinterpret_cast( hDstImage )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendImageCopyFromMemoryExt( hCommandList, hDstImage, srcptr, pDstRegion, srcRowPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetAllocPropertiesExt __zedlllocal ze_result_t ZE_APICALL zeImageGetAllocPropertiesExt( ze_context_handle_t hContext, ///< [in] handle of the context object ze_image_handle_t hImage, ///< [in] handle of image object to query ze_image_allocation_ext_properties_t* pImageAllocProperties ///< [in,out] query result for image allocation properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnGetAllocPropertiesExt = dditable->ze.Image.pfnGetAllocPropertiesExt; if( nullptr == pfnGetAllocPropertiesExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hImage = reinterpret_cast( hImage )->handle; // forward to device-driver result = pfnGetAllocPropertiesExt( hContext, hImage, pImageAllocProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeModuleInspectLinkageExt __zedlllocal ze_result_t ZE_APICALL zeModuleInspectLinkageExt( ze_linkage_inspection_ext_desc_t* pInspectDesc, ///< [in] pointer to linkage inspection descriptor structure. uint32_t numModules, ///< [in] number of modules to be inspected pointed to by phModules. ze_module_handle_t* phModules, ///< [in][range(0, numModules)] pointer to an array of modules to be ///< inspected for import dependencies. ze_module_build_log_handle_t* phLog ///< [out] pointer to handle of linkage inspection log. Log object will ///< contain separate lists of imports, un-resolvable imports, and exports. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( phModules[ 0 ] )->dditable; auto pfnInspectLinkageExt = dditable->ze.Module.pfnInspectLinkageExt; if( nullptr == pfnInspectLinkageExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handles to driver handles auto phModulesLocal = new ze_module_handle_t [numModules]; for( size_t i = 0; ( nullptr != phModules ) && ( i < numModules ); ++i ) phModulesLocal[ i ] = reinterpret_cast( phModules[ i ] )->handle; // forward to device-driver result = pfnInspectLinkageExt( pInspectDesc, numModules, phModulesLocal, phLog ); delete []phModulesLocal; if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phLog = reinterpret_cast( context->ze_module_build_log_factory.getInstance( *phLog, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemFreeExt __zedlllocal ze_result_t ZE_APICALL zeMemFreeExt( ze_context_handle_t hContext, ///< [in] handle of the context object const ze_memory_free_ext_desc_t* pMemFreeDesc, ///< [in] pointer to memory free descriptor void* ptr ///< [in][release] pointer to memory to free ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnFreeExt = dditable->ze.Mem.pfnFreeExt; if( nullptr == pfnFreeExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnFreeExt( hContext, pMemFreeDesc, ptr ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetExp( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric vertices available. ///< if count is greater than the number of fabric vertices available, then ///< the driver shall update the value with the correct number of fabric ///< vertices available. ze_fabric_vertex_handle_t* phVertices ///< [in,out][optional][range(0, *pCount)] array of handle of fabric vertices. ///< if count is less than the number of fabric vertices available, then ///< driver shall only retrieve that number of fabric vertices. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnGetExp = dditable->ze.FabricVertexExp.pfnGetExp; if( nullptr == pfnGetExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnGetExp( hDriver, pCount, phVertices ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phVertices ) && ( i < *pCount ); ++i ) phVertices[ i ] = reinterpret_cast( context->ze_fabric_vertex_factory.getInstance( phVertices[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetSubVerticesExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetSubVerticesExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex object uint32_t* pCount, ///< [in,out] pointer to the number of sub-vertices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub-vertices available. ///< if count is greater than the number of sub-vertices available, then ///< the driver shall update the value with the correct number of ///< sub-vertices available. ze_fabric_vertex_handle_t* phSubvertices ///< [in,out][optional][range(0, *pCount)] array of handle of sub-vertices. ///< if count is less than the number of sub-vertices available, then ///< driver shall only retrieve that number of sub-vertices. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVertex )->dditable; auto pfnGetSubVerticesExp = dditable->ze.FabricVertexExp.pfnGetSubVerticesExp; if( nullptr == pfnGetSubVerticesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVertex = reinterpret_cast( hVertex )->handle; // forward to device-driver result = pfnGetSubVerticesExp( hVertex, pCount, phSubvertices ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phSubvertices ) && ( i < *pCount ); ++i ) phSubvertices[ i ] = reinterpret_cast( context->ze_fabric_vertex_factory.getInstance( phSubvertices[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetPropertiesExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_fabric_vertex_exp_properties_t* pVertexProperties///< [in,out] query result for fabric vertex properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVertex )->dditable; auto pfnGetPropertiesExp = dditable->ze.FabricVertexExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVertex = reinterpret_cast( hVertex )->handle; // forward to device-driver result = pfnGetPropertiesExp( hVertex, pVertexProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricVertexGetDeviceExp __zedlllocal ze_result_t ZE_APICALL zeFabricVertexGetDeviceExp( ze_fabric_vertex_handle_t hVertex, ///< [in] handle of the fabric vertex ze_device_handle_t* phDevice ///< [out] device handle corresponding to fabric vertex ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVertex )->dditable; auto pfnGetDeviceExp = dditable->ze.FabricVertexExp.pfnGetDeviceExp; if( nullptr == pfnGetDeviceExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVertex = reinterpret_cast( hVertex )->handle; // forward to device-driver result = pfnGetDeviceExp( hVertex, phDevice ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phDevice = reinterpret_cast( context->ze_device_factory.getInstance( *phDevice, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDeviceGetFabricVertexExp __zedlllocal ze_result_t ZE_APICALL zeDeviceGetFabricVertexExp( ze_device_handle_t hDevice, ///< [in] handle of the device ze_fabric_vertex_handle_t* phVertex ///< [out] fabric vertex handle corresponding to device ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetFabricVertexExp = dditable->ze.DeviceExp.pfnGetFabricVertexExp; if( nullptr == pfnGetFabricVertexExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetFabricVertexExp( hDevice, phVertex ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phVertex = reinterpret_cast( context->ze_fabric_vertex_factory.getInstance( *phVertex, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricEdgeGetExp __zedlllocal ze_result_t ZE_APICALL zeFabricEdgeGetExp( ze_fabric_vertex_handle_t hVertexA, ///< [in] handle of first fabric vertex instance ze_fabric_vertex_handle_t hVertexB, ///< [in] handle of second fabric vertex instance uint32_t* pCount, ///< [in,out] pointer to the number of fabric edges. ///< if count is zero, then the driver shall update the value with the ///< total number of fabric edges available. ///< if count is greater than the number of fabric edges available, then ///< the driver shall update the value with the correct number of fabric ///< edges available. ze_fabric_edge_handle_t* phEdges ///< [in,out][optional][range(0, *pCount)] array of handle of fabric edges. ///< if count is less than the number of fabric edges available, then ///< driver shall only retrieve that number of fabric edges. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVertexA )->dditable; auto pfnGetExp = dditable->ze.FabricEdgeExp.pfnGetExp; if( nullptr == pfnGetExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVertexA = reinterpret_cast( hVertexA )->handle; // convert loader handle to driver handle hVertexB = reinterpret_cast( hVertexB )->handle; // forward to device-driver result = pfnGetExp( hVertexA, hVertexB, pCount, phEdges ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phEdges ) && ( i < *pCount ); ++i ) phEdges[ i ] = reinterpret_cast( context->ze_fabric_edge_factory.getInstance( phEdges[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricEdgeGetVerticesExp __zedlllocal ze_result_t ZE_APICALL zeFabricEdgeGetVerticesExp( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge instance ze_fabric_vertex_handle_t* phVertexA, ///< [out] fabric vertex connected to one end of the given fabric edge. ze_fabric_vertex_handle_t* phVertexB ///< [out] fabric vertex connected to other end of the given fabric edge. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEdge )->dditable; auto pfnGetVerticesExp = dditable->ze.FabricEdgeExp.pfnGetVerticesExp; if( nullptr == pfnGetVerticesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEdge = reinterpret_cast( hEdge )->handle; // forward to device-driver result = pfnGetVerticesExp( hEdge, phVertexA, phVertexB ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phVertexA = reinterpret_cast( context->ze_fabric_vertex_factory.getInstance( *phVertexA, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } try { // convert driver handle to loader handle *phVertexB = reinterpret_cast( context->ze_fabric_vertex_factory.getInstance( *phVertexB, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeFabricEdgeGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeFabricEdgeGetPropertiesExp( ze_fabric_edge_handle_t hEdge, ///< [in] handle of the fabric edge ze_fabric_edge_exp_properties_t* pEdgeProperties///< [in,out] query result for fabric edge properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEdge )->dditable; auto pfnGetPropertiesExp = dditable->ze.FabricEdgeExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEdge = reinterpret_cast( hEdge )->handle; // forward to device-driver result = pfnGetPropertiesExp( hEdge, pEdgeProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeEventQueryKernelTimestampsExt __zedlllocal ze_result_t ZE_APICALL zeEventQueryKernelTimestampsExt( ze_event_handle_t hEvent, ///< [in] handle of the event ze_device_handle_t hDevice, ///< [in] handle of the device to query uint32_t* pCount, ///< [in,out] pointer to the number of event packets available. ///< - This value is implementation specific. ///< - if `*pCount` is zero, then the driver shall update the value with ///< the total number of event packets available. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver shall update the value with the correct value. ///< - Buffer(s) for query results must be sized by the application to ///< accommodate a minimum of `*pCount` elements. ze_event_query_kernel_timestamps_results_ext_properties_t* pResults ///< [in,out][optional][range(0, *pCount)] pointer to event query ///< properties structure(s). ///< - This parameter may be null when `*pCount` is zero. ///< - if `*pCount` is less than the number of event packets available, ///< the driver may only update `*pCount` elements, starting at element zero. ///< - if `*pCount` is greater than the number of event packets ///< available, the driver may only update the valid elements. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEvent )->dditable; auto pfnQueryKernelTimestampsExt = dditable->ze.Event.pfnQueryKernelTimestampsExt; if( nullptr == pfnQueryKernelTimestampsExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEvent = reinterpret_cast( hEvent )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnQueryKernelTimestampsExt( hEvent, hDevice, pCount, pResults ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderCreateExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderCreateExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object const ze_rtas_builder_exp_desc_t* pDescriptor, ///< [in] pointer to builder descriptor ze_rtas_builder_exp_handle_t* phBuilder ///< [out] handle of builder object ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnCreateExp = dditable->ze.RTASBuilderExp.pfnCreateExp; if( nullptr == pfnCreateExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnCreateExp( hDriver, pDescriptor, phBuilder ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phBuilder = reinterpret_cast( context->ze_rtas_builder_exp_factory.getInstance( *phBuilder, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderGetBuildPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderGetBuildPropertiesExp( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor ze_rtas_builder_exp_properties_t* pProperties ///< [in,out] query result for builder properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hBuilder )->dditable; auto pfnGetBuildPropertiesExp = dditable->ze.RTASBuilderExp.pfnGetBuildPropertiesExp; if( nullptr == pfnGetBuildPropertiesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hBuilder = reinterpret_cast( hBuilder )->handle; // forward to device-driver result = pfnGetBuildPropertiesExp( hBuilder, pBuildOpDescriptor, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeDriverRTASFormatCompatibilityCheckExp __zedlllocal ze_result_t ZE_APICALL zeDriverRTASFormatCompatibilityCheckExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_format_exp_t rtasFormatA, ///< [in] operand A ze_rtas_format_exp_t rtasFormatB ///< [in] operand B ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnRTASFormatCompatibilityCheckExp = dditable->ze.DriverExp.pfnRTASFormatCompatibilityCheckExp; if( nullptr == pfnRTASFormatCompatibilityCheckExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnRTASFormatCompatibilityCheckExp( hDriver, rtasFormatA, rtasFormatB ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderBuildExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderBuildExp( ze_rtas_builder_exp_handle_t hBuilder, ///< [in] handle of builder object const ze_rtas_builder_build_op_exp_desc_t* pBuildOpDescriptor, ///< [in] pointer to build operation descriptor void* pScratchBuffer, ///< [in][range(0, `scratchBufferSizeBytes`)] scratch buffer to be used ///< during acceleration structure construction size_t scratchBufferSizeBytes, ///< [in] size of scratch buffer, in bytes void* pRtasBuffer, ///< [in] pointer to destination buffer size_t rtasBufferSizeBytes, ///< [in] destination buffer size, in bytes ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in][optional] handle to parallel operation object void* pBuildUserPtr, ///< [in][optional] pointer passed to callbacks ze_rtas_aabb_exp_t* pBounds, ///< [in,out][optional] pointer to destination address for acceleration ///< structure bounds size_t* pRtasBufferSizeBytes ///< [out][optional] updated acceleration structure size requirement, in ///< bytes ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hBuilder )->dditable; auto pfnBuildExp = dditable->ze.RTASBuilderExp.pfnBuildExp; if( nullptr == pfnBuildExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hBuilder = reinterpret_cast( hBuilder )->handle; // convert loader handle to driver handle hParallelOperation = ( hParallelOperation ) ? reinterpret_cast( hParallelOperation )->handle : nullptr; // forward to device-driver result = pfnBuildExp( hBuilder, pBuildOpDescriptor, pScratchBuffer, scratchBufferSizeBytes, pRtasBuffer, rtasBufferSizeBytes, hParallelOperation, pBuildUserPtr, pBounds, pRtasBufferSizeBytes ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASBuilderDestroyExp __zedlllocal ze_result_t ZE_APICALL zeRTASBuilderDestroyExp( ze_rtas_builder_exp_handle_t hBuilder ///< [in][release] handle of builder object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hBuilder )->dditable; auto pfnDestroyExp = dditable->ze.RTASBuilderExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hBuilder = reinterpret_cast( hBuilder )->handle; // forward to device-driver result = pfnDestroyExp( hBuilder ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_rtas_builder_exp_factory.release( hBuilder ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationCreateExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationCreateExp( ze_driver_handle_t hDriver, ///< [in] handle of driver object ze_rtas_parallel_operation_exp_handle_t* phParallelOperation///< [out] handle of parallel operation object ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnCreateExp = dditable->ze.RTASParallelOperationExp.pfnCreateExp; if( nullptr == pfnCreateExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnCreateExp( hDriver, phParallelOperation ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phParallelOperation = reinterpret_cast( context->ze_rtas_parallel_operation_exp_factory.getInstance( *phParallelOperation, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationGetPropertiesExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation, ///< [in] handle of parallel operation object ze_rtas_parallel_operation_exp_properties_t* pProperties///< [in,out] query result for parallel operation properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hParallelOperation )->dditable; auto pfnGetPropertiesExp = dditable->ze.RTASParallelOperationExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hParallelOperation = reinterpret_cast( hParallelOperation )->handle; // forward to device-driver result = pfnGetPropertiesExp( hParallelOperation, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationJoinExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationJoinExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in] handle of parallel operation object ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hParallelOperation )->dditable; auto pfnJoinExp = dditable->ze.RTASParallelOperationExp.pfnJoinExp; if( nullptr == pfnJoinExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hParallelOperation = reinterpret_cast( hParallelOperation )->handle; // forward to device-driver result = pfnJoinExp( hParallelOperation ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeRTASParallelOperationDestroyExp __zedlllocal ze_result_t ZE_APICALL zeRTASParallelOperationDestroyExp( ze_rtas_parallel_operation_exp_handle_t hParallelOperation ///< [in][release] handle of parallel operation object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hParallelOperation )->dditable; auto pfnDestroyExp = dditable->ze.RTASParallelOperationExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hParallelOperation = reinterpret_cast( hParallelOperation )->handle; // forward to device-driver result = pfnDestroyExp( hParallelOperation ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->ze_rtas_parallel_operation_exp_factory.release( hParallelOperation ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeMemGetPitchFor2dImage __zedlllocal ze_result_t ZE_APICALL zeMemGetPitchFor2dImage( ze_context_handle_t hContext, ///< [in] handle of the context object ze_device_handle_t hDevice, ///< [in] handle of the device size_t imageWidth, ///< [in] imageWidth size_t imageHeight, ///< [in] imageHeight unsigned int elementSizeInBytes, ///< [in] Element size in bytes size_t * rowPitch ///< [out] rowPitch ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnGetPitchFor2dImage = dditable->ze.Mem.pfnGetPitchFor2dImage; if( nullptr == pfnGetPitchFor2dImage ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetPitchFor2dImage( hContext, hDevice, imageWidth, imageHeight, elementSizeInBytes, rowPitch ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeImageGetDeviceOffsetExp __zedlllocal ze_result_t ZE_APICALL zeImageGetDeviceOffsetExp( ze_image_handle_t hImage, ///< [in] handle of the image uint64_t* pDeviceOffset ///< [out] bindless device offset for image ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hImage )->dditable; auto pfnGetDeviceOffsetExp = dditable->ze.ImageExp.pfnGetDeviceOffsetExp; if( nullptr == pfnGetDeviceOffsetExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hImage = reinterpret_cast( hImage )->handle; // forward to device-driver result = pfnGetDeviceOffsetExp( hImage, pDeviceOffset ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListCreateCloneExp __zedlllocal ze_result_t ZE_APICALL zeCommandListCreateCloneExp( ze_command_list_handle_t hCommandList, ///< [in] handle to source command list (the command list to clone) ze_command_list_handle_t* phClonedCommandList ///< [out] pointer to handle of the cloned command list ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnCreateCloneExp = dditable->ze.CommandListExp.pfnCreateCloneExp; if( nullptr == pfnCreateCloneExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnCreateCloneExp( hCommandList, phClonedCommandList ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phClonedCommandList = reinterpret_cast( context->ze_command_list_factory.getInstance( *phClonedCommandList, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListImmediateAppendCommandListsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListImmediateAppendCommandListsExp( ze_command_list_handle_t hCommandListImmediate, ///< [in] handle of the immediate command list uint32_t numCommandLists, ///< [in] number of command lists ze_command_list_handle_t* phCommandLists, ///< [in][range(0, numCommandLists)] handles of command lists ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion ///< - if not null, this event is signaled after the completion of all ///< appended command lists uint32_t numWaitEvents, ///< [in][optional] number of events to wait on before executing appended ///< command lists; must be 0 if nullptr == phWaitEvents ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before executing appended command lists. ///< - if not null, all wait events must be satisfied prior to the start ///< of any appended command list(s) ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandListImmediate )->dditable; auto pfnImmediateAppendCommandListsExp = dditable->ze.CommandListExp.pfnImmediateAppendCommandListsExp; if( nullptr == pfnImmediateAppendCommandListsExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandListImmediate = reinterpret_cast( hCommandListImmediate )->handle; // convert loader handles to driver handles auto phCommandListsLocal = new ze_command_list_handle_t [numCommandLists]; for( size_t i = 0; ( nullptr != phCommandLists ) && ( i < numCommandLists ); ++i ) phCommandListsLocal[ i ] = reinterpret_cast( phCommandLists[ i ] )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnImmediateAppendCommandListsExp( hCommandListImmediate, numCommandLists, phCommandListsLocal, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phCommandListsLocal; delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdExp __zedlllocal ze_result_t ZE_APICALL zeCommandListGetNextCommandIdExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in] pointer to mutable command identifier descriptor uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnGetNextCommandIdExp = dditable->ze.CommandListExp.pfnGetNextCommandIdExp; if( nullptr == pfnGetNextCommandIdExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnGetNextCommandIdExp( hCommandList, desc, pCommandId ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListGetNextCommandIdWithKernelsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListGetNextCommandIdWithKernelsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_command_id_exp_desc_t* desc, ///< [in][out] pointer to mutable command identifier descriptor uint32_t numKernels, ///< [in][optional] number of entries on phKernels list ze_kernel_handle_t* phKernels, ///< [in][optional][range(0, numKernels)] list of kernels that user can ///< switch between using ::zeCommandListUpdateMutableCommandKernelsExp ///< call uint64_t* pCommandId ///< [out] pointer to mutable command identifier to be written ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnGetNextCommandIdWithKernelsExp = dditable->ze.CommandListExp.pfnGetNextCommandIdWithKernelsExp; if( nullptr == pfnGetNextCommandIdWithKernelsExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handles to driver handles auto phKernelsLocal = new ze_kernel_handle_t [numKernels]; for( size_t i = 0; ( nullptr != phKernels ) && ( i < numKernels ); ++i ) phKernelsLocal[ i ] = reinterpret_cast( phKernels[ i ] )->handle; // forward to device-driver result = pfnGetNextCommandIdWithKernelsExp( hCommandList, desc, numKernels, phKernelsLocal, pCommandId ); delete []phKernelsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list const ze_mutable_commands_exp_desc_t* desc ///< [in] pointer to mutable commands descriptor; multiple descriptors may ///< be chained via `pNext` member ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnUpdateMutableCommandsExp = dditable->ze.CommandListExp.pfnUpdateMutableCommandsExp; if( nullptr == pfnUpdateMutableCommandsExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnUpdateMutableCommandsExp( hCommandList, desc ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandSignalEventExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandSignalEventExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier ze_event_handle_t hSignalEvent ///< [in][optional] handle of the event to signal on completion ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnUpdateMutableCommandSignalEventExp = dditable->ze.CommandListExp.pfnUpdateMutableCommandSignalEventExp; if( nullptr == pfnUpdateMutableCommandSignalEventExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // forward to device-driver result = pfnUpdateMutableCommandSignalEventExp( hCommandList, commandId, hSignalEvent ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandWaitEventsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandWaitEventsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint64_t commandId, ///< [in] command identifier uint32_t numWaitEvents, ///< [in][optional] the number of wait events ze_event_handle_t* phWaitEvents ///< [in][optional][range(0, numWaitEvents)] handle of the events to wait ///< on before launching ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnUpdateMutableCommandWaitEventsExp = dditable->ze.CommandListExp.pfnUpdateMutableCommandWaitEventsExp; if( nullptr == pfnUpdateMutableCommandWaitEventsExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnUpdateMutableCommandWaitEventsExp( hCommandList, commandId, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zeCommandListUpdateMutableCommandKernelsExp __zedlllocal ze_result_t ZE_APICALL zeCommandListUpdateMutableCommandKernelsExp( ze_command_list_handle_t hCommandList, ///< [in] handle of the command list uint32_t numKernels, ///< [in] the number of kernels to update uint64_t* pCommandId, ///< [in][range(0, numKernels)] command identifier ze_kernel_handle_t* phKernels ///< [in][range(0, numKernels)] handle of the kernel for a command ///< identifier to switch to ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnUpdateMutableCommandKernelsExp = dditable->ze.CommandListExp.pfnUpdateMutableCommandKernelsExp; if( nullptr == pfnUpdateMutableCommandKernelsExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handles to driver handles auto phKernelsLocal = new ze_kernel_handle_t [numKernels]; for( size_t i = 0; ( nullptr != phKernels ) && ( i < numKernels ); ++i ) phKernelsLocal[ i ] = reinterpret_cast( phKernels[ i ] )->handle; // forward to device-driver result = pfnUpdateMutableCommandKernelsExp( hCommandList, numKernels, pCommandId, phKernelsLocal ); delete []phKernelsLocal; return result; } } // namespace loader #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Global table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetGlobalProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_global_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetGlobalProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.Global); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; if (drv.dditable.ze.Global.pfnInitDrivers) { loader::context->initDriversSupport = true; } } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnInit = loader::zeInit; pDdiTable->pfnInitDrivers = loader::zeInitDrivers; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.Global; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetGlobalProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetGlobalProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_global_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_global_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.Global = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASBuilderExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetRTASBuilderExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_rtas_builder_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetRTASBuilderExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.ze.RTASBuilderExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreateExp = loader::zeRTASBuilderCreateExp; pDdiTable->pfnGetBuildPropertiesExp = loader::zeRTASBuilderGetBuildPropertiesExp; pDdiTable->pfnBuildExp = loader::zeRTASBuilderBuildExp; pDdiTable->pfnDestroyExp = loader::zeRTASBuilderDestroyExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.RTASBuilderExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetRTASBuilderExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetRTASBuilderExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_rtas_builder_exp_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_rtas_builder_exp_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.RTASBuilderExp = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RTASParallelOperationExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetRTASParallelOperationExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_rtas_parallel_operation_exp_dditable_t* pDdiTable///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetRTASParallelOperationExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.ze.RTASParallelOperationExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreateExp = loader::zeRTASParallelOperationCreateExp; pDdiTable->pfnGetPropertiesExp = loader::zeRTASParallelOperationGetPropertiesExp; pDdiTable->pfnJoinExp = loader::zeRTASParallelOperationJoinExp; pDdiTable->pfnDestroyExp = loader::zeRTASParallelOperationDestroyExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.RTASParallelOperationExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetRTASParallelOperationExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetRTASParallelOperationExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_rtas_parallel_operation_exp_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_rtas_parallel_operation_exp_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.RTASParallelOperationExp = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Driver table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDriverProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_driver_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetDriverProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.Driver); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGet = loader::zeDriverGet; pDdiTable->pfnGetApiVersion = loader::zeDriverGetApiVersion; pDdiTable->pfnGetProperties = loader::zeDriverGetProperties; pDdiTable->pfnGetIpcProperties = loader::zeDriverGetIpcProperties; pDdiTable->pfnGetExtensionProperties = loader::zeDriverGetExtensionProperties; pDdiTable->pfnGetExtensionFunctionAddress = loader::zeDriverGetExtensionFunctionAddress; pDdiTable->pfnGetLastErrorDescription = loader::zeDriverGetLastErrorDescription; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.Driver; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetDriverProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetDriverProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_driver_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_driver_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.Driver = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DriverExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDriverExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_driver_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetDriverExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.ze.DriverExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnRTASFormatCompatibilityCheckExp = loader::zeDriverRTASFormatCompatibilityCheckExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.DriverExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetDriverExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetDriverExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_driver_exp_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_driver_exp_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.DriverExp = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetDeviceProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.Device); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGet = loader::zeDeviceGet; pDdiTable->pfnGetSubDevices = loader::zeDeviceGetSubDevices; pDdiTable->pfnGetProperties = loader::zeDeviceGetProperties; pDdiTable->pfnGetComputeProperties = loader::zeDeviceGetComputeProperties; pDdiTable->pfnGetModuleProperties = loader::zeDeviceGetModuleProperties; pDdiTable->pfnGetCommandQueueGroupProperties = loader::zeDeviceGetCommandQueueGroupProperties; pDdiTable->pfnGetMemoryProperties = loader::zeDeviceGetMemoryProperties; pDdiTable->pfnGetMemoryAccessProperties = loader::zeDeviceGetMemoryAccessProperties; pDdiTable->pfnGetCacheProperties = loader::zeDeviceGetCacheProperties; pDdiTable->pfnGetImageProperties = loader::zeDeviceGetImageProperties; pDdiTable->pfnGetExternalMemoryProperties = loader::zeDeviceGetExternalMemoryProperties; pDdiTable->pfnGetP2PProperties = loader::zeDeviceGetP2PProperties; pDdiTable->pfnCanAccessPeer = loader::zeDeviceCanAccessPeer; pDdiTable->pfnGetStatus = loader::zeDeviceGetStatus; pDdiTable->pfnGetGlobalTimestamps = loader::zeDeviceGetGlobalTimestamps; pDdiTable->pfnImportExternalSemaphoreExt = loader::zeDeviceImportExternalSemaphoreExt; pDdiTable->pfnReleaseExternalSemaphoreExt = loader::zeDeviceReleaseExternalSemaphoreExt; pDdiTable->pfnReserveCacheExt = loader::zeDeviceReserveCacheExt; pDdiTable->pfnSetCacheAdviceExt = loader::zeDeviceSetCacheAdviceExt; pDdiTable->pfnPciGetPropertiesExt = loader::zeDevicePciGetPropertiesExt; pDdiTable->pfnGetRootDevice = loader::zeDeviceGetRootDevice; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.Device; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetDeviceProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetDeviceProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_device_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_device_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.Device = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetDeviceExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.ze.DeviceExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetFabricVertexExp = loader::zeDeviceGetFabricVertexExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.DeviceExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetDeviceExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetDeviceExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_device_exp_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_device_exp_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.DeviceExp = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Context table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetContextProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_context_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetContextProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.Context); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zeContextCreate; pDdiTable->pfnDestroy = loader::zeContextDestroy; pDdiTable->pfnGetStatus = loader::zeContextGetStatus; pDdiTable->pfnSystemBarrier = loader::zeContextSystemBarrier; pDdiTable->pfnMakeMemoryResident = loader::zeContextMakeMemoryResident; pDdiTable->pfnEvictMemory = loader::zeContextEvictMemory; pDdiTable->pfnMakeImageResident = loader::zeContextMakeImageResident; pDdiTable->pfnEvictImage = loader::zeContextEvictImage; pDdiTable->pfnCreateEx = loader::zeContextCreateEx; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.Context; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetContextProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetContextProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_context_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_context_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.Context = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandQueue table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandQueueProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_queue_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetCommandQueueProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.CommandQueue); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zeCommandQueueCreate; pDdiTable->pfnDestroy = loader::zeCommandQueueDestroy; pDdiTable->pfnExecuteCommandLists = loader::zeCommandQueueExecuteCommandLists; pDdiTable->pfnSynchronize = loader::zeCommandQueueSynchronize; pDdiTable->pfnGetOrdinal = loader::zeCommandQueueGetOrdinal; pDdiTable->pfnGetIndex = loader::zeCommandQueueGetIndex; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.CommandQueue; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetCommandQueueProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetCommandQueueProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_command_queue_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_command_queue_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.CommandQueue = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandList table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandListProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_list_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetCommandListProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.CommandList); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zeCommandListCreate; pDdiTable->pfnCreateImmediate = loader::zeCommandListCreateImmediate; pDdiTable->pfnDestroy = loader::zeCommandListDestroy; pDdiTable->pfnClose = loader::zeCommandListClose; pDdiTable->pfnReset = loader::zeCommandListReset; pDdiTable->pfnAppendWriteGlobalTimestamp = loader::zeCommandListAppendWriteGlobalTimestamp; pDdiTable->pfnAppendBarrier = loader::zeCommandListAppendBarrier; pDdiTable->pfnAppendMemoryRangesBarrier = loader::zeCommandListAppendMemoryRangesBarrier; pDdiTable->pfnAppendMemoryCopy = loader::zeCommandListAppendMemoryCopy; pDdiTable->pfnAppendMemoryFill = loader::zeCommandListAppendMemoryFill; pDdiTable->pfnAppendMemoryCopyRegion = loader::zeCommandListAppendMemoryCopyRegion; pDdiTable->pfnAppendMemoryCopyFromContext = loader::zeCommandListAppendMemoryCopyFromContext; pDdiTable->pfnAppendImageCopy = loader::zeCommandListAppendImageCopy; pDdiTable->pfnAppendImageCopyRegion = loader::zeCommandListAppendImageCopyRegion; pDdiTable->pfnAppendImageCopyToMemory = loader::zeCommandListAppendImageCopyToMemory; pDdiTable->pfnAppendImageCopyFromMemory = loader::zeCommandListAppendImageCopyFromMemory; pDdiTable->pfnAppendMemoryPrefetch = loader::zeCommandListAppendMemoryPrefetch; pDdiTable->pfnAppendMemAdvise = loader::zeCommandListAppendMemAdvise; pDdiTable->pfnAppendSignalEvent = loader::zeCommandListAppendSignalEvent; pDdiTable->pfnAppendWaitOnEvents = loader::zeCommandListAppendWaitOnEvents; pDdiTable->pfnAppendEventReset = loader::zeCommandListAppendEventReset; pDdiTable->pfnAppendQueryKernelTimestamps = loader::zeCommandListAppendQueryKernelTimestamps; pDdiTable->pfnAppendLaunchKernel = loader::zeCommandListAppendLaunchKernel; pDdiTable->pfnAppendLaunchCooperativeKernel = loader::zeCommandListAppendLaunchCooperativeKernel; pDdiTable->pfnAppendLaunchKernelIndirect = loader::zeCommandListAppendLaunchKernelIndirect; pDdiTable->pfnAppendLaunchMultipleKernelsIndirect = loader::zeCommandListAppendLaunchMultipleKernelsIndirect; pDdiTable->pfnAppendSignalExternalSemaphoreExt = loader::zeCommandListAppendSignalExternalSemaphoreExt; pDdiTable->pfnAppendWaitExternalSemaphoreExt = loader::zeCommandListAppendWaitExternalSemaphoreExt; pDdiTable->pfnAppendImageCopyToMemoryExt = loader::zeCommandListAppendImageCopyToMemoryExt; pDdiTable->pfnAppendImageCopyFromMemoryExt = loader::zeCommandListAppendImageCopyFromMemoryExt; pDdiTable->pfnHostSynchronize = loader::zeCommandListHostSynchronize; pDdiTable->pfnGetDeviceHandle = loader::zeCommandListGetDeviceHandle; pDdiTable->pfnGetContextHandle = loader::zeCommandListGetContextHandle; pDdiTable->pfnGetOrdinal = loader::zeCommandListGetOrdinal; pDdiTable->pfnImmediateGetIndex = loader::zeCommandListImmediateGetIndex; pDdiTable->pfnIsImmediate = loader::zeCommandListIsImmediate; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.CommandList; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetCommandListProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetCommandListProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_command_list_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_command_list_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.CommandList = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandListExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetCommandListExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_command_list_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetCommandListExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.ze.CommandListExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetNextCommandIdWithKernelsExp = loader::zeCommandListGetNextCommandIdWithKernelsExp; pDdiTable->pfnUpdateMutableCommandKernelsExp = loader::zeCommandListUpdateMutableCommandKernelsExp; pDdiTable->pfnCreateCloneExp = loader::zeCommandListCreateCloneExp; pDdiTable->pfnImmediateAppendCommandListsExp = loader::zeCommandListImmediateAppendCommandListsExp; pDdiTable->pfnGetNextCommandIdExp = loader::zeCommandListGetNextCommandIdExp; pDdiTable->pfnUpdateMutableCommandsExp = loader::zeCommandListUpdateMutableCommandsExp; pDdiTable->pfnUpdateMutableCommandSignalEventExp = loader::zeCommandListUpdateMutableCommandSignalEventExp; pDdiTable->pfnUpdateMutableCommandWaitEventsExp = loader::zeCommandListUpdateMutableCommandWaitEventsExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.CommandListExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetCommandListExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetCommandListExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_command_list_exp_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_command_list_exp_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.CommandListExp = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Event table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetEventProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.Event); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zeEventCreate; pDdiTable->pfnDestroy = loader::zeEventDestroy; pDdiTable->pfnHostSignal = loader::zeEventHostSignal; pDdiTable->pfnHostSynchronize = loader::zeEventHostSynchronize; pDdiTable->pfnQueryStatus = loader::zeEventQueryStatus; pDdiTable->pfnHostReset = loader::zeEventHostReset; pDdiTable->pfnQueryKernelTimestamp = loader::zeEventQueryKernelTimestamp; pDdiTable->pfnQueryKernelTimestampsExt = loader::zeEventQueryKernelTimestampsExt; pDdiTable->pfnGetEventPool = loader::zeEventGetEventPool; pDdiTable->pfnGetSignalScope = loader::zeEventGetSignalScope; pDdiTable->pfnGetWaitScope = loader::zeEventGetWaitScope; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.Event; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetEventProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetEventProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_event_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_event_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.Event = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's EventExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetEventExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.ze.EventExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnQueryTimestampsExp = loader::zeEventQueryTimestampsExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.EventExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetEventExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetEventExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_event_exp_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_event_exp_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.EventExp = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's EventPool table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetEventPoolProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_event_pool_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetEventPoolProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.EventPool); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zeEventPoolCreate; pDdiTable->pfnDestroy = loader::zeEventPoolDestroy; pDdiTable->pfnGetIpcHandle = loader::zeEventPoolGetIpcHandle; pDdiTable->pfnOpenIpcHandle = loader::zeEventPoolOpenIpcHandle; pDdiTable->pfnCloseIpcHandle = loader::zeEventPoolCloseIpcHandle; pDdiTable->pfnPutIpcHandle = loader::zeEventPoolPutIpcHandle; pDdiTable->pfnGetContextHandle = loader::zeEventPoolGetContextHandle; pDdiTable->pfnGetFlags = loader::zeEventPoolGetFlags; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.EventPool; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetEventPoolProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetEventPoolProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_event_pool_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_event_pool_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.EventPool = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Fence table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFenceProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fence_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetFenceProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.Fence); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zeFenceCreate; pDdiTable->pfnDestroy = loader::zeFenceDestroy; pDdiTable->pfnHostSynchronize = loader::zeFenceHostSynchronize; pDdiTable->pfnQueryStatus = loader::zeFenceQueryStatus; pDdiTable->pfnReset = loader::zeFenceReset; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.Fence; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetFenceProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetFenceProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_fence_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_fence_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.Fence = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Image table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetImageProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_image_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetImageProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.Image); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zeImageGetProperties; pDdiTable->pfnCreate = loader::zeImageCreate; pDdiTable->pfnDestroy = loader::zeImageDestroy; pDdiTable->pfnGetAllocPropertiesExt = loader::zeImageGetAllocPropertiesExt; pDdiTable->pfnViewCreateExt = loader::zeImageViewCreateExt; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.Image; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetImageProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetImageProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_image_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_image_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.Image = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ImageExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetImageExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_image_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetImageExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.ze.ImageExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetMemoryPropertiesExp = loader::zeImageGetMemoryPropertiesExp; pDdiTable->pfnViewCreateExp = loader::zeImageViewCreateExp; pDdiTable->pfnGetDeviceOffsetExp = loader::zeImageGetDeviceOffsetExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.ImageExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetImageExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetImageExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_image_exp_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_image_exp_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.ImageExp = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Kernel table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetKernelProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_kernel_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetKernelProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.Kernel); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zeKernelCreate; pDdiTable->pfnDestroy = loader::zeKernelDestroy; pDdiTable->pfnSetCacheConfig = loader::zeKernelSetCacheConfig; pDdiTable->pfnSetGroupSize = loader::zeKernelSetGroupSize; pDdiTable->pfnSuggestGroupSize = loader::zeKernelSuggestGroupSize; pDdiTable->pfnSuggestMaxCooperativeGroupCount = loader::zeKernelSuggestMaxCooperativeGroupCount; pDdiTable->pfnSetArgumentValue = loader::zeKernelSetArgumentValue; pDdiTable->pfnSetIndirectAccess = loader::zeKernelSetIndirectAccess; pDdiTable->pfnGetIndirectAccess = loader::zeKernelGetIndirectAccess; pDdiTable->pfnGetSourceAttributes = loader::zeKernelGetSourceAttributes; pDdiTable->pfnGetProperties = loader::zeKernelGetProperties; pDdiTable->pfnGetName = loader::zeKernelGetName; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.Kernel; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetKernelProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetKernelProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_kernel_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_kernel_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.Kernel = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's KernelExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetKernelExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_kernel_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetKernelExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.ze.KernelExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnSetGlobalOffsetExp = loader::zeKernelSetGlobalOffsetExp; pDdiTable->pfnGetBinaryExp = loader::zeKernelGetBinaryExp; pDdiTable->pfnSchedulingHintExp = loader::zeKernelSchedulingHintExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.KernelExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetKernelExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetKernelExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_kernel_exp_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_kernel_exp_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.KernelExp = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Mem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetMemProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.Mem); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnAllocShared = loader::zeMemAllocShared; pDdiTable->pfnAllocDevice = loader::zeMemAllocDevice; pDdiTable->pfnAllocHost = loader::zeMemAllocHost; pDdiTable->pfnFree = loader::zeMemFree; pDdiTable->pfnGetAllocProperties = loader::zeMemGetAllocProperties; pDdiTable->pfnGetAddressRange = loader::zeMemGetAddressRange; pDdiTable->pfnGetIpcHandle = loader::zeMemGetIpcHandle; pDdiTable->pfnOpenIpcHandle = loader::zeMemOpenIpcHandle; pDdiTable->pfnCloseIpcHandle = loader::zeMemCloseIpcHandle; pDdiTable->pfnFreeExt = loader::zeMemFreeExt; pDdiTable->pfnPutIpcHandle = loader::zeMemPutIpcHandle; pDdiTable->pfnGetPitchFor2dImage = loader::zeMemGetPitchFor2dImage; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.Mem; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetMemProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetMemProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_mem_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_mem_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.Mem = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MemExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetMemExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_mem_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetMemExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.ze.MemExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetIpcHandleFromFileDescriptorExp = loader::zeMemGetIpcHandleFromFileDescriptorExp; pDdiTable->pfnGetFileDescriptorFromIpcHandleExp = loader::zeMemGetFileDescriptorFromIpcHandleExp; pDdiTable->pfnSetAtomicAccessAttributeExp = loader::zeMemSetAtomicAccessAttributeExp; pDdiTable->pfnGetAtomicAccessAttributeExp = loader::zeMemGetAtomicAccessAttributeExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.MemExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetMemExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetMemExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_mem_exp_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_mem_exp_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.MemExp = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Module table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetModuleProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_module_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetModuleProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.Module); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zeModuleCreate; pDdiTable->pfnDestroy = loader::zeModuleDestroy; pDdiTable->pfnDynamicLink = loader::zeModuleDynamicLink; pDdiTable->pfnGetNativeBinary = loader::zeModuleGetNativeBinary; pDdiTable->pfnGetGlobalPointer = loader::zeModuleGetGlobalPointer; pDdiTable->pfnGetKernelNames = loader::zeModuleGetKernelNames; pDdiTable->pfnGetProperties = loader::zeModuleGetProperties; pDdiTable->pfnGetFunctionPointer = loader::zeModuleGetFunctionPointer; pDdiTable->pfnInspectLinkageExt = loader::zeModuleInspectLinkageExt; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.Module; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetModuleProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetModuleProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_module_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_module_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.Module = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's ModuleBuildLog table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetModuleBuildLogProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_module_build_log_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetModuleBuildLogProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.ModuleBuildLog); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnDestroy = loader::zeModuleBuildLogDestroy; pDdiTable->pfnGetString = loader::zeModuleBuildLogGetString; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.ModuleBuildLog; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetModuleBuildLogProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetModuleBuildLogProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_module_build_log_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_module_build_log_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.ModuleBuildLog = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's PhysicalMem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetPhysicalMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_physical_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetPhysicalMemProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.PhysicalMem); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zePhysicalMemCreate; pDdiTable->pfnDestroy = loader::zePhysicalMemDestroy; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.PhysicalMem; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetPhysicalMemProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetPhysicalMemProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_physical_mem_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_physical_mem_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.PhysicalMem = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Sampler table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetSamplerProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_sampler_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetSamplerProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.Sampler); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zeSamplerCreate; pDdiTable->pfnDestroy = loader::zeSamplerDestroy; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.Sampler; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetSamplerProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetSamplerProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_sampler_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_sampler_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.Sampler = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's VirtualMem table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetVirtualMemProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_virtual_mem_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetVirtualMemProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.ze.VirtualMem); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnReserve = loader::zeVirtualMemReserve; pDdiTable->pfnFree = loader::zeVirtualMemFree; pDdiTable->pfnQueryPageSize = loader::zeVirtualMemQueryPageSize; pDdiTable->pfnMap = loader::zeVirtualMemMap; pDdiTable->pfnUnmap = loader::zeVirtualMemUnmap; pDdiTable->pfnSetAccessAttribute = loader::zeVirtualMemSetAccessAttribute; pDdiTable->pfnGetAccessAttribute = loader::zeVirtualMemGetAccessAttribute; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.VirtualMem; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetVirtualMemProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetVirtualMemProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_virtual_mem_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_virtual_mem_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.VirtualMem = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricEdgeExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFabricEdgeExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fabric_edge_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetFabricEdgeExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.ze.FabricEdgeExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetExp = loader::zeFabricEdgeGetExp; pDdiTable->pfnGetVerticesExp = loader::zeFabricEdgeGetVerticesExp; pDdiTable->pfnGetPropertiesExp = loader::zeFabricEdgeGetPropertiesExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.FabricEdgeExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetFabricEdgeExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetFabricEdgeExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_fabric_edge_exp_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_fabric_edge_exp_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.FabricEdgeExp = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricVertexExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zeGetFabricVertexExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested ze_fabric_vertex_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zeGetFabricVertexExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.ze.FabricVertexExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetExp = loader::zeFabricVertexGetExp; pDdiTable->pfnGetSubVerticesExp = loader::zeFabricVertexGetSubVerticesExp; pDdiTable->pfnGetPropertiesExp = loader::zeFabricVertexGetPropertiesExp; pDdiTable->pfnGetDeviceExp = loader::zeFabricVertexGetDeviceExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.ze.FabricVertexExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zeGetFabricVertexExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } // If the API tracing layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zeGetFabricVertexExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; ze_fabric_vertex_exp_dditable_t dditable; memcpy(&dditable, pDdiTable, sizeof(ze_fabric_vertex_exp_dditable_t)); result = getTable( version, &dditable ); loader::context->tracing_dditable.ze.FabricVertexExp = dditable; if ( loader::context->tracingLayerEnabled ) { result = getTable( version, pDdiTable ); } } return result; } #if defined(__cplusplus) }; #endif level-zero-1.20.6/source/loader/ze_ldrddi.h000066400000000000000000000101571475521542100205550ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_ldrddi.h * */ #pragma once namespace loader { /////////////////////////////////////////////////////////////////////////////// using ze_driver_object_t = object_t < ze_driver_handle_t >; using ze_driver_factory_t = singleton_factory_t < ze_driver_object_t, ze_driver_handle_t >; using ze_device_object_t = object_t < ze_device_handle_t >; using ze_device_factory_t = singleton_factory_t < ze_device_object_t, ze_device_handle_t >; using ze_context_object_t = object_t < ze_context_handle_t >; using ze_context_factory_t = singleton_factory_t < ze_context_object_t, ze_context_handle_t >; using ze_command_queue_object_t = object_t < ze_command_queue_handle_t >; using ze_command_queue_factory_t = singleton_factory_t < ze_command_queue_object_t, ze_command_queue_handle_t >; using ze_command_list_object_t = object_t < ze_command_list_handle_t >; using ze_command_list_factory_t = singleton_factory_t < ze_command_list_object_t, ze_command_list_handle_t >; using ze_fence_object_t = object_t < ze_fence_handle_t >; using ze_fence_factory_t = singleton_factory_t < ze_fence_object_t, ze_fence_handle_t >; using ze_event_pool_object_t = object_t < ze_event_pool_handle_t >; using ze_event_pool_factory_t = singleton_factory_t < ze_event_pool_object_t, ze_event_pool_handle_t >; using ze_event_object_t = object_t < ze_event_handle_t >; using ze_event_factory_t = singleton_factory_t < ze_event_object_t, ze_event_handle_t >; using ze_image_object_t = object_t < ze_image_handle_t >; using ze_image_factory_t = singleton_factory_t < ze_image_object_t, ze_image_handle_t >; using ze_module_object_t = object_t < ze_module_handle_t >; using ze_module_factory_t = singleton_factory_t < ze_module_object_t, ze_module_handle_t >; using ze_module_build_log_object_t = object_t < ze_module_build_log_handle_t >; using ze_module_build_log_factory_t = singleton_factory_t < ze_module_build_log_object_t, ze_module_build_log_handle_t >; using ze_kernel_object_t = object_t < ze_kernel_handle_t >; using ze_kernel_factory_t = singleton_factory_t < ze_kernel_object_t, ze_kernel_handle_t >; using ze_sampler_object_t = object_t < ze_sampler_handle_t >; using ze_sampler_factory_t = singleton_factory_t < ze_sampler_object_t, ze_sampler_handle_t >; using ze_physical_mem_object_t = object_t < ze_physical_mem_handle_t >; using ze_physical_mem_factory_t = singleton_factory_t < ze_physical_mem_object_t, ze_physical_mem_handle_t >; using ze_fabric_vertex_object_t = object_t < ze_fabric_vertex_handle_t >; using ze_fabric_vertex_factory_t = singleton_factory_t < ze_fabric_vertex_object_t, ze_fabric_vertex_handle_t >; using ze_fabric_edge_object_t = object_t < ze_fabric_edge_handle_t >; using ze_fabric_edge_factory_t = singleton_factory_t < ze_fabric_edge_object_t, ze_fabric_edge_handle_t >; using ze_external_semaphore_ext_object_t = object_t < ze_external_semaphore_ext_handle_t >; using ze_external_semaphore_ext_factory_t = singleton_factory_t < ze_external_semaphore_ext_object_t, ze_external_semaphore_ext_handle_t >; using ze_rtas_builder_exp_object_t = object_t < ze_rtas_builder_exp_handle_t >; using ze_rtas_builder_exp_factory_t = singleton_factory_t < ze_rtas_builder_exp_object_t, ze_rtas_builder_exp_handle_t >; using ze_rtas_parallel_operation_exp_object_t = object_t < ze_rtas_parallel_operation_exp_handle_t >; using ze_rtas_parallel_operation_exp_factory_t = singleton_factory_t < ze_rtas_parallel_operation_exp_object_t, ze_rtas_parallel_operation_exp_handle_t >; } level-zero-1.20.6/source/loader/ze_loader.cpp000066400000000000000000000737321475521542100211240ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "ze_loader_internal.h" #include "driver_discovery.h" #include #ifdef __linux__ #include #include #include #endif // __linux__ namespace loader { /////////////////////////////////////////////////////////////////////////////// context_t *context; void context_t::debug_trace_message(std::string message, std::string result) { if (zel_logger->log_to_console){ std::string debugTracePrefix = "ZE_LOADER_DEBUG_TRACE:"; std::cerr << debugTracePrefix << message << result << std::endl; } zel_logger->log_trace(message + result); }; std::string to_string(const ze_init_flags_t flags) { if (flags & ZE_INIT_FLAG_GPU_ONLY) { return "ZE_INIT_FLAG_GPU_ONLY"; } else if (flags & ZE_INIT_FLAG_VPU_ONLY) { return "ZE_INIT_FLAG_VPU_ONLY"; } else if (flags == 0) { return "0(ZE_INIT_ALL_DRIVER_TYPES_ENABLED)"; } else { return (std::to_string(static_cast(flags))); } } std::string to_string(const ze_init_driver_type_desc_t *desc) { std::string flags_value; if (desc->flags & ZE_INIT_DRIVER_TYPE_FLAG_GPU) { flags_value+= "|ZE_INIT_DRIVER_TYPE_FLAG_GPU|"; } if (desc->flags & ZE_INIT_DRIVER_TYPE_FLAG_NPU) { flags_value+= "|ZE_INIT_DRIVER_TYPE_FLAG_NPU|"; } return flags_value; } bool driverSortComparator(const driver_t &a, const driver_t &b) { if (a.pciOrderingRequested) { if (a.driverType == ZEL_DRIVER_TYPE_OTHER) { return false; } if (a.driverType == ZEL_DRIVER_TYPE_MIXED && b.driverType == ZEL_DRIVER_TYPE_OTHER) { return true; } else if(a.driverType == ZEL_DRIVER_TYPE_MIXED) { return false; } return a.driverType > b.driverType; } return a.driverType < b.driverType; } /** * @brief Checks and initializes drivers based on the provided flags and descriptors. * * This function performs the following operations: * 1. If debug tracing is enabled, logs the input parameters. * 2. If `zeInitDrivers` is not supported by the driver and it is called first, returns `ZE_RESULT_ERROR_UNINITIALIZED`. * 3. Determines the appropriate driver vector (`zeDrivers` or `zesDrivers`) based on the input parameters. * 4. Iterates over the drivers and attempts to initialize each driver: * - If initialization fails and the driver is not in use, removes the driver from the list. * - If the number of drivers becomes one and interception is not forced, sets the `requireDdiReinit` flag to true. * - If the initialization fails and `return_first_driver_result` is true, returns the result immediately. * - If initialization succeeds, marks the driver as in use. * 5. Sorts the drivers in ascending order of driver type using `driverSortComparator`. * 6. Logs the sorted driver list if debug tracing is enabled. * 7. If no drivers are left, returns `ZE_RESULT_ERROR_UNINITIALIZED`. * 8. Returns `ZE_RESULT_SUCCESS` if at least one driver is successfully initialized. * * @param flags Initialization flags. * @param desc Driver type descriptor (optional). * @param globalInitStored Pointer to global DDI table for initialization. * @param sysmanGlobalInitStored Pointer to Sysman global DDI table for initialization. * @param requireDdiReinit Pointer to a boolean flag indicating if DDI reinitialization is required. * @param sysmanOnly Boolean flag indicating if only Sysman drivers should be checked. * @return `ZE_RESULT_SUCCESS` if at least one driver is successfully initialized, otherwise an appropriate error code. */ ze_result_t context_t::check_drivers(ze_init_flags_t flags, ze_init_driver_type_desc_t* desc, ze_global_dditable_t *globalInitStored, zes_global_dditable_t *sysmanGlobalInitStored, bool *requireDdiReinit, bool sysmanOnly) { if (debugTraceEnabled) { if (desc) { std::string message = "check_drivers(" + std::string("desc->flags=") + loader::to_string(desc) + ")"; debug_trace_message(message, ""); } else { std::string message = "check_drivers(" + std::string("flags=") + loader::to_string(flags) + ")"; debug_trace_message(message, ""); } } // If zeInitDrivers is not supported by this driver, but zeInitDrivers is called first, then return uninitialized. if (desc && !loader::context->initDriversSupport) { if (debugTraceEnabled) { std::string message = "zeInitDrivers called first, but not supported by driver, returning uninitialized."; debug_trace_message(message, ""); } return ZE_RESULT_ERROR_UNINITIALIZED; } bool return_first_driver_result=false; std::string initName = "zeInit"; driver_vector_t *drivers = &zeDrivers; // If desc is set, then this is zeInitDrivers. if (desc) { initName = "zeInitDrivers"; } // If this is sysmanOnly check_drivers, then zesInit is being called and we need to use zesDrivers. if (sysmanOnly) { drivers = &zesDrivers; initName = "zesInit"; } if(drivers->size()==1) { return_first_driver_result=true; } bool pciOrderingRequested = getenv_tobool( "ZE_ENABLE_PCI_ID_DEVICE_ORDER" ); for(auto it = drivers->begin(); it != drivers->end(); ) { it->pciOrderingRequested = pciOrderingRequested; std::string freeLibraryErrorValue; ze_result_t result = init_driver(*it, flags, desc, globalInitStored, sysmanGlobalInitStored, sysmanOnly); if(result != ZE_RESULT_SUCCESS) { // If the driver has already been init and handles are to be read, then this driver cannot be removed from the list. // Also, if any driver supports zeInitDrivers, then no driver can be removed to allow for different sets of drivers. if (!it->driverInuse && !loader::context->initDriversSupport) { if (debugTraceEnabled) { std::string errorMessage = "Check Drivers Failed on " + it->name + " , driver will be removed. " + initName + " failed with "; debug_trace_message(errorMessage, loader::to_string(result)); } it = drivers->erase(it); // If the number of drivers is now ==1, then we need to reinit the ddi tables to pass through. // If ZE_ENABLE_LOADER_INTERCEPT is set to 1, then even if drivers were removed, don't reinit the ddi tables. if (drivers->size() == 1 && !loader::context->forceIntercept) { *requireDdiReinit = true; } } else { it++; } if(return_first_driver_result) return result; } else { // If this is a single driver system, then the first success for this driver needs to be set. it->driverInuse = true; it++; } } // Sort drivers in ascending order of driver type unless ZE_ENABLE_PCI_ID_DEVICE_ORDER, then in decending order with MIXED and OTHER at the end. std::sort(drivers->begin(), drivers->end(), driverSortComparator); if (debugTraceEnabled) { std::string message = "Drivers after sorting:"; for (const auto& driver : *drivers) { message += "\nDriver Type: " + std::to_string(driver.driverType) + " Driver Name: " + driver.name; } debug_trace_message(message, ""); } if(drivers->size() == 0) return ZE_RESULT_ERROR_UNINITIALIZED; return ZE_RESULT_SUCCESS; } ze_result_t context_t::init_driver(driver_t &driver, ze_init_flags_t flags, ze_init_driver_type_desc_t* desc, ze_global_dditable_t *globalInitStored, zes_global_dditable_t *sysmanGlobalInitStored, bool sysmanOnly) { if (sysmanOnly) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(driver.handle, "zesGetGlobalProcAddrTable")); if(!getTable) { if (debugTraceEnabled) { std::string errorMessage = "init driver " + driver.name + " failed, zesGetGlobalProcAddrTable function pointer null. Returning "; debug_trace_message(errorMessage, loader::to_string(ZE_RESULT_ERROR_UNINITIALIZED)); } return ZE_RESULT_ERROR_UNINITIALIZED; } zes_global_dditable_t global; auto getTableResult = getTable(ZE_API_VERSION_CURRENT, &global); if(getTableResult != ZE_RESULT_SUCCESS) { if (debugTraceEnabled) { std::string errorMessage = "init driver " + driver.name + " failed, zesGetGlobalProcAddrTable() failed with "; debug_trace_message(errorMessage, loader::to_string(getTableResult)); } return ZE_RESULT_ERROR_UNINITIALIZED; } if(nullptr == global.pfnInit) { if (debugTraceEnabled) { std::string errorMessage = "init driver " + driver.name + " failed, zesInit function pointer null. Returning "; debug_trace_message(errorMessage, loader::to_string(ZE_RESULT_ERROR_UNINITIALIZED)); } return ZE_RESULT_ERROR_UNINITIALIZED; } // Use the previously init ddi table pointer to zesInit to allow for intercept of the zesInit calls ze_result_t res = sysmanGlobalInitStored->pfnInit(flags); // Verify that this driver successfully init in the call above. if (driver.initStatus != ZE_RESULT_SUCCESS) { res = driver.initStatus; } if (debugTraceEnabled) { std::string message = "init driver " + driver.name + " zesInit(" + loader::to_string(flags) + ") returning "; debug_trace_message(message, loader::to_string(res)); } return res; } else { uint32_t pCount = 0; std::vector driverHandles; if (!desc) { auto pfnInit = driver.dditable.ze.Global.pfnInit; if(nullptr == pfnInit || globalInitStored->pfnInit == nullptr) { if (debugTraceEnabled) { std::string errorMessage = "init driver " + driver.name + " failed, zeInit function pointer null. Returning "; debug_trace_message(errorMessage, loader::to_string(ZE_RESULT_ERROR_UNINITIALIZED)); } return ZE_RESULT_ERROR_UNINITIALIZED; } // Use the previously init ddi table pointer to zeInit to allow for intercept of the zeInit calls ze_result_t res = globalInitStored->pfnInit(flags); // Verify that this driver successfully init in the call above. if (res != ZE_RESULT_SUCCESS || driver.initStatus != ZE_RESULT_SUCCESS) { if (driver.initStatus != ZE_RESULT_SUCCESS) res = driver.initStatus; if (debugTraceEnabled) { std::string message = "init driver (global ddi) " + driver.name + " zeInit(" + loader::to_string(flags) + ") returning "; debug_trace_message(message, loader::to_string(res)); } return res; } res = driver.dditable.ze.Driver.pfnGet(&pCount, nullptr); // Verify that this driver successfully init in the call above. if (res != ZE_RESULT_SUCCESS) { if (debugTraceEnabled) { std::string message = "init driver " + driver.name + " zeDriverGet(" + loader::to_string(desc) + ") returning "; debug_trace_message(message, loader::to_string(res)); } return res; } driverHandles.resize(pCount); res = driver.dditable.ze.Driver.pfnGet(&pCount, driverHandles.data()); // Verify that this driver successfully init in the call above. if (res != ZE_RESULT_SUCCESS) { if (debugTraceEnabled) { std::string message = "init driver " + driver.name + " zeDriverGet(" + loader::to_string(desc) + ") returning "; debug_trace_message(message, loader::to_string(res)); } return res; } } else { auto pfnInitDrivers = driver.dditable.ze.Global.pfnInitDrivers; if(nullptr == pfnInitDrivers || globalInitStored->pfnInitDrivers == nullptr) { if (debugTraceEnabled) { std::string errorMessage = "init driver " + driver.name + " failed, pfnInitDrivers function pointer null. Returning "; debug_trace_message(errorMessage, loader::to_string(ZE_RESULT_ERROR_UNINITIALIZED)); } return ZE_RESULT_ERROR_UNINITIALIZED; } pCount = 0; // Use the previously init ddi table pointer to zeInit to allow for intercept of the zeInit calls ze_result_t res = globalInitStored->pfnInitDrivers(&pCount, nullptr, desc); // Verify that this driver successfully init in the call above. if (res != ZE_RESULT_SUCCESS || driver.initDriversStatus != ZE_RESULT_SUCCESS) { if (driver.initDriversStatus != ZE_RESULT_SUCCESS) res = driver.initDriversStatus; if (debugTraceEnabled) { std::string message = "init driver (global ddi) " + driver.name + " zeInitDrivers(" + loader::to_string(desc) + ") returning "; debug_trace_message(message, loader::to_string(res)); } return res; } // Reset pCount to 0 when calling the driver init function from the driver's ddi table. pCount = 0; res = driver.dditable.ze.Global.pfnInitDrivers(&pCount, nullptr, desc); // Verify that this driver successfully init in the call above. if (res != ZE_RESULT_SUCCESS) { if (debugTraceEnabled) { std::string message = "init driver (driver ddi) " + driver.name + " zeInitDrivers(" + loader::to_string(desc) + ") returning "; debug_trace_message(message, loader::to_string(res)); } return res; } driverHandles.resize(pCount); // Use the driver's init function to query the driver handles and read the properties. res = driver.dditable.ze.Global.pfnInitDrivers(&pCount, driverHandles.data(), desc); // Verify that this driver successfully init in the call above. if (res != ZE_RESULT_SUCCESS) { if (debugTraceEnabled) { std::string message = "init driver (driver ddi) " + driver.name + " zeInitDrivers(" + loader::to_string(desc) + ") returning "; debug_trace_message(message, loader::to_string(res)); } return res; } } for (auto handle : driverHandles) { ze_driver_properties_t properties = {}; properties.stype = ZE_STRUCTURE_TYPE_DRIVER_PROPERTIES; properties.pNext = nullptr; ze_result_t res = driver.dditable.ze.Driver.pfnGetProperties(handle, &properties); if (res != ZE_RESULT_SUCCESS) { if (debugTraceEnabled) { std::string message = "init driver " + driver.name + " failed, zeDriverGetProperties returned "; debug_trace_message(message, loader::to_string(res)); } return res; } driver.properties = properties; uint32_t deviceCount = 0; res = driver.dditable.ze.Device.pfnGet( handle, &deviceCount, nullptr ); if( ZE_RESULT_SUCCESS != res ) { if (debugTraceEnabled) { std::string message = "init driver " + driver.name + " failed, zeDeviceGet returned "; debug_trace_message(message, loader::to_string(res)); } return res; } if (deviceCount == 0) { if (debugTraceEnabled) { std::string message = "init driver " + driver.name + " failed, zeDeviceGet returned 0 devices"; debug_trace_message(message, ""); } return ZE_RESULT_ERROR_UNINITIALIZED; } std::vector deviceHandles(deviceCount); res = driver.dditable.ze.Device.pfnGet( handle, &deviceCount, deviceHandles.data() ); if( ZE_RESULT_SUCCESS != res ) { if (debugTraceEnabled) { std::string message = "init driver " + driver.name + " failed, zeDeviceGet returned "; debug_trace_message(message, loader::to_string(res)); } return res; } bool integratedGPU = false; bool discreteGPU = false; bool other = false; for( auto device : deviceHandles ) { ze_device_properties_t deviceProperties = {}; deviceProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES; deviceProperties.pNext = nullptr; res = driver.dditable.ze.Device.pfnGetProperties(device, &deviceProperties); if( ZE_RESULT_SUCCESS != res ) { if (debugTraceEnabled) { std::string message = "init driver " + driver.name + " failed, zeDeviceGetProperties returned "; debug_trace_message(message, loader::to_string(res)); } return res; } if (deviceProperties.type == ZE_DEVICE_TYPE_GPU) { if (deviceProperties.flags & ZE_DEVICE_PROPERTY_FLAG_INTEGRATED) { integratedGPU = true; } else { discreteGPU = true; } } else { other = true; } } if (integratedGPU && discreteGPU && other) { driver.driverType = ZEL_DRIVER_TYPE_MIXED; } else if (integratedGPU && discreteGPU) { driver.driverType = ZEL_DRIVER_TYPE_GPU; } else if (integratedGPU) { driver.driverType = ZEL_DRIVER_TYPE_INTEGRATED_GPU; } else if (discreteGPU) { driver.driverType = ZEL_DRIVER_TYPE_DISCRETE_GPU; } else if (other) { driver.driverType = ZEL_DRIVER_TYPE_OTHER; } } return ZE_RESULT_SUCCESS; } } /////////////////////////////////////////////////////////////////////////////// ze_result_t context_t::init() { if (driverEnvironmentQueried) { return ZE_RESULT_SUCCESS; } debugTraceEnabled = getenv_tobool( "ZE_ENABLE_LOADER_DEBUG_TRACE" ); auto discoveredDrivers = discoverEnabledDrivers(); std::string loadLibraryErrorValue; zel_logger = createLogger(); if ((getenv_string("ZEL_LOADER_LOGGING_LEVEL") == "trace") && !debugTraceEnabled) { debugTraceEnabled = true; zel_logger->log_to_console = false; } if (zel_logger->logging_enabled) zel_logger->get_base_logger()->info("Loader Version {}.{}.{} {}", LOADER_VERSION_MAJOR, LOADER_VERSION_MINOR, LOADER_VERSION_PATCH, LOADER_VERSION_SHA); add_loader_version(); std::string loaderLibraryPath; auto loaderLibraryPathEnv = getenv_string("ZEL_LIBRARY_PATH"); if (!loaderLibraryPathEnv.empty()) { loaderLibraryPath = loaderLibraryPathEnv; } #ifdef _WIN32 else { loaderLibraryPath = readLevelZeroLoaderLibraryPath(); } #endif if (debugTraceEnabled) debug_trace_message("Using Loader Library Path: ", loaderLibraryPath); // To allow for two different sets of drivers to be in use between sysman and core/tools, we use and store the drivers in two vectors. // alldrivers stores all the drivers for cleanup when the library exits. zeDrivers.reserve( discoveredDrivers.size() + getenv_tobool( "ZE_ENABLE_NULL_DRIVER" ) ); zesDrivers.reserve( discoveredDrivers.size() + getenv_tobool( "ZE_ENABLE_NULL_DRIVER" ) ); allDrivers.reserve( discoveredDrivers.size() + getenv_tobool( "ZE_ENABLE_NULL_DRIVER" ) ); if( getenv_tobool( "ZE_ENABLE_NULL_DRIVER" ) ) { zel_logger->log_info("Enabling Null Driver"); auto handle = LOAD_DRIVER_LIBRARY( create_library_path( MAKE_LIBRARY_NAME( "ze_null", L0_LOADER_VERSION ), loaderLibraryPath.c_str()).c_str()); if (debugTraceEnabled) { std::string message = "ze_null Driver Init"; debug_trace_message(message, ""); } if( NULL != handle ) { allDrivers.emplace_back(); allDrivers.rbegin()->handle = handle; allDrivers.rbegin()->name = "ze_null"; } else if (debugTraceEnabled) { GET_LIBRARY_ERROR(loadLibraryErrorValue); std::string errorMessage = "Load Library of " + create_library_path( MAKE_LIBRARY_NAME( "ze_null", L0_LOADER_VERSION ), loaderLibraryPath.c_str()) + " failed with "; debug_trace_message(errorMessage, loadLibraryErrorValue); loadLibraryErrorValue.clear(); } } for( auto name : discoveredDrivers ) { auto handle = LOAD_DRIVER_LIBRARY( name.c_str() ); if( NULL != handle ) { if (debugTraceEnabled) { std::string message = "Loading Driver " + name + " succeeded"; #ifndef _WIN32 // TODO: implement same message for windows, move dlinfo to ze_util.h as a macro struct link_map *dlinfo_map; if (dlinfo(handle, RTLD_DI_LINKMAP, &dlinfo_map) == 0) { message += " from: " + std::string(dlinfo_map->l_name); } #endif debug_trace_message(message, ""); } allDrivers.emplace_back(); allDrivers.rbegin()->handle = handle; allDrivers.rbegin()->name = name; } else if (debugTraceEnabled) { GET_LIBRARY_ERROR(loadLibraryErrorValue); std::string errorMessage = "Load Library of " + name + " failed with "; debug_trace_message(errorMessage, loadLibraryErrorValue); loadLibraryErrorValue.clear(); } } if(allDrivers.size()==0){ if (debugTraceEnabled) { std::string message = "0 Drivers Discovered"; debug_trace_message(message, ""); } zel_logger->log_error("0 Drivers Discovered"); return ZE_RESULT_ERROR_UNINITIALIZED; } std::copy(allDrivers.begin(), allDrivers.end(), std::back_inserter(zeDrivers)); std::copy(allDrivers.begin(), allDrivers.end(), std::back_inserter(zesDrivers)); typedef ze_result_t (ZE_APICALL *getVersion_t)(zel_component_version_t *version); if( getenv_tobool( "ZE_ENABLE_VALIDATION_LAYER" ) ) { zel_logger->log_info("Validation Layer Enabled"); std::string validationLayerLibraryPath = create_library_path(MAKE_LAYER_NAME( "ze_validation_layer" ), loaderLibraryPath.c_str()); validationLayer = LOAD_DRIVER_LIBRARY( validationLayerLibraryPath.c_str() ); if(validationLayer) { auto getVersion = reinterpret_cast( GET_FUNCTION_PTR(validationLayer, "zelLoaderGetVersion")); zel_component_version_t compVersion; if(getVersion && ZE_RESULT_SUCCESS == getVersion(&compVersion)) { compVersions.push_back(compVersion); } } else if (debugTraceEnabled) { GET_LIBRARY_ERROR(loadLibraryErrorValue); std::string errorMessage = "Load Library of " + std::string(MAKE_LAYER_NAME( "ze_validation_layer" )) + " failed with "; debug_trace_message(errorMessage, loadLibraryErrorValue); loadLibraryErrorValue.clear(); } } if (getenv_tobool( "ZE_ENABLE_TRACING_LAYER" )) { zel_logger->log_info("Tracing Layer Enabled"); tracingLayerEnabled = true; } std::string tracingLayerLibraryPath = create_library_path(MAKE_LAYER_NAME( "ze_tracing_layer" ), loaderLibraryPath.c_str()); if (debugTraceEnabled) debug_trace_message("Tracing Layer Library Path: ", tracingLayerLibraryPath); tracingLayer = LOAD_DRIVER_LIBRARY( tracingLayerLibraryPath.c_str() ); if(tracingLayer) { auto getVersion = reinterpret_cast( GET_FUNCTION_PTR(tracingLayer, "zelLoaderGetVersion")); zel_component_version_t compVersion; if(getVersion && ZE_RESULT_SUCCESS == getVersion(&compVersion)) { compVersions.push_back(compVersion); } } else if (debugTraceEnabled) { GET_LIBRARY_ERROR(loadLibraryErrorValue); std::string errorMessage = "Load Library of " + std::string(MAKE_LAYER_NAME( "ze_tracing_layer" )) + " failed with "; debug_trace_message(errorMessage, loadLibraryErrorValue); loadLibraryErrorValue.clear(); } if( getenv_tobool( "ZET_ENABLE_API_TRACING_EXP" ) ) { auto depr_msg = "ZET_ENABLE_API_TRACING_EXP is deprecated. Use ZE_ENABLE_TRACING_LAYER instead"; zel_logger->log_warning(depr_msg); std::cout << depr_msg << std::endl; } forceIntercept = getenv_tobool( "ZE_ENABLE_LOADER_INTERCEPT" ); // Default sysmanInstance Drivers to be the zeDrivers list unless zesInit is called during init. sysmanInstanceDrivers = &zeDrivers; if(forceIntercept || allDrivers.size() > 1){ intercept_enabled = true; zel_logger->log_info("Intercept Enabled"); } driverEnvironmentQueried = true; zel_logger->log_info("zeInit succeeded"); return ZE_RESULT_SUCCESS; }; /////////////////////////////////////////////////////////////////////////////// context_t::~context_t() { std::string freeLibraryErrorValue; if (validationLayer) { auto free_result = FREE_DRIVER_LIBRARY( validationLayer ); auto failure = FREE_DRIVER_LIBRARY_FAILURE_CHECK(free_result); if (debugTraceEnabled && failure) { GET_LIBRARY_ERROR(freeLibraryErrorValue); if (!freeLibraryErrorValue.empty()) { std::string errorMessage = "Free Library Failed for ze_validation_layer with "; debug_trace_message(errorMessage, freeLibraryErrorValue); freeLibraryErrorValue.clear(); } } } if (tracingLayer) { auto free_result = FREE_DRIVER_LIBRARY( tracingLayer ); auto failure = FREE_DRIVER_LIBRARY_FAILURE_CHECK(free_result); if (debugTraceEnabled && failure) { GET_LIBRARY_ERROR(freeLibraryErrorValue); if (!freeLibraryErrorValue.empty()) { std::string errorMessage = "Free Library Failed for ze_tracing_layer with "; debug_trace_message(errorMessage, freeLibraryErrorValue); freeLibraryErrorValue.clear(); } } } for( auto& drv : allDrivers ) { if (drv.handle) { auto free_result = FREE_DRIVER_LIBRARY( drv.handle ); auto failure = FREE_DRIVER_LIBRARY_FAILURE_CHECK(free_result); if (debugTraceEnabled && failure) { GET_LIBRARY_ERROR(freeLibraryErrorValue); if (!freeLibraryErrorValue.empty()) { std::string errorMessage = "Free Library Failed for " + drv.name + " With "; debug_trace_message(errorMessage, freeLibraryErrorValue); freeLibraryErrorValue.clear(); } } } } }; void context_t::add_loader_version(){ zel_component_version_t compVersion = {}; string_copy_s(compVersion.component_name, LOADER_COMP_NAME, ZEL_COMPONENT_STRING_SIZE - 1); compVersion.spec_version = ZE_API_VERSION_CURRENT; compVersion.component_lib_version.major = LOADER_VERSION_MAJOR; compVersion.component_lib_version.minor = LOADER_VERSION_MINOR; compVersion.component_lib_version.patch = LOADER_VERSION_PATCH; compVersions.push_back(compVersion); } } level-zero-1.20.6/source/loader/ze_loader_api.cpp000066400000000000000000000116131475521542100217430ustar00rootroot00000000000000/* * * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_loader_api.cpp * */ #include "ze_loader_internal.h" #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for initializing loader /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED ZE_DLLEXPORT ze_result_t ZE_APICALL zeLoaderInit() { return loader::context->init(); } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for verifying usable L0 Drivers for Loader to report /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED ZE_DLLEXPORT ze_result_t ZE_APICALL zelLoaderDriverCheck(ze_init_flags_t flags, ze_init_driver_type_desc_t* desc, ze_global_dditable_t *globalInitStored, zes_global_dditable_t *sysmanGlobalInitStored, bool *requireDdiReinit, bool sysmanOnly) { return loader::context->check_drivers(flags, desc, globalInitStored, sysmanGlobalInitStored, requireDdiReinit, sysmanOnly); } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for getting tracing lib handle /// /// @returns /// - ::handle to tracing library ZE_DLLEXPORT HMODULE ZE_APICALL zeLoaderGetTracingHandle() { return loader::context->tracingLayer; } /////////////////////////////////////////////////////////////////////////////// /// @brief Internal function for Setting the ddi table for the Tracing Layer. /// ZE_DLLEXPORT ze_result_t ZE_APICALL zelLoaderTracingLayerInit(std::atomic &zeDdiTable) { zeDdiTable.store(&loader::context->tracing_dditable.ze); return ZE_RESULT_SUCCESS; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelLoaderGetVersionsInternal( size_t *num_elems, //Pointer to num versions to get. zel_component_version_t *versions) //Pointer to array of versions. If set to NULL, num_elems is returned { if(nullptr == versions){ *num_elems = loader::context->compVersions.size(); return ZE_RESULT_SUCCESS; } auto size = *num_elems > loader::context->compVersions.size() ? loader::context->compVersions.size() : *num_elems; memcpy(versions, loader::context->compVersions.data(), size * sizeof(zel_component_version_t)); return ZE_RESULT_SUCCESS; } ZE_DLLEXPORT ze_result_t ZE_APICALL zelLoaderTranslateHandleInternal( zel_handle_type_t handleType, void *handleIn, void **handleOut) { if(!loader::context->intercept_enabled) { *handleOut = handleIn; return ZE_RESULT_SUCCESS; } switch(handleType){ case ZEL_HANDLE_DRIVER: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_DEVICE: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_CONTEXT: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_COMMAND_QUEUE: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_COMMAND_LIST: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_FENCE: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_EVENT_POOL: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_EVENT: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_IMAGE: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_MODULE: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_MODULE_BUILD_LOG: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_KERNEL: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_SAMPLER: *handleOut = reinterpret_cast( handleIn )->handle; break; case ZEL_HANDLE_PHYSICAL_MEM: *handleOut = reinterpret_cast( handleIn )->handle; break; default: return ZE_RESULT_ERROR_INVALID_ENUMERATION; } return ZE_RESULT_SUCCESS; } #if defined(__cplusplus) } #endiflevel-zero-1.20.6/source/loader/ze_loader_api.h000066400000000000000000000050261475521542100214110ustar00rootroot00000000000000/* * * Copyright (C) 2020-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_loader_api.cpp * */ #include "ze_loader_internal.h" #include "loader/ze_loader.h" #define TRACING_COMP_NAME "loader" #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for initializing loader /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED ZE_DLLEXPORT ze_result_t ZE_APICALL zeLoaderInit(); /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for verifying usable L0 Drivers for Loader to report /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED ZE_DLLEXPORT ze_result_t ZE_APICALL zelLoaderDriverCheck(ze_init_flags_t flags, ze_init_driver_type_desc_t* desc, ze_global_dditable_t *globalInitStored, zes_global_dditable_t *sysmanGlobalInitStored, bool *requireDdiReinit, bool sysmanOnly); /////////////////////////////////////////////////////////////////////////////// /// @brief Internal function for Setting the ddi table for the Tracing Layer. /// ZE_DLLEXPORT ze_result_t ZE_APICALL zelLoaderTracingLayerInit(std::atomic &zeDdiTable); /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for getting tracing lib handle /// /// @returns /// - ::handle to tracing library ZE_DLLEXPORT HMODULE ZE_APICALL zeLoaderGetTracingHandle(); /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for getting version /// ZE_DLLEXPORT ze_result_t ZE_APICALL zelLoaderGetVersion(zel_component_version_t *version); /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for getting versions of all components /// ZE_DLLEXPORT ze_result_t ZE_APICALL zelLoaderGetVersionsInternal( size_t *num_elems, //Pointer to num versions to get. zel_component_version_t *versions); //Pointer to array of versions. If set to NULL, num_elems is returned ZE_DLLEXPORT ze_result_t ZE_APICALL zelLoaderTranslateHandleInternal( zel_handle_type_t handleType, //Handle type void *handleIn, //Input: handle to translate from loader handle to driver handle void **handleOut); //Output: Pointer to handleOut is set to driver handle if successful #if defined(__cplusplus) } #endiflevel-zero-1.20.6/source/loader/ze_loader_internal.h000066400000000000000000000171021475521542100224520ustar00rootroot00000000000000/* * * Copyright (C) 2019-2022 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include #include #include #include "ze_ddi.h" #include "zet_ddi.h" #include "zes_ddi.h" #include "ze_util.h" #include "ze_object.h" #include "ze_ldrddi.h" #include "zet_ldrddi.h" #include "zes_ldrddi.h" #include "loader/ze_loader.h" #include "logging.h" #include "spdlog/spdlog.h" namespace loader { /////////////////////////////////////////////////////////////////////////////// /// @brief Driver Type Enumerations /// @details The ordering of the drivers reported to the user is based on the order of the enumerations provided. /// When additional driver types are added, they should be added to the end of the list to avoid reporting new device types /// before known device types. typedef enum _zel_driver_type_t { ZEL_DRIVER_TYPE_DISCRETE_GPU= 0, ///< The driver has Discrete GPUs only ZEL_DRIVER_TYPE_GPU = 1, ///< The driver has Heterogenous GPU types ZEL_DRIVER_TYPE_INTEGRATED_GPU = 2, ///< The driver has Integrated GPUs only ZEL_DRIVER_TYPE_MIXED = 3, ///< The driver has Heterogenous driver types not limited to GPU or NPU. ZEL_DRIVER_TYPE_OTHER = 4, ///< The driver has No GPU Devices and has other device types only ZEL_DRIVER_TYPE_FORCE_UINT32 = 0x7fffffff } zel_driver_type_t; ////////////////////////////////////////////////////////////////////////// struct driver_t { HMODULE handle = NULL; ze_result_t initStatus = ZE_RESULT_SUCCESS; ze_result_t initDriversStatus = ZE_RESULT_SUCCESS; dditable_t dditable = {}; std::string name; bool driverInuse = false; zel_driver_type_t driverType; ze_driver_properties_t properties; bool pciOrderingRequested = false; }; using driver_vector_t = std::vector< driver_t >; /////////////////////////////////////////////////////////////////////////////// class context_t { public: /////////////////////////////////////////////////////////////////////////////// ze_driver_factory_t ze_driver_factory; ze_device_factory_t ze_device_factory; ze_context_factory_t ze_context_factory; ze_command_queue_factory_t ze_command_queue_factory; ze_command_list_factory_t ze_command_list_factory; ze_fence_factory_t ze_fence_factory; ze_event_pool_factory_t ze_event_pool_factory; ze_event_factory_t ze_event_factory; ze_image_factory_t ze_image_factory; ze_module_factory_t ze_module_factory; ze_module_build_log_factory_t ze_module_build_log_factory; ze_kernel_factory_t ze_kernel_factory; ze_sampler_factory_t ze_sampler_factory; ze_physical_mem_factory_t ze_physical_mem_factory; ze_fabric_vertex_factory_t ze_fabric_vertex_factory; ze_fabric_edge_factory_t ze_fabric_edge_factory; ze_external_semaphore_ext_factory_t ze_external_semaphore_ext_factory; ze_rtas_builder_exp_factory_t ze_rtas_builder_exp_factory; ze_rtas_parallel_operation_exp_factory_t ze_rtas_parallel_operation_exp_factory; /////////////////////////////////////////////////////////////////////////////// zes_driver_factory_t zes_driver_factory; zes_device_factory_t zes_device_factory; zes_sched_factory_t zes_sched_factory; zes_perf_factory_t zes_perf_factory; zes_pwr_factory_t zes_pwr_factory; zes_freq_factory_t zes_freq_factory; zes_engine_factory_t zes_engine_factory; zes_standby_factory_t zes_standby_factory; zes_firmware_factory_t zes_firmware_factory; zes_mem_factory_t zes_mem_factory; zes_fabric_port_factory_t zes_fabric_port_factory; zes_temp_factory_t zes_temp_factory; zes_psu_factory_t zes_psu_factory; zes_fan_factory_t zes_fan_factory; zes_led_factory_t zes_led_factory; zes_ras_factory_t zes_ras_factory; zes_diag_factory_t zes_diag_factory; zes_overclock_factory_t zes_overclock_factory; zes_vf_factory_t zes_vf_factory; /////////////////////////////////////////////////////////////////////////////// zet_driver_factory_t zet_driver_factory; zet_device_factory_t zet_device_factory; zet_context_factory_t zet_context_factory; zet_command_list_factory_t zet_command_list_factory; zet_module_factory_t zet_module_factory; zet_kernel_factory_t zet_kernel_factory; zet_metric_group_factory_t zet_metric_group_factory; zet_metric_factory_t zet_metric_factory; zet_metric_streamer_factory_t zet_metric_streamer_factory; zet_metric_query_pool_factory_t zet_metric_query_pool_factory; zet_metric_query_factory_t zet_metric_query_factory; zet_tracer_exp_factory_t zet_tracer_exp_factory; zet_debug_session_factory_t zet_debug_session_factory; zet_metric_programmable_exp_factory_t zet_metric_programmable_exp_factory; zet_metric_tracer_exp_factory_t zet_metric_tracer_exp_factory; zet_metric_decoder_exp_factory_t zet_metric_decoder_exp_factory; /////////////////////////////////////////////////////////////////////////////// std::mutex image_handle_map_lock; std::mutex sampler_handle_map_lock; std::unordered_map image_handle_map; std::unordered_map sampler_handle_map; ze_api_version_t version = ZE_API_VERSION_CURRENT; driver_vector_t allDrivers; driver_vector_t zeDrivers; driver_vector_t zesDrivers; driver_vector_t *sysmanInstanceDrivers; HMODULE validationLayer = nullptr; HMODULE tracingLayer = nullptr; bool driverEnvironmentQueried = false; bool forceIntercept = false; bool initDriversSupport = false; std::vector compVersions; const char *LOADER_COMP_NAME = "loader"; ze_result_t check_drivers(ze_init_flags_t flags, ze_init_driver_type_desc_t* desc, ze_global_dditable_t *globalInitStored, zes_global_dditable_t *sysmanGlobalInitStored, bool *requireDdiReinit, bool sysmanOnly); void debug_trace_message(std::string errorMessage, std::string errorValue); ze_result_t init(); ze_result_t init_driver(driver_t &driver, ze_init_flags_t flags, ze_init_driver_type_desc_t* desc, ze_global_dditable_t *globalInitStored, zes_global_dditable_t *sysmanGlobalInitStored, bool sysmanOnly); void add_loader_version(); ~context_t(); bool intercept_enabled = false; bool debugTraceEnabled = false; bool tracingLayerEnabled = false; dditable_t tracing_dditable = {}; std::shared_ptr zel_logger; }; extern context_t *context; } level-zero-1.20.6/source/loader/ze_object.h000066400000000000000000000013171475521542100205570ustar00rootroot00000000000000/* * * Copyright (C) 2019-2021 Intel Corporation * * SPDX-License-Identifier: MIT * * @file ze_object.h * */ #pragma once #include "ze_singleton.h" ////////////////////////////////////////////////////////////////////////// struct dditable_t { ze_dditable_t ze; zet_dditable_t zet; zes_dditable_t zes; }; ////////////////////////////////////////////////////////////////////////// template class object_t { public: using handle_t = _handle_t; handle_t handle; dditable_t* dditable; object_t() = delete; object_t( handle_t _handle, dditable_t* _dditable ) : handle( _handle ), dditable( _dditable ) { } ~object_t() = default; }; level-zero-1.20.6/source/loader/zel_tracing_ldrddi.cpp000066400000000000000000000031751475521542100227750ustar00rootroot00000000000000/* * Copyright (C) 2020 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zel_tracing_ldrddi.cpp * */ #include "ze_loader_internal.h" #include "layers/zel_tracing_ddi.h" namespace loader { #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Tracer table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zelGetTracerApiProcAddrTable( ze_api_version_t version, ///< [in] API version requested zel_tracer_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) return ZE_RESULT_ERROR_UNINITIALIZED; if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; if(( nullptr != loader::context->tracingLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->tracingLayer, "zelGetTracerApiProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } #if defined(__cplusplus) }; #endif } // namespace loader level-zero-1.20.6/source/loader/zes_ldrddi.cpp000066400000000000000000011151231475521542100212730ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_ldrddi.cpp * */ #include "ze_loader_internal.h" namespace loader { /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesInit __zedlllocal ze_result_t ZE_APICALL zesInit( zes_init_flags_t flags ///< [in] initialization flags. ///< currently unused, must be 0 (default). ) { ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; drv.initStatus = drv.dditable.zes.Global.pfnInit( flags ); if(drv.initStatus == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; } if(!atLeastOneDriverValid) result=ZE_RESULT_ERROR_UNINITIALIZED; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverGet __zedlllocal ze_result_t ZE_APICALL zesDriverGet( uint32_t* pCount, ///< [in,out] pointer to the number of sysman driver instances. ///< if count is zero, then the loader shall update the value with the ///< total number of sysman drivers available. ///< if count is greater than the number of sysman drivers available, then ///< the loader shall update the value with the correct number of sysman ///< drivers available. zes_driver_handle_t* phDrivers ///< [in,out][optional][range(0, *pCount)] array of sysman driver instance handles. ///< if count is less than the number of sysman drivers available, then the ///< loader shall only retrieve that number of sysman drivers. ) { ze_result_t result = ZE_RESULT_SUCCESS; uint32_t total_driver_handle_count = 0; for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; if( ( 0 < *pCount ) && ( *pCount == total_driver_handle_count)) break; uint32_t library_driver_handle_count = 0; result = drv.dditable.zes.Driver.pfnGet( &library_driver_handle_count, nullptr ); if( ZE_RESULT_SUCCESS != result ) { // If Get Drivers fails with Uninitialized, then update the driver init status to prevent reporting this driver in the next get call. if (ZE_RESULT_ERROR_UNINITIALIZED == result) { drv.initStatus = result; } continue; } if( nullptr != phDrivers && *pCount !=0) { if( total_driver_handle_count + library_driver_handle_count > *pCount) { library_driver_handle_count = *pCount - total_driver_handle_count; } result = drv.dditable.zes.Driver.pfnGet( &library_driver_handle_count, &phDrivers[ total_driver_handle_count ] ); if( ZE_RESULT_SUCCESS != result ) break; drv.driverInuse = true; try { for( uint32_t i = 0; i < library_driver_handle_count; ++i ) { uint32_t driver_index = total_driver_handle_count + i; phDrivers[ driver_index ] = reinterpret_cast( context->zes_driver_factory.getInstance( phDrivers[ driver_index ], &drv.dditable ) ); } } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } } total_driver_handle_count += library_driver_handle_count; } // If the last driver get failed, but at least one driver succeeded, then return success with total count. if( ZE_RESULT_SUCCESS == result || total_driver_handle_count > 0) *pCount = total_driver_handle_count; if (total_driver_handle_count > 0) { result = ZE_RESULT_SUCCESS; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverGetExtensionProperties __zedlllocal ze_result_t ZE_APICALL zesDriverGetExtensionProperties( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t* pCount, ///< [in,out] pointer to the number of extension properties. ///< if count is zero, then the driver shall update the value with the ///< total number of extension properties available. ///< if count is greater than the number of extension properties available, ///< then the driver shall update the value with the correct number of ///< extension properties available. zes_driver_extension_properties_t* pExtensionProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< extension properties. ///< if count is less than the number of extension properties available, ///< then driver shall only retrieve that number of extension properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnGetExtensionProperties = dditable->zes.Driver.pfnGetExtensionProperties; if( nullptr == pfnGetExtensionProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnGetExtensionProperties( hDriver, pCount, pExtensionProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverGetExtensionFunctionAddress __zedlllocal ze_result_t ZE_APICALL zesDriverGetExtensionFunctionAddress( zes_driver_handle_t hDriver, ///< [in] handle of the driver instance const char* name, ///< [in] extension function name void** ppFunctionAddress ///< [out] pointer to function pointer ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnGetExtensionFunctionAddress = dditable->zes.Driver.pfnGetExtensionFunctionAddress; if( nullptr == pfnGetExtensionFunctionAddress ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnGetExtensionFunctionAddress( hDriver, name, ppFunctionAddress ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGet __zedlllocal ze_result_t ZE_APICALL zesDeviceGet( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance uint32_t* pCount, ///< [in,out] pointer to the number of sysman devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sysman devices available. ///< if count is greater than the number of sysman devices available, then ///< the driver shall update the value with the correct number of sysman ///< devices available. zes_device_handle_t* phDevices ///< [in,out][optional][range(0, *pCount)] array of handle of sysman devices. ///< if count is less than the number of sysman devices available, then ///< driver shall only retrieve that number of sysman devices. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnGet = dditable->zes.Device.pfnGet; if( nullptr == pfnGet ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnGet( hDriver, pCount, phDevices ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phDevices ) && ( i < *pCount ); ++i ) phDevices[ i ] = reinterpret_cast( context->zes_device_factory.getInstance( phDevices[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetProperties __zedlllocal ze_result_t ZE_APICALL zesDeviceGetProperties( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_properties_t* pProperties ///< [in,out] Structure that will contain information about the device. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetProperties = dditable->zes.Device.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetProperties( hDevice, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetState __zedlllocal ze_result_t ZE_APICALL zesDeviceGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_device_state_t* pState ///< [in,out] Structure that will contain information about the device. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetState = dditable->zes.Device.pfnGetState; if( nullptr == pfnGetState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetState( hDevice, pState ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceReset __zedlllocal ze_result_t ZE_APICALL zesDeviceReset( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device ze_bool_t force ///< [in] If set to true, all applications that are currently using the ///< device will be forcibly killed. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnReset = dditable->zes.Device.pfnReset; if( nullptr == pfnReset ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnReset( hDevice, force ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceResetExt __zedlllocal ze_result_t ZE_APICALL zesDeviceResetExt( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device zes_reset_properties_t* pProperties ///< [in] Device reset properties to apply ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnResetExt = dditable->zes.Device.pfnResetExt; if( nullptr == pfnResetExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnResetExt( hDevice, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceProcessesGetState __zedlllocal ze_result_t ZE_APICALL zesDeviceProcessesGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle for the device uint32_t* pCount, ///< [in,out] pointer to the number of processes. ///< if count is zero, then the driver shall update the value with the ///< total number of processes currently attached to the device. ///< if count is greater than the number of processes currently attached to ///< the device, then the driver shall update the value with the correct ///< number of processes. zes_process_state_t* pProcesses ///< [in,out][optional][range(0, *pCount)] array of process information. ///< if count is less than the number of processes currently attached to ///< the device, then the driver shall only retrieve information about that ///< number of processes. In this case, the return code will ::ZE_RESULT_ERROR_INVALID_SIZE. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnProcessesGetState = dditable->zes.Device.pfnProcessesGetState; if( nullptr == pfnProcessesGetState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnProcessesGetState( hDevice, pCount, pProcesses ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDevicePciGetProperties __zedlllocal ze_result_t ZE_APICALL zesDevicePciGetProperties( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_properties_t* pProperties ///< [in,out] Will contain the PCI properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnPciGetProperties = dditable->zes.Device.pfnPciGetProperties; if( nullptr == pfnPciGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnPciGetProperties( hDevice, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDevicePciGetState __zedlllocal ze_result_t ZE_APICALL zesDevicePciGetState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_state_t* pState ///< [in,out] Will contain the PCI properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnPciGetState = dditable->zes.Device.pfnPciGetState; if( nullptr == pfnPciGetState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnPciGetState( hDevice, pState ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDevicePciGetBars __zedlllocal ze_result_t ZE_APICALL zesDevicePciGetBars( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of PCI bars. ///< if count is zero, then the driver shall update the value with the ///< total number of PCI bars that are setup. ///< if count is greater than the number of PCI bars that are setup, then ///< the driver shall update the value with the correct number of PCI bars. zes_pci_bar_properties_t* pProperties ///< [in,out][optional][range(0, *pCount)] array of information about setup ///< PCI bars. ///< if count is less than the number of PCI bars that are setup, then the ///< driver shall only retrieve information about that number of PCI bars. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnPciGetBars = dditable->zes.Device.pfnPciGetBars; if( nullptr == pfnPciGetBars ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnPciGetBars( hDevice, pCount, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDevicePciGetStats __zedlllocal ze_result_t ZE_APICALL zesDevicePciGetStats( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pci_stats_t* pStats ///< [in,out] Will contain a snapshot of the latest stats. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnPciGetStats = dditable->zes.Device.pfnPciGetStats; if( nullptr == pfnPciGetStats ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnPciGetStats( hDevice, pStats ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceSetOverclockWaiver __zedlllocal ze_result_t ZE_APICALL zesDeviceSetOverclockWaiver( zes_device_handle_t hDevice ///< [in] Sysman handle of the device. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnSetOverclockWaiver = dditable->zes.Device.pfnSetOverclockWaiver; if( nullptr == pfnSetOverclockWaiver ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnSetOverclockWaiver( hDevice ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetOverclockDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceGetOverclockDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pOverclockDomains ///< [in,out] Returns the overclock domains that are supported (a bit for ///< each of enum ::zes_overclock_domain_t). If no bits are set, the device ///< doesn't support overclocking. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetOverclockDomains = dditable->zes.Device.pfnGetOverclockDomains; if( nullptr == pfnGetOverclockDomains ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetOverclockDomains( hDevice, pOverclockDomains ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetOverclockControls __zedlllocal ze_result_t ZE_APICALL zesDeviceGetOverclockControls( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_domain_t domainType, ///< [in] Domain type. uint32_t* pAvailableControls ///< [in,out] Returns the overclock controls that are supported for the ///< specified overclock domain (a bit for each of enum ///< ::zes_overclock_control_t). ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetOverclockControls = dditable->zes.Device.pfnGetOverclockControls; if( nullptr == pfnGetOverclockControls ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetOverclockControls( hDevice, domainType, pAvailableControls ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceResetOverclockSettings __zedlllocal ze_result_t ZE_APICALL zesDeviceResetOverclockSettings( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. ze_bool_t onShippedState ///< [in] True will reset to shipped state; false will reset to ///< manufacturing state ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnResetOverclockSettings = dditable->zes.Device.pfnResetOverclockSettings; if( nullptr == pfnResetOverclockSettings ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnResetOverclockSettings( hDevice, onShippedState ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceReadOverclockState __zedlllocal ze_result_t ZE_APICALL zesDeviceReadOverclockState( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_overclock_mode_t* pOverclockMode, ///< [out] One of overclock mode. ze_bool_t* pWaiverSetting, ///< [out] Waiver setting: 0 = Waiver not set, 1 = waiver has been set. ze_bool_t* pOverclockState, ///< [out] Current settings 0 =manufacturing state, 1= shipped state).. zes_pending_action_t* pPendingAction, ///< [out] This enum is returned when the driver attempts to set an ///< overclock control or reset overclock settings. ze_bool_t* pPendingReset ///< [out] Pending reset 0 =manufacturing state, 1= shipped state).. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnReadOverclockState = dditable->zes.Device.pfnReadOverclockState; if( nullptr == pfnReadOverclockState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnReadOverclockState( hDevice, pOverclockMode, pWaiverSetting, pOverclockState, pPendingAction, pPendingReset ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumOverclockDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumOverclockDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_overclock_handle_t* phDomainHandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumOverclockDomains = dditable->zes.Device.pfnEnumOverclockDomains; if( nullptr == pfnEnumOverclockDomains ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumOverclockDomains( hDevice, pCount, phDomainHandle ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phDomainHandle ) && ( i < *pCount ); ++i ) phDomainHandle[ i ] = reinterpret_cast( context->zes_overclock_factory.getInstance( phDomainHandle[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetDomainProperties __zedlllocal ze_result_t ZE_APICALL zesOverclockGetDomainProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_properties_t* pDomainProperties ///< [in,out] The overclock properties for the specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDomainHandle )->dditable; auto pfnGetDomainProperties = dditable->zes.Overclock.pfnGetDomainProperties; if( nullptr == pfnGetDomainProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDomainHandle = reinterpret_cast( hDomainHandle )->handle; // forward to device-driver result = pfnGetDomainProperties( hDomainHandle, pDomainProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetDomainVFProperties __zedlllocal ze_result_t ZE_APICALL zesOverclockGetDomainVFProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_property_t* pVFProperties ///< [in,out] The VF min,max,step for a specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDomainHandle )->dditable; auto pfnGetDomainVFProperties = dditable->zes.Overclock.pfnGetDomainVFProperties; if( nullptr == pfnGetDomainVFProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDomainHandle = reinterpret_cast( hDomainHandle )->handle; // forward to device-driver result = pfnGetDomainVFProperties( hDomainHandle, pVFProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetDomainControlProperties __zedlllocal ze_result_t ZE_APICALL zesOverclockGetDomainControlProperties( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Handle for the component. zes_control_property_t* pControlProperties ///< [in,out] overclock control values. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDomainHandle )->dditable; auto pfnGetDomainControlProperties = dditable->zes.Overclock.pfnGetDomainControlProperties; if( nullptr == pfnGetDomainControlProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDomainHandle = reinterpret_cast( hDomainHandle )->handle; // forward to device-driver result = pfnGetDomainControlProperties( hDomainHandle, DomainControl, pControlProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetControlCurrentValue __zedlllocal ze_result_t ZE_APICALL zesOverclockGetControlCurrentValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [in,out] Getting overclock control value for the specified control. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDomainHandle )->dditable; auto pfnGetControlCurrentValue = dditable->zes.Overclock.pfnGetControlCurrentValue; if( nullptr == pfnGetControlCurrentValue ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDomainHandle = reinterpret_cast( hDomainHandle )->handle; // forward to device-driver result = pfnGetControlCurrentValue( hDomainHandle, DomainControl, pValue ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetControlPendingValue __zedlllocal ze_result_t ZE_APICALL zesOverclockGetControlPendingValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Overclock Control. double* pValue ///< [out] Returns the pending value for a given control. The units and ///< format of the value depend on the control type. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDomainHandle )->dditable; auto pfnGetControlPendingValue = dditable->zes.Overclock.pfnGetControlPendingValue; if( nullptr == pfnGetControlPendingValue ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDomainHandle = reinterpret_cast( hDomainHandle )->handle; // forward to device-driver result = pfnGetControlPendingValue( hDomainHandle, DomainControl, pValue ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockSetControlUserValue __zedlllocal ze_result_t ZE_APICALL zesOverclockSetControlUserValue( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. double pValue, ///< [in] The new value of the control. The units and format of the value ///< depend on the control type. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDomainHandle )->dditable; auto pfnSetControlUserValue = dditable->zes.Overclock.pfnSetControlUserValue; if( nullptr == pfnSetControlUserValue ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDomainHandle = reinterpret_cast( hDomainHandle )->handle; // forward to device-driver result = pfnSetControlUserValue( hDomainHandle, DomainControl, pValue, pPendingAction ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetControlState __zedlllocal ze_result_t ZE_APICALL zesOverclockGetControlState( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_overclock_control_t DomainControl, ///< [in] Domain Control. zes_control_state_t* pControlState, ///< [out] Current overclock control state. zes_pending_action_t* pPendingAction ///< [out] Pending overclock setting. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDomainHandle )->dditable; auto pfnGetControlState = dditable->zes.Overclock.pfnGetControlState; if( nullptr == pfnGetControlState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDomainHandle = reinterpret_cast( hDomainHandle )->handle; // forward to device-driver result = pfnGetControlState( hDomainHandle, DomainControl, pControlState, pPendingAction ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockGetVFPointValues __zedlllocal ze_result_t ZE_APICALL zesOverclockGetVFPointValues( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. zes_vf_array_type_t VFArrayType, ///< [in] User,Default or Live VF array to read from uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t* PointValue ///< [out] Returns the frequency in 1kHz units or voltage in millivolt ///< units from the custom V-F curve at the specified zero-based index ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDomainHandle )->dditable; auto pfnGetVFPointValues = dditable->zes.Overclock.pfnGetVFPointValues; if( nullptr == pfnGetVFPointValues ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDomainHandle = reinterpret_cast( hDomainHandle )->handle; // forward to device-driver result = pfnGetVFPointValues( hDomainHandle, VFType, VFArrayType, PointIndex, PointValue ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesOverclockSetVFPointValues __zedlllocal ze_result_t ZE_APICALL zesOverclockSetVFPointValues( zes_overclock_handle_t hDomainHandle, ///< [in] Handle for the component domain. zes_vf_type_t VFType, ///< [in] Voltage or Freqency point to read. uint32_t PointIndex, ///< [in] Point index - number between (0, max_num_points - 1). uint32_t PointValue ///< [in] Writes frequency in 1kHz units or voltage in millivolt units to ///< custom V-F curve at the specified zero-based index ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDomainHandle )->dditable; auto pfnSetVFPointValues = dditable->zes.Overclock.pfnSetVFPointValues; if( nullptr == pfnSetVFPointValues ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDomainHandle = reinterpret_cast( hDomainHandle )->handle; // forward to device-driver result = pfnSetVFPointValues( hDomainHandle, VFType, PointIndex, PointValue ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumDiagnosticTestSuites __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumDiagnosticTestSuites( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_diag_handle_t* phDiagnostics ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumDiagnosticTestSuites = dditable->zes.Device.pfnEnumDiagnosticTestSuites; if( nullptr == pfnEnumDiagnosticTestSuites ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumDiagnosticTestSuites( hDevice, pCount, phDiagnostics ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phDiagnostics ) && ( i < *pCount ); ++i ) phDiagnostics[ i ] = reinterpret_cast( context->zes_diag_factory.getInstance( phDiagnostics[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDiagnosticsGetProperties __zedlllocal ze_result_t ZE_APICALL zesDiagnosticsGetProperties( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. zes_diag_properties_t* pProperties ///< [in,out] Structure describing the properties of a diagnostics test ///< suite ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDiagnostics )->dditable; auto pfnGetProperties = dditable->zes.Diagnostics.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDiagnostics = reinterpret_cast( hDiagnostics )->handle; // forward to device-driver result = pfnGetProperties( hDiagnostics, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDiagnosticsGetTests __zedlllocal ze_result_t ZE_APICALL zesDiagnosticsGetTests( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of tests. ///< if count is zero, then the driver shall update the value with the ///< total number of tests that are available. ///< if count is greater than the number of tests that are available, then ///< the driver shall update the value with the correct number of tests. zes_diag_test_t* pTests ///< [in,out][optional][range(0, *pCount)] array of information about ///< individual tests sorted by increasing value of the `index` member of ::zes_diag_test_t. ///< if count is less than the number of tests that are available, then the ///< driver shall only retrieve that number of tests. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDiagnostics )->dditable; auto pfnGetTests = dditable->zes.Diagnostics.pfnGetTests; if( nullptr == pfnGetTests ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDiagnostics = reinterpret_cast( hDiagnostics )->handle; // forward to device-driver result = pfnGetTests( hDiagnostics, pCount, pTests ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDiagnosticsRunTests __zedlllocal ze_result_t ZE_APICALL zesDiagnosticsRunTests( zes_diag_handle_t hDiagnostics, ///< [in] Handle for the component. uint32_t startIndex, ///< [in] The index of the first test to run. Set to ///< ::ZES_DIAG_FIRST_TEST_INDEX to start from the beginning. uint32_t endIndex, ///< [in] The index of the last test to run. Set to ///< ::ZES_DIAG_LAST_TEST_INDEX to complete all tests after the start test. zes_diag_result_t* pResult ///< [in,out] The result of the diagnostics ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDiagnostics )->dditable; auto pfnRunTests = dditable->zes.Diagnostics.pfnRunTests; if( nullptr == pfnRunTests ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDiagnostics = reinterpret_cast( hDiagnostics )->handle; // forward to device-driver result = pfnRunTests( hDiagnostics, startIndex, endIndex, pResult ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEccAvailable __zedlllocal ze_result_t ZE_APICALL zesDeviceEccAvailable( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pAvailable ///< [out] ECC functionality is available (true)/unavailable (false). ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEccAvailable = dditable->zes.Device.pfnEccAvailable; if( nullptr == pfnEccAvailable ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEccAvailable( hDevice, pAvailable ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEccConfigurable __zedlllocal ze_result_t ZE_APICALL zesDeviceEccConfigurable( zes_device_handle_t hDevice, ///< [in] Handle for the component. ze_bool_t* pConfigurable ///< [out] ECC can be enabled/disabled (true)/enabled/disabled (false). ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEccConfigurable = dditable->zes.Device.pfnEccConfigurable; if( nullptr == pfnEccConfigurable ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEccConfigurable( hDevice, pConfigurable ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetEccState __zedlllocal ze_result_t ZE_APICALL zesDeviceGetEccState( zes_device_handle_t hDevice, ///< [in] Handle for the component. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetEccState = dditable->zes.Device.pfnGetEccState; if( nullptr == pfnGetEccState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetEccState( hDevice, pState ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceSetEccState __zedlllocal ze_result_t ZE_APICALL zesDeviceSetEccState( zes_device_handle_t hDevice, ///< [in] Handle for the component. const zes_device_ecc_desc_t* newState, ///< [in] Pointer to desired ECC state. zes_device_ecc_properties_t* pState ///< [out] ECC state, pending state, and pending action for state change. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnSetEccState = dditable->zes.Device.pfnSetEccState; if( nullptr == pfnSetEccState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnSetEccState( hDevice, newState, pState ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumEngineGroups __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumEngineGroups( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_engine_handle_t* phEngine ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumEngineGroups = dditable->zes.Device.pfnEnumEngineGroups; if( nullptr == pfnEnumEngineGroups ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumEngineGroups( hDevice, pCount, phEngine ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phEngine ) && ( i < *pCount ); ++i ) phEngine[ i ] = reinterpret_cast( context->zes_engine_factory.getInstance( phEngine[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetProperties __zedlllocal ze_result_t ZE_APICALL zesEngineGetProperties( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_properties_t* pProperties ///< [in,out] The properties for the specified engine group. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEngine )->dditable; auto pfnGetProperties = dditable->zes.Engine.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEngine = reinterpret_cast( hEngine )->handle; // forward to device-driver result = pfnGetProperties( hEngine, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetActivity __zedlllocal ze_result_t ZE_APICALL zesEngineGetActivity( zes_engine_handle_t hEngine, ///< [in] Handle for the component. zes_engine_stats_t* pStats ///< [in,out] Will contain a snapshot of the engine group activity ///< counters. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEngine )->dditable; auto pfnGetActivity = dditable->zes.Engine.pfnGetActivity; if( nullptr == pfnGetActivity ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEngine = reinterpret_cast( hEngine )->handle; // forward to device-driver result = pfnGetActivity( hEngine, pStats ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEventRegister __zedlllocal ze_result_t ZE_APICALL zesDeviceEventRegister( zes_device_handle_t hDevice, ///< [in] The device handle. zes_event_type_flags_t events ///< [in] List of events to listen to. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEventRegister = dditable->zes.Device.pfnEventRegister; if( nullptr == pfnEventRegister ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEventRegister( hDevice, events ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverEventListen __zedlllocal ze_result_t ZE_APICALL zesDriverEventListen( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint32_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT32_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnEventListen = dditable->zes.Driver.pfnEventListen; if( nullptr == pfnEventListen ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // convert loader handles to driver handles auto phDevicesLocal = new zes_device_handle_t [count]; for( size_t i = 0; ( nullptr != phDevices ) && ( i < count ); ++i ) phDevicesLocal[ i ] = reinterpret_cast( phDevices[ i ] )->handle; // forward to device-driver result = pfnEventListen( hDriver, timeout, count, phDevicesLocal, pNumDeviceEvents, pEvents ); delete []phDevicesLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverEventListenEx __zedlllocal ze_result_t ZE_APICALL zesDriverEventListenEx( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then will check status and return immediately; ///< if `UINT64_MAX`, then function will not return until events arrive. uint32_t count, ///< [in] Number of device handles in phDevices. zes_device_handle_t* phDevices, ///< [in][range(0, count)] Device handles to listen to for events. Only ///< devices from the provided driver handle can be specified in this list. uint32_t* pNumDeviceEvents, ///< [in,out] Will contain the actual number of devices in phDevices that ///< generated events. If non-zero, check pEvents to determine the devices ///< and events that were received. zes_event_type_flags_t* pEvents ///< [in,out] An array that will continue the list of events for each ///< device listened in phDevices. ///< This array must be at least as big as count. ///< For every device handle in phDevices, this will provide the events ///< that occurred for that device at the same position in this array. If ///< no event was received for a given device, the corresponding array ///< entry will be zero. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnEventListenEx = dditable->zes.Driver.pfnEventListenEx; if( nullptr == pfnEventListenEx ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // convert loader handles to driver handles auto phDevicesLocal = new zes_device_handle_t [count]; for( size_t i = 0; ( nullptr != phDevices ) && ( i < count ); ++i ) phDevicesLocal[ i ] = reinterpret_cast( phDevices[ i ] )->handle; // forward to device-driver result = pfnEventListenEx( hDriver, timeout, count, phDevicesLocal, pNumDeviceEvents, pEvents ); delete []phDevicesLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumFabricPorts __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumFabricPorts( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fabric_port_handle_t* phPort ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumFabricPorts = dditable->zes.Device.pfnEnumFabricPorts; if( nullptr == pfnEnumFabricPorts ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumFabricPorts( hDevice, pCount, phPort ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phPort ) && ( i < *pCount ); ++i ) phPort[ i ] = reinterpret_cast( context->zes_fabric_port_factory.getInstance( phPort[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetProperties __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetProperties( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_properties_t* pProperties ///< [in,out] Will contain properties of the Fabric Port. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPort )->dditable; auto pfnGetProperties = dditable->zes.FabricPort.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPort = reinterpret_cast( hPort )->handle; // forward to device-driver result = pfnGetProperties( hPort, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetLinkType __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetLinkType( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_link_type_t* pLinkType ///< [in,out] Will contain details about the link attached to the Fabric ///< port. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPort )->dditable; auto pfnGetLinkType = dditable->zes.FabricPort.pfnGetLinkType; if( nullptr == pfnGetLinkType ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPort = reinterpret_cast( hPort )->handle; // forward to device-driver result = pfnGetLinkType( hPort, pLinkType ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetConfig __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetConfig( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_config_t* pConfig ///< [in,out] Will contain configuration of the Fabric Port. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPort )->dditable; auto pfnGetConfig = dditable->zes.FabricPort.pfnGetConfig; if( nullptr == pfnGetConfig ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPort = reinterpret_cast( hPort )->handle; // forward to device-driver result = pfnGetConfig( hPort, pConfig ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortSetConfig __zedlllocal ze_result_t ZE_APICALL zesFabricPortSetConfig( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. const zes_fabric_port_config_t* pConfig ///< [in] Contains new configuration of the Fabric Port. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPort )->dditable; auto pfnSetConfig = dditable->zes.FabricPort.pfnSetConfig; if( nullptr == pfnSetConfig ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPort = reinterpret_cast( hPort )->handle; // forward to device-driver result = pfnSetConfig( hPort, pConfig ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetState __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetState( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_state_t* pState ///< [in,out] Will contain the current state of the Fabric Port ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPort )->dditable; auto pfnGetState = dditable->zes.FabricPort.pfnGetState; if( nullptr == pfnGetState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPort = reinterpret_cast( hPort )->handle; // forward to device-driver result = pfnGetState( hPort, pState ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetThroughput __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetThroughput( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_throughput_t* pThroughput ///< [in,out] Will contain the Fabric port throughput counters. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPort )->dditable; auto pfnGetThroughput = dditable->zes.FabricPort.pfnGetThroughput; if( nullptr == pfnGetThroughput ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPort = reinterpret_cast( hPort )->handle; // forward to device-driver result = pfnGetThroughput( hPort, pThroughput ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetFabricErrorCounters __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetFabricErrorCounters( zes_fabric_port_handle_t hPort, ///< [in] Handle for the component. zes_fabric_port_error_counters_t* pErrors ///< [in,out] Will contain the Fabric port Error counters. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPort )->dditable; auto pfnGetFabricErrorCounters = dditable->zes.FabricPort.pfnGetFabricErrorCounters; if( nullptr == pfnGetFabricErrorCounters ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPort = reinterpret_cast( hPort )->handle; // forward to device-driver result = pfnGetFabricErrorCounters( hPort, pErrors ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFabricPortGetMultiPortThroughput __zedlllocal ze_result_t ZE_APICALL zesFabricPortGetMultiPortThroughput( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t numPorts, ///< [in] Number of ports enumerated in function ::zesDeviceEnumFabricPorts zes_fabric_port_handle_t* phPort, ///< [in][range(0, numPorts)] array of fabric port handles provided by user ///< to gather throughput values. zes_fabric_port_throughput_t** pThroughput ///< [out][range(0, numPorts)] array of fabric port throughput counters ///< from multiple ports of type ::zes_fabric_port_throughput_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetMultiPortThroughput = dditable->zes.FabricPort.pfnGetMultiPortThroughput; if( nullptr == pfnGetMultiPortThroughput ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // convert loader handles to driver handles auto phPortLocal = new zes_fabric_port_handle_t [numPorts]; for( size_t i = 0; ( nullptr != phPort ) && ( i < numPorts ); ++i ) phPortLocal[ i ] = reinterpret_cast( phPort[ i ] )->handle; // forward to device-driver result = pfnGetMultiPortThroughput( hDevice, numPorts, phPortLocal, pThroughput ); delete []phPortLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumFans __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumFans( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_fan_handle_t* phFan ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumFans = dditable->zes.Device.pfnEnumFans; if( nullptr == pfnEnumFans ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumFans( hDevice, pCount, phFan ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phFan ) && ( i < *pCount ); ++i ) phFan[ i ] = reinterpret_cast( context->zes_fan_factory.getInstance( phFan[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanGetProperties __zedlllocal ze_result_t ZE_APICALL zesFanGetProperties( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_properties_t* pProperties ///< [in,out] Will contain the properties of the fan. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFan )->dditable; auto pfnGetProperties = dditable->zes.Fan.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFan = reinterpret_cast( hFan )->handle; // forward to device-driver result = pfnGetProperties( hFan, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanGetConfig __zedlllocal ze_result_t ZE_APICALL zesFanGetConfig( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_config_t* pConfig ///< [in,out] Will contain the current configuration of the fan. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFan )->dditable; auto pfnGetConfig = dditable->zes.Fan.pfnGetConfig; if( nullptr == pfnGetConfig ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFan = reinterpret_cast( hFan )->handle; // forward to device-driver result = pfnGetConfig( hFan, pConfig ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanSetDefaultMode __zedlllocal ze_result_t ZE_APICALL zesFanSetDefaultMode( zes_fan_handle_t hFan ///< [in] Handle for the component. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFan )->dditable; auto pfnSetDefaultMode = dditable->zes.Fan.pfnSetDefaultMode; if( nullptr == pfnSetDefaultMode ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFan = reinterpret_cast( hFan )->handle; // forward to device-driver result = pfnSetDefaultMode( hFan ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanSetFixedSpeedMode __zedlllocal ze_result_t ZE_APICALL zesFanSetFixedSpeedMode( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_t* speed ///< [in] The fixed fan speed setting ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFan )->dditable; auto pfnSetFixedSpeedMode = dditable->zes.Fan.pfnSetFixedSpeedMode; if( nullptr == pfnSetFixedSpeedMode ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFan = reinterpret_cast( hFan )->handle; // forward to device-driver result = pfnSetFixedSpeedMode( hFan, speed ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanSetSpeedTableMode __zedlllocal ze_result_t ZE_APICALL zesFanSetSpeedTableMode( zes_fan_handle_t hFan, ///< [in] Handle for the component. const zes_fan_speed_table_t* speedTable ///< [in] A table containing temperature/speed pairs. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFan )->dditable; auto pfnSetSpeedTableMode = dditable->zes.Fan.pfnSetSpeedTableMode; if( nullptr == pfnSetSpeedTableMode ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFan = reinterpret_cast( hFan )->handle; // forward to device-driver result = pfnSetSpeedTableMode( hFan, speedTable ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFanGetState __zedlllocal ze_result_t ZE_APICALL zesFanGetState( zes_fan_handle_t hFan, ///< [in] Handle for the component. zes_fan_speed_units_t units, ///< [in] The units in which the fan speed should be returned. int32_t* pSpeed ///< [in,out] Will contain the current speed of the fan in the units ///< requested. A value of -1 indicates that the fan speed cannot be ///< measured. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFan )->dditable; auto pfnGetState = dditable->zes.Fan.pfnGetState; if( nullptr == pfnGetState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFan = reinterpret_cast( hFan )->handle; // forward to device-driver result = pfnGetState( hFan, units, pSpeed ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumFirmwares __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumFirmwares( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_firmware_handle_t* phFirmware ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumFirmwares = dditable->zes.Device.pfnEnumFirmwares; if( nullptr == pfnEnumFirmwares ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumFirmwares( hDevice, pCount, phFirmware ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phFirmware ) && ( i < *pCount ); ++i ) phFirmware[ i ] = reinterpret_cast( context->zes_firmware_factory.getInstance( phFirmware[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetProperties __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetProperties( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. zes_firmware_properties_t* pProperties ///< [in,out] Pointer to an array that will hold the properties of the ///< firmware ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFirmware )->dditable; auto pfnGetProperties = dditable->zes.Firmware.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFirmware = reinterpret_cast( hFirmware )->handle; // forward to device-driver result = pfnGetProperties( hFirmware, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareFlash __zedlllocal ze_result_t ZE_APICALL zesFirmwareFlash( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. void* pImage, ///< [in] Image of the new firmware to flash. uint32_t size ///< [in] Size of the flash image. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFirmware )->dditable; auto pfnFlash = dditable->zes.Firmware.pfnFlash; if( nullptr == pfnFlash ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFirmware = reinterpret_cast( hFirmware )->handle; // forward to device-driver result = pfnFlash( hFirmware, pImage, size ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetFlashProgress __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetFlashProgress( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. uint32_t* pCompletionPercent ///< [in,out] Pointer to the Completion Percentage of Firmware Update ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFirmware )->dditable; auto pfnGetFlashProgress = dditable->zes.Firmware.pfnGetFlashProgress; if( nullptr == pfnGetFlashProgress ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFirmware = reinterpret_cast( hFirmware )->handle; // forward to device-driver result = pfnGetFlashProgress( hFirmware, pCompletionPercent ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetConsoleLogs __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetConsoleLogs( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. size_t* pSize, ///< [in,out] size of firmware log char* pFirmwareLog ///< [in,out][optional] pointer to null-terminated string of the log. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFirmware )->dditable; auto pfnGetConsoleLogs = dditable->zes.Firmware.pfnGetConsoleLogs; if( nullptr == pfnGetConsoleLogs ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFirmware = reinterpret_cast( hFirmware )->handle; // forward to device-driver result = pfnGetConsoleLogs( hFirmware, pSize, pFirmwareLog ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumFrequencyDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumFrequencyDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_freq_handle_t* phFrequency ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumFrequencyDomains = dditable->zes.Device.pfnEnumFrequencyDomains; if( nullptr == pfnEnumFrequencyDomains ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumFrequencyDomains( hDevice, pCount, phFrequency ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phFrequency ) && ( i < *pCount ); ++i ) phFrequency[ i ] = reinterpret_cast( context->zes_freq_factory.getInstance( phFrequency[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetProperties __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetProperties( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_properties_t* pProperties ///< [in,out] The frequency properties for the specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnGetProperties = dditable->zes.Frequency.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnGetProperties( hFrequency, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetAvailableClocks __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetAvailableClocks( zes_freq_handle_t hFrequency, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of frequencies. ///< if count is zero, then the driver shall update the value with the ///< total number of frequencies that are available. ///< if count is greater than the number of frequencies that are available, ///< then the driver shall update the value with the correct number of frequencies. double* phFrequency ///< [in,out][optional][range(0, *pCount)] array of frequencies in units of ///< MHz and sorted from slowest to fastest. ///< if count is less than the number of frequencies that are available, ///< then the driver shall only retrieve that number of frequencies. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnGetAvailableClocks = dditable->zes.Frequency.pfnGetAvailableClocks; if( nullptr == pfnGetAvailableClocks ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnGetAvailableClocks( hFrequency, pCount, phFrequency ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetRange __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetRange( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_range_t* pLimits ///< [in,out] The range between which the hardware can operate for the ///< specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnGetRange = dditable->zes.Frequency.pfnGetRange; if( nullptr == pfnGetRange ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnGetRange( hFrequency, pLimits ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencySetRange __zedlllocal ze_result_t ZE_APICALL zesFrequencySetRange( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. const zes_freq_range_t* pLimits ///< [in] The limits between which the hardware can operate for the ///< specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnSetRange = dditable->zes.Frequency.pfnSetRange; if( nullptr == pfnSetRange ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnSetRange( hFrequency, pLimits ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetState __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetState( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_state_t* pState ///< [in,out] Frequency state for the specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnGetState = dditable->zes.Frequency.pfnGetState; if( nullptr == pfnGetState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnGetState( hFrequency, pState ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyGetThrottleTime __zedlllocal ze_result_t ZE_APICALL zesFrequencyGetThrottleTime( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_freq_throttle_time_t* pThrottleTime ///< [in,out] Will contain a snapshot of the throttle time counters for the ///< specified domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnGetThrottleTime = dditable->zes.Frequency.pfnGetThrottleTime; if( nullptr == pfnGetThrottleTime ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnGetThrottleTime( hFrequency, pThrottleTime ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetCapabilities __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetCapabilities( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_capabilities_t* pOcCapabilities ///< [in,out] Pointer to the capabilities structure. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnOcGetCapabilities = dditable->zes.Frequency.pfnOcGetCapabilities; if( nullptr == pfnOcGetCapabilities ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnOcGetCapabilities( hFrequency, pOcCapabilities ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetFrequencyTarget __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetFrequencyTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentOcFrequency ///< [out] Overclocking Frequency in MHz, if extended moded is supported, ///< will returned in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnOcGetFrequencyTarget = dditable->zes.Frequency.pfnOcGetFrequencyTarget; if( nullptr == pfnOcGetFrequencyTarget ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnOcGetFrequencyTarget( hFrequency, pCurrentOcFrequency ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetFrequencyTarget __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetFrequencyTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentOcFrequency ///< [in] Overclocking Frequency in MHz, if extended moded is supported, it ///< could be set in 1 Mhz granularity, else, in multiples of 50 Mhz. This ///< cannot be greater than the `maxOcFrequency` member of ///< ::zes_oc_capabilities_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnOcSetFrequencyTarget = dditable->zes.Frequency.pfnOcSetFrequencyTarget; if( nullptr == pfnOcSetFrequencyTarget ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnOcSetFrequencyTarget( hFrequency, CurrentOcFrequency ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetVoltageTarget __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetVoltageTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pCurrentVoltageTarget, ///< [out] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double* pCurrentVoltageOffset ///< [out] This voltage offset is applied to all points on the ///< voltage/frequency curve, including the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnOcGetVoltageTarget = dditable->zes.Frequency.pfnOcGetVoltageTarget; if( nullptr == pfnOcGetVoltageTarget ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnOcGetVoltageTarget( hFrequency, pCurrentVoltageTarget, pCurrentVoltageOffset ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetVoltageTarget __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetVoltageTarget( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double CurrentVoltageTarget, ///< [in] Overclock voltage in Volts. This cannot be greater than the ///< `maxOcVoltage` member of ::zes_oc_capabilities_t. double CurrentVoltageOffset ///< [in] This voltage offset is applied to all points on the ///< voltage/frequency curve, include the new overclock voltageTarget. ///< Valid range is between the `minOcVoltageOffset` and ///< `maxOcVoltageOffset` members of ::zes_oc_capabilities_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnOcSetVoltageTarget = dditable->zes.Frequency.pfnOcSetVoltageTarget; if( nullptr == pfnOcSetVoltageTarget ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnOcSetVoltageTarget( hFrequency, CurrentVoltageTarget, CurrentVoltageOffset ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetMode __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetMode( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t CurrentOcMode ///< [in] Current Overclocking Mode ::zes_oc_mode_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnOcSetMode = dditable->zes.Frequency.pfnOcSetMode; if( nullptr == pfnOcSetMode ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnOcSetMode( hFrequency, CurrentOcMode ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetMode __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetMode( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. zes_oc_mode_t* pCurrentOcMode ///< [out] Current Overclocking Mode ::zes_oc_mode_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnOcGetMode = dditable->zes.Frequency.pfnOcGetMode; if( nullptr == pfnOcGetMode ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnOcGetMode( hFrequency, pCurrentOcMode ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetIccMax __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetIccMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcIccMax ///< [in,out] Will contain the maximum current limit in Amperes on ///< successful return. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnOcGetIccMax = dditable->zes.Frequency.pfnOcGetIccMax; if( nullptr == pfnOcGetIccMax ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnOcGetIccMax( hFrequency, pOcIccMax ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetIccMax __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetIccMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocIccMax ///< [in] The new maximum current limit in Amperes. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnOcSetIccMax = dditable->zes.Frequency.pfnOcSetIccMax; if( nullptr == pfnOcSetIccMax ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnOcSetIccMax( hFrequency, ocIccMax ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcGetTjMax __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcGetTjMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double* pOcTjMax ///< [in,out] Will contain the maximum temperature limit in degrees Celsius ///< on successful return. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnOcGetTjMax = dditable->zes.Frequency.pfnOcGetTjMax; if( nullptr == pfnOcGetTjMax ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnOcGetTjMax( hFrequency, pOcTjMax ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFrequencyOcSetTjMax __zedlllocal ze_result_t ZE_APICALL zesFrequencyOcSetTjMax( zes_freq_handle_t hFrequency, ///< [in] Handle for the component. double ocTjMax ///< [in] The new maximum temperature limit in degrees Celsius. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFrequency )->dditable; auto pfnOcSetTjMax = dditable->zes.Frequency.pfnOcSetTjMax; if( nullptr == pfnOcSetTjMax ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFrequency = reinterpret_cast( hFrequency )->handle; // forward to device-driver result = pfnOcSetTjMax( hFrequency, ocTjMax ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumLeds __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumLeds( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_led_handle_t* phLed ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumLeds = dditable->zes.Device.pfnEnumLeds; if( nullptr == pfnEnumLeds ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumLeds( hDevice, pCount, phLed ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phLed ) && ( i < *pCount ); ++i ) phLed[ i ] = reinterpret_cast( context->zes_led_factory.getInstance( phLed[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesLedGetProperties __zedlllocal ze_result_t ZE_APICALL zesLedGetProperties( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_properties_t* pProperties ///< [in,out] Will contain the properties of the LED. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hLed )->dditable; auto pfnGetProperties = dditable->zes.Led.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hLed = reinterpret_cast( hLed )->handle; // forward to device-driver result = pfnGetProperties( hLed, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesLedGetState __zedlllocal ze_result_t ZE_APICALL zesLedGetState( zes_led_handle_t hLed, ///< [in] Handle for the component. zes_led_state_t* pState ///< [in,out] Will contain the current state of the LED. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hLed )->dditable; auto pfnGetState = dditable->zes.Led.pfnGetState; if( nullptr == pfnGetState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hLed = reinterpret_cast( hLed )->handle; // forward to device-driver result = pfnGetState( hLed, pState ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesLedSetState __zedlllocal ze_result_t ZE_APICALL zesLedSetState( zes_led_handle_t hLed, ///< [in] Handle for the component. ze_bool_t enable ///< [in] Set to TRUE to turn the LED on, FALSE to turn off. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hLed )->dditable; auto pfnSetState = dditable->zes.Led.pfnSetState; if( nullptr == pfnSetState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hLed = reinterpret_cast( hLed )->handle; // forward to device-driver result = pfnSetState( hLed, enable ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesLedSetColor __zedlllocal ze_result_t ZE_APICALL zesLedSetColor( zes_led_handle_t hLed, ///< [in] Handle for the component. const zes_led_color_t* pColor ///< [in] New color of the LED. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hLed )->dditable; auto pfnSetColor = dditable->zes.Led.pfnSetColor; if( nullptr == pfnSetColor ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hLed = reinterpret_cast( hLed )->handle; // forward to device-driver result = pfnSetColor( hLed, pColor ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumMemoryModules __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumMemoryModules( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_mem_handle_t* phMemory ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumMemoryModules = dditable->zes.Device.pfnEnumMemoryModules; if( nullptr == pfnEnumMemoryModules ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumMemoryModules( hDevice, pCount, phMemory ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phMemory ) && ( i < *pCount ); ++i ) phMemory[ i ] = reinterpret_cast( context->zes_mem_factory.getInstance( phMemory[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesMemoryGetProperties __zedlllocal ze_result_t ZE_APICALL zesMemoryGetProperties( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_properties_t* pProperties ///< [in,out] Will contain memory properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMemory )->dditable; auto pfnGetProperties = dditable->zes.Memory.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMemory = reinterpret_cast( hMemory )->handle; // forward to device-driver result = pfnGetProperties( hMemory, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesMemoryGetState __zedlllocal ze_result_t ZE_APICALL zesMemoryGetState( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_state_t* pState ///< [in,out] Will contain the current health and allocated memory. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMemory )->dditable; auto pfnGetState = dditable->zes.Memory.pfnGetState; if( nullptr == pfnGetState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMemory = reinterpret_cast( hMemory )->handle; // forward to device-driver result = pfnGetState( hMemory, pState ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesMemoryGetBandwidth __zedlllocal ze_result_t ZE_APICALL zesMemoryGetBandwidth( zes_mem_handle_t hMemory, ///< [in] Handle for the component. zes_mem_bandwidth_t* pBandwidth ///< [in,out] Will contain the total number of bytes read from and written ///< to memory, as well as the current maximum bandwidth. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMemory )->dditable; auto pfnGetBandwidth = dditable->zes.Memory.pfnGetBandwidth; if( nullptr == pfnGetBandwidth ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMemory = reinterpret_cast( hMemory )->handle; // forward to device-driver result = pfnGetBandwidth( hMemory, pBandwidth ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPerformanceFactorDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumPerformanceFactorDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_perf_handle_t* phPerf ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumPerformanceFactorDomains = dditable->zes.Device.pfnEnumPerformanceFactorDomains; if( nullptr == pfnEnumPerformanceFactorDomains ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumPerformanceFactorDomains( hDevice, pCount, phPerf ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phPerf ) && ( i < *pCount ); ++i ) phPerf[ i ] = reinterpret_cast( context->zes_perf_factory.getInstance( phPerf[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPerformanceFactorGetProperties __zedlllocal ze_result_t ZE_APICALL zesPerformanceFactorGetProperties( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. zes_perf_properties_t* pProperties ///< [in,out] Will contain information about the specified Performance ///< Factor domain. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPerf )->dditable; auto pfnGetProperties = dditable->zes.PerformanceFactor.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPerf = reinterpret_cast( hPerf )->handle; // forward to device-driver result = pfnGetProperties( hPerf, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPerformanceFactorGetConfig __zedlllocal ze_result_t ZE_APICALL zesPerformanceFactorGetConfig( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double* pFactor ///< [in,out] Will contain the actual Performance Factor being used by the ///< hardware (may not be the same as the requested Performance Factor). ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPerf )->dditable; auto pfnGetConfig = dditable->zes.PerformanceFactor.pfnGetConfig; if( nullptr == pfnGetConfig ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPerf = reinterpret_cast( hPerf )->handle; // forward to device-driver result = pfnGetConfig( hPerf, pFactor ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPerformanceFactorSetConfig __zedlllocal ze_result_t ZE_APICALL zesPerformanceFactorSetConfig( zes_perf_handle_t hPerf, ///< [in] Handle for the Performance Factor domain. double factor ///< [in] The new Performance Factor. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPerf )->dditable; auto pfnSetConfig = dditable->zes.PerformanceFactor.pfnSetConfig; if( nullptr == pfnSetConfig ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPerf = reinterpret_cast( hPerf )->handle; // forward to device-driver result = pfnSetConfig( hPerf, factor ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPowerDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumPowerDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_pwr_handle_t* phPower ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumPowerDomains = dditable->zes.Device.pfnEnumPowerDomains; if( nullptr == pfnEnumPowerDomains ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumPowerDomains( hDevice, pCount, phPower ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phPower ) && ( i < *pCount ); ++i ) phPower[ i ] = reinterpret_cast( context->zes_pwr_factory.getInstance( phPower[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetCardPowerDomain __zedlllocal ze_result_t ZE_APICALL zesDeviceGetCardPowerDomain( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. zes_pwr_handle_t* phPower ///< [in,out] power domain handle for the entire PCIe card. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetCardPowerDomain = dditable->zes.Device.pfnGetCardPowerDomain; if( nullptr == pfnGetCardPowerDomain ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetCardPowerDomain( hDevice, phPower ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phPower = reinterpret_cast( context->zes_pwr_factory.getInstance( *phPower, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetProperties __zedlllocal ze_result_t ZE_APICALL zesPowerGetProperties( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_properties_t* pProperties ///< [in,out] Structure that will contain property data. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPower )->dditable; auto pfnGetProperties = dditable->zes.Power.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPower = reinterpret_cast( hPower )->handle; // forward to device-driver result = pfnGetProperties( hPower, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetEnergyCounter __zedlllocal ze_result_t ZE_APICALL zesPowerGetEnergyCounter( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_energy_counter_t* pEnergy ///< [in,out] Will contain the latest snapshot of the energy counter and ///< timestamp when the last counter value was measured. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPower )->dditable; auto pfnGetEnergyCounter = dditable->zes.Power.pfnGetEnergyCounter; if( nullptr == pfnGetEnergyCounter ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPower = reinterpret_cast( hPower )->handle; // forward to device-driver result = pfnGetEnergyCounter( hPower, pEnergy ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetLimits __zedlllocal ze_result_t ZE_APICALL zesPowerGetLimits( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_power_sustained_limit_t* pSustained, ///< [in,out][optional] The sustained power limit. If this is null, the ///< current sustained power limits will not be returned. zes_power_burst_limit_t* pBurst, ///< [in,out][optional] The burst power limit. If this is null, the current ///< peak power limits will not be returned. zes_power_peak_limit_t* pPeak ///< [in,out][optional] The peak power limit. If this is null, the peak ///< power limits will not be returned. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPower )->dditable; auto pfnGetLimits = dditable->zes.Power.pfnGetLimits; if( nullptr == pfnGetLimits ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPower = reinterpret_cast( hPower )->handle; // forward to device-driver result = pfnGetLimits( hPower, pSustained, pBurst, pPeak ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerSetLimits __zedlllocal ze_result_t ZE_APICALL zesPowerSetLimits( zes_pwr_handle_t hPower, ///< [in] Handle for the component. const zes_power_sustained_limit_t* pSustained, ///< [in][optional] The sustained power limit. If this is null, no changes ///< will be made to the sustained power limits. const zes_power_burst_limit_t* pBurst, ///< [in][optional] The burst power limit. If this is null, no changes will ///< be made to the burst power limits. const zes_power_peak_limit_t* pPeak ///< [in][optional] The peak power limit. If this is null, no changes will ///< be made to the peak power limits. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPower )->dditable; auto pfnSetLimits = dditable->zes.Power.pfnSetLimits; if( nullptr == pfnSetLimits ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPower = reinterpret_cast( hPower )->handle; // forward to device-driver result = pfnSetLimits( hPower, pSustained, pBurst, pPeak ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetEnergyThreshold __zedlllocal ze_result_t ZE_APICALL zesPowerGetEnergyThreshold( zes_pwr_handle_t hPower, ///< [in] Handle for the component. zes_energy_threshold_t* pThreshold ///< [in,out] Returns information about the energy threshold setting - ///< enabled/energy threshold/process ID. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPower )->dditable; auto pfnGetEnergyThreshold = dditable->zes.Power.pfnGetEnergyThreshold; if( nullptr == pfnGetEnergyThreshold ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPower = reinterpret_cast( hPower )->handle; // forward to device-driver result = pfnGetEnergyThreshold( hPower, pThreshold ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerSetEnergyThreshold __zedlllocal ze_result_t ZE_APICALL zesPowerSetEnergyThreshold( zes_pwr_handle_t hPower, ///< [in] Handle for the component. double threshold ///< [in] The energy threshold to be set in joules. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPower )->dditable; auto pfnSetEnergyThreshold = dditable->zes.Power.pfnSetEnergyThreshold; if( nullptr == pfnSetEnergyThreshold ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPower = reinterpret_cast( hPower )->handle; // forward to device-driver result = pfnSetEnergyThreshold( hPower, threshold ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumPsus __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumPsus( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_psu_handle_t* phPsu ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumPsus = dditable->zes.Device.pfnEnumPsus; if( nullptr == pfnEnumPsus ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumPsus( hDevice, pCount, phPsu ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phPsu ) && ( i < *pCount ); ++i ) phPsu[ i ] = reinterpret_cast( context->zes_psu_factory.getInstance( phPsu[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPsuGetProperties __zedlllocal ze_result_t ZE_APICALL zesPsuGetProperties( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_properties_t* pProperties ///< [in,out] Will contain the properties of the power supply. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPsu )->dditable; auto pfnGetProperties = dditable->zes.Psu.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPsu = reinterpret_cast( hPsu )->handle; // forward to device-driver result = pfnGetProperties( hPsu, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPsuGetState __zedlllocal ze_result_t ZE_APICALL zesPsuGetState( zes_psu_handle_t hPsu, ///< [in] Handle for the component. zes_psu_state_t* pState ///< [in,out] Will contain the current state of the power supply. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPsu )->dditable; auto pfnGetState = dditable->zes.Psu.pfnGetState; if( nullptr == pfnGetState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPsu = reinterpret_cast( hPsu )->handle; // forward to device-driver result = pfnGetState( hPsu, pState ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumRasErrorSets __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumRasErrorSets( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_ras_handle_t* phRas ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumRasErrorSets = dditable->zes.Device.pfnEnumRasErrorSets; if( nullptr == pfnEnumRasErrorSets ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumRasErrorSets( hDevice, pCount, phRas ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phRas ) && ( i < *pCount ); ++i ) phRas[ i ] = reinterpret_cast( context->zes_ras_factory.getInstance( phRas[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasGetProperties __zedlllocal ze_result_t ZE_APICALL zesRasGetProperties( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_properties_t* pProperties ///< [in,out] Structure describing RAS properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hRas )->dditable; auto pfnGetProperties = dditable->zes.Ras.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hRas = reinterpret_cast( hRas )->handle; // forward to device-driver result = pfnGetProperties( hRas, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasGetConfig __zedlllocal ze_result_t ZE_APICALL zesRasGetConfig( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_config_t* pConfig ///< [in,out] Will be populed with the current RAS configuration - ///< thresholds used to trigger events ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hRas )->dditable; auto pfnGetConfig = dditable->zes.Ras.pfnGetConfig; if( nullptr == pfnGetConfig ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hRas = reinterpret_cast( hRas )->handle; // forward to device-driver result = pfnGetConfig( hRas, pConfig ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasSetConfig __zedlllocal ze_result_t ZE_APICALL zesRasSetConfig( zes_ras_handle_t hRas, ///< [in] Handle for the component. const zes_ras_config_t* pConfig ///< [in] Change the RAS configuration - thresholds used to trigger events ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hRas )->dditable; auto pfnSetConfig = dditable->zes.Ras.pfnSetConfig; if( nullptr == pfnSetConfig ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hRas = reinterpret_cast( hRas )->handle; // forward to device-driver result = pfnSetConfig( hRas, pConfig ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasGetState __zedlllocal ze_result_t ZE_APICALL zesRasGetState( zes_ras_handle_t hRas, ///< [in] Handle for the component. ze_bool_t clear, ///< [in] Set to 1 to clear the counters of this type zes_ras_state_t* pState ///< [in,out] Breakdown of where errors have occurred ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hRas )->dditable; auto pfnGetState = dditable->zes.Ras.pfnGetState; if( nullptr == pfnGetState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hRas = reinterpret_cast( hRas )->handle; // forward to device-driver result = pfnGetState( hRas, clear, pState ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumSchedulers __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumSchedulers( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_sched_handle_t* phScheduler ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumSchedulers = dditable->zes.Device.pfnEnumSchedulers; if( nullptr == pfnEnumSchedulers ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumSchedulers( hDevice, pCount, phScheduler ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phScheduler ) && ( i < *pCount ); ++i ) phScheduler[ i ] = reinterpret_cast( context->zes_sched_factory.getInstance( phScheduler[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerGetProperties __zedlllocal ze_result_t ZE_APICALL zesSchedulerGetProperties( zes_sched_handle_t hScheduler, ///< [in] Handle for the component. zes_sched_properties_t* pProperties ///< [in,out] Structure that will contain property data. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hScheduler )->dditable; auto pfnGetProperties = dditable->zes.Scheduler.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hScheduler = reinterpret_cast( hScheduler )->handle; // forward to device-driver result = pfnGetProperties( hScheduler, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerGetCurrentMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerGetCurrentMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_mode_t* pMode ///< [in,out] Will contain the current scheduler mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hScheduler )->dditable; auto pfnGetCurrentMode = dditable->zes.Scheduler.pfnGetCurrentMode; if( nullptr == pfnGetCurrentMode ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hScheduler = reinterpret_cast( hScheduler )->handle; // forward to device-driver result = pfnGetCurrentMode( hScheduler, pMode ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerGetTimeoutModeProperties __zedlllocal ze_result_t ZE_APICALL zesSchedulerGetTimeoutModeProperties( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeout_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hScheduler )->dditable; auto pfnGetTimeoutModeProperties = dditable->zes.Scheduler.pfnGetTimeoutModeProperties; if( nullptr == pfnGetTimeoutModeProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hScheduler = reinterpret_cast( hScheduler )->handle; // forward to device-driver result = pfnGetTimeoutModeProperties( hScheduler, getDefaults, pConfig ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerGetTimesliceModeProperties __zedlllocal ze_result_t ZE_APICALL zesSchedulerGetTimesliceModeProperties( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t getDefaults, ///< [in] If TRUE, the driver will return the system default properties for ///< this mode, otherwise it will return the current properties. zes_sched_timeslice_properties_t* pConfig ///< [in,out] Will contain the current parameters for this mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hScheduler )->dditable; auto pfnGetTimesliceModeProperties = dditable->zes.Scheduler.pfnGetTimesliceModeProperties; if( nullptr == pfnGetTimesliceModeProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hScheduler = reinterpret_cast( hScheduler )->handle; // forward to device-driver result = pfnGetTimesliceModeProperties( hScheduler, getDefaults, pConfig ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerSetTimeoutMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerSetTimeoutMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeout_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hScheduler )->dditable; auto pfnSetTimeoutMode = dditable->zes.Scheduler.pfnSetTimeoutMode; if( nullptr == pfnSetTimeoutMode ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hScheduler = reinterpret_cast( hScheduler )->handle; // forward to device-driver result = pfnSetTimeoutMode( hScheduler, pProperties, pNeedReload ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerSetTimesliceMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerSetTimesliceMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. zes_sched_timeslice_properties_t* pProperties, ///< [in] The properties to use when configurating this mode. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hScheduler )->dditable; auto pfnSetTimesliceMode = dditable->zes.Scheduler.pfnSetTimesliceMode; if( nullptr == pfnSetTimesliceMode ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hScheduler = reinterpret_cast( hScheduler )->handle; // forward to device-driver result = pfnSetTimesliceMode( hScheduler, pProperties, pNeedReload ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerSetExclusiveMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerSetExclusiveMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hScheduler )->dditable; auto pfnSetExclusiveMode = dditable->zes.Scheduler.pfnSetExclusiveMode; if( nullptr == pfnSetExclusiveMode ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hScheduler = reinterpret_cast( hScheduler )->handle; // forward to device-driver result = pfnSetExclusiveMode( hScheduler, pNeedReload ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesSchedulerSetComputeUnitDebugMode __zedlllocal ze_result_t ZE_APICALL zesSchedulerSetComputeUnitDebugMode( zes_sched_handle_t hScheduler, ///< [in] Sysman handle for the component. ze_bool_t* pNeedReload ///< [in,out] Will be set to TRUE if a device driver reload is needed to ///< apply the new scheduler mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hScheduler )->dditable; auto pfnSetComputeUnitDebugMode = dditable->zes.Scheduler.pfnSetComputeUnitDebugMode; if( nullptr == pfnSetComputeUnitDebugMode ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hScheduler = reinterpret_cast( hScheduler )->handle; // forward to device-driver result = pfnSetComputeUnitDebugMode( hScheduler, pNeedReload ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumStandbyDomains __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumStandbyDomains( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_standby_handle_t* phStandby ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumStandbyDomains = dditable->zes.Device.pfnEnumStandbyDomains; if( nullptr == pfnEnumStandbyDomains ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumStandbyDomains( hDevice, pCount, phStandby ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phStandby ) && ( i < *pCount ); ++i ) phStandby[ i ] = reinterpret_cast( context->zes_standby_factory.getInstance( phStandby[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesStandbyGetProperties __zedlllocal ze_result_t ZE_APICALL zesStandbyGetProperties( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_properties_t* pProperties ///< [in,out] Will contain the standby hardware properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hStandby )->dditable; auto pfnGetProperties = dditable->zes.Standby.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hStandby = reinterpret_cast( hStandby )->handle; // forward to device-driver result = pfnGetProperties( hStandby, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesStandbyGetMode __zedlllocal ze_result_t ZE_APICALL zesStandbyGetMode( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t* pMode ///< [in,out] Will contain the current standby mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hStandby )->dditable; auto pfnGetMode = dditable->zes.Standby.pfnGetMode; if( nullptr == pfnGetMode ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hStandby = reinterpret_cast( hStandby )->handle; // forward to device-driver result = pfnGetMode( hStandby, pMode ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesStandbySetMode __zedlllocal ze_result_t ZE_APICALL zesStandbySetMode( zes_standby_handle_t hStandby, ///< [in] Handle for the component. zes_standby_promo_mode_t mode ///< [in] New standby mode. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hStandby )->dditable; auto pfnSetMode = dditable->zes.Standby.pfnSetMode; if( nullptr == pfnSetMode ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hStandby = reinterpret_cast( hStandby )->handle; // forward to device-driver result = pfnSetMode( hStandby, mode ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumTemperatureSensors __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumTemperatureSensors( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_temp_handle_t* phTemperature ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumTemperatureSensors = dditable->zes.Device.pfnEnumTemperatureSensors; if( nullptr == pfnEnumTemperatureSensors ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumTemperatureSensors( hDevice, pCount, phTemperature ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phTemperature ) && ( i < *pCount ); ++i ) phTemperature[ i ] = reinterpret_cast( context->zes_temp_factory.getInstance( phTemperature[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesTemperatureGetProperties __zedlllocal ze_result_t ZE_APICALL zesTemperatureGetProperties( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_properties_t* pProperties ///< [in,out] Will contain the temperature sensor properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hTemperature )->dditable; auto pfnGetProperties = dditable->zes.Temperature.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hTemperature = reinterpret_cast( hTemperature )->handle; // forward to device-driver result = pfnGetProperties( hTemperature, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesTemperatureGetConfig __zedlllocal ze_result_t ZE_APICALL zesTemperatureGetConfig( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. zes_temp_config_t* pConfig ///< [in,out] Returns current configuration. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hTemperature )->dditable; auto pfnGetConfig = dditable->zes.Temperature.pfnGetConfig; if( nullptr == pfnGetConfig ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hTemperature = reinterpret_cast( hTemperature )->handle; // forward to device-driver result = pfnGetConfig( hTemperature, pConfig ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesTemperatureSetConfig __zedlllocal ze_result_t ZE_APICALL zesTemperatureSetConfig( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. const zes_temp_config_t* pConfig ///< [in] New configuration. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hTemperature )->dditable; auto pfnSetConfig = dditable->zes.Temperature.pfnSetConfig; if( nullptr == pfnSetConfig ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hTemperature = reinterpret_cast( hTemperature )->handle; // forward to device-driver result = pfnSetConfig( hTemperature, pConfig ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesTemperatureGetState __zedlllocal ze_result_t ZE_APICALL zesTemperatureGetState( zes_temp_handle_t hTemperature, ///< [in] Handle for the component. double* pTemperature ///< [in,out] Will contain the temperature read from the specified sensor ///< in degrees Celsius. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hTemperature )->dditable; auto pfnGetState = dditable->zes.Temperature.pfnGetState; if( nullptr == pfnGetState ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hTemperature = reinterpret_cast( hTemperature )->handle; // forward to device-driver result = pfnGetState( hTemperature, pTemperature ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerGetLimitsExt __zedlllocal ze_result_t ZE_APICALL zesPowerGetLimitsExt( zes_pwr_handle_t hPower, ///< [in] Power domain handle instance. uint32_t* pCount, ///< [in,out] Pointer to the number of power limit descriptors. If count is ///< zero, then the driver shall update the value with the total number of ///< components of this type that are available. If count is greater than ///< the number of components of this type that are available, then the ///< driver shall update the value with the correct number of components. zes_power_limit_ext_desc_t* pSustained ///< [in,out][optional][range(0, *pCount)] Array of query results for power ///< limit descriptors. If count is less than the number of components of ///< this type that are available, then the driver shall only retrieve that ///< number of components. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPower )->dditable; auto pfnGetLimitsExt = dditable->zes.Power.pfnGetLimitsExt; if( nullptr == pfnGetLimitsExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPower = reinterpret_cast( hPower )->handle; // forward to device-driver result = pfnGetLimitsExt( hPower, pCount, pSustained ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesPowerSetLimitsExt __zedlllocal ze_result_t ZE_APICALL zesPowerSetLimitsExt( zes_pwr_handle_t hPower, ///< [in] Handle for the component. uint32_t* pCount, ///< [in] Pointer to the number of power limit descriptors. zes_power_limit_ext_desc_t* pSustained ///< [in][optional][range(0, *pCount)] Array of power limit descriptors. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hPower )->dditable; auto pfnSetLimitsExt = dditable->zes.Power.pfnSetLimitsExt; if( nullptr == pfnSetLimitsExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hPower = reinterpret_cast( hPower )->handle; // forward to device-driver result = pfnSetLimitsExt( hPower, pCount, pSustained ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesEngineGetActivityExt __zedlllocal ze_result_t ZE_APICALL zesEngineGetActivityExt( zes_engine_handle_t hEngine, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_engine_stats_t* pStats ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector with engine stat for ///< PF at index 0 of the vector followed by user provided pCount-1 number ///< of VF engine stats. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hEngine )->dditable; auto pfnGetActivityExt = dditable->zes.Engine.pfnGetActivityExt; if( nullptr == pfnGetActivityExt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hEngine = reinterpret_cast( hEngine )->handle; // forward to device-driver result = pfnGetActivityExt( hEngine, pCount, pStats ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasGetStateExp __zedlllocal ze_result_t ZE_APICALL zesRasGetStateExp( zes_ras_handle_t hRas, ///< [in] Handle for the component. uint32_t* pCount, ///< [in,out] pointer to the number of RAS state structures that can be retrieved. ///< if count is zero, then the driver shall update the value with the ///< total number of error categories for which state can be retrieved. ///< if count is greater than the number of RAS states available, then the ///< driver shall update the value with the correct number of RAS states available. zes_ras_state_exp_t* pState ///< [in,out][optional][range(0, *pCount)] array of query results for RAS ///< error states for different categories. ///< if count is less than the number of RAS states available, then driver ///< shall only retrieve that number of RAS states. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hRas )->dditable; auto pfnGetStateExp = dditable->zes.RasExp.pfnGetStateExp; if( nullptr == pfnGetStateExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hRas = reinterpret_cast( hRas )->handle; // forward to device-driver result = pfnGetStateExp( hRas, pCount, pState ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesRasClearStateExp __zedlllocal ze_result_t ZE_APICALL zesRasClearStateExp( zes_ras_handle_t hRas, ///< [in] Handle for the component. zes_ras_error_category_exp_t category ///< [in] category for which error counter is to be cleared. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hRas )->dditable; auto pfnClearStateExp = dditable->zes.RasExp.pfnClearStateExp; if( nullptr == pfnClearStateExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hRas = reinterpret_cast( hRas )->handle; // forward to device-driver result = pfnClearStateExp( hRas, category ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareGetSecurityVersionExp __zedlllocal ze_result_t ZE_APICALL zesFirmwareGetSecurityVersionExp( zes_firmware_handle_t hFirmware, ///< [in] Handle for the component. char* pVersion ///< [in,out] NULL terminated string value. The string "unknown" will be ///< returned if this property cannot be determined. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFirmware )->dditable; auto pfnGetSecurityVersionExp = dditable->zes.FirmwareExp.pfnGetSecurityVersionExp; if( nullptr == pfnGetSecurityVersionExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFirmware = reinterpret_cast( hFirmware )->handle; // forward to device-driver result = pfnGetSecurityVersionExp( hFirmware, pVersion ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesFirmwareSetSecurityVersionExp __zedlllocal ze_result_t ZE_APICALL zesFirmwareSetSecurityVersionExp( zes_firmware_handle_t hFirmware ///< [in] Handle for the component. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hFirmware )->dditable; auto pfnSetSecurityVersionExp = dditable->zes.FirmwareExp.pfnSetSecurityVersionExp; if( nullptr == pfnSetSecurityVersionExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hFirmware = reinterpret_cast( hFirmware )->handle; // forward to device-driver result = pfnSetSecurityVersionExp( hFirmware ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceGetSubDevicePropertiesExp __zedlllocal ze_result_t ZE_APICALL zesDeviceGetSubDevicePropertiesExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of sub devices. ///< if count is zero, then the driver shall update the value with the ///< total number of sub devices currently attached to the device. ///< if count is greater than the number of sub devices currently attached ///< to the device, then the driver shall update the value with the correct ///< number of sub devices. zes_subdevice_exp_properties_t* pSubdeviceProps ///< [in,out][optional][range(0, *pCount)] array of sub device property structures. ///< if count is less than the number of sysman sub devices available, then ///< the driver shall only retrieve that number of sub device property structures. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetSubDevicePropertiesExp = dditable->zes.DeviceExp.pfnGetSubDevicePropertiesExp; if( nullptr == pfnGetSubDevicePropertiesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetSubDevicePropertiesExp( hDevice, pCount, pSubdeviceProps ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDriverGetDeviceByUuidExp __zedlllocal ze_result_t ZE_APICALL zesDriverGetDeviceByUuidExp( zes_driver_handle_t hDriver, ///< [in] handle of the sysman driver instance zes_uuid_t uuid, ///< [in] universal unique identifier. zes_device_handle_t* phDevice, ///< [out] Sysman handle of the device. ze_bool_t* onSubdevice, ///< [out] True if the UUID belongs to the sub-device; false means that ///< UUID belongs to the root device. uint32_t* subdeviceId ///< [out] If onSubdevice is true, this gives the ID of the sub-device ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnGetDeviceByUuidExp = dditable->zes.DriverExp.pfnGetDeviceByUuidExp; if( nullptr == pfnGetDeviceByUuidExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnGetDeviceByUuidExp( hDriver, uuid, phDevice, onSubdevice, subdeviceId ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phDevice = reinterpret_cast( context->zes_device_factory.getInstance( *phDevice, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumActiveVFExp __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumActiveVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumActiveVFExp = dditable->zes.DeviceExp.pfnEnumActiveVFExp; if( nullptr == pfnEnumActiveVFExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumActiveVFExp( hDevice, pCount, phVFhandle ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phVFhandle ) && ( i < *pCount ); ++i ) phVFhandle[ i ] = reinterpret_cast( context->zes_vf_factory.getInstance( phVFhandle[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFPropertiesExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFPropertiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_properties_t* pProperties ///< [in,out] Will contain VF properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVFhandle )->dditable; auto pfnGetVFPropertiesExp = dditable->zes.VFManagementExp.pfnGetVFPropertiesExp; if( nullptr == pfnGetVFPropertiesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVFhandle = reinterpret_cast( hVFhandle )->handle; // forward to device-driver result = pfnGetVFPropertiesExp( hVFhandle, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFMemoryUtilizationExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFMemoryUtilizationExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_mem_exp_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVFhandle )->dditable; auto pfnGetVFMemoryUtilizationExp = dditable->zes.VFManagementExp.pfnGetVFMemoryUtilizationExp; if( nullptr == pfnGetVFMemoryUtilizationExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVFhandle = reinterpret_cast( hVFhandle )->handle; // forward to device-driver result = pfnGetVFMemoryUtilizationExp( hVFhandle, pCount, pMemUtil ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFEngineUtilizationExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFEngineUtilizationExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. ///< - The count returned is the sum of number of VF instances currently ///< available and the PF instance. zes_vf_util_engine_exp_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVFhandle )->dditable; auto pfnGetVFEngineUtilizationExp = dditable->zes.VFManagementExp.pfnGetVFEngineUtilizationExp; if( nullptr == pfnGetVFEngineUtilizationExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVFhandle = reinterpret_cast( hVFhandle )->handle; // forward to device-driver result = pfnGetVFEngineUtilizationExp( hVFhandle, pCount, pEngineUtil ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementSetVFTelemetryModeExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementSetVFTelemetryModeExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flags, ///< [in] utilization flags to enable or disable. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. ze_bool_t enable ///< [in] Enable utilization telemetry. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVFhandle )->dditable; auto pfnSetVFTelemetryModeExp = dditable->zes.VFManagementExp.pfnSetVFTelemetryModeExp; if( nullptr == pfnSetVFTelemetryModeExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVFhandle = reinterpret_cast( hVFhandle )->handle; // forward to device-driver result = pfnSetVFTelemetryModeExp( hVFhandle, flags, enable ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementSetVFTelemetrySamplingIntervalExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementSetVFTelemetrySamplingIntervalExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. zes_vf_info_util_exp_flags_t flag, ///< [in] utilization flags to set sampling interval. May be 0 or a valid ///< combination of ::zes_vf_info_util_exp_flag_t. uint64_t samplingInterval ///< [in] Sampling interval value. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVFhandle )->dditable; auto pfnSetVFTelemetrySamplingIntervalExp = dditable->zes.VFManagementExp.pfnSetVFTelemetrySamplingIntervalExp; if( nullptr == pfnSetVFTelemetrySamplingIntervalExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVFhandle = reinterpret_cast( hVFhandle )->handle; // forward to device-driver result = pfnSetVFTelemetrySamplingIntervalExp( hVFhandle, flag, samplingInterval ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesDeviceEnumEnabledVFExp __zedlllocal ze_result_t ZE_APICALL zesDeviceEnumEnabledVFExp( zes_device_handle_t hDevice, ///< [in] Sysman handle of the device. uint32_t* pCount, ///< [in,out] pointer to the number of components of this type. ///< if count is zero, then the driver shall update the value with the ///< total number of components of this type that are available. ///< if count is greater than the number of components of this type that ///< are available, then the driver shall update the value with the correct ///< number of components. zes_vf_handle_t* phVFhandle ///< [in,out][optional][range(0, *pCount)] array of handle of components of ///< this type. ///< if count is less than the number of components of this type that are ///< available, then the driver shall only retrieve that number of ///< component handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnEnumEnabledVFExp = dditable->zes.DeviceExp.pfnEnumEnabledVFExp; if( nullptr == pfnEnumEnabledVFExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnEnumEnabledVFExp( hDevice, pCount, phVFhandle ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phVFhandle ) && ( i < *pCount ); ++i ) phVFhandle[ i ] = reinterpret_cast( context->zes_vf_factory.getInstance( phVFhandle[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFCapabilitiesExp __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFCapabilitiesExp( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVFhandle )->dditable; auto pfnGetVFCapabilitiesExp = dditable->zes.VFManagementExp.pfnGetVFCapabilitiesExp; if( nullptr == pfnGetVFCapabilitiesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVFhandle = reinterpret_cast( hVFhandle )->handle; // forward to device-driver result = pfnGetVFCapabilitiesExp( hVFhandle, pCapability ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFMemoryUtilizationExp2 __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFMemoryUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF memory stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of memory stats available. ///< - if count is greater than the total number of memory stats ///< available, the driver shall update the value with the correct number ///< of memory stats available. zes_vf_util_mem_exp2_t* pMemUtil ///< [in,out][optional][range(0, *pCount)] array of memory group activity counters. ///< - if count is less than the total number of memory stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< memory stats. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVFhandle )->dditable; auto pfnGetVFMemoryUtilizationExp2 = dditable->zes.VFManagementExp.pfnGetVFMemoryUtilizationExp2; if( nullptr == pfnGetVFMemoryUtilizationExp2 ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVFhandle = reinterpret_cast( hVFhandle )->handle; // forward to device-driver result = pfnGetVFMemoryUtilizationExp2( hVFhandle, pCount, pMemUtil ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFEngineUtilizationExp2 __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFEngineUtilizationExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the component. uint32_t* pCount, ///< [in,out] Pointer to the number of VF engine stats descriptors. ///< - if count is zero, the driver shall update the value with the total ///< number of engine stats available. ///< - if count is greater than the total number of engine stats ///< available, the driver shall update the value with the correct number ///< of engine stats available. zes_vf_util_engine_exp2_t* pEngineUtil ///< [in,out][optional][range(0, *pCount)] array of engine group activity counters. ///< - if count is less than the total number of engine stats available, ///< then driver shall only retrieve that number of stats. ///< - the implementation shall populate the vector pCount-1 number of VF ///< engine stats. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVFhandle )->dditable; auto pfnGetVFEngineUtilizationExp2 = dditable->zes.VFManagementExp.pfnGetVFEngineUtilizationExp2; if( nullptr == pfnGetVFEngineUtilizationExp2 ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVFhandle = reinterpret_cast( hVFhandle )->handle; // forward to device-driver result = pfnGetVFEngineUtilizationExp2( hVFhandle, pCount, pEngineUtil ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zesVFManagementGetVFCapabilitiesExp2 __zedlllocal ze_result_t ZE_APICALL zesVFManagementGetVFCapabilitiesExp2( zes_vf_handle_t hVFhandle, ///< [in] Sysman handle for the VF component. zes_vf_exp2_capabilities_t* pCapability ///< [in,out] Will contain VF capability. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hVFhandle )->dditable; auto pfnGetVFCapabilitiesExp2 = dditable->zes.VFManagementExp.pfnGetVFCapabilitiesExp2; if( nullptr == pfnGetVFCapabilitiesExp2 ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hVFhandle = reinterpret_cast( hVFhandle )->handle; // forward to device-driver result = pfnGetVFCapabilitiesExp2( hVFhandle, pCapability ); return result; } } // namespace loader #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Global table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetGlobalProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_global_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetGlobalProcAddrTable") ); if(!getTable) { atLeastOneDriverValid = true; //It is valid to not have this proc addr table continue; } auto getTableResult = getTable( version, &drv.dditable.zes.Global); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnInit = loader::zesInit; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Global; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetGlobalProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetDeviceProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Device); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesDeviceGetProperties; pDdiTable->pfnGetState = loader::zesDeviceGetState; pDdiTable->pfnReset = loader::zesDeviceReset; pDdiTable->pfnProcessesGetState = loader::zesDeviceProcessesGetState; pDdiTable->pfnPciGetProperties = loader::zesDevicePciGetProperties; pDdiTable->pfnPciGetState = loader::zesDevicePciGetState; pDdiTable->pfnPciGetBars = loader::zesDevicePciGetBars; pDdiTable->pfnPciGetStats = loader::zesDevicePciGetStats; pDdiTable->pfnEnumDiagnosticTestSuites = loader::zesDeviceEnumDiagnosticTestSuites; pDdiTable->pfnEnumEngineGroups = loader::zesDeviceEnumEngineGroups; pDdiTable->pfnEventRegister = loader::zesDeviceEventRegister; pDdiTable->pfnEnumFabricPorts = loader::zesDeviceEnumFabricPorts; pDdiTable->pfnEnumFans = loader::zesDeviceEnumFans; pDdiTable->pfnEnumFirmwares = loader::zesDeviceEnumFirmwares; pDdiTable->pfnEnumFrequencyDomains = loader::zesDeviceEnumFrequencyDomains; pDdiTable->pfnEnumLeds = loader::zesDeviceEnumLeds; pDdiTable->pfnEnumMemoryModules = loader::zesDeviceEnumMemoryModules; pDdiTable->pfnEnumPerformanceFactorDomains = loader::zesDeviceEnumPerformanceFactorDomains; pDdiTable->pfnEnumPowerDomains = loader::zesDeviceEnumPowerDomains; pDdiTable->pfnGetCardPowerDomain = loader::zesDeviceGetCardPowerDomain; pDdiTable->pfnEnumPsus = loader::zesDeviceEnumPsus; pDdiTable->pfnEnumRasErrorSets = loader::zesDeviceEnumRasErrorSets; pDdiTable->pfnEnumSchedulers = loader::zesDeviceEnumSchedulers; pDdiTable->pfnEnumStandbyDomains = loader::zesDeviceEnumStandbyDomains; pDdiTable->pfnEnumTemperatureSensors = loader::zesDeviceEnumTemperatureSensors; pDdiTable->pfnEccAvailable = loader::zesDeviceEccAvailable; pDdiTable->pfnEccConfigurable = loader::zesDeviceEccConfigurable; pDdiTable->pfnGetEccState = loader::zesDeviceGetEccState; pDdiTable->pfnSetEccState = loader::zesDeviceSetEccState; pDdiTable->pfnGet = loader::zesDeviceGet; pDdiTable->pfnSetOverclockWaiver = loader::zesDeviceSetOverclockWaiver; pDdiTable->pfnGetOverclockDomains = loader::zesDeviceGetOverclockDomains; pDdiTable->pfnGetOverclockControls = loader::zesDeviceGetOverclockControls; pDdiTable->pfnResetOverclockSettings = loader::zesDeviceResetOverclockSettings; pDdiTable->pfnReadOverclockState = loader::zesDeviceReadOverclockState; pDdiTable->pfnEnumOverclockDomains = loader::zesDeviceEnumOverclockDomains; pDdiTable->pfnResetExt = loader::zesDeviceResetExt; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Device; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetDeviceProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetDeviceExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.zes.DeviceExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnEnumEnabledVFExp = loader::zesDeviceEnumEnabledVFExp; pDdiTable->pfnGetSubDevicePropertiesExp = loader::zesDeviceGetSubDevicePropertiesExp; pDdiTable->pfnEnumActiveVFExp = loader::zesDeviceEnumActiveVFExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.DeviceExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetDeviceExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Driver table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDriverProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_driver_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetDriverProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Driver); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnEventListen = loader::zesDriverEventListen; pDdiTable->pfnEventListenEx = loader::zesDriverEventListenEx; pDdiTable->pfnGet = loader::zesDriverGet; pDdiTable->pfnGetExtensionProperties = loader::zesDriverGetExtensionProperties; pDdiTable->pfnGetExtensionFunctionAddress = loader::zesDriverGetExtensionFunctionAddress; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Driver; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetDriverProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DriverExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDriverExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_driver_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetDriverExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.zes.DriverExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetDeviceByUuidExp = loader::zesDriverGetDeviceByUuidExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.DriverExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetDriverExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Diagnostics table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetDiagnosticsProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_diagnostics_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetDiagnosticsProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Diagnostics); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesDiagnosticsGetProperties; pDdiTable->pfnGetTests = loader::zesDiagnosticsGetTests; pDdiTable->pfnRunTests = loader::zesDiagnosticsRunTests; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Diagnostics; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetDiagnosticsProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Engine table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetEngineProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_engine_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetEngineProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Engine); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesEngineGetProperties; pDdiTable->pfnGetActivity = loader::zesEngineGetActivity; pDdiTable->pfnGetActivityExt = loader::zesEngineGetActivityExt; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Engine; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetEngineProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FabricPort table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFabricPortProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_fabric_port_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetFabricPortProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.FabricPort); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesFabricPortGetProperties; pDdiTable->pfnGetLinkType = loader::zesFabricPortGetLinkType; pDdiTable->pfnGetConfig = loader::zesFabricPortGetConfig; pDdiTable->pfnSetConfig = loader::zesFabricPortSetConfig; pDdiTable->pfnGetState = loader::zesFabricPortGetState; pDdiTable->pfnGetThroughput = loader::zesFabricPortGetThroughput; pDdiTable->pfnGetFabricErrorCounters = loader::zesFabricPortGetFabricErrorCounters; pDdiTable->pfnGetMultiPortThroughput = loader::zesFabricPortGetMultiPortThroughput; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.FabricPort; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetFabricPortProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Fan table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFanProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_fan_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetFanProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Fan); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesFanGetProperties; pDdiTable->pfnGetConfig = loader::zesFanGetConfig; pDdiTable->pfnSetDefaultMode = loader::zesFanSetDefaultMode; pDdiTable->pfnSetFixedSpeedMode = loader::zesFanSetFixedSpeedMode; pDdiTable->pfnSetSpeedTableMode = loader::zesFanSetSpeedTableMode; pDdiTable->pfnGetState = loader::zesFanGetState; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Fan; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetFanProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Firmware table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFirmwareProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_firmware_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetFirmwareProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Firmware); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesFirmwareGetProperties; pDdiTable->pfnFlash = loader::zesFirmwareFlash; pDdiTable->pfnGetFlashProgress = loader::zesFirmwareGetFlashProgress; pDdiTable->pfnGetConsoleLogs = loader::zesFirmwareGetConsoleLogs; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Firmware; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetFirmwareProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's FirmwareExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFirmwareExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_firmware_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetFirmwareExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.zes.FirmwareExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetSecurityVersionExp = loader::zesFirmwareGetSecurityVersionExp; pDdiTable->pfnSetSecurityVersionExp = loader::zesFirmwareSetSecurityVersionExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.FirmwareExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetFirmwareExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Frequency table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetFrequencyProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_frequency_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetFrequencyProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Frequency); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesFrequencyGetProperties; pDdiTable->pfnGetAvailableClocks = loader::zesFrequencyGetAvailableClocks; pDdiTable->pfnGetRange = loader::zesFrequencyGetRange; pDdiTable->pfnSetRange = loader::zesFrequencySetRange; pDdiTable->pfnGetState = loader::zesFrequencyGetState; pDdiTable->pfnGetThrottleTime = loader::zesFrequencyGetThrottleTime; pDdiTable->pfnOcGetCapabilities = loader::zesFrequencyOcGetCapabilities; pDdiTable->pfnOcGetFrequencyTarget = loader::zesFrequencyOcGetFrequencyTarget; pDdiTable->pfnOcSetFrequencyTarget = loader::zesFrequencyOcSetFrequencyTarget; pDdiTable->pfnOcGetVoltageTarget = loader::zesFrequencyOcGetVoltageTarget; pDdiTable->pfnOcSetVoltageTarget = loader::zesFrequencyOcSetVoltageTarget; pDdiTable->pfnOcSetMode = loader::zesFrequencyOcSetMode; pDdiTable->pfnOcGetMode = loader::zesFrequencyOcGetMode; pDdiTable->pfnOcGetIccMax = loader::zesFrequencyOcGetIccMax; pDdiTable->pfnOcSetIccMax = loader::zesFrequencyOcSetIccMax; pDdiTable->pfnOcGetTjMax = loader::zesFrequencyOcGetTjMax; pDdiTable->pfnOcSetTjMax = loader::zesFrequencyOcSetTjMax; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Frequency; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetFrequencyProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Led table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetLedProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_led_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetLedProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Led); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesLedGetProperties; pDdiTable->pfnGetState = loader::zesLedGetState; pDdiTable->pfnSetState = loader::zesLedSetState; pDdiTable->pfnSetColor = loader::zesLedSetColor; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Led; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetLedProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Memory table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetMemoryProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_memory_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetMemoryProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Memory); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesMemoryGetProperties; pDdiTable->pfnGetState = loader::zesMemoryGetState; pDdiTable->pfnGetBandwidth = loader::zesMemoryGetBandwidth; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Memory; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetMemoryProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Overclock table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetOverclockProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_overclock_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetOverclockProcAddrTable") ); if(!getTable) { atLeastOneDriverValid = true; //It is valid to not have this proc addr table continue; } auto getTableResult = getTable( version, &drv.dditable.zes.Overclock); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetDomainProperties = loader::zesOverclockGetDomainProperties; pDdiTable->pfnGetDomainVFProperties = loader::zesOverclockGetDomainVFProperties; pDdiTable->pfnGetDomainControlProperties = loader::zesOverclockGetDomainControlProperties; pDdiTable->pfnGetControlCurrentValue = loader::zesOverclockGetControlCurrentValue; pDdiTable->pfnGetControlPendingValue = loader::zesOverclockGetControlPendingValue; pDdiTable->pfnSetControlUserValue = loader::zesOverclockSetControlUserValue; pDdiTable->pfnGetControlState = loader::zesOverclockGetControlState; pDdiTable->pfnGetVFPointValues = loader::zesOverclockGetVFPointValues; pDdiTable->pfnSetVFPointValues = loader::zesOverclockSetVFPointValues; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Overclock; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetOverclockProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's PerformanceFactor table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetPerformanceFactorProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_performance_factor_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetPerformanceFactorProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.PerformanceFactor); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesPerformanceFactorGetProperties; pDdiTable->pfnGetConfig = loader::zesPerformanceFactorGetConfig; pDdiTable->pfnSetConfig = loader::zesPerformanceFactorSetConfig; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.PerformanceFactor; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetPerformanceFactorProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Power table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetPowerProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_power_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetPowerProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Power); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesPowerGetProperties; pDdiTable->pfnGetEnergyCounter = loader::zesPowerGetEnergyCounter; pDdiTable->pfnGetLimits = loader::zesPowerGetLimits; pDdiTable->pfnSetLimits = loader::zesPowerSetLimits; pDdiTable->pfnGetEnergyThreshold = loader::zesPowerGetEnergyThreshold; pDdiTable->pfnSetEnergyThreshold = loader::zesPowerSetEnergyThreshold; pDdiTable->pfnGetLimitsExt = loader::zesPowerGetLimitsExt; pDdiTable->pfnSetLimitsExt = loader::zesPowerSetLimitsExt; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Power; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetPowerProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Psu table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetPsuProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_psu_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetPsuProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Psu); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesPsuGetProperties; pDdiTable->pfnGetState = loader::zesPsuGetState; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Psu; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetPsuProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Ras table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetRasProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_ras_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetRasProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Ras); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesRasGetProperties; pDdiTable->pfnGetConfig = loader::zesRasGetConfig; pDdiTable->pfnSetConfig = loader::zesRasSetConfig; pDdiTable->pfnGetState = loader::zesRasGetState; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Ras; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetRasProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's RasExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetRasExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_ras_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetRasExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.zes.RasExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetStateExp = loader::zesRasGetStateExp; pDdiTable->pfnClearStateExp = loader::zesRasClearStateExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.RasExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetRasExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Scheduler table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetSchedulerProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_scheduler_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetSchedulerProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Scheduler); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesSchedulerGetProperties; pDdiTable->pfnGetCurrentMode = loader::zesSchedulerGetCurrentMode; pDdiTable->pfnGetTimeoutModeProperties = loader::zesSchedulerGetTimeoutModeProperties; pDdiTable->pfnGetTimesliceModeProperties = loader::zesSchedulerGetTimesliceModeProperties; pDdiTable->pfnSetTimeoutMode = loader::zesSchedulerSetTimeoutMode; pDdiTable->pfnSetTimesliceMode = loader::zesSchedulerSetTimesliceMode; pDdiTable->pfnSetExclusiveMode = loader::zesSchedulerSetExclusiveMode; pDdiTable->pfnSetComputeUnitDebugMode = loader::zesSchedulerSetComputeUnitDebugMode; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Scheduler; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetSchedulerProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Standby table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetStandbyProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_standby_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetStandbyProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Standby); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesStandbyGetProperties; pDdiTable->pfnGetMode = loader::zesStandbyGetMode; pDdiTable->pfnSetMode = loader::zesStandbySetMode; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Standby; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetStandbyProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Temperature table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetTemperatureProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_temperature_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetTemperatureProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zes.Temperature); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProperties = loader::zesTemperatureGetProperties; pDdiTable->pfnGetConfig = loader::zesTemperatureGetConfig; pDdiTable->pfnSetConfig = loader::zesTemperatureSetConfig; pDdiTable->pfnGetState = loader::zesTemperatureGetState; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.Temperature; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetTemperatureProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's VFManagementExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zesGetVFManagementExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zes_vf_management_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->sysmanInstanceDrivers->size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : *loader::context->sysmanInstanceDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zesGetVFManagementExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.zes.VFManagementExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->sysmanInstanceDrivers->size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetVFCapabilitiesExp = loader::zesVFManagementGetVFCapabilitiesExp; pDdiTable->pfnGetVFMemoryUtilizationExp2 = loader::zesVFManagementGetVFMemoryUtilizationExp2; pDdiTable->pfnGetVFEngineUtilizationExp2 = loader::zesVFManagementGetVFEngineUtilizationExp2; pDdiTable->pfnGetVFCapabilitiesExp2 = loader::zesVFManagementGetVFCapabilitiesExp2; pDdiTable->pfnGetVFPropertiesExp = loader::zesVFManagementGetVFPropertiesExp; pDdiTable->pfnGetVFMemoryUtilizationExp = loader::zesVFManagementGetVFMemoryUtilizationExp; pDdiTable->pfnGetVFEngineUtilizationExp = loader::zesVFManagementGetVFEngineUtilizationExp; pDdiTable->pfnSetVFTelemetryModeExp = loader::zesVFManagementSetVFTelemetryModeExp; pDdiTable->pfnSetVFTelemetrySamplingIntervalExp = loader::zesVFManagementSetVFTelemetrySamplingIntervalExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->sysmanInstanceDrivers->front().dditable.zes.VFManagementExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zesGetVFManagementExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } #if defined(__cplusplus) }; #endif level-zero-1.20.6/source/loader/zes_ldrddi.h000066400000000000000000000075201475521542100207400ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zes_ldrddi.h * */ #pragma once namespace loader { /////////////////////////////////////////////////////////////////////////////// using zes_driver_object_t = object_t < zes_driver_handle_t >; using zes_driver_factory_t = singleton_factory_t < zes_driver_object_t, zes_driver_handle_t >; using zes_device_object_t = object_t < zes_device_handle_t >; using zes_device_factory_t = singleton_factory_t < zes_device_object_t, zes_device_handle_t >; using zes_sched_object_t = object_t < zes_sched_handle_t >; using zes_sched_factory_t = singleton_factory_t < zes_sched_object_t, zes_sched_handle_t >; using zes_perf_object_t = object_t < zes_perf_handle_t >; using zes_perf_factory_t = singleton_factory_t < zes_perf_object_t, zes_perf_handle_t >; using zes_pwr_object_t = object_t < zes_pwr_handle_t >; using zes_pwr_factory_t = singleton_factory_t < zes_pwr_object_t, zes_pwr_handle_t >; using zes_freq_object_t = object_t < zes_freq_handle_t >; using zes_freq_factory_t = singleton_factory_t < zes_freq_object_t, zes_freq_handle_t >; using zes_engine_object_t = object_t < zes_engine_handle_t >; using zes_engine_factory_t = singleton_factory_t < zes_engine_object_t, zes_engine_handle_t >; using zes_standby_object_t = object_t < zes_standby_handle_t >; using zes_standby_factory_t = singleton_factory_t < zes_standby_object_t, zes_standby_handle_t >; using zes_firmware_object_t = object_t < zes_firmware_handle_t >; using zes_firmware_factory_t = singleton_factory_t < zes_firmware_object_t, zes_firmware_handle_t >; using zes_mem_object_t = object_t < zes_mem_handle_t >; using zes_mem_factory_t = singleton_factory_t < zes_mem_object_t, zes_mem_handle_t >; using zes_fabric_port_object_t = object_t < zes_fabric_port_handle_t >; using zes_fabric_port_factory_t = singleton_factory_t < zes_fabric_port_object_t, zes_fabric_port_handle_t >; using zes_temp_object_t = object_t < zes_temp_handle_t >; using zes_temp_factory_t = singleton_factory_t < zes_temp_object_t, zes_temp_handle_t >; using zes_psu_object_t = object_t < zes_psu_handle_t >; using zes_psu_factory_t = singleton_factory_t < zes_psu_object_t, zes_psu_handle_t >; using zes_fan_object_t = object_t < zes_fan_handle_t >; using zes_fan_factory_t = singleton_factory_t < zes_fan_object_t, zes_fan_handle_t >; using zes_led_object_t = object_t < zes_led_handle_t >; using zes_led_factory_t = singleton_factory_t < zes_led_object_t, zes_led_handle_t >; using zes_ras_object_t = object_t < zes_ras_handle_t >; using zes_ras_factory_t = singleton_factory_t < zes_ras_object_t, zes_ras_handle_t >; using zes_diag_object_t = object_t < zes_diag_handle_t >; using zes_diag_factory_t = singleton_factory_t < zes_diag_object_t, zes_diag_handle_t >; using zes_overclock_object_t = object_t < zes_overclock_handle_t >; using zes_overclock_factory_t = singleton_factory_t < zes_overclock_object_t, zes_overclock_handle_t >; using zes_vf_object_t = object_t < zes_vf_handle_t >; using zes_vf_factory_t = singleton_factory_t < zes_vf_object_t, zes_vf_handle_t >; } level-zero-1.20.6/source/loader/zet_ldrddi.cpp000066400000000000000000005220121475521542100212720ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_ldrddi.cpp * */ #include "ze_loader_internal.h" namespace loader { /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetModuleGetDebugInfo __zedlllocal ze_result_t ZE_APICALL zetModuleGetDebugInfo( zet_module_handle_t hModule, ///< [in] handle of the module zet_module_debug_info_format_t format, ///< [in] debug info format requested size_t* pSize, ///< [in,out] size of debug info in bytes uint8_t* pDebugInfo ///< [in,out][optional] byte pointer to debug info ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hModule )->dditable; auto pfnGetDebugInfo = dditable->zet.Module.pfnGetDebugInfo; if( nullptr == pfnGetDebugInfo ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hModule = reinterpret_cast( hModule )->handle; // forward to device-driver result = pfnGetDebugInfo( hModule, format, pSize, pDebugInfo ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDeviceGetDebugProperties __zedlllocal ze_result_t ZE_APICALL zetDeviceGetDebugProperties( zet_device_handle_t hDevice, ///< [in] device handle zet_device_debug_properties_t* pDebugProperties ///< [in,out] query result for debug properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetDebugProperties = dditable->zet.Device.pfnGetDebugProperties; if( nullptr == pfnGetDebugProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetDebugProperties( hDevice, pDebugProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugAttach __zedlllocal ze_result_t ZE_APICALL zetDebugAttach( zet_device_handle_t hDevice, ///< [in] device handle const zet_debug_config_t* config, ///< [in] the debug configuration zet_debug_session_handle_t* phDebug ///< [out] debug session handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnAttach = dditable->zet.Debug.pfnAttach; if( nullptr == pfnAttach ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnAttach( hDevice, config, phDebug ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phDebug = reinterpret_cast( context->zet_debug_session_factory.getInstance( *phDebug, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugDetach __zedlllocal ze_result_t ZE_APICALL zetDebugDetach( zet_debug_session_handle_t hDebug ///< [in][release] debug session handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDebug )->dditable; auto pfnDetach = dditable->zet.Debug.pfnDetach; if( nullptr == pfnDetach ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDebug = reinterpret_cast( hDebug )->handle; // forward to device-driver result = pfnDetach( hDebug ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->zet_debug_session_factory.release( hDebug ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugReadEvent __zedlllocal ze_result_t ZE_APICALL zetDebugReadEvent( zet_debug_session_handle_t hDebug, ///< [in] debug session handle uint64_t timeout, ///< [in] if non-zero, then indicates the maximum time (in milliseconds) to ///< yield before returning ::ZE_RESULT_SUCCESS or ::ZE_RESULT_NOT_READY; ///< if zero, then immediately returns the status of the event; ///< if `UINT64_MAX`, then function will not return until complete or ///< device is lost. ///< Due to external dependencies, timeout may be rounded to the closest ///< value allowed by the accuracy of those dependencies. zet_debug_event_t* event ///< [in,out] a pointer to a ::zet_debug_event_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDebug )->dditable; auto pfnReadEvent = dditable->zet.Debug.pfnReadEvent; if( nullptr == pfnReadEvent ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDebug = reinterpret_cast( hDebug )->handle; // forward to device-driver result = pfnReadEvent( hDebug, timeout, event ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugAcknowledgeEvent __zedlllocal ze_result_t ZE_APICALL zetDebugAcknowledgeEvent( zet_debug_session_handle_t hDebug, ///< [in] debug session handle const zet_debug_event_t* event ///< [in] a pointer to a ::zet_debug_event_t. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDebug )->dditable; auto pfnAcknowledgeEvent = dditable->zet.Debug.pfnAcknowledgeEvent; if( nullptr == pfnAcknowledgeEvent ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDebug = reinterpret_cast( hDebug )->handle; // forward to device-driver result = pfnAcknowledgeEvent( hDebug, event ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugInterrupt __zedlllocal ze_result_t ZE_APICALL zetDebugInterrupt( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to interrupt ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDebug )->dditable; auto pfnInterrupt = dditable->zet.Debug.pfnInterrupt; if( nullptr == pfnInterrupt ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDebug = reinterpret_cast( hDebug )->handle; // forward to device-driver result = pfnInterrupt( hDebug, thread ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugResume __zedlllocal ze_result_t ZE_APICALL zetDebugResume( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread ///< [in] the thread to resume ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDebug )->dditable; auto pfnResume = dditable->zet.Debug.pfnResume; if( nullptr == pfnResume ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDebug = reinterpret_cast( hDebug )->handle; // forward to device-driver result = pfnResume( hDebug, thread ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugReadMemory __zedlllocal ze_result_t ZE_APICALL zetDebugReadMemory( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to read void* buffer ///< [in,out] a buffer to hold a copy of the memory ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDebug )->dditable; auto pfnReadMemory = dditable->zet.Debug.pfnReadMemory; if( nullptr == pfnReadMemory ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDebug = reinterpret_cast( hDebug )->handle; // forward to device-driver result = pfnReadMemory( hDebug, thread, desc, size, buffer ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugWriteMemory __zedlllocal ze_result_t ZE_APICALL zetDebugWriteMemory( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier. const zet_debug_memory_space_desc_t* desc, ///< [in] memory space descriptor size_t size, ///< [in] the number of bytes to write const void* buffer ///< [in] a buffer holding the pattern to write ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDebug )->dditable; auto pfnWriteMemory = dditable->zet.Debug.pfnWriteMemory; if( nullptr == pfnWriteMemory ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDebug = reinterpret_cast( hDebug )->handle; // forward to device-driver result = pfnWriteMemory( hDebug, thread, desc, size, buffer ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugGetRegisterSetProperties __zedlllocal ze_result_t ZE_APICALL zetDebugGetRegisterSetProperties( zet_device_handle_t hDevice, ///< [in] device handle uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetRegisterSetProperties = dditable->zet.Debug.pfnGetRegisterSetProperties; if( nullptr == pfnGetRegisterSetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetRegisterSetProperties( hDevice, pCount, pRegisterSetProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugGetThreadRegisterSetProperties __zedlllocal ze_result_t ZE_APICALL zetDebugGetThreadRegisterSetProperties( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier specifying a single stopped thread uint32_t* pCount, ///< [in,out] pointer to the number of register set properties. ///< if count is zero, then the driver shall update the value with the ///< total number of register set properties available. ///< if count is greater than the number of register set properties ///< available, then the driver shall update the value with the correct ///< number of registry set properties available. zet_debug_regset_properties_t* pRegisterSetProperties ///< [in,out][optional][range(0, *pCount)] array of query results for ///< register set properties. ///< if count is less than the number of register set properties available, ///< then driver shall only retrieve that number of register set properties. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDebug )->dditable; auto pfnGetThreadRegisterSetProperties = dditable->zet.Debug.pfnGetThreadRegisterSetProperties; if( nullptr == pfnGetThreadRegisterSetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDebug = reinterpret_cast( hDebug )->handle; // forward to device-driver result = pfnGetThreadRegisterSetProperties( hDebug, thread, pCount, pRegisterSetProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugReadRegisters __zedlllocal ze_result_t ZE_APICALL zetDebugReadRegisters( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to read; start+count must be less than or ///< equal to the `count` member of ::zet_debug_register_group_properties_t ///< for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDebug )->dditable; auto pfnReadRegisters = dditable->zet.Debug.pfnReadRegisters; if( nullptr == pfnReadRegisters ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDebug = reinterpret_cast( hDebug )->handle; // forward to device-driver result = pfnReadRegisters( hDebug, thread, type, start, count, pRegisterValues ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDebugWriteRegisters __zedlllocal ze_result_t ZE_APICALL zetDebugWriteRegisters( zet_debug_session_handle_t hDebug, ///< [in] debug session handle ze_device_thread_t thread, ///< [in] the thread identifier uint32_t type, ///< [in] register set type uint32_t start, ///< [in] the starting offset into the register state area; must be less ///< than the `count` member of ::zet_debug_regset_properties_t for the ///< type uint32_t count, ///< [in] the number of registers to write; start+count must be less than ///< or equal to the `count` member of ///< ::zet_debug_register_group_properties_t for the type void* pRegisterValues ///< [in,out][optional][range(0, count)] buffer of register values ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDebug )->dditable; auto pfnWriteRegisters = dditable->zet.Debug.pfnWriteRegisters; if( nullptr == pfnWriteRegisters ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDebug = reinterpret_cast( hDebug )->handle; // forward to device-driver result = pfnWriteRegisters( hDebug, thread, type, start, count, pRegisterValues ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupGet __zedlllocal ze_result_t ZE_APICALL zetMetricGroupGet( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric groups. ///< if count is zero, then the driver shall update the value with the ///< total number of metric groups available. ///< if count is greater than the number of metric groups available, then ///< the driver shall update the value with the correct number of metric ///< groups available. zet_metric_group_handle_t* phMetricGroups ///< [in,out][optional][range(0, *pCount)] array of handle of metric groups. ///< if count is less than the number of metric groups available, then ///< driver shall only retrieve that number of metric groups. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGet = dditable->zet.MetricGroup.pfnGet; if( nullptr == pfnGet ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGet( hDevice, pCount, phMetricGroups ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phMetricGroups ) && ( i < *pCount ); ++i ) phMetricGroups[ i ] = reinterpret_cast( context->zet_metric_group_factory.getInstance( phMetricGroups[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupGetProperties __zedlllocal ze_result_t ZE_APICALL zetMetricGroupGetProperties( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_properties_t* pProperties ///< [in,out] metric group properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricGroup )->dditable; auto pfnGetProperties = dditable->zet.MetricGroup.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricGroup = reinterpret_cast( hMetricGroup )->handle; // forward to device-driver result = pfnGetProperties( hMetricGroup, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCalculateMetricValues __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCalculateMetricValues( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pMetricValueCount, ///< [in,out] pointer to number of metric values calculated. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pMetricValueCount)] buffer of calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricGroup )->dditable; auto pfnCalculateMetricValues = dditable->zet.MetricGroup.pfnCalculateMetricValues; if( nullptr == pfnCalculateMetricValues ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricGroup = reinterpret_cast( hMetricGroup )->handle; // forward to device-driver result = pfnCalculateMetricValues( hMetricGroup, type, rawDataSize, pRawData, pMetricValueCount, pMetricValues ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGet __zedlllocal ze_result_t ZE_APICALL zetMetricGet( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group uint32_t* pCount, ///< [in,out] pointer to the number of metrics. ///< if count is zero, then the driver shall update the value with the ///< total number of metrics available. ///< if count is greater than the number of metrics available, then the ///< driver shall update the value with the correct number of metrics available. zet_metric_handle_t* phMetrics ///< [in,out][optional][range(0, *pCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metrics. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricGroup )->dditable; auto pfnGet = dditable->zet.Metric.pfnGet; if( nullptr == pfnGet ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricGroup = reinterpret_cast( hMetricGroup )->handle; // forward to device-driver result = pfnGet( hMetricGroup, pCount, phMetrics ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phMetrics ) && ( i < *pCount ); ++i ) phMetrics[ i ] = reinterpret_cast( context->zet_metric_factory.getInstance( phMetrics[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGetProperties __zedlllocal ze_result_t ZE_APICALL zetMetricGetProperties( zet_metric_handle_t hMetric, ///< [in] handle of the metric zet_metric_properties_t* pProperties ///< [in,out] metric properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetric )->dditable; auto pfnGetProperties = dditable->zet.Metric.pfnGetProperties; if( nullptr == pfnGetProperties ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetric = reinterpret_cast( hMetric )->handle; // forward to device-driver result = pfnGetProperties( hMetric, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetContextActivateMetricGroups __zedlllocal ze_result_t ZE_APICALL zetContextActivateMetricGroups( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t count, ///< [in] metric group count to activate; must be 0 if `nullptr == ///< phMetricGroups` zet_metric_group_handle_t* phMetricGroups ///< [in][optional][range(0, count)] handles of the metric groups to activate. ///< nullptr deactivates all previously used metric groups. ///< all metrics groups must come from a different domains. ///< metric query and metric stream must use activated metric groups. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnActivateMetricGroups = dditable->zet.Context.pfnActivateMetricGroups; if( nullptr == pfnActivateMetricGroups ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // convert loader handles to driver handles auto phMetricGroupsLocal = new zet_metric_group_handle_t [count]; for( size_t i = 0; ( nullptr != phMetricGroups ) && ( i < count ); ++i ) phMetricGroupsLocal[ i ] = reinterpret_cast( phMetricGroups[ i ] )->handle; // forward to device-driver result = pfnActivateMetricGroups( hContext, hDevice, count, phMetricGroupsLocal ); delete []phMetricGroupsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricStreamerOpen __zedlllocal ze_result_t ZE_APICALL zetMetricStreamerOpen( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_streamer_desc_t* desc, ///< [in,out] metric streamer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification zet_metric_streamer_handle_t* phMetricStreamer ///< [out] handle of metric streamer ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnOpen = dditable->zet.MetricStreamer.pfnOpen; if( nullptr == pfnOpen ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // convert loader handle to driver handle hMetricGroup = reinterpret_cast( hMetricGroup )->handle; // convert loader handle to driver handle hNotificationEvent = ( hNotificationEvent ) ? reinterpret_cast( hNotificationEvent )->handle : nullptr; // forward to device-driver result = pfnOpen( hContext, hDevice, hMetricGroup, desc, hNotificationEvent, phMetricStreamer ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phMetricStreamer = reinterpret_cast( context->zet_metric_streamer_factory.getInstance( *phMetricStreamer, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetCommandListAppendMetricStreamerMarker __zedlllocal ze_result_t ZE_APICALL zetCommandListAppendMetricStreamerMarker( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t value ///< [in] streamer marker value ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendMetricStreamerMarker = dditable->zet.CommandList.pfnAppendMetricStreamerMarker; if( nullptr == pfnAppendMetricStreamerMarker ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hMetricStreamer = reinterpret_cast( hMetricStreamer )->handle; // forward to device-driver result = pfnAppendMetricStreamerMarker( hCommandList, hMetricStreamer, value ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricStreamerClose __zedlllocal ze_result_t ZE_APICALL zetMetricStreamerClose( zet_metric_streamer_handle_t hMetricStreamer ///< [in][release] handle of the metric streamer ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricStreamer )->dditable; auto pfnClose = dditable->zet.MetricStreamer.pfnClose; if( nullptr == pfnClose ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricStreamer = reinterpret_cast( hMetricStreamer )->handle; // forward to device-driver result = pfnClose( hMetricStreamer ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->zet_metric_streamer_factory.release( hMetricStreamer ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricStreamerReadData __zedlllocal ze_result_t ZE_APICALL zetMetricStreamerReadData( zet_metric_streamer_handle_t hMetricStreamer, ///< [in] handle of the metric streamer uint32_t maxReportCount, ///< [in] the maximum number of reports the application wants to receive. ///< if `UINT32_MAX`, then function will retrieve all reports available size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing streamer ///< reports in raw format ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricStreamer )->dditable; auto pfnReadData = dditable->zet.MetricStreamer.pfnReadData; if( nullptr == pfnReadData ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricStreamer = reinterpret_cast( hMetricStreamer )->handle; // forward to device-driver result = pfnReadData( hMetricStreamer, maxReportCount, pRawDataSize, pRawData ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryPoolCreate __zedlllocal ze_result_t ZE_APICALL zetMetricQueryPoolCreate( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device zet_metric_group_handle_t hMetricGroup, ///< [in] metric group associated with the query object. const zet_metric_query_pool_desc_t* desc, ///< [in] metric query pool descriptor zet_metric_query_pool_handle_t* phMetricQueryPool ///< [out] handle of metric query pool ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnCreate = dditable->zet.MetricQueryPool.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // convert loader handle to driver handle hMetricGroup = reinterpret_cast( hMetricGroup )->handle; // forward to device-driver result = pfnCreate( hContext, hDevice, hMetricGroup, desc, phMetricQueryPool ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phMetricQueryPool = reinterpret_cast( context->zet_metric_query_pool_factory.getInstance( *phMetricQueryPool, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryPoolDestroy __zedlllocal ze_result_t ZE_APICALL zetMetricQueryPoolDestroy( zet_metric_query_pool_handle_t hMetricQueryPool ///< [in][release] handle of the metric query pool ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricQueryPool )->dditable; auto pfnDestroy = dditable->zet.MetricQueryPool.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricQueryPool = reinterpret_cast( hMetricQueryPool )->handle; // forward to device-driver result = pfnDestroy( hMetricQueryPool ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->zet_metric_query_pool_factory.release( hMetricQueryPool ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryCreate __zedlllocal ze_result_t ZE_APICALL zetMetricQueryCreate( zet_metric_query_pool_handle_t hMetricQueryPool,///< [in] handle of the metric query pool uint32_t index, ///< [in] index of the query within the pool zet_metric_query_handle_t* phMetricQuery ///< [out] handle of metric query ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricQueryPool )->dditable; auto pfnCreate = dditable->zet.MetricQuery.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricQueryPool = reinterpret_cast( hMetricQueryPool )->handle; // forward to device-driver result = pfnCreate( hMetricQueryPool, index, phMetricQuery ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phMetricQuery = reinterpret_cast( context->zet_metric_query_factory.getInstance( *phMetricQuery, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryDestroy __zedlllocal ze_result_t ZE_APICALL zetMetricQueryDestroy( zet_metric_query_handle_t hMetricQuery ///< [in][release] handle of metric query ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricQuery )->dditable; auto pfnDestroy = dditable->zet.MetricQuery.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricQuery = reinterpret_cast( hMetricQuery )->handle; // forward to device-driver result = pfnDestroy( hMetricQuery ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->zet_metric_query_factory.release( hMetricQuery ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryReset __zedlllocal ze_result_t ZE_APICALL zetMetricQueryReset( zet_metric_query_handle_t hMetricQuery ///< [in] handle of metric query ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricQuery )->dditable; auto pfnReset = dditable->zet.MetricQuery.pfnReset; if( nullptr == pfnReset ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricQuery = reinterpret_cast( hMetricQuery )->handle; // forward to device-driver result = pfnReset( hMetricQuery ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetCommandListAppendMetricQueryBegin __zedlllocal ze_result_t ZE_APICALL zetCommandListAppendMetricQueryBegin( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery ///< [in] handle of the metric query ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendMetricQueryBegin = dditable->zet.CommandList.pfnAppendMetricQueryBegin; if( nullptr == pfnAppendMetricQueryBegin ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hMetricQuery = reinterpret_cast( hMetricQuery )->handle; // forward to device-driver result = pfnAppendMetricQueryBegin( hCommandList, hMetricQuery ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetCommandListAppendMetricQueryEnd __zedlllocal ze_result_t ZE_APICALL zetCommandListAppendMetricQueryEnd( zet_command_list_handle_t hCommandList, ///< [in] handle of the command list zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query ze_event_handle_t hSignalEvent, ///< [in][optional] handle of the event to signal on completion uint32_t numWaitEvents, ///< [in] must be zero ze_event_handle_t* phWaitEvents ///< [in][mbz] must be nullptr ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendMetricQueryEnd = dditable->zet.CommandList.pfnAppendMetricQueryEnd; if( nullptr == pfnAppendMetricQueryEnd ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // convert loader handle to driver handle hMetricQuery = reinterpret_cast( hMetricQuery )->handle; // convert loader handle to driver handle hSignalEvent = ( hSignalEvent ) ? reinterpret_cast( hSignalEvent )->handle : nullptr; // convert loader handles to driver handles auto phWaitEventsLocal = new ze_event_handle_t [numWaitEvents]; for( size_t i = 0; ( nullptr != phWaitEvents ) && ( i < numWaitEvents ); ++i ) phWaitEventsLocal[ i ] = reinterpret_cast( phWaitEvents[ i ] )->handle; // forward to device-driver result = pfnAppendMetricQueryEnd( hCommandList, hMetricQuery, hSignalEvent, numWaitEvents, phWaitEventsLocal ); delete []phWaitEventsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetCommandListAppendMetricMemoryBarrier __zedlllocal ze_result_t ZE_APICALL zetCommandListAppendMetricMemoryBarrier( zet_command_list_handle_t hCommandList ///< [in] handle of the command list ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hCommandList )->dditable; auto pfnAppendMetricMemoryBarrier = dditable->zet.CommandList.pfnAppendMetricMemoryBarrier; if( nullptr == pfnAppendMetricMemoryBarrier ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hCommandList = reinterpret_cast( hCommandList )->handle; // forward to device-driver result = pfnAppendMetricMemoryBarrier( hCommandList ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricQueryGetData __zedlllocal ze_result_t ZE_APICALL zetMetricQueryGetData( zet_metric_query_handle_t hMetricQuery, ///< [in] handle of the metric query size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all reports available. ///< if size is non-zero, then driver will only retrieve the number of ///< reports that fit into the buffer. ///< if size is larger than size needed for all reports, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing query ///< reports in raw format ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricQuery )->dditable; auto pfnGetData = dditable->zet.MetricQuery.pfnGetData; if( nullptr == pfnGetData ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricQuery = reinterpret_cast( hMetricQuery )->handle; // forward to device-driver result = pfnGetData( hMetricQuery, pRawDataSize, pRawData ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetKernelGetProfileInfo __zedlllocal ze_result_t ZE_APICALL zetKernelGetProfileInfo( zet_kernel_handle_t hKernel, ///< [in] handle to kernel zet_profile_properties_t* pProfileProperties ///< [out] pointer to profile properties ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hKernel )->dditable; auto pfnGetProfileInfo = dditable->zet.Kernel.pfnGetProfileInfo; if( nullptr == pfnGetProfileInfo ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hKernel = reinterpret_cast( hKernel )->handle; // forward to device-driver result = pfnGetProfileInfo( hKernel, pProfileProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpCreate __zedlllocal ze_result_t ZE_APICALL zetTracerExpCreate( zet_context_handle_t hContext, ///< [in] handle of the context object const zet_tracer_exp_desc_t* desc, ///< [in] pointer to tracer descriptor zet_tracer_exp_handle_t* phTracer ///< [out] pointer to handle of tracer object created ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnCreate = dditable->zet.TracerExp.pfnCreate; if( nullptr == pfnCreate ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // forward to device-driver result = pfnCreate( hContext, desc, phTracer ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phTracer = reinterpret_cast( context->zet_tracer_exp_factory.getInstance( *phTracer, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpDestroy __zedlllocal ze_result_t ZE_APICALL zetTracerExpDestroy( zet_tracer_exp_handle_t hTracer ///< [in][release] handle of tracer object to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hTracer )->dditable; auto pfnDestroy = dditable->zet.TracerExp.pfnDestroy; if( nullptr == pfnDestroy ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hTracer = reinterpret_cast( hTracer )->handle; // forward to device-driver result = pfnDestroy( hTracer ); if( ZE_RESULT_SUCCESS != result ) return result; // release loader handle context->zet_tracer_exp_factory.release( hTracer ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpSetPrologues __zedlllocal ze_result_t ZE_APICALL zetTracerExpSetPrologues( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hTracer )->dditable; auto pfnSetPrologues = dditable->zet.TracerExp.pfnSetPrologues; if( nullptr == pfnSetPrologues ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hTracer = reinterpret_cast( hTracer )->handle; // forward to device-driver result = pfnSetPrologues( hTracer, pCoreCbs ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpSetEpilogues __zedlllocal ze_result_t ZE_APICALL zetTracerExpSetEpilogues( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer zet_core_callbacks_t* pCoreCbs ///< [in] pointer to table of 'core' callback function pointers ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hTracer )->dditable; auto pfnSetEpilogues = dditable->zet.TracerExp.pfnSetEpilogues; if( nullptr == pfnSetEpilogues ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hTracer = reinterpret_cast( hTracer )->handle; // forward to device-driver result = pfnSetEpilogues( hTracer, pCoreCbs ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetTracerExpSetEnabled __zedlllocal ze_result_t ZE_APICALL zetTracerExpSetEnabled( zet_tracer_exp_handle_t hTracer, ///< [in] handle of the tracer ze_bool_t enable ///< [in] enable the tracer if true; disable if false ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hTracer )->dditable; auto pfnSetEnabled = dditable->zet.TracerExp.pfnSetEnabled; if( nullptr == pfnSetEnabled ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hTracer = reinterpret_cast( hTracer )->handle; // forward to device-driver result = pfnSetEnabled( hTracer, enable ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDeviceGetConcurrentMetricGroupsExp __zedlllocal ze_result_t ZE_APICALL zetDeviceGetConcurrentMetricGroupsExp( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t * phMetricGroups, ///< [in,out] metrics groups to be re-arranged to be sets of concurrent ///< groups uint32_t * pMetricGroupsCountPerConcurrentGroup,///< [in,out][optional][*pConcurrentGroupCount] count of metric groups per ///< concurrent group. uint32_t * pConcurrentGroupCount ///< [out] number of concurrent groups. ///< The value of this parameter could be used to determine the number of ///< replays necessary. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetConcurrentMetricGroupsExp = dditable->zet.DeviceExp.pfnGetConcurrentMetricGroupsExp; if( nullptr == pfnGetConcurrentMetricGroupsExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetConcurrentMetricGroupsExp( hDevice, metricGroupCount, phMetricGroups, pMetricGroupsCountPerConcurrentGroup, pConcurrentGroupCount ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerCreateExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerCreateExp( zet_context_handle_t hContext, ///< [in] handle of the context object zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t metricGroupCount, ///< [in] metric group count zet_metric_group_handle_t* phMetricGroups, ///< [in][range(0, metricGroupCount )] handles of the metric groups to ///< trace zet_metric_tracer_exp_desc_t* desc, ///< [in,out] metric tracer descriptor ze_event_handle_t hNotificationEvent, ///< [in][optional] event used for report availability notification. Note: ///< If buffer is not drained when the event it flagged, there is a risk of ///< HW event buffer being overrun zet_metric_tracer_exp_handle_t* phMetricTracer ///< [out] handle of the metric tracer ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hContext )->dditable; auto pfnCreateExp = dditable->zet.MetricTracerExp.pfnCreateExp; if( nullptr == pfnCreateExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hContext = reinterpret_cast( hContext )->handle; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // convert loader handles to driver handles auto phMetricGroupsLocal = new zet_metric_group_handle_t [metricGroupCount ]; for( size_t i = 0; ( nullptr != phMetricGroups ) && ( i < metricGroupCount ); ++i ) phMetricGroupsLocal[ i ] = reinterpret_cast( phMetricGroups[ i ] )->handle; // convert loader handle to driver handle hNotificationEvent = ( hNotificationEvent ) ? reinterpret_cast( hNotificationEvent )->handle : nullptr; // forward to device-driver result = pfnCreateExp( hContext, hDevice, metricGroupCount, phMetricGroupsLocal, desc, hNotificationEvent, phMetricTracer ); delete []phMetricGroupsLocal; if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phMetricTracer = reinterpret_cast( context->zet_metric_tracer_exp_factory.getInstance( *phMetricTracer, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerDestroyExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerDestroyExp( zet_metric_tracer_exp_handle_t hMetricTracer ///< [in] handle of the metric tracer ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricTracer )->dditable; auto pfnDestroyExp = dditable->zet.MetricTracerExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricTracer = reinterpret_cast( hMetricTracer )->handle; // forward to device-driver result = pfnDestroyExp( hMetricTracer ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerEnableExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerEnableExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_NOT_READY will be returned ///< when the tracer is inactive. ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricTracer )->dditable; auto pfnEnableExp = dditable->zet.MetricTracerExp.pfnEnableExp; if( nullptr == pfnEnableExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricTracer = reinterpret_cast( hMetricTracer )->handle; // forward to device-driver result = pfnEnableExp( hMetricTracer, synchronous ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerDisableExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerDisableExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer ze_bool_t synchronous ///< [in] request synchronous behavior. Confirmation of successful ///< asynchronous operation is done by calling ::zetMetricTracerReadDataExp() ///< and checking the return status: ::ZE_RESULT_SUCCESS will be returned ///< when the tracer is active or when it is inactive but still has data. ///< ::ZE_RESULT_NOT_READY will be returned when the tracer is inactive and ///< has no more data to be retrieved. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricTracer )->dditable; auto pfnDisableExp = dditable->zet.MetricTracerExp.pfnDisableExp; if( nullptr == pfnDisableExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricTracer = reinterpret_cast( hMetricTracer )->handle; // forward to device-driver result = pfnDisableExp( hMetricTracer, synchronous ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerReadDataExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerReadDataExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer size_t* pRawDataSize, ///< [in,out] pointer to size in bytes of raw data requested to read. ///< if size is zero, then the driver will update the value with the total ///< size in bytes needed for all data available. ///< if size is non-zero, then driver will only retrieve that amount of ///< data. ///< if size is larger than size needed for all data, then driver will ///< update the value with the actual size needed. uint8_t* pRawData ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricTracer )->dditable; auto pfnReadDataExp = dditable->zet.MetricTracerExp.pfnReadDataExp; if( nullptr == pfnReadDataExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricTracer = reinterpret_cast( hMetricTracer )->handle; // forward to device-driver result = pfnReadDataExp( hMetricTracer, pRawDataSize, pRawData ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricDecoderCreateExp __zedlllocal ze_result_t ZE_APICALL zetMetricDecoderCreateExp( zet_metric_tracer_exp_handle_t hMetricTracer, ///< [in] handle of the metric tracer zet_metric_decoder_exp_handle_t* phMetricDecoder///< [out] handle of the metric decoder object ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricTracer )->dditable; auto pfnCreateExp = dditable->zet.MetricDecoderExp.pfnCreateExp; if( nullptr == pfnCreateExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricTracer = reinterpret_cast( hMetricTracer )->handle; // forward to device-driver result = pfnCreateExp( hMetricTracer, phMetricDecoder ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phMetricDecoder = reinterpret_cast( context->zet_metric_decoder_exp_factory.getInstance( *phMetricDecoder, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricDecoderDestroyExp __zedlllocal ze_result_t ZE_APICALL zetMetricDecoderDestroyExp( zet_metric_decoder_exp_handle_t phMetricDecoder ///< [in] handle of the metric decoder object ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( phMetricDecoder )->dditable; auto pfnDestroyExp = dditable->zet.MetricDecoderExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle phMetricDecoder = reinterpret_cast( phMetricDecoder )->handle; // forward to device-driver result = pfnDestroyExp( phMetricDecoder ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricDecoderGetDecodableMetricsExp __zedlllocal ze_result_t ZE_APICALL zetMetricDecoderGetDecodableMetricsExp( zet_metric_decoder_exp_handle_t hMetricDecoder, ///< [in] handle of the metric decoder object uint32_t* pCount, ///< [in,out] pointer to number of decodable metric in the hMetricDecoder ///< handle. If count is zero, then the driver shall ///< update the value with the total number of decodable metrics available ///< in the decoder. if count is greater than zero ///< but less than the total number of decodable metrics available in the ///< decoder, then only that number will be returned. ///< if count is greater than the number of decodable metrics available in ///< the decoder, then the driver shall update the ///< value with the actual number of decodable metrics available. zet_metric_handle_t* phMetrics ///< [in,out] [range(0, *pCount)] array of handles of decodable metrics in ///< the hMetricDecoder handle provided. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricDecoder )->dditable; auto pfnGetDecodableMetricsExp = dditable->zet.MetricDecoderExp.pfnGetDecodableMetricsExp; if( nullptr == pfnGetDecodableMetricsExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricDecoder = reinterpret_cast( hMetricDecoder )->handle; // forward to device-driver result = pfnGetDecodableMetricsExp( hMetricDecoder, pCount, phMetrics ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phMetrics ) && ( i < *pCount ); ++i ) phMetrics[ i ] = reinterpret_cast( context->zet_metric_factory.getInstance( phMetrics[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricTracerDecodeExp __zedlllocal ze_result_t ZE_APICALL zetMetricTracerDecodeExp( zet_metric_decoder_exp_handle_t phMetricDecoder,///< [in] handle of the metric decoder object size_t* pRawDataSize, ///< [in,out] size in bytes of raw data buffer. If pMetricEntriesCount is ///< greater than zero but less than total number of ///< decodable metrics available in the raw data buffer, then driver shall ///< update this value with actual number of raw ///< data bytes processed. uint8_t* pRawData, ///< [in,out][optional][range(0, *pRawDataSize)] buffer containing tracer ///< data in raw format uint32_t metricsCount, ///< [in] number of decodable metrics in the tracer for which the ///< hMetricDecoder handle was provided. See ///< ::zetMetricDecoderGetDecodableMetricsExp(). If metricCount is greater ///< than zero but less than the number decodable ///< metrics available in the raw data buffer, then driver shall only ///< decode those. zet_metric_handle_t* phMetrics, ///< [in] [range(0, metricsCount)] array of handles of decodable metrics in ///< the decoder for which the hMetricDecoder handle was ///< provided. Metrics handles are expected to be for decodable metrics, ///< see ::zetMetricDecoderGetDecodableMetricsExp() uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. If count is zero, then the ///< driver shall update the value with the total ///< number of metric sets to be decoded. If count is greater than the ///< number available in the raw data buffer, then the ///< driver shall update the value with the actual number of metric sets to ///< be decoded. There is a 1:1 relation between ///< the number of sets and sub-devices returned in the decoded entries. uint32_t* pMetricEntriesCountPerSet, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric entries ///< counts per metric set, one value per set. uint32_t* pMetricEntriesCount, ///< [in,out] pointer to the total number of metric entries decoded, for ///< all metric sets. If count is zero, then the ///< driver shall update the value with the total number of metric entries ///< to be decoded. If count is greater than zero ///< but less than the total number of metric entries available in the raw ///< data, then user provided number will be decoded. ///< If count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with ///< the actual number of decodable metric entries decoded. If set to null, ///< then driver will only update the value of ///< pSetCount. zet_metric_entry_exp_t* pMetricEntries ///< [in,out][optional][range(0, *pMetricEntriesCount)] buffer containing ///< decoded metric entries ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( phMetricDecoder )->dditable; auto pfnDecodeExp = dditable->zet.MetricTracerExp.pfnDecodeExp; if( nullptr == pfnDecodeExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle phMetricDecoder = reinterpret_cast( phMetricDecoder )->handle; // convert loader handles to driver handles auto phMetricsLocal = new zet_metric_handle_t [metricsCount]; for( size_t i = 0; ( nullptr != phMetrics ) && ( i < metricsCount ); ++i ) phMetricsLocal[ i ] = reinterpret_cast( phMetrics[ i ] )->handle; // forward to device-driver result = pfnDecodeExp( phMetricDecoder, pRawDataSize, pRawData, metricsCount, phMetricsLocal, pSetCount, pMetricEntriesCountPerSet, pMetricEntriesCount, pMetricEntries ); delete []phMetricsLocal; return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCalculateMultipleMetricValuesExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCalculateMultipleMetricValuesExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer const uint8_t* pRawData, ///< [in][range(0, rawDataSize)] buffer of raw data to calculate uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricGroup )->dditable; auto pfnCalculateMultipleMetricValuesExp = dditable->zet.MetricGroupExp.pfnCalculateMultipleMetricValuesExp; if( nullptr == pfnCalculateMultipleMetricValuesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricGroup = reinterpret_cast( hMetricGroup )->handle; // forward to device-driver result = pfnCalculateMultipleMetricValuesExp( hMetricGroup, type, rawDataSize, pRawData, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupGetGlobalTimestampsExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupGetGlobalTimestampsExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group ze_bool_t synchronizedWithHost, ///< [in] Returns the timestamps synchronized to the host or the device. uint64_t* globalTimestamp, ///< [out] Device timestamp. uint64_t* metricTimestamp ///< [out] Metric timestamp. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricGroup )->dditable; auto pfnGetGlobalTimestampsExp = dditable->zet.MetricGroupExp.pfnGetGlobalTimestampsExp; if( nullptr == pfnGetGlobalTimestampsExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricGroup = reinterpret_cast( hMetricGroup )->handle; // forward to device-driver result = pfnGetGlobalTimestampsExp( hMetricGroup, synchronizedWithHost, globalTimestamp, metricTimestamp ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupGetExportDataExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupGetExportDataExp( zet_metric_group_handle_t hMetricGroup, ///< [in] handle of the metric group const uint8_t* pRawData, ///< [in] buffer of raw data size_t rawDataSize, ///< [in] size in bytes of raw data buffer size_t* pExportDataSize, ///< [in,out] size in bytes of export data buffer ///< if size is zero, then the driver shall update the value with the ///< number of bytes necessary to store the exported data. ///< if size is greater than required, then the driver shall update the ///< value with the actual number of bytes necessary to store the exported data. uint8_t * pExportData ///< [in,out][optional][range(0, *pExportDataSize)] buffer of exported data. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricGroup )->dditable; auto pfnGetExportDataExp = dditable->zet.MetricGroupExp.pfnGetExportDataExp; if( nullptr == pfnGetExportDataExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricGroup = reinterpret_cast( hMetricGroup )->handle; // forward to device-driver result = pfnGetExportDataExp( hMetricGroup, pRawData, rawDataSize, pExportDataSize, pExportData ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCalculateMetricExportDataExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCalculateMetricExportDataExp( ze_driver_handle_t hDriver, ///< [in] handle of the driver instance zet_metric_group_calculation_type_t type, ///< [in] calculation type to be applied on raw data size_t exportDataSize, ///< [in] size in bytes of exported data buffer const uint8_t* pExportData, ///< [in][range(0, exportDataSize)] buffer of exported data to calculate zet_metric_calculate_exp_desc_t* pCalculateDescriptor, ///< [in] descriptor specifying calculation specific parameters uint32_t* pSetCount, ///< [in,out] pointer to number of metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric sets to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric sets to be calculated. uint32_t* pTotalMetricValueCount, ///< [in,out] pointer to number of the total number of metric values ///< calculated, for all metric sets. ///< if count is zero, then the driver shall update the value with the ///< total number of metric values to be calculated. ///< if count is greater than the number available in the raw data buffer, ///< then the driver shall update the value with the actual number of ///< metric values to be calculated. uint32_t* pMetricCounts, ///< [in,out][optional][range(0, *pSetCount)] buffer of metric counts per ///< metric set. zet_typed_value_t* pMetricValues ///< [in,out][optional][range(0, *pTotalMetricValueCount)] buffer of ///< calculated metrics. ///< if count is less than the number available in the raw data buffer, ///< then driver shall only calculate that number of metric values. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDriver )->dditable; auto pfnCalculateMetricExportDataExp = dditable->zet.MetricGroupExp.pfnCalculateMetricExportDataExp; if( nullptr == pfnCalculateMetricExportDataExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDriver = reinterpret_cast( hDriver )->handle; // forward to device-driver result = pfnCalculateMetricExportDataExp( hDriver, type, exportDataSize, pExportData, pCalculateDescriptor, pSetCount, pTotalMetricValueCount, pMetricCounts, pMetricValues ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricProgrammableGetExp __zedlllocal ze_result_t ZE_APICALL zetMetricProgrammableGetExp( zet_device_handle_t hDevice, ///< [in] handle of the device uint32_t* pCount, ///< [in,out] pointer to the number of metric programmable handles. ///< if count is zero, then the driver shall update the value with the ///< total number of metric programmable handles available. ///< if count is greater than the number of metric programmable handles ///< available, then the driver shall update the value with the correct ///< number of metric programmable handles available. zet_metric_programmable_exp_handle_t* phMetricProgrammables ///< [in,out][optional][range(0, *pCount)] array of handle of metric programmables. ///< if count is less than the number of metric programmables available, ///< then driver shall only retrieve that number of metric programmables. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnGetExp = dditable->zet.MetricProgrammableExp.pfnGetExp; if( nullptr == pfnGetExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnGetExp( hDevice, pCount, phMetricProgrammables ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phMetricProgrammables ) && ( i < *pCount ); ++i ) phMetricProgrammables[ i ] = reinterpret_cast( context->zet_metric_programmable_exp_factory.getInstance( phMetricProgrammables[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricProgrammableGetPropertiesExp __zedlllocal ze_result_t ZE_APICALL zetMetricProgrammableGetPropertiesExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_exp_properties_t* pProperties ///< [in,out] properties of the metric programmable ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricProgrammable )->dditable; auto pfnGetPropertiesExp = dditable->zet.MetricProgrammableExp.pfnGetPropertiesExp; if( nullptr == pfnGetPropertiesExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricProgrammable = reinterpret_cast( hMetricProgrammable )->handle; // forward to device-driver result = pfnGetPropertiesExp( hMetricProgrammable, pProperties ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricProgrammableGetParamInfoExp __zedlllocal ze_result_t ZE_APICALL zetMetricProgrammableGetParamInfoExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t* pParameterCount, ///< [in,out] count of the parameters to retrieve parameter info. ///< if value pParameterCount is greater than count of parameters ///< available, then pParameterCount will be updated with count of ///< parameters available. ///< The count of parameters available can be queried using ::zetMetricProgrammableGetPropertiesExp. zet_metric_programmable_param_info_exp_t* pParameterInfo///< [in,out][range(1, *pParameterCount)] array of parameter info. ///< if parameterCount is less than the number of parameters available, ///< then driver shall only retrieve that number of parameter info. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricProgrammable )->dditable; auto pfnGetParamInfoExp = dditable->zet.MetricProgrammableExp.pfnGetParamInfoExp; if( nullptr == pfnGetParamInfoExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricProgrammable = reinterpret_cast( hMetricProgrammable )->handle; // forward to device-driver result = pfnGetParamInfoExp( hMetricProgrammable, pParameterCount, pParameterInfo ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricProgrammableGetParamValueInfoExp __zedlllocal ze_result_t ZE_APICALL zetMetricProgrammableGetParamValueInfoExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterOrdinal, ///< [in] ordinal of the parameter in the metric programmable uint32_t* pValueInfoCount, ///< [in,out] count of parameter value information to retrieve. ///< if value at pValueInfoCount is greater than count of value info ///< available, then pValueInfoCount will be updated with count of value ///< info available. ///< The count of parameter value info available can be queried using ::zetMetricProgrammableGetParamInfoExp. zet_metric_programmable_param_value_info_exp_t* pValueInfo ///< [in,out][range(1, *pValueInfoCount)] array of parameter value info. ///< if pValueInfoCount is less than the number of value info available, ///< then driver shall only retrieve that number of value info. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricProgrammable )->dditable; auto pfnGetParamValueInfoExp = dditable->zet.MetricProgrammableExp.pfnGetParamValueInfoExp; if( nullptr == pfnGetParamValueInfoExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricProgrammable = reinterpret_cast( hMetricProgrammable )->handle; // forward to device-driver result = pfnGetParamValueInfoExp( hMetricProgrammable, parameterOrdinal, pValueInfoCount, pValueInfo ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricCreateFromProgrammableExp2 __zedlllocal ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp2( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable uint32_t parameterCount, ///< [in] Count of parameters to set. zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricProgrammable )->dditable; auto pfnCreateFromProgrammableExp2 = dditable->zet.MetricExp.pfnCreateFromProgrammableExp2; if( nullptr == pfnCreateFromProgrammableExp2 ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricProgrammable = reinterpret_cast( hMetricProgrammable )->handle; // forward to device-driver result = pfnCreateFromProgrammableExp2( hMetricProgrammable, parameterCount, pParameterValues, pName, pDescription, pMetricHandleCount, phMetricHandles ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phMetricHandles ) && ( i < *pMetricHandleCount ); ++i ) phMetricHandles[ i ] = reinterpret_cast( context->zet_metric_factory.getInstance( phMetricHandles[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricCreateFromProgrammableExp __zedlllocal ze_result_t ZE_APICALL zetMetricCreateFromProgrammableExp( zet_metric_programmable_exp_handle_t hMetricProgrammable, ///< [in] handle of the metric programmable zet_metric_programmable_param_value_exp_t* pParameterValues,///< [in] list of parameter values to be set. uint32_t parameterCount, ///< [in] Count of parameters to set. const char* pName, ///< [in] pointer to metric name to be used. Must point to a ///< null-terminated character array no longer than ::ZET_MAX_METRIC_NAME. const char* pDescription, ///< [in] pointer to metric description to be used. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_DESCRIPTION. uint32_t* pMetricHandleCount, ///< [in,out] Pointer to the number of metric handles. ///< if count is zero, then the driver shall update the value with the ///< number of metric handles available for this programmable. ///< if count is greater than the number of metric handles available, then ///< the driver shall update the value with the correct number of metric ///< handles available. zet_metric_handle_t* phMetricHandles ///< [in,out][optional][range(0,*pMetricHandleCount)] array of handle of metrics. ///< if count is less than the number of metrics available, then driver ///< shall only retrieve that number of metric handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricProgrammable )->dditable; auto pfnCreateFromProgrammableExp = dditable->zet.MetricExp.pfnCreateFromProgrammableExp; if( nullptr == pfnCreateFromProgrammableExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricProgrammable = reinterpret_cast( hMetricProgrammable )->handle; // forward to device-driver result = pfnCreateFromProgrammableExp( hMetricProgrammable, pParameterValues, parameterCount, pName, pDescription, pMetricHandleCount, phMetricHandles ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phMetricHandles ) && ( i < *pMetricHandleCount ); ++i ) phMetricHandles[ i ] = reinterpret_cast( context->zet_metric_factory.getInstance( phMetricHandles[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetDeviceCreateMetricGroupsFromMetricsExp __zedlllocal ze_result_t ZE_APICALL zetDeviceCreateMetricGroupsFromMetricsExp( zet_device_handle_t hDevice, ///< [in] handle of the device. uint32_t metricCount, ///< [in] number of metric handles. zet_metric_handle_t * phMetrics, ///< [in] metric handles to be added to the metric groups. const char * pMetricGroupNamePrefix, ///< [in] prefix to the name created for the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_NAME_PREFIX_EXP. const char * pDescription, ///< [in] pointer to description of the metric groups. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. uint32_t * pMetricGroupCount, ///< [in,out] pointer to the number of metric group handles to be created. ///< if pMetricGroupCount is zero, then the driver shall update the value ///< with the maximum possible number of metric group handles that could be created. ///< if pMetricGroupCount is greater than the number of metric group ///< handles that could be created, then the driver shall update the value ///< with the correct number of metric group handles generated. ///< if pMetricGroupCount is lesser than the number of metric group handles ///< that could be created, then ::ZE_RESULT_ERROR_INVALID_ARGUMENT is returned. zet_metric_group_handle_t* phMetricGroup ///< [in,out][optional][range(0, *pMetricGroupCount)] array of handle of ///< metric group handles. ///< Created Metric group handles. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnCreateMetricGroupsFromMetricsExp = dditable->zet.DeviceExp.pfnCreateMetricGroupsFromMetricsExp; if( nullptr == pfnCreateMetricGroupsFromMetricsExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnCreateMetricGroupsFromMetricsExp( hDevice, metricCount, phMetrics, pMetricGroupNamePrefix, pDescription, pMetricGroupCount, phMetricGroup ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handles to loader handles for( size_t i = 0; ( nullptr != phMetricGroup ) && ( i < *pMetricGroupCount ); ++i ) phMetricGroup[ i ] = reinterpret_cast( context->zet_metric_group_factory.getInstance( phMetricGroup[ i ], dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCreateExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCreateExp( zet_device_handle_t hDevice, ///< [in] handle of the device const char* pName, ///< [in] pointer to metric group name. Must point to a null-terminated ///< character array no longer than ::ZET_MAX_METRIC_GROUP_NAME. const char* pDescription, ///< [in] pointer to metric group description. Must point to a ///< null-terminated character array no longer than ///< ::ZET_MAX_METRIC_GROUP_DESCRIPTION. zet_metric_group_sampling_type_flags_t samplingType,///< [in] Sampling type for the metric group. zet_metric_group_handle_t* phMetricGroup ///< [in,out] Created Metric group handle ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hDevice )->dditable; auto pfnCreateExp = dditable->zet.MetricGroupExp.pfnCreateExp; if( nullptr == pfnCreateExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hDevice = reinterpret_cast( hDevice )->handle; // forward to device-driver result = pfnCreateExp( hDevice, pName, pDescription, samplingType, phMetricGroup ); if( ZE_RESULT_SUCCESS != result ) return result; try { // convert driver handle to loader handle *phMetricGroup = reinterpret_cast( context->zet_metric_group_factory.getInstance( *phMetricGroup, dditable ) ); } catch( std::bad_alloc& ) { result = ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY; } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupAddMetricExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupAddMetricExp( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric, ///< [in] Metric to be added to the group. size_t * pErrorStringSize, ///< [in,out][optional] Size of the error string to query, if an error was ///< reported during adding the metric handle. ///< if *pErrorStringSize is zero, then the driver shall update the value ///< with the size of the error string in bytes. char* pErrorString ///< [in,out][optional][range(0, *pErrorStringSize)] Error string. ///< if *pErrorStringSize is less than the length of the error string ///< available, then driver shall only retrieve that length of error string. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricGroup )->dditable; auto pfnAddMetricExp = dditable->zet.MetricGroupExp.pfnAddMetricExp; if( nullptr == pfnAddMetricExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricGroup = reinterpret_cast( hMetricGroup )->handle; // convert loader handle to driver handle hMetric = reinterpret_cast( hMetric )->handle; // forward to device-driver result = pfnAddMetricExp( hMetricGroup, hMetric, pErrorStringSize, pErrorString ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupRemoveMetricExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupRemoveMetricExp( zet_metric_group_handle_t hMetricGroup, ///< [in] Handle of the metric group zet_metric_handle_t hMetric ///< [in] Metric handle to be removed from the metric group. ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricGroup )->dditable; auto pfnRemoveMetricExp = dditable->zet.MetricGroupExp.pfnRemoveMetricExp; if( nullptr == pfnRemoveMetricExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricGroup = reinterpret_cast( hMetricGroup )->handle; // convert loader handle to driver handle hMetric = reinterpret_cast( hMetric )->handle; // forward to device-driver result = pfnRemoveMetricExp( hMetricGroup, hMetric ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupCloseExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupCloseExp( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricGroup )->dditable; auto pfnCloseExp = dditable->zet.MetricGroupExp.pfnCloseExp; if( nullptr == pfnCloseExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricGroup = reinterpret_cast( hMetricGroup )->handle; // forward to device-driver result = pfnCloseExp( hMetricGroup ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricGroupDestroyExp __zedlllocal ze_result_t ZE_APICALL zetMetricGroupDestroyExp( zet_metric_group_handle_t hMetricGroup ///< [in] Handle of the metric group to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetricGroup )->dditable; auto pfnDestroyExp = dditable->zet.MetricGroupExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetricGroup = reinterpret_cast( hMetricGroup )->handle; // forward to device-driver result = pfnDestroyExp( hMetricGroup ); return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for zetMetricDestroyExp __zedlllocal ze_result_t ZE_APICALL zetMetricDestroyExp( zet_metric_handle_t hMetric ///< [in] Handle of the metric to destroy ) { ze_result_t result = ZE_RESULT_SUCCESS; // extract driver's function pointer table auto dditable = reinterpret_cast( hMetric )->dditable; auto pfnDestroyExp = dditable->zet.MetricExp.pfnDestroyExp; if( nullptr == pfnDestroyExp ) return ZE_RESULT_ERROR_UNINITIALIZED; // convert loader handle to driver handle hMetric = reinterpret_cast( hMetric )->handle; // forward to device-driver result = pfnDestroyExp( hMetric ); return result; } } // namespace loader #if defined(__cplusplus) extern "C" { #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricDecoderExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricDecoderExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_decoder_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetMetricDecoderExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.zet.MetricDecoderExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreateExp = loader::zetMetricDecoderCreateExp; pDdiTable->pfnDestroyExp = loader::zetMetricDecoderDestroyExp; pDdiTable->pfnGetDecodableMetricsExp = loader::zetMetricDecoderGetDecodableMetricsExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.MetricDecoderExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetMetricDecoderExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricProgrammableExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricProgrammableExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_programmable_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetMetricProgrammableExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.zet.MetricProgrammableExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetExp = loader::zetMetricProgrammableGetExp; pDdiTable->pfnGetPropertiesExp = loader::zetMetricProgrammableGetPropertiesExp; pDdiTable->pfnGetParamInfoExp = loader::zetMetricProgrammableGetParamInfoExp; pDdiTable->pfnGetParamValueInfoExp = loader::zetMetricProgrammableGetParamValueInfoExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.MetricProgrammableExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetMetricProgrammableExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricTracerExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricTracerExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_tracer_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetMetricTracerExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.zet.MetricTracerExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreateExp = loader::zetMetricTracerCreateExp; pDdiTable->pfnDestroyExp = loader::zetMetricTracerDestroyExp; pDdiTable->pfnEnableExp = loader::zetMetricTracerEnableExp; pDdiTable->pfnDisableExp = loader::zetMetricTracerDisableExp; pDdiTable->pfnReadDataExp = loader::zetMetricTracerReadDataExp; pDdiTable->pfnDecodeExp = loader::zetMetricTracerDecodeExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.MetricTracerExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetMetricTracerExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Device table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDeviceProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_device_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetDeviceProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zet.Device); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetDebugProperties = loader::zetDeviceGetDebugProperties; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.Device; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetDeviceProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's DeviceExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDeviceExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_device_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetDeviceExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.zet.DeviceExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetConcurrentMetricGroupsExp = loader::zetDeviceGetConcurrentMetricGroupsExp; pDdiTable->pfnCreateMetricGroupsFromMetricsExp = loader::zetDeviceCreateMetricGroupsFromMetricsExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.DeviceExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetDeviceExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Context table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetContextProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_context_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetContextProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zet.Context); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnActivateMetricGroups = loader::zetContextActivateMetricGroups; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.Context; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetContextProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's CommandList table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetCommandListProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_command_list_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetCommandListProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zet.CommandList); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnAppendMetricStreamerMarker = loader::zetCommandListAppendMetricStreamerMarker; pDdiTable->pfnAppendMetricQueryBegin = loader::zetCommandListAppendMetricQueryBegin; pDdiTable->pfnAppendMetricQueryEnd = loader::zetCommandListAppendMetricQueryEnd; pDdiTable->pfnAppendMetricMemoryBarrier = loader::zetCommandListAppendMetricMemoryBarrier; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.CommandList; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetCommandListProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Kernel table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetKernelProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_kernel_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetKernelProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zet.Kernel); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetProfileInfo = loader::zetKernelGetProfileInfo; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.Kernel; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetKernelProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Module table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetModuleProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_module_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetModuleProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zet.Module); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGetDebugInfo = loader::zetModuleGetDebugInfo; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.Module; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetModuleProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Debug table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetDebugProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_debug_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetDebugProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zet.Debug); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnAttach = loader::zetDebugAttach; pDdiTable->pfnDetach = loader::zetDebugDetach; pDdiTable->pfnReadEvent = loader::zetDebugReadEvent; pDdiTable->pfnAcknowledgeEvent = loader::zetDebugAcknowledgeEvent; pDdiTable->pfnInterrupt = loader::zetDebugInterrupt; pDdiTable->pfnResume = loader::zetDebugResume; pDdiTable->pfnReadMemory = loader::zetDebugReadMemory; pDdiTable->pfnWriteMemory = loader::zetDebugWriteMemory; pDdiTable->pfnGetRegisterSetProperties = loader::zetDebugGetRegisterSetProperties; pDdiTable->pfnReadRegisters = loader::zetDebugReadRegisters; pDdiTable->pfnWriteRegisters = loader::zetDebugWriteRegisters; pDdiTable->pfnGetThreadRegisterSetProperties = loader::zetDebugGetThreadRegisterSetProperties; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.Debug; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetDebugProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Metric table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetMetricProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zet.Metric); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGet = loader::zetMetricGet; pDdiTable->pfnGetProperties = loader::zetMetricGetProperties; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.Metric; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetMetricProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetMetricExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.zet.MetricExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreateFromProgrammableExp2 = loader::zetMetricCreateFromProgrammableExp2; pDdiTable->pfnCreateFromProgrammableExp = loader::zetMetricCreateFromProgrammableExp; pDdiTable->pfnDestroyExp = loader::zetMetricDestroyExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.MetricExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetMetricExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricGroup table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricGroupProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_group_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetMetricGroupProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zet.MetricGroup); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnGet = loader::zetMetricGroupGet; pDdiTable->pfnGetProperties = loader::zetMetricGroupGetProperties; pDdiTable->pfnCalculateMetricValues = loader::zetMetricGroupCalculateMetricValues; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.MetricGroup; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetMetricGroupProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricGroupExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricGroupExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_group_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetMetricGroupExpProcAddrTable") ); if(!getTable) continue; result = getTable( version, &drv.dditable.zet.MetricGroupExp); } if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCalculateMultipleMetricValuesExp = loader::zetMetricGroupCalculateMultipleMetricValuesExp; pDdiTable->pfnGetGlobalTimestampsExp = loader::zetMetricGroupGetGlobalTimestampsExp; pDdiTable->pfnGetExportDataExp = loader::zetMetricGroupGetExportDataExp; pDdiTable->pfnCalculateMetricExportDataExp = loader::zetMetricGroupCalculateMetricExportDataExp; pDdiTable->pfnCreateExp = loader::zetMetricGroupCreateExp; pDdiTable->pfnAddMetricExp = loader::zetMetricGroupAddMetricExp; pDdiTable->pfnRemoveMetricExp = loader::zetMetricGroupRemoveMetricExp; pDdiTable->pfnCloseExp = loader::zetMetricGroupCloseExp; pDdiTable->pfnDestroyExp = loader::zetMetricGroupDestroyExp; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.MetricGroupExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetMetricGroupExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricQuery table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricQueryProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_query_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetMetricQueryProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zet.MetricQuery); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zetMetricQueryCreate; pDdiTable->pfnDestroy = loader::zetMetricQueryDestroy; pDdiTable->pfnReset = loader::zetMetricQueryReset; pDdiTable->pfnGetData = loader::zetMetricQueryGetData; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.MetricQuery; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetMetricQueryProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricQueryPool table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricQueryPoolProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_query_pool_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetMetricQueryPoolProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zet.MetricQueryPool); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zetMetricQueryPoolCreate; pDdiTable->pfnDestroy = loader::zetMetricQueryPoolDestroy; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.MetricQueryPool; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetMetricQueryPoolProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's MetricStreamer table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetMetricStreamerProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_metric_streamer_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetMetricStreamerProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zet.MetricStreamer); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnOpen = loader::zetMetricStreamerOpen; pDdiTable->pfnClose = loader::zetMetricStreamerClose; pDdiTable->pfnReadData = loader::zetMetricStreamerReadData; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.MetricStreamer; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetMetricStreamerProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's TracerExp table /// with current process' addresses /// /// @returns /// - ::ZE_RESULT_SUCCESS /// - ::ZE_RESULT_ERROR_UNINITIALIZED /// - ::ZE_RESULT_ERROR_INVALID_NULL_POINTER /// - ::ZE_RESULT_ERROR_UNSUPPORTED_VERSION ZE_DLLEXPORT ze_result_t ZE_APICALL zetGetTracerExpProcAddrTable( ze_api_version_t version, ///< [in] API version requested zet_tracer_exp_dditable_t* pDdiTable ///< [in,out] pointer to table of DDI function pointers ) { if( loader::context->zeDrivers.size() < 1 ) { return ZE_RESULT_ERROR_UNINITIALIZED; } if( nullptr == pDdiTable ) return ZE_RESULT_ERROR_INVALID_NULL_POINTER; if( loader::context->version < version ) return ZE_RESULT_ERROR_UNSUPPORTED_VERSION; ze_result_t result = ZE_RESULT_SUCCESS; bool atLeastOneDriverValid = false; // Load the device-driver DDI tables for( auto& drv : loader::context->zeDrivers ) { if(drv.initStatus != ZE_RESULT_SUCCESS) continue; auto getTable = reinterpret_cast( GET_FUNCTION_PTR( drv.handle, "zetGetTracerExpProcAddrTable") ); if(!getTable) continue; auto getTableResult = getTable( version, &drv.dditable.zet.TracerExp); if(getTableResult == ZE_RESULT_SUCCESS) atLeastOneDriverValid = true; else drv.initStatus = getTableResult; } if(!atLeastOneDriverValid) result = ZE_RESULT_ERROR_UNINITIALIZED; else result = ZE_RESULT_SUCCESS; if( ZE_RESULT_SUCCESS == result ) { if( ( loader::context->zeDrivers.size() > 1 ) || loader::context->forceIntercept ) { // return pointers to loader's DDIs pDdiTable->pfnCreate = loader::zetTracerExpCreate; pDdiTable->pfnDestroy = loader::zetTracerExpDestroy; pDdiTable->pfnSetPrologues = loader::zetTracerExpSetPrologues; pDdiTable->pfnSetEpilogues = loader::zetTracerExpSetEpilogues; pDdiTable->pfnSetEnabled = loader::zetTracerExpSetEnabled; } else { // return pointers directly to driver's DDIs *pDdiTable = loader::context->zeDrivers.front().dditable.zet.TracerExp; } } // If the validation layer is enabled, then intercept the loader's DDIs if(( ZE_RESULT_SUCCESS == result ) && ( nullptr != loader::context->validationLayer )) { auto getTable = reinterpret_cast( GET_FUNCTION_PTR(loader::context->validationLayer, "zetGetTracerExpProcAddrTable") ); if(!getTable) return ZE_RESULT_ERROR_UNINITIALIZED; result = getTable( version, pDdiTable ); } return result; } #if defined(__cplusplus) }; #endif level-zero-1.20.6/source/loader/zet_ldrddi.h000066400000000000000000000071231475521542100207400ustar00rootroot00000000000000/* * * Copyright (C) 2019-2024 Intel Corporation * * SPDX-License-Identifier: MIT * * @file zet_ldrddi.h * */ #pragma once namespace loader { /////////////////////////////////////////////////////////////////////////////// using zet_driver_object_t = object_t < zet_driver_handle_t >; using zet_driver_factory_t = singleton_factory_t < zet_driver_object_t, zet_driver_handle_t >; using zet_device_object_t = object_t < zet_device_handle_t >; using zet_device_factory_t = singleton_factory_t < zet_device_object_t, zet_device_handle_t >; using zet_context_object_t = object_t < zet_context_handle_t >; using zet_context_factory_t = singleton_factory_t < zet_context_object_t, zet_context_handle_t >; using zet_command_list_object_t = object_t < zet_command_list_handle_t >; using zet_command_list_factory_t = singleton_factory_t < zet_command_list_object_t, zet_command_list_handle_t >; using zet_module_object_t = object_t < zet_module_handle_t >; using zet_module_factory_t = singleton_factory_t < zet_module_object_t, zet_module_handle_t >; using zet_kernel_object_t = object_t < zet_kernel_handle_t >; using zet_kernel_factory_t = singleton_factory_t < zet_kernel_object_t, zet_kernel_handle_t >; using zet_metric_group_object_t = object_t < zet_metric_group_handle_t >; using zet_metric_group_factory_t = singleton_factory_t < zet_metric_group_object_t, zet_metric_group_handle_t >; using zet_metric_object_t = object_t < zet_metric_handle_t >; using zet_metric_factory_t = singleton_factory_t < zet_metric_object_t, zet_metric_handle_t >; using zet_metric_streamer_object_t = object_t < zet_metric_streamer_handle_t >; using zet_metric_streamer_factory_t = singleton_factory_t < zet_metric_streamer_object_t, zet_metric_streamer_handle_t >; using zet_metric_query_pool_object_t = object_t < zet_metric_query_pool_handle_t >; using zet_metric_query_pool_factory_t = singleton_factory_t < zet_metric_query_pool_object_t, zet_metric_query_pool_handle_t >; using zet_metric_query_object_t = object_t < zet_metric_query_handle_t >; using zet_metric_query_factory_t = singleton_factory_t < zet_metric_query_object_t, zet_metric_query_handle_t >; using zet_tracer_exp_object_t = object_t < zet_tracer_exp_handle_t >; using zet_tracer_exp_factory_t = singleton_factory_t < zet_tracer_exp_object_t, zet_tracer_exp_handle_t >; using zet_debug_session_object_t = object_t < zet_debug_session_handle_t >; using zet_debug_session_factory_t = singleton_factory_t < zet_debug_session_object_t, zet_debug_session_handle_t >; using zet_metric_tracer_exp_object_t = object_t < zet_metric_tracer_exp_handle_t >; using zet_metric_tracer_exp_factory_t = singleton_factory_t < zet_metric_tracer_exp_object_t, zet_metric_tracer_exp_handle_t >; using zet_metric_decoder_exp_object_t = object_t < zet_metric_decoder_exp_handle_t >; using zet_metric_decoder_exp_factory_t = singleton_factory_t < zet_metric_decoder_exp_object_t, zet_metric_decoder_exp_handle_t >; using zet_metric_programmable_exp_object_t = object_t < zet_metric_programmable_exp_handle_t >; using zet_metric_programmable_exp_factory_t = singleton_factory_t < zet_metric_programmable_exp_object_t, zet_metric_programmable_exp_handle_t >; } level-zero-1.20.6/source/utils/000077500000000000000000000000001475521542100163325ustar00rootroot00000000000000level-zero-1.20.6/source/utils/CMakeLists.txt000066400000000000000000000010521475521542100210700ustar00rootroot00000000000000# Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: MIT set(logging_files logging.h logging.cpp) add_library(level_zero_utils STATIC ${logging_files}) if(SYSTEM_SPDLOG) target_link_libraries(level_zero_utils PUBLIC spdlog::spdlog) else() target_include_directories(level_zero_utils PUBLIC $) endif() target_include_directories(level_zero_utils PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) set_property(TARGET level_zero_utils PROPERTY POSITION_INDEPENDENT_CODE ON) level-zero-1.20.6/source/utils/logging.cpp000066400000000000000000000112561475521542100204710ustar00rootroot00000000000000/* * * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "logging.h" namespace loader { std::string to_string(const ze_result_t result) { if (result == ZE_RESULT_SUCCESS) { return "ZE_RESULT_SUCCESS"; } else if (result == ZE_RESULT_NOT_READY) { return "ZE_RESULT_NOT_READY"; } else if (result == ZE_RESULT_ERROR_UNINITIALIZED) { return "ZE_RESULT_ERROR_UNINITIALIZED"; } else if (result == ZE_RESULT_ERROR_DEVICE_LOST) { return "ZE_RESULT_ERROR_DEVICE_LOST"; } else if (result == ZE_RESULT_ERROR_INVALID_ARGUMENT) { return "ZE_RESULT_ERROR_INVALID_ARGUMENT"; } else if (result == ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY) { return "ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY"; } else if (result == ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY) { return "ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"; } else if (result == ZE_RESULT_ERROR_MODULE_BUILD_FAILURE) { return "ZE_RESULT_ERROR_MODULE_BUILD_FAILURE"; } else if (result == ZE_RESULT_ERROR_MODULE_LINK_FAILURE) { return "ZE_RESULT_ERROR_MODULE_LINK_FAILURE"; } else if (result == ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS) { return "ZE_RESULT_ERROR_INSUFFICIENT_PERMISSIONS"; } else if (result == ZE_RESULT_ERROR_NOT_AVAILABLE) { return "ZE_RESULT_ERROR_NOT_AVAILABLE"; } else if (result == ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE) { return "ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE"; } else if (result == ZE_RESULT_WARNING_DROPPED_DATA) { return "ZE_RESULT_WARNING_DROPPED_DATA"; } else if (result == ZE_RESULT_ERROR_UNSUPPORTED_VERSION) { return "ZE_RESULT_ERROR_UNSUPPORTED_VERSION"; } else if (result == ZE_RESULT_ERROR_UNSUPPORTED_FEATURE) { return "ZE_RESULT_ERROR_UNSUPPORTED_FEATURE"; } else if (result == ZE_RESULT_ERROR_INVALID_NULL_HANDLE) { return "ZE_RESULT_ERROR_INVALID_NULL_HANDLE"; } else if (result == ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE) { return "ZE_RESULT_ERROR_HANDLE_OBJECT_IN_USE"; } else if (result == ZE_RESULT_ERROR_INVALID_NULL_POINTER) { return "ZE_RESULT_ERROR_INVALID_NULL_POINTER"; } else if (result == ZE_RESULT_ERROR_INVALID_SIZE) { return "ZE_RESULT_ERROR_INVALID_SIZE"; } else if (result == ZE_RESULT_ERROR_UNSUPPORTED_SIZE) { return "ZE_RESULT_ERROR_UNSUPPORTED_SIZE"; } else if (result == ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT) { return "ZE_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"; } else if (result == ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT) { return "ZE_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"; } else if (result == ZE_RESULT_ERROR_INVALID_ENUMERATION) { return "ZE_RESULT_ERROR_INVALID_ENUMERATION"; } else if (result == ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION) { return "ZE_RESULT_ERROR_UNSUPPORTED_ENUMERATION"; } else if (result == ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT) { return "ZE_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT"; } else if (result == ZE_RESULT_ERROR_INVALID_NATIVE_BINARY) { return "ZE_RESULT_ERROR_INVALID_NATIVE_BINARY"; } else if (result == ZE_RESULT_ERROR_INVALID_GLOBAL_NAME) { return "ZE_RESULT_ERROR_INVALID_GLOBAL_NAME"; } else if (result == ZE_RESULT_ERROR_INVALID_KERNEL_NAME) { return "ZE_RESULT_ERROR_INVALID_KERNEL_NAME"; } else if (result == ZE_RESULT_ERROR_INVALID_FUNCTION_NAME) { return "ZE_RESULT_ERROR_INVALID_FUNCTION_NAME"; } else if (result == ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION) { return "ZE_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION"; } else if (result == ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION) { return "ZE_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION"; } else if (result == ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX) { return "ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX"; } else if (result == ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE) { return "ZE_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE"; } else if (result == ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE) { return "ZE_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE"; } else if (result == ZE_RESULT_ERROR_INVALID_MODULE_UNLINKED) { return "ZE_RESULT_ERROR_INVALID_MODULE_UNLINKED"; } else if (result == ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE) { return "ZE_RESULT_ERROR_INVALID_COMMAND_LIST_TYPE"; } else if (result == ZE_RESULT_ERROR_OVERLAPPING_REGIONS) { return "ZE_RESULT_ERROR_OVERLAPPING_REGIONS"; } else if (result == ZE_RESULT_ERROR_UNKNOWN) { return "ZE_RESULT_ERROR_UNKNOWN"; } else { return std::to_string(static_cast(result)); } } } // namespace loaderlevel-zero-1.20.6/source/utils/logging.h000066400000000000000000000143111475521542100201310ustar00rootroot00000000000000/* * * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * */ #ifndef level_zero_loader_LOGGING_HPP #define level_zero_loader_LOGGING_HPP #ifndef FMT_HEADER_ONLY #define FMT_HEADER_ONLY #endif #define LOADER_LOG_FILE "ze_loader.log" #define LOADER_LOG_FILE_DIRECTORY ".oneapi_logs" #include #include #include #include #include #include "spdlog/sinks/ansicolor_sink.h" #include "spdlog/sinks/basic_file_sink.h" #include "spdlog/spdlog.h" #include "ze_api.h" #include "ze_util.h" #ifdef __linux__ #include #include #include #endif // __linux__ namespace loader { std::string to_string(const ze_result_t result); enum class Console { out_stdout, out_stderr }; class Logger { public: Logger(std::string logger_name, std::string filename, std::string log_level, bool logging_enabled_env, std::string format = "") { if (logging_enabled_env) { logging_enabled = logging_enabled_env; try { _logger = spdlog::basic_logger_st(logger_name, filename); } catch (spdlog::spdlog_ex &exception) { std::cerr << "Unable to create log file: " << exception.what() << "\n"; logging_enabled = false; return; } if (!format.empty()) { _logger->set_pattern(format); } setLogLevel(log_level); } } Logger(std::string logger_name, Console out, std::string log_level, bool logging_enabled_env, std::string format = "") { if (logging_enabled_env) { logging_enabled = logging_enabled_env; try { if (out == Console::out_stdout) { auto sink = std::make_shared(); _logger = std::make_shared(logger_name, std::move(sink)); } else if (out == Console::out_stderr) { auto sink = std::make_shared(); _logger = std::make_shared(logger_name, std::move(sink)); } else { std::cerr << "Invalid console output specified\n"; logging_enabled = false; return; } } catch (spdlog::spdlog_ex &exception) { std::cerr << "Unable to create log stdout logger " << exception.what() << "\n"; logging_enabled = false; return; } if (!format.empty()) { _logger->set_pattern(format); } setLogLevel(log_level); } } ~Logger() { if (!logging_enabled) return; _logger->flush(); } void set_level(spdlog::level::level_enum log_level){ if (!logging_enabled) return; _logger->set_level(log_level); } void log_trace(std::string msg) { if (!logging_enabled) return; _logger->trace(msg); } void log_debug(std::string msg) { if (!logging_enabled) return; _logger->debug(msg); } void log_info(std::string msg) { if (!logging_enabled) return; _logger->info(msg); } void log_warning(std::string msg) { if (!logging_enabled) return; _logger->warn(msg); } void log_error(std::string msg) { if (!logging_enabled) return; _logger->error(msg); } void log_fatal(std::string msg) { if (!logging_enabled) return; _logger->critical(msg); } std::shared_ptr get_base_logger(){ return _logger; } bool log_to_console = true; bool logging_enabled = false; private: void setLogLevel(std::string log_level) { // validate log level if ("trace" == log_level) { _logger->set_level(spdlog::level::trace); } else if ("debug" == log_level) { _logger->set_level(spdlog::level::debug); } else if ("info" == log_level) { _logger->set_level(spdlog::level::info); } else if ("warn" == log_level) { _logger->set_level(spdlog::level::warn); } else if ("error" == log_level) { _logger->set_level(spdlog::level::err); } else if ("critical" == log_level) { _logger->set_level(spdlog::level::critical); } else if ("off" == log_level) { _logger->set_level(spdlog::level::off); } else { _logger->warn("Invalid logging level set: ", log_level); } spdlog::flush_on(spdlog::level::trace); } std::shared_ptr _logger = nullptr; }; inline std::shared_ptr createLogger() { std::shared_ptr zel_logger; auto log_directory = getenv_string("ZEL_LOADER_LOG_DIR"); if (log_directory.empty()) { std::string home_dir; #ifdef _WIN32 home_dir = getenv_string("USERPROFILE"); if (home_dir == ""){ auto home_drive = getenv_string("HOMEDRIVE"); auto home_path = getenv_string("HOMEPATH"); if ((home_drive != "") && (home_path != "")) { home_dir = home_drive + home_path; } else { home_dir = "."; } } log_directory = home_dir + "\\" + LOADER_LOG_FILE_DIRECTORY; #else home_dir = getenv_string("HOME"); if (home_dir == "") { auto pwdir = getpwuid(getuid())->pw_dir; home_dir = (pwdir == NULL) ? "." : std::string(pwdir); } log_directory = home_dir + "/" + LOADER_LOG_FILE_DIRECTORY; #endif } auto loader_file = getenv_string("ZEL_LOADER_LOG_FILE"); if (loader_file.empty()){ loader_file = LOADER_LOG_FILE; } else { auto log_depr_msg = "ZEL_LOADER_LOG_FILE will be deprecated in a future release"; std::cout << log_depr_msg << std::endl; } std::string full_log_file_path = ""; #ifdef _WIN32 full_log_file_path = log_directory + "\\" + loader_file; #else full_log_file_path = log_directory + "/" + loader_file; #endif auto logging_enabled = getenv_tobool( "ZEL_ENABLE_LOADER_LOGGING" ); auto log_level = getenv_string("ZEL_LOADER_LOGGING_LEVEL"); auto log_console = getenv_tobool("ZEL_LOADER_LOG_CONSOLE"); if (log_level.empty()) { log_level = "warn"; } if (!log_console) { zel_logger = std::make_shared("ze_loader", full_log_file_path, log_level, logging_enabled); } else { zel_logger = std::make_shared("ze_loader", Console::out_stderr, log_level, logging_enabled); } if (!logging_enabled){ zel_logger->set_level(spdlog::level::off); } return zel_logger; } } // namespace loader #endiflevel-zero-1.20.6/test/000077500000000000000000000000001475521542100146515ustar00rootroot00000000000000level-zero-1.20.6/test/CMakeLists.txt000066400000000000000000000112741475521542100174160ustar00rootroot00000000000000# Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: MIT add_executable( tests loader_api.cpp loader_validation_layer.cpp ) target_include_directories(tests PRIVATE ${CMAKE_SOURCE_DIR}/include) target_link_libraries( tests GTest::gtest_main ${TARGET_LOADER_NAME} ) # For some reason the MSVC runtime libraries used by googletest and test # binaries don't match, so force the test binary to use the dynamic runtime. if(MSVC) target_compile_options(tests PRIVATE "/MD$<$:d>") endif() add_test(NAME tests_api COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingzeGetLoaderVersionsAPIThenValidVersionIsReturned*) set_property(TEST tests_api PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") add_test(NAME tests_init_gpu_all COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingZeInitDriversWithGPUTypeThenExpectPassWithGPUorAllOnly*) set_property(TEST tests_init_gpu_all PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") add_test(NAME tests_init_npu_all COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingZeInitDriversWithNPUTypeThenExpectPassWithNPUorAllOnly*) set_property(TEST tests_init_npu_all PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") add_test(NAME tests_any COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingZeInitDriversWithAnyTypeWithNullDriverAcceptingAllThenExpectatLeast1Driver*) set_property(TEST tests_any PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") add_test(NAME tests_both_init_all COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingZeInitDriversThenzeInitThenBothCallsSucceedWithAllTypes*) set_property(TEST tests_both_init_all PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") add_test(NAME tests_both_init_gpu COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingZeInitDriversThenzeInitThenBothCallsSucceedWithGPUTypes*) set_property(TEST tests_both_init_gpu PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") add_test(NAME tests_both_init_npu COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingZeInitDriversThenzeInitThenBothCallsSucceedWithNPUTypes*) set_property(TEST tests_both_init_npu PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") add_test(NAME tests_both_succeed COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingzeInitThenZeInitDriversThenBothCallsSucceedWithAllTypes*) set_property(TEST tests_both_succeed PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") add_test(NAME tests_both_gpu COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingzeInitThenZeInitDriversThenBothCallsSucceedWithGPUTypes*) set_property(TEST tests_both_gpu PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") add_test(NAME tests_both_npu COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingzeInitThenZeInitDriversThenBothCallsSucceedWithNPUTypes*) set_property(TEST tests_both_npu PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") add_test(NAME tests_missing_api COMMAND tests --gtest_filter=*GivenZeInitDriversUnsupportedOnTheDriverWhenCallingZeInitDriversThenUninitializedReturned*) set_property(TEST tests_missing_api PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") add_test(NAME tests_multi_call_failure COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingZeInitDriversWithTypesUnsupportedWithFailureThenSupportedTypesThenSuccessReturned*) set_property(TEST tests_multi_call_failure PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1") # These tests are currently not supported on Windows. The reason is that the std::cerr is not being redirected to a pipe in Windows to be then checked against the expected output. if(NOT MSVC) add_test(NAME tests_event_deadlock COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingzeCommandListAppendMemoryCopyWithCircularDependencyOnEventsThenValidationLayerPrintsWarningOfDeadlock*) set_property(TEST tests_event_deadlock PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1;ZE_ENABLE_VALIDATION_LAYER=1;ZEL_ENABLE_EVENTS_CHECKER=1") add_test(NAME tests_event_deadlock_reset COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingzeCommandListAppendMemoryCopyWithCircularDependencyOnEventsAndExplicitCallzeEventHostSignalThenValidationLayerPrintsWarningOfIllegalUsage*) set_property(TEST tests_event_deadlock_reset PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1;ZE_ENABLE_VALIDATION_LAYER=1;ZEL_ENABLE_EVENTS_CHECKER=1") add_test(NAME tests_event_reset_reuse COMMAND tests --gtest_filter=*GivenLevelZeroLoaderPresentWhenCallingzeEventHostResetWithAlreadySignaledEventThenUsingEventAgainThenValidationLayerDoesNotPrintsWarningOfIllegalUsage*) set_property(TEST tests_event_reset_reuse PROPERTY ENVIRONMENT "ZE_ENABLE_NULL_DRIVER=1;ZE_ENABLE_VALIDATION_LAYER=1;ZEL_ENABLE_EVENTS_CHECKER=1") endif() level-zero-1.20.6/test/loader_api.cpp000066400000000000000000000221321475521542100174540ustar00rootroot00000000000000/* * * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "gtest/gtest.h" #include "loader/ze_loader.h" #include "ze_api.h" #if defined(_WIN32) #define putenv_safe _putenv #else #define putenv_safe putenv #endif namespace { TEST( LoaderAPI, GivenLevelZeroLoaderPresentWhenCallingzeGetLoaderVersionsAPIThenValidVersionIsReturned) { EXPECT_EQ(ZE_RESULT_SUCCESS, zeInit(0)); size_t size = 0; EXPECT_EQ(ZE_RESULT_SUCCESS, zelLoaderGetVersions(&size, nullptr)); EXPECT_GT(size, 0); std::vector versions(size); EXPECT_EQ(ZE_RESULT_SUCCESS, zelLoaderGetVersions(&size, versions.data())); std::cout << "Found " << versions.size() << " versions" << std::endl; std::cout << std::endl; const std::string loader_name = "loader"; for (auto &component : versions) { std::cout << "component.component_name: " << component.component_name << std::endl; std::cout << "component.component_lib_version.major: " << component.component_lib_version.major << std::endl; std::cout << "component.spec_version: " << component.spec_version << std::endl; std::cout << "component.component_lib_name: " << component.component_name << std::endl; std::cout << std::endl; if (loader_name == component.component_name) { EXPECT_GE(component.component_lib_version.major, 1); } } } TEST( LoaderInit, GivenLevelZeroLoaderPresentWhenCallingZeInitDriversWithTypesUnsupportedWithFailureThenSupportedTypesThenSuccessReturned) { uint32_t pCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = ZE_INIT_DRIVER_TYPE_FLAG_NPU; desc.pNext = nullptr; putenv_safe( const_cast( "ZEL_TEST_NULL_DRIVER_TYPE=GPU" ) ); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_EQ(pCount, 0); pCount = 0; desc.flags = UINT32_MAX; EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); } TEST( LoaderInit, GivenLevelZeroLoaderPresentWhenCallingZeInitDriversWithGPUTypeThenExpectPassWithGPUorAllOnly) { uint32_t pCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = ZE_INIT_DRIVER_TYPE_FLAG_GPU; desc.pNext = nullptr; putenv_safe( const_cast( "ZEL_TEST_NULL_DRIVER_TYPE=GPU" ) ); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); pCount = 0; desc.flags = UINT32_MAX; EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); pCount = 0; desc.flags = ZE_INIT_DRIVER_TYPE_FLAG_GPU | ZE_INIT_DRIVER_TYPE_FLAG_NPU; EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); } TEST( LoaderInit, GivenLevelZeroLoaderPresentWhenCallingZeInitDriversWithNPUTypeThenExpectPassWithNPUorAllOnly) { uint32_t pCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = ZE_INIT_DRIVER_TYPE_FLAG_NPU; desc.pNext = nullptr; putenv_safe( const_cast( "ZEL_TEST_NULL_DRIVER_TYPE=NPU" ) ); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); pCount = 0; desc.flags = UINT32_MAX; EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); pCount = 0; desc.flags = ZE_INIT_DRIVER_TYPE_FLAG_GPU | ZE_INIT_DRIVER_TYPE_FLAG_NPU; EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); } TEST( LoaderInit, GivenLevelZeroLoaderPresentWhenCallingZeInitDriversWithAnyTypeWithNullDriverAcceptingAllThenExpectatLeast1Driver) { uint32_t pCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = ZE_INIT_DRIVER_TYPE_FLAG_NPU; desc.pNext = nullptr; putenv_safe( const_cast( "ZEL_TEST_NULL_DRIVER_TYPE=ALL" ) ); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); pCount = 0; desc.flags = UINT32_MAX; EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); pCount = 0; desc.flags = ZE_INIT_DRIVER_TYPE_FLAG_GPU; EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); pCount = 0; desc.flags = ZE_INIT_DRIVER_TYPE_FLAG_GPU | ZE_INIT_DRIVER_TYPE_FLAG_NPU; EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); } TEST( LoaderInit, GivenLevelZeroLoaderPresentWhenCallingZeInitDriversThenzeInitThenBothCallsSucceedWithAllTypes) { uint32_t pInitDriversCount = 0; uint32_t pDriverGetCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = UINT32_MAX; desc.pNext = nullptr; putenv_safe( const_cast( "ZEL_TEST_NULL_DRIVER_TYPE=ALL" ) ); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pInitDriversCount, nullptr, &desc)); EXPECT_GT(pInitDriversCount, 0); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInit(0)); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&pDriverGetCount, nullptr)); EXPECT_GT(pDriverGetCount, 0); } TEST( LoaderInit, GivenLevelZeroLoaderPresentWhenCallingZeInitDriversThenzeInitThenBothCallsSucceedWithGPUTypes) { uint32_t pInitDriversCount = 0; uint32_t pDriverGetCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = UINT32_MAX; desc.pNext = nullptr; putenv_safe( const_cast( "ZEL_TEST_NULL_DRIVER_TYPE=GPU" ) ); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pInitDriversCount, nullptr, &desc)); EXPECT_GT(pInitDriversCount, 0); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInit(ZE_INIT_FLAG_GPU_ONLY)); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&pDriverGetCount, nullptr)); EXPECT_GT(pDriverGetCount, 0); } TEST( LoaderInit, GivenZeInitDriversUnsupportedOnTheDriverWhenCallingZeInitDriversThenUninitializedReturned) { uint32_t pInitDriversCount = 0; uint32_t pDriverGetCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = UINT32_MAX; desc.pNext = nullptr; putenv_safe( const_cast( "ZEL_TEST_MISSING_API=zeInitDrivers" ) ); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zeInitDrivers(&pInitDriversCount, nullptr, &desc)); EXPECT_EQ(pInitDriversCount, 0); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInit(0)); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&pDriverGetCount, nullptr)); EXPECT_GT(pDriverGetCount, 0); } TEST( LoaderInit, GivenLevelZeroLoaderPresentWhenCallingZeInitDriversThenzeInitThenBothCallsSucceedWithNPUTypes) { uint32_t pInitDriversCount = 0; uint32_t pDriverGetCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = UINT32_MAX; desc.pNext = nullptr; putenv_safe( const_cast( "ZEL_TEST_NULL_DRIVER_TYPE=NPU" ) ); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pInitDriversCount, nullptr, &desc)); EXPECT_GT(pInitDriversCount, 0); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInit(ZE_INIT_FLAG_VPU_ONLY)); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&pDriverGetCount, nullptr)); EXPECT_GT(pDriverGetCount, 0); } TEST( LoaderInit, GivenLevelZeroLoaderPresentWhenCallingzeInitThenZeInitDriversThenBothCallsSucceedWithAllTypes) { uint32_t pInitDriversCount = 0; uint32_t pDriverGetCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = UINT32_MAX; desc.pNext = nullptr; putenv_safe( const_cast( "ZEL_TEST_NULL_DRIVER_TYPE=ALL" ) ); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInit(0)); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pInitDriversCount, nullptr, &desc)); EXPECT_GT(pInitDriversCount, 0); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&pDriverGetCount, nullptr)); EXPECT_GT(pDriverGetCount, 0); } TEST( LoaderInit, GivenLevelZeroLoaderPresentWhenCallingzeInitThenZeInitDriversThenBothCallsSucceedWithGPUTypes) { uint32_t pInitDriversCount = 0; uint32_t pDriverGetCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = UINT32_MAX; desc.pNext = nullptr; putenv_safe( const_cast( "ZEL_TEST_NULL_DRIVER_TYPE=GPU" ) ); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInit(ZE_INIT_FLAG_GPU_ONLY)); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pInitDriversCount, nullptr, &desc)); EXPECT_GT(pInitDriversCount, 0); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&pDriverGetCount, nullptr)); EXPECT_GT(pDriverGetCount, 0); } TEST( LoaderInit, GivenLevelZeroLoaderPresentWhenCallingzeInitThenZeInitDriversThenBothCallsSucceedWithNPUTypes) { uint32_t pInitDriversCount = 0; uint32_t pDriverGetCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = UINT32_MAX; desc.pNext = nullptr; putenv_safe( const_cast( "ZEL_TEST_NULL_DRIVER_TYPE=NPU" ) ); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInit(ZE_INIT_FLAG_VPU_ONLY)); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pInitDriversCount, nullptr, &desc)); EXPECT_GT(pInitDriversCount, 0); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&pDriverGetCount, nullptr)); EXPECT_GT(pDriverGetCount, 0); } } // namespace level-zero-1.20.6/test/loader_validation_layer.cpp000066400000000000000000000517411475521542100222410ustar00rootroot00000000000000/* * * Copyright (C) 2024 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "gtest/gtest.h" #include "loader/ze_loader.h" #include "ze_api.h" #if defined(_WIN32) #define putenv_safe _putenv #else #define putenv_safe putenv #endif TEST( LoaderValidation, GivenLevelZeroLoaderPresentWhenCallingzeCommandListAppendMemoryCopyWithCircularDependencyOnEventsThenValidationLayerPrintsWarningOfDeadlock) { uint32_t pCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = UINT32_MAX; desc.pNext = nullptr; putenv_safe(const_cast("ZEL_TEST_NULL_DRIVER_TYPE=GPU")); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInit(ZE_INIT_FLAG_GPU_ONLY)); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); ze_result_t status; const ze_device_type_t type = ZE_DEVICE_TYPE_GPU; ze_driver_handle_t pDriver = nullptr; ze_device_handle_t pDevice = nullptr; uint32_t driverCount = 0; EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&driverCount, nullptr)); std::vector drivers(driverCount); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&driverCount, drivers.data())); for (uint32_t driver = 0; driver < driverCount; ++driver) { pDriver = drivers[driver]; // get all devices uint32_t deviceCount = 0; EXPECT_EQ(ZE_RESULT_SUCCESS, zeDeviceGet(pDriver, &deviceCount, nullptr)); std::vector devices(deviceCount); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDeviceGet(pDriver, &deviceCount, devices.data())); // for each device, find the first one matching the type for (uint32_t device = 0; device < deviceCount; ++device) { auto phDevice = devices[device]; ze_device_properties_t device_properties = {}; device_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES; EXPECT_EQ(ZE_RESULT_SUCCESS, zeDeviceGetProperties(phDevice, &device_properties)); if (type == device_properties.type) { pDevice = phDevice; break; } } if (pDevice) { break; } } EXPECT_NE(pDevice, nullptr); ze_context_handle_t context; ze_context_desc_t context_desc = {}; context_desc.stype = ZE_STRUCTURE_TYPE_CONTEXT_DESC; status = zeContextCreate(pDriver, &context_desc, &context); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // Create an command list for direct submission ze_command_list_desc_t altdesc = {}; altdesc.stype = ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC; ze_command_list_handle_t command_list = {}; status = zeCommandListCreate(context, pDevice, &altdesc, &command_list); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // Create an event to be signaled by the device ze_event_pool_desc_t ep_desc = {}; ep_desc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; ep_desc.count = 3; ep_desc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; ze_event_pool_handle_t event_pool; status = zeEventPoolCreate(context, &ep_desc, 1, &pDevice, &event_pool); EXPECT_EQ(ZE_RESULT_SUCCESS, status); std::vector event{}; // Three events for memcpy that will form a circular dependency. event.resize(3); ze_event_desc_t ev_desc = {}; ev_desc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC; ev_desc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE; ev_desc.wait = ZE_EVENT_SCOPE_FLAG_HOST; for (uint32_t i = 0; i < 3; ++i) { ev_desc.index = i; status = zeEventCreate(event_pool, &ev_desc, &event[i]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); } ze_host_mem_alloc_desc_t host_desc = {}; host_desc.stype = ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC; host_desc.pNext = nullptr; host_desc.flags = 0; size_t buffer_size = 1024; void *host_mem_ptr = nullptr; status = zeMemAllocHost(context, &host_desc, buffer_size, 1, &host_mem_ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); ze_device_mem_alloc_desc_t device_desc = {}; device_desc.stype = ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC; device_desc.pNext = nullptr; // device_desc.ordinal = 0; device_desc.flags = 0; void *device_mem_ptr = nullptr; status = zeMemAllocDevice(context, &device_desc, buffer_size, 0, pDevice, &device_mem_ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // Action_0: Host to Device, is dependent on a future action called Action_2 (see below). status = zeCommandListAppendMemoryCopy(command_list, device_mem_ptr, host_mem_ptr, buffer_size, event[0], 1 /* 1 */, &event[2] /* &start_event */); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // Action_1: Host to Device, is dependent on Action_0 status = zeCommandListAppendMemoryCopy(command_list, device_mem_ptr, host_mem_ptr, buffer_size, event[1], 1, &event[0]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); std::stringstream capture; std::streambuf *old_buf; old_buf = std::cerr.rdbuf(); std::cerr.rdbuf(capture.rdbuf()); // Action_2: Host to Device, is dependent on Action_1. It also creates a deadlock by having Action_0 dependent on it. status = zeCommandListAppendMemoryCopy(command_list, device_mem_ptr, host_mem_ptr, buffer_size, event[2], 1, &event[1]); std::cerr.rdbuf(old_buf); auto found = capture.str().find("Warning: There may be a potential event deadlock"); EXPECT_NE(found, std::string::npos); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandListClose(command_list); EXPECT_EQ(ZE_RESULT_SUCCESS, status); ze_command_queue_desc_t command_queue_description{}; command_queue_description.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC; command_queue_description.pNext = nullptr; // command_queue_description.ordinal = 0; // command_queue_description.index = 0; command_queue_description.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS; ze_command_queue_handle_t command_queue{}; status = zeCommandQueueCreate(context, pDevice, &command_queue_description, &command_queue); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandQueueExecuteCommandLists(command_queue, 1, &command_list, nullptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandQueueSynchronize(command_queue, UINT64_MAX); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandQueueDestroy(command_queue); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeMemFree(context, host_mem_ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeMemFree(context, device_mem_ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeEventDestroy(event[0]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeEventDestroy(event[1]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeEventDestroy(event[2]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeEventPoolDestroy(event_pool); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandListDestroy(command_list); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeContextDestroy(context); EXPECT_EQ(ZE_RESULT_SUCCESS, status); } TEST( LoaderValidation, GivenLevelZeroLoaderPresentWhenCallingzeCommandListAppendMemoryCopyWithCircularDependencyOnEventsAndExplicitCallzeEventHostSignalThenValidationLayerPrintsWarningOfIllegalUsage) { uint32_t pCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = UINT32_MAX; desc.pNext = nullptr; putenv_safe(const_cast("ZEL_TEST_NULL_DRIVER_TYPE=GPU")); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInit(ZE_INIT_FLAG_GPU_ONLY)); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); ze_result_t status; const ze_device_type_t type = ZE_DEVICE_TYPE_GPU; ze_driver_handle_t pDriver = nullptr; ze_device_handle_t pDevice = nullptr; uint32_t driverCount = 0; EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&driverCount, nullptr)); std::vector drivers(driverCount); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&driverCount, drivers.data())); for (uint32_t driver = 0; driver < driverCount; ++driver) { pDriver = drivers[driver]; // get all devices uint32_t deviceCount = 0; EXPECT_EQ(ZE_RESULT_SUCCESS, zeDeviceGet(pDriver, &deviceCount, nullptr)); std::vector devices(deviceCount); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDeviceGet(pDriver, &deviceCount, devices.data())); // for each device, find the first one matching the type for (uint32_t device = 0; device < deviceCount; ++device) { auto phDevice = devices[device]; ze_device_properties_t device_properties = {}; device_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES; EXPECT_EQ(ZE_RESULT_SUCCESS, zeDeviceGetProperties(phDevice, &device_properties)); if (type == device_properties.type) { pDevice = phDevice; break; } } if (pDevice) { break; } } EXPECT_NE(pDevice, nullptr); ze_context_handle_t context; ze_context_desc_t context_desc = {}; context_desc.stype = ZE_STRUCTURE_TYPE_CONTEXT_DESC; status = zeContextCreate(pDriver, &context_desc, &context); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // Create an command list for direct submission ze_command_list_desc_t altdesc = {}; altdesc.stype = ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC; ze_command_list_handle_t command_list = {}; status = zeCommandListCreate(context, pDevice, &altdesc, &command_list); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // Create an event to be signaled by the device ze_event_pool_desc_t ep_desc = {}; ep_desc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; ep_desc.count = 3; ep_desc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; ze_event_pool_handle_t event_pool; status = zeEventPoolCreate(context, &ep_desc, 1, &pDevice, &event_pool); EXPECT_EQ(ZE_RESULT_SUCCESS, status); std::vector event{}; // Three events for memcpy that will form a circular dependency. event.resize(3); ze_event_desc_t ev_desc = {}; ev_desc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC; ev_desc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE; ev_desc.wait = ZE_EVENT_SCOPE_FLAG_HOST; for (uint32_t i = 0; i < 3; ++i) { ev_desc.index = i; status = zeEventCreate(event_pool, &ev_desc, &event[i]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); } ze_host_mem_alloc_desc_t host_desc = {}; host_desc.stype = ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC; host_desc.pNext = nullptr; host_desc.flags = 0; size_t buffer_size = 1024; void *host_mem_ptr = nullptr; status = zeMemAllocHost(context, &host_desc, buffer_size, 1, &host_mem_ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); ze_device_mem_alloc_desc_t device_desc = {}; device_desc.stype = ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC; device_desc.pNext = nullptr; // device_desc.ordinal = 0; device_desc.flags = 0; void *device_mem_ptr = nullptr; status = zeMemAllocDevice(context, &device_desc, buffer_size, 0, pDevice, &device_mem_ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // Action_0: Host to Device, is dependent on a future action called Action_2 (see below). status = zeCommandListAppendMemoryCopy(command_list, device_mem_ptr, host_mem_ptr, buffer_size, event[0], 1 /* 1 */, &event[2] /* &start_event */); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // Action_1: Host to Device, is dependent on Action_0 status = zeCommandListAppendMemoryCopy(command_list, device_mem_ptr, host_mem_ptr, buffer_size, event[1], 1, &event[0]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); std::stringstream capture; std::streambuf *old_cerr_buf = std::cerr.rdbuf(); std::streambuf *old_cout_buf = std::cout.rdbuf(); std::cerr.rdbuf(capture.rdbuf()); std::cout.rdbuf(capture.rdbuf()); // Action_2: Host to Device, is dependent on Action_1. It also creates a deadlock by having Action_0 dependent on it. status = zeCommandListAppendMemoryCopy(command_list, device_mem_ptr, host_mem_ptr, buffer_size, event[2], 1, &event[1]); std::cerr.rdbuf(old_cerr_buf); std::cout.rdbuf(old_cout_buf); auto found = capture.str().find("Warning: There may be a potential event deadlock"); EXPECT_NE(found, std::string::npos); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandListClose(command_list); EXPECT_EQ(ZE_RESULT_SUCCESS, status); ze_command_queue_desc_t command_queue_description{}; command_queue_description.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC; command_queue_description.pNext = nullptr; // command_queue_description.ordinal = 0; // command_queue_description.index = 0; command_queue_description.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS; ze_command_queue_handle_t command_queue{}; status = zeCommandQueueCreate(context, pDevice, &command_queue_description, &command_queue); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // clear the capture stringstream for reuse capture.str(""); capture.clear(); old_cerr_buf = std::cerr.rdbuf(); old_cout_buf = std::cout.rdbuf(); std::cerr.rdbuf(capture.rdbuf()); std::cout.rdbuf(capture.rdbuf()); // Explicitly break the dependency by signaling the last event. status = zeEventHostSignal(event[2]); std::cerr.rdbuf(old_cerr_buf); std::cout.rdbuf(old_cout_buf); found = capture.str().find("Warning: zeEventHostSignal is using the same ze_event_handle_t"); EXPECT_NE(found, std::string::npos); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandQueueExecuteCommandLists(command_queue, 1, &command_list, nullptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandQueueSynchronize(command_queue, UINT64_MAX); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandQueueDestroy(command_queue); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeMemFree(context, host_mem_ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeMemFree(context, device_mem_ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeEventDestroy(event[0]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeEventDestroy(event[1]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeEventDestroy(event[2]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeEventPoolDestroy(event_pool); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandListDestroy(command_list); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeContextDestroy(context); EXPECT_EQ(ZE_RESULT_SUCCESS, status); } TEST( LoaderValidation, GivenLevelZeroLoaderPresentWhenCallingzeEventHostResetWithAlreadySignaledEventThenUsingEventAgainThenValidationLayerDoesNotPrintsWarningOfIllegalUsage) { uint32_t pCount = 0; ze_init_driver_type_desc_t desc = {ZE_STRUCTURE_TYPE_INIT_DRIVER_TYPE_DESC}; desc.flags = UINT32_MAX; desc.pNext = nullptr; putenv_safe(const_cast("ZEL_TEST_NULL_DRIVER_TYPE=GPU")); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInit(ZE_INIT_FLAG_GPU_ONLY)); EXPECT_EQ(ZE_RESULT_SUCCESS, zeInitDrivers(&pCount, nullptr, &desc)); EXPECT_GT(pCount, 0); ze_result_t status; const ze_device_type_t type = ZE_DEVICE_TYPE_GPU; ze_driver_handle_t pDriver = nullptr; ze_device_handle_t pDevice = nullptr; uint32_t driverCount = 0; EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&driverCount, nullptr)); std::vector drivers(driverCount); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&driverCount, drivers.data())); for (uint32_t driver = 0; driver < driverCount; ++driver) { pDriver = drivers[driver]; // get all devices uint32_t deviceCount = 0; EXPECT_EQ(ZE_RESULT_SUCCESS, zeDeviceGet(pDriver, &deviceCount, nullptr)); std::vector devices(deviceCount); EXPECT_EQ(ZE_RESULT_SUCCESS, zeDeviceGet(pDriver, &deviceCount, devices.data())); // for each device, find the first one matching the type for (uint32_t device = 0; device < deviceCount; ++device) { auto phDevice = devices[device]; ze_device_properties_t device_properties = {}; device_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES; EXPECT_EQ(ZE_RESULT_SUCCESS, zeDeviceGetProperties(phDevice, &device_properties)); if (type == device_properties.type) { pDevice = phDevice; break; } } if (pDevice) { break; } } EXPECT_NE(pDevice, nullptr); ze_context_handle_t context; ze_context_desc_t context_desc = {}; context_desc.stype = ZE_STRUCTURE_TYPE_CONTEXT_DESC; status = zeContextCreate(pDriver, &context_desc, &context); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // Create an command list for direct submission ze_command_list_desc_t altdesc = {}; altdesc.stype = ZE_STRUCTURE_TYPE_COMMAND_LIST_DESC; ze_command_list_handle_t command_list = {}; status = zeCommandListCreate(context, pDevice, &altdesc, &command_list); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // Create an event to be signaled by the device ze_event_pool_desc_t ep_desc = {}; ep_desc.stype = ZE_STRUCTURE_TYPE_EVENT_POOL_DESC; ep_desc.count = 1; ep_desc.flags = ZE_EVENT_POOL_FLAG_HOST_VISIBLE; ze_event_pool_handle_t event_pool; status = zeEventPoolCreate(context, &ep_desc, 1, &pDevice, &event_pool); EXPECT_EQ(ZE_RESULT_SUCCESS, status); std::vector event{}; // event for memcpy. event.resize(1); ze_event_desc_t ev_desc = {}; ev_desc.stype = ZE_STRUCTURE_TYPE_EVENT_DESC; ev_desc.signal = ZE_EVENT_SCOPE_FLAG_DEVICE; ev_desc.wait = ZE_EVENT_SCOPE_FLAG_HOST; for (uint32_t i = 0; i < 1; ++i) { ev_desc.index = i; status = zeEventCreate(event_pool, &ev_desc, &event[i]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); } ze_host_mem_alloc_desc_t host_desc = {}; host_desc.stype = ZE_STRUCTURE_TYPE_HOST_MEM_ALLOC_DESC; host_desc.pNext = nullptr; host_desc.flags = 0; size_t buffer_size = 1024; void *host_mem_ptr = nullptr; status = zeMemAllocHost(context, &host_desc, buffer_size, 1, &host_mem_ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); ze_device_mem_alloc_desc_t device_desc = {}; device_desc.stype = ZE_STRUCTURE_TYPE_DEVICE_MEM_ALLOC_DESC; device_desc.pNext = nullptr; // device_desc.ordinal = 0; device_desc.flags = 0; void *device_mem_ptr = nullptr; status = zeMemAllocDevice(context, &device_desc, buffer_size, 0, pDevice, &device_mem_ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // Host to Device, signals event[0] and is dependent on nothing. status = zeCommandListAppendMemoryCopy(command_list, device_mem_ptr, host_mem_ptr, buffer_size, event[0], 0, nullptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandListClose(command_list); EXPECT_EQ(ZE_RESULT_SUCCESS, status); ze_command_queue_desc_t command_queue_description{}; command_queue_description.stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC; command_queue_description.pNext = nullptr; // command_queue_description.ordinal = 0; // command_queue_description.index = 0; command_queue_description.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS; ze_command_queue_handle_t command_queue{}; status = zeCommandQueueCreate(context, pDevice, &command_queue_description, &command_queue); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandQueueExecuteCommandLists(command_queue, 1, &command_list, nullptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandQueueSynchronize(command_queue, UINT64_MAX); EXPECT_EQ(ZE_RESULT_SUCCESS, status); // Explicitly reset the event to be used again. status = zeEventHostReset(event[0]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); std::stringstream capture; std::streambuf *old_cerr_buf = std::cerr.rdbuf(); std::streambuf *old_cout_buf = std::cout.rdbuf(); std::cerr.rdbuf(capture.rdbuf()); std::cout.rdbuf(capture.rdbuf()); // Host to Device, signals event[0] and is dependent on nothing. status = zeCommandListAppendMemoryCopy(command_list, device_mem_ptr, host_mem_ptr, buffer_size, event[0], 0, nullptr); std::cerr.rdbuf(old_cerr_buf); std::cout.rdbuf(old_cout_buf); EXPECT_EQ(ZE_RESULT_SUCCESS, status); auto warningText = capture.str(); EXPECT_EQ(warningText, ""); status = zeCommandQueueDestroy(command_queue); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeMemFree(context, host_mem_ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeMemFree(context, device_mem_ptr); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeEventDestroy(event[0]); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeEventPoolDestroy(event_pool); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeCommandListDestroy(command_list); EXPECT_EQ(ZE_RESULT_SUCCESS, status); status = zeContextDestroy(context); EXPECT_EQ(ZE_RESULT_SUCCESS, status); } level-zero-1.20.6/third_party/000077500000000000000000000000001475521542100162235ustar00rootroot00000000000000level-zero-1.20.6/third_party/spdlog_headers/000077500000000000000000000000001475521542100212065ustar00rootroot00000000000000level-zero-1.20.6/third_party/spdlog_headers/.version000066400000000000000000000000071475521542100226710ustar00rootroot000000000000001.13.0 level-zero-1.20.6/third_party/spdlog_headers/LICENSE000066400000000000000000000025121475521542100222130ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2016 Gabi Melman. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- NOTE: Third party dependency used by this software -- This software depends on the fmt lib (MIT License), and users must comply to its license: https://raw.githubusercontent.com/fmtlib/fmt/master/LICENSE level-zero-1.20.6/third_party/spdlog_headers/README.md000066400000000000000000000002071475521542100224640ustar00rootroot00000000000000# Source locations of interface headers https://github.com/gabime/spdlog/tree/a3a0c9d66386962fcaf0178fcae03ac77c1e0257/include/spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/000077500000000000000000000000001475521542100224765ustar00rootroot00000000000000level-zero-1.20.6/third_party/spdlog_headers/spdlog/common-inl.h000066400000000000000000000040021475521542100247130ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include #include namespace spdlog { namespace level { #if __cplusplus >= 201703L constexpr #endif static string_view_t level_string_views[] SPDLOG_LEVEL_NAMES; static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES; SPDLOG_INLINE const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT { return level_string_views[l]; } SPDLOG_INLINE const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT { return short_level_names[l]; } SPDLOG_INLINE spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT { auto it = std::find(std::begin(level_string_views), std::end(level_string_views), name); if (it != std::end(level_string_views)) return static_cast(std::distance(std::begin(level_string_views), it)); // check also for "warn" and "err" before giving up.. if (name == "warn") { return level::warn; } if (name == "err") { return level::err; } return level::off; } } // namespace level SPDLOG_INLINE spdlog_ex::spdlog_ex(std::string msg) : msg_(std::move(msg)) {} SPDLOG_INLINE spdlog_ex::spdlog_ex(const std::string &msg, int last_errno) { #ifdef SPDLOG_USE_STD_FORMAT msg_ = std::system_error(std::error_code(last_errno, std::generic_category()), msg).what(); #else memory_buf_t outbuf; fmt::format_system_error(outbuf, last_errno, msg.c_str()); msg_ = fmt::to_string(outbuf); #endif } SPDLOG_INLINE const char *spdlog_ex::what() const SPDLOG_NOEXCEPT { return msg_.c_str(); } SPDLOG_INLINE void throw_spdlog_ex(const std::string &msg, int last_errno) { SPDLOG_THROW(spdlog_ex(msg, last_errno)); } SPDLOG_INLINE void throw_spdlog_ex(std::string msg) { SPDLOG_THROW(spdlog_ex(std::move(msg))); } } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/common.h000066400000000000000000000316211475521542100241420ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include #include #include #include #include #include #include #include #include #include #ifdef SPDLOG_USE_STD_FORMAT #include #if __cpp_lib_format >= 202207L #include #else #include #endif #endif #ifdef SPDLOG_COMPILED_LIB #undef SPDLOG_HEADER_ONLY #if defined(SPDLOG_SHARED_LIB) #if defined(_WIN32) #ifdef spdlog_EXPORTS #define SPDLOG_API __declspec(dllexport) #else // !spdlog_EXPORTS #define SPDLOG_API __declspec(dllimport) #endif #else // !defined(_WIN32) #define SPDLOG_API __attribute__((visibility("default"))) #endif #else // !defined(SPDLOG_SHARED_LIB) #define SPDLOG_API #endif #define SPDLOG_INLINE #else // !defined(SPDLOG_COMPILED_LIB) #define SPDLOG_API #define SPDLOG_HEADER_ONLY #define SPDLOG_INLINE inline #endif // #ifdef SPDLOG_COMPILED_LIB #include #if !defined(SPDLOG_USE_STD_FORMAT) && \ FMT_VERSION >= 80000 // backward compatibility with fmt versions older than 8 #define SPDLOG_FMT_RUNTIME(format_string) fmt::runtime(format_string) #define SPDLOG_FMT_STRING(format_string) FMT_STRING(format_string) #if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) #include #endif #else #define SPDLOG_FMT_RUNTIME(format_string) format_string #define SPDLOG_FMT_STRING(format_string) format_string #endif // visual studio up to 2013 does not support noexcept nor constexpr #if defined(_MSC_VER) && (_MSC_VER < 1900) #define SPDLOG_NOEXCEPT _NOEXCEPT #define SPDLOG_CONSTEXPR #else #define SPDLOG_NOEXCEPT noexcept #define SPDLOG_CONSTEXPR constexpr #endif // If building with std::format, can just use constexpr, otherwise if building with fmt // SPDLOG_CONSTEXPR_FUNC needs to be set the same as FMT_CONSTEXPR to avoid situations where // a constexpr function in spdlog could end up calling a non-constexpr function in fmt // depending on the compiler // If fmt determines it can't use constexpr, we should inline the function instead #ifdef SPDLOG_USE_STD_FORMAT #define SPDLOG_CONSTEXPR_FUNC constexpr #else // Being built with fmt #if FMT_USE_CONSTEXPR #define SPDLOG_CONSTEXPR_FUNC FMT_CONSTEXPR #else #define SPDLOG_CONSTEXPR_FUNC inline #endif #endif #if defined(__GNUC__) || defined(__clang__) #define SPDLOG_DEPRECATED __attribute__((deprecated)) #elif defined(_MSC_VER) #define SPDLOG_DEPRECATED __declspec(deprecated) #else #define SPDLOG_DEPRECATED #endif // disable thread local on msvc 2013 #ifndef SPDLOG_NO_TLS #if (defined(_MSC_VER) && (_MSC_VER < 1900)) || defined(__cplusplus_winrt) #define SPDLOG_NO_TLS 1 #endif #endif #ifndef SPDLOG_FUNCTION #define SPDLOG_FUNCTION static_cast(__FUNCTION__) #endif #ifdef SPDLOG_NO_EXCEPTIONS #define SPDLOG_TRY #define SPDLOG_THROW(ex) \ do { \ printf("spdlog fatal error: %s\n", ex.what()); \ std::abort(); \ } while (0) #define SPDLOG_CATCH_STD #else #define SPDLOG_TRY try #define SPDLOG_THROW(ex) throw(ex) #define SPDLOG_CATCH_STD \ catch (const std::exception &) { \ } #endif namespace spdlog { class formatter; namespace sinks { class sink; } #if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) using filename_t = std::wstring; // allow macro expansion to occur in SPDLOG_FILENAME_T #define SPDLOG_FILENAME_T_INNER(s) L##s #define SPDLOG_FILENAME_T(s) SPDLOG_FILENAME_T_INNER(s) #else using filename_t = std::string; #define SPDLOG_FILENAME_T(s) s #endif using log_clock = std::chrono::system_clock; using sink_ptr = std::shared_ptr; using sinks_init_list = std::initializer_list; using err_handler = std::function; #ifdef SPDLOG_USE_STD_FORMAT namespace fmt_lib = std; using string_view_t = std::string_view; using memory_buf_t = std::string; template #if __cpp_lib_format >= 202207L using format_string_t = std::format_string; #else using format_string_t = std::string_view; #endif template struct is_convertible_to_basic_format_string : std::integral_constant>::value> {}; #if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) using wstring_view_t = std::wstring_view; using wmemory_buf_t = std::wstring; template #if __cpp_lib_format >= 202207L using wformat_string_t = std::wformat_string; #else using wformat_string_t = std::wstring_view; #endif #endif #define SPDLOG_BUF_TO_STRING(x) x #else // use fmt lib instead of std::format namespace fmt_lib = fmt; using string_view_t = fmt::basic_string_view; using memory_buf_t = fmt::basic_memory_buffer; template using format_string_t = fmt::format_string; template using remove_cvref_t = typename std::remove_cv::type>::type; template #if FMT_VERSION >= 90101 using fmt_runtime_string = fmt::runtime_format_string; #else using fmt_runtime_string = fmt::basic_runtime; #endif // clang doesn't like SFINAE disabled constructor in std::is_convertible<> so have to repeat the // condition from basic_format_string here, in addition, fmt::basic_runtime is only // convertible to basic_format_string but not basic_string_view template struct is_convertible_to_basic_format_string : std::integral_constant>::value || std::is_same, fmt_runtime_string>::value> { }; #if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) using wstring_view_t = fmt::basic_string_view; using wmemory_buf_t = fmt::basic_memory_buffer; template using wformat_string_t = fmt::wformat_string; #endif #define SPDLOG_BUF_TO_STRING(x) fmt::to_string(x) #endif #ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT #ifndef _WIN32 #error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows #endif // _WIN32 #endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT template struct is_convertible_to_any_format_string : std::integral_constant::value || is_convertible_to_basic_format_string::value> {}; #if defined(SPDLOG_NO_ATOMIC_LEVELS) using level_t = details::null_atomic_int; #else using level_t = std::atomic; #endif #define SPDLOG_LEVEL_TRACE 0 #define SPDLOG_LEVEL_DEBUG 1 #define SPDLOG_LEVEL_INFO 2 #define SPDLOG_LEVEL_WARN 3 #define SPDLOG_LEVEL_ERROR 4 #define SPDLOG_LEVEL_CRITICAL 5 #define SPDLOG_LEVEL_OFF 6 #if !defined(SPDLOG_ACTIVE_LEVEL) #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO #endif // Log level enum namespace level { enum level_enum : int { trace = SPDLOG_LEVEL_TRACE, debug = SPDLOG_LEVEL_DEBUG, info = SPDLOG_LEVEL_INFO, warn = SPDLOG_LEVEL_WARN, err = SPDLOG_LEVEL_ERROR, critical = SPDLOG_LEVEL_CRITICAL, off = SPDLOG_LEVEL_OFF, n_levels }; #define SPDLOG_LEVEL_NAME_TRACE spdlog::string_view_t("trace", 5) #define SPDLOG_LEVEL_NAME_DEBUG spdlog::string_view_t("debug", 5) #define SPDLOG_LEVEL_NAME_INFO spdlog::string_view_t("info", 4) #define SPDLOG_LEVEL_NAME_WARNING spdlog::string_view_t("warning", 7) #define SPDLOG_LEVEL_NAME_ERROR spdlog::string_view_t("error", 5) #define SPDLOG_LEVEL_NAME_CRITICAL spdlog::string_view_t("critical", 8) #define SPDLOG_LEVEL_NAME_OFF spdlog::string_view_t("off", 3) #if !defined(SPDLOG_LEVEL_NAMES) #define SPDLOG_LEVEL_NAMES \ { \ SPDLOG_LEVEL_NAME_TRACE, SPDLOG_LEVEL_NAME_DEBUG, SPDLOG_LEVEL_NAME_INFO, \ SPDLOG_LEVEL_NAME_WARNING, SPDLOG_LEVEL_NAME_ERROR, SPDLOG_LEVEL_NAME_CRITICAL, \ SPDLOG_LEVEL_NAME_OFF \ } #endif #if !defined(SPDLOG_SHORT_LEVEL_NAMES) #define SPDLOG_SHORT_LEVEL_NAMES \ { "T", "D", "I", "W", "E", "C", "O" } #endif SPDLOG_API const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT; SPDLOG_API const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT; SPDLOG_API spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT; } // namespace level // // Color mode used by sinks with color support. // enum class color_mode { always, automatic, never }; // // Pattern time - specific time getting to use for pattern_formatter. // local time by default // enum class pattern_time_type { local, // log localtime utc // log utc }; // // Log exception // class SPDLOG_API spdlog_ex : public std::exception { public: explicit spdlog_ex(std::string msg); spdlog_ex(const std::string &msg, int last_errno); const char *what() const SPDLOG_NOEXCEPT override; private: std::string msg_; }; [[noreturn]] SPDLOG_API void throw_spdlog_ex(const std::string &msg, int last_errno); [[noreturn]] SPDLOG_API void throw_spdlog_ex(std::string msg); struct source_loc { SPDLOG_CONSTEXPR source_loc() = default; SPDLOG_CONSTEXPR source_loc(const char *filename_in, int line_in, const char *funcname_in) : filename{filename_in}, line{line_in}, funcname{funcname_in} {} SPDLOG_CONSTEXPR bool empty() const SPDLOG_NOEXCEPT { return line <= 0; } const char *filename{nullptr}; int line{0}; const char *funcname{nullptr}; }; struct file_event_handlers { file_event_handlers() : before_open(nullptr), after_open(nullptr), before_close(nullptr), after_close(nullptr) {} std::function before_open; std::function after_open; std::function before_close; std::function after_close; }; namespace details { // to_string_view SPDLOG_CONSTEXPR_FUNC spdlog::string_view_t to_string_view(const memory_buf_t &buf) SPDLOG_NOEXCEPT { return spdlog::string_view_t{buf.data(), buf.size()}; } SPDLOG_CONSTEXPR_FUNC spdlog::string_view_t to_string_view(spdlog::string_view_t str) SPDLOG_NOEXCEPT { return str; } #if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) SPDLOG_CONSTEXPR_FUNC spdlog::wstring_view_t to_string_view(const wmemory_buf_t &buf) SPDLOG_NOEXCEPT { return spdlog::wstring_view_t{buf.data(), buf.size()}; } SPDLOG_CONSTEXPR_FUNC spdlog::wstring_view_t to_string_view(spdlog::wstring_view_t str) SPDLOG_NOEXCEPT { return str; } #endif #ifndef SPDLOG_USE_STD_FORMAT template inline fmt::basic_string_view to_string_view(fmt::basic_format_string fmt) { return fmt; } #elif __cpp_lib_format >= 202207L template SPDLOG_CONSTEXPR_FUNC std::basic_string_view to_string_view( std::basic_format_string fmt) SPDLOG_NOEXCEPT { return fmt.get(); } #endif // make_unique support for pre c++14 #if __cplusplus >= 201402L // C++14 and beyond using std::enable_if_t; using std::make_unique; #else template using enable_if_t = typename std::enable_if::type; template std::unique_ptr make_unique(Args &&...args) { static_assert(!std::is_array::value, "arrays not supported"); return std::unique_ptr(new T(std::forward(args)...)); } #endif // to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324) template ::value, int> = 0> constexpr T conditional_static_cast(U value) { return static_cast(value); } template ::value, int> = 0> constexpr T conditional_static_cast(U value) { return value; } } // namespace details } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "common-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/000077500000000000000000000000001475521542100241235ustar00rootroot00000000000000level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/backtracer-inl.h000066400000000000000000000037241475521542100271630ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif namespace spdlog { namespace details { SPDLOG_INLINE backtracer::backtracer(const backtracer &other) { std::lock_guard lock(other.mutex_); enabled_ = other.enabled(); messages_ = other.messages_; } SPDLOG_INLINE backtracer::backtracer(backtracer &&other) SPDLOG_NOEXCEPT { std::lock_guard lock(other.mutex_); enabled_ = other.enabled(); messages_ = std::move(other.messages_); } SPDLOG_INLINE backtracer &backtracer::operator=(backtracer other) { std::lock_guard lock(mutex_); enabled_ = other.enabled(); messages_ = std::move(other.messages_); return *this; } SPDLOG_INLINE void backtracer::enable(size_t size) { std::lock_guard lock{mutex_}; enabled_.store(true, std::memory_order_relaxed); messages_ = circular_q{size}; } SPDLOG_INLINE void backtracer::disable() { std::lock_guard lock{mutex_}; enabled_.store(false, std::memory_order_relaxed); } SPDLOG_INLINE bool backtracer::enabled() const { return enabled_.load(std::memory_order_relaxed); } SPDLOG_INLINE void backtracer::push_back(const log_msg &msg) { std::lock_guard lock{mutex_}; messages_.push_back(log_msg_buffer{msg}); } SPDLOG_INLINE bool backtracer::empty() const { std::lock_guard lock{mutex_}; return messages_.empty(); } // pop all items in the q and apply the given fun on each of them. SPDLOG_INLINE void backtracer::foreach_pop(std::function fun) { std::lock_guard lock{mutex_}; while (!messages_.empty()) { auto &front_msg = messages_.front(); fun(front_msg); messages_.pop_front(); } } } // namespace details } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/backtracer.h000066400000000000000000000022151475521542100263750ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include #include #include #include // Store log messages in circular buffer. // Useful for storing debug data in case of error/warning happens. namespace spdlog { namespace details { class SPDLOG_API backtracer { mutable std::mutex mutex_; std::atomic enabled_{false}; circular_q messages_; public: backtracer() = default; backtracer(const backtracer &other); backtracer(backtracer &&other) SPDLOG_NOEXCEPT; backtracer &operator=(backtracer other); void enable(size_t size); void disable(); bool enabled() const; void push_back(const log_msg &msg); bool empty() const; // pop all items in the q and apply the given fun on each of them. void foreach_pop(std::function fun); }; } // namespace details } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "backtracer-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/circular_q.h000066400000000000000000000064611475521542100264270ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) // circular q view of std::vector. #pragma once #include #include #include "spdlog/common.h" namespace spdlog { namespace details { template class circular_q { size_t max_items_ = 0; typename std::vector::size_type head_ = 0; typename std::vector::size_type tail_ = 0; size_t overrun_counter_ = 0; std::vector v_; public: using value_type = T; // empty ctor - create a disabled queue with no elements allocated at all circular_q() = default; explicit circular_q(size_t max_items) : max_items_(max_items + 1) // one item is reserved as marker for full q , v_(max_items_) {} circular_q(const circular_q &) = default; circular_q &operator=(const circular_q &) = default; // move cannot be default, // since we need to reset head_, tail_, etc to zero in the moved object circular_q(circular_q &&other) SPDLOG_NOEXCEPT { copy_moveable(std::move(other)); } circular_q &operator=(circular_q &&other) SPDLOG_NOEXCEPT { copy_moveable(std::move(other)); return *this; } // push back, overrun (oldest) item if no room left void push_back(T &&item) { if (max_items_ > 0) { v_[tail_] = std::move(item); tail_ = (tail_ + 1) % max_items_; if (tail_ == head_) // overrun last item if full { head_ = (head_ + 1) % max_items_; ++overrun_counter_; } } } // Return reference to the front item. // If there are no elements in the container, the behavior is undefined. const T &front() const { return v_[head_]; } T &front() { return v_[head_]; } // Return number of elements actually stored size_t size() const { if (tail_ >= head_) { return tail_ - head_; } else { return max_items_ - (head_ - tail_); } } // Return const reference to item by index. // If index is out of range 0…size()-1, the behavior is undefined. const T &at(size_t i) const { assert(i < size()); return v_[(head_ + i) % max_items_]; } // Pop item from front. // If there are no elements in the container, the behavior is undefined. void pop_front() { head_ = (head_ + 1) % max_items_; } bool empty() const { return tail_ == head_; } bool full() const { // head is ahead of the tail by 1 if (max_items_ > 0) { return ((tail_ + 1) % max_items_) == head_; } return false; } size_t overrun_counter() const { return overrun_counter_; } void reset_overrun_counter() { overrun_counter_ = 0; } private: // copy from other&& and reset it to disabled state void copy_moveable(circular_q &&other) SPDLOG_NOEXCEPT { max_items_ = other.max_items_; head_ = other.head_; tail_ = other.tail_; overrun_counter_ = other.overrun_counter_; v_ = std::move(other.v_); // put &&other in disabled, but valid state other.max_items_ = 0; other.head_ = other.tail_ = 0; other.overrun_counter_ = 0; } }; } // namespace details } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/console_globals.h000066400000000000000000000011331475521542100274370ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include namespace spdlog { namespace details { struct console_mutex { using mutex_t = std::mutex; static mutex_t &mutex() { static mutex_t s_mutex; return s_mutex; } }; struct console_nullmutex { using mutex_t = null_mutex; static mutex_t &mutex() { static mutex_t s_mutex; return s_mutex; } }; } // namespace details } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/file_helper-inl.h000066400000000000000000000111441475521542100273330ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include #include #include #include #include #include #include #include namespace spdlog { namespace details { SPDLOG_INLINE file_helper::file_helper(const file_event_handlers &event_handlers) : event_handlers_(event_handlers) {} SPDLOG_INLINE file_helper::~file_helper() { close(); } SPDLOG_INLINE void file_helper::open(const filename_t &fname, bool truncate) { close(); filename_ = fname; auto *mode = SPDLOG_FILENAME_T("ab"); auto *trunc_mode = SPDLOG_FILENAME_T("wb"); if (event_handlers_.before_open) { event_handlers_.before_open(filename_); } for (int tries = 0; tries < open_tries_; ++tries) { // create containing folder if not exists already. os::create_dir(os::dir_name(fname)); if (truncate) { // Truncate by opening-and-closing a tmp file in "wb" mode, always // opening the actual log-we-write-to in "ab" mode, since that // interacts more politely with eternal processes that might // rotate/truncate the file underneath us. std::FILE *tmp; if (os::fopen_s(&tmp, fname, trunc_mode)) { continue; } std::fclose(tmp); } if (!os::fopen_s(&fd_, fname, mode)) { if (event_handlers_.after_open) { event_handlers_.after_open(filename_, fd_); } return; } details::os::sleep_for_millis(open_interval_); } throw_spdlog_ex("Failed opening file " + os::filename_to_str(filename_) + " for writing", errno); } SPDLOG_INLINE void file_helper::reopen(bool truncate) { if (filename_.empty()) { throw_spdlog_ex("Failed re opening file - was not opened before"); } this->open(filename_, truncate); } SPDLOG_INLINE void file_helper::flush() { if (std::fflush(fd_) != 0) { throw_spdlog_ex("Failed flush to file " + os::filename_to_str(filename_), errno); } } SPDLOG_INLINE void file_helper::sync() { if (!os::fsync(fd_)) { throw_spdlog_ex("Failed to fsync file " + os::filename_to_str(filename_), errno); } } SPDLOG_INLINE void file_helper::close() { if (fd_ != nullptr) { if (event_handlers_.before_close) { event_handlers_.before_close(filename_, fd_); } std::fclose(fd_); fd_ = nullptr; if (event_handlers_.after_close) { event_handlers_.after_close(filename_); } } } SPDLOG_INLINE void file_helper::write(const memory_buf_t &buf) { if (fd_ == nullptr) return; size_t msg_size = buf.size(); auto data = buf.data(); if (std::fwrite(data, 1, msg_size, fd_) != msg_size) { throw_spdlog_ex("Failed writing to file " + os::filename_to_str(filename_), errno); } } SPDLOG_INLINE size_t file_helper::size() const { if (fd_ == nullptr) { throw_spdlog_ex("Cannot use size() on closed file " + os::filename_to_str(filename_)); } return os::filesize(fd_); } SPDLOG_INLINE const filename_t &file_helper::filename() const { return filename_; } // // return file path and its extension: // // "mylog.txt" => ("mylog", ".txt") // "mylog" => ("mylog", "") // "mylog." => ("mylog.", "") // "/dir1/dir2/mylog.txt" => ("/dir1/dir2/mylog", ".txt") // // the starting dot in filenames is ignored (hidden files): // // ".mylog" => (".mylog". "") // "my_folder/.mylog" => ("my_folder/.mylog", "") // "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt") SPDLOG_INLINE std::tuple file_helper::split_by_extension( const filename_t &fname) { auto ext_index = fname.rfind('.'); // no valid extension found - return whole path and empty string as // extension if (ext_index == filename_t::npos || ext_index == 0 || ext_index == fname.size() - 1) { return std::make_tuple(fname, filename_t()); } // treat cases like "/etc/rc.d/somelogfile or "/abc/.hiddenfile" auto folder_index = fname.find_last_of(details::os::folder_seps_filename); if (folder_index != filename_t::npos && folder_index >= ext_index - 1) { return std::make_tuple(fname, filename_t()); } // finally - return a valid base and extension tuple return std::make_tuple(fname.substr(0, ext_index), fname.substr(ext_index)); } } // namespace details } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/file_helper.h000066400000000000000000000033361475521542100265570ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include namespace spdlog { namespace details { // Helper class for file sinks. // When failing to open a file, retry several times(5) with a delay interval(10 ms). // Throw spdlog_ex exception on errors. class SPDLOG_API file_helper { public: file_helper() = default; explicit file_helper(const file_event_handlers &event_handlers); file_helper(const file_helper &) = delete; file_helper &operator=(const file_helper &) = delete; ~file_helper(); void open(const filename_t &fname, bool truncate = false); void reopen(bool truncate); void flush(); void sync(); void close(); void write(const memory_buf_t &buf); size_t size() const; const filename_t &filename() const; // // return file path and its extension: // // "mylog.txt" => ("mylog", ".txt") // "mylog" => ("mylog", "") // "mylog." => ("mylog.", "") // "/dir1/dir2/mylog.txt" => ("/dir1/dir2/mylog", ".txt") // // the starting dot in filenames is ignored (hidden files): // // ".mylog" => (".mylog". "") // "my_folder/.mylog" => ("my_folder/.mylog", "") // "my_folder/.mylog.txt" => ("my_folder/.mylog", ".txt") static std::tuple split_by_extension(const filename_t &fname); private: const int open_tries_ = 5; const unsigned int open_interval_ = 10; std::FILE *fd_{nullptr}; filename_t filename_; file_event_handlers event_handlers_; }; } // namespace details } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "file_helper-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/fmt_helper.h000066400000000000000000000105671475521542100264320ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include #include #include #include #ifdef SPDLOG_USE_STD_FORMAT #include #include #endif // Some fmt helpers to efficiently format and pad ints and strings namespace spdlog { namespace details { namespace fmt_helper { inline void append_string_view(spdlog::string_view_t view, memory_buf_t &dest) { auto *buf_ptr = view.data(); dest.append(buf_ptr, buf_ptr + view.size()); } #ifdef SPDLOG_USE_STD_FORMAT template inline void append_int(T n, memory_buf_t &dest) { // Buffer should be large enough to hold all digits (digits10 + 1) and a sign SPDLOG_CONSTEXPR const auto BUF_SIZE = std::numeric_limits::digits10 + 2; char buf[BUF_SIZE]; auto [ptr, ec] = std::to_chars(buf, buf + BUF_SIZE, n, 10); if (ec == std::errc()) { dest.append(buf, ptr); } else { throw_spdlog_ex("Failed to format int", static_cast(ec)); } } #else template inline void append_int(T n, memory_buf_t &dest) { fmt::format_int i(n); dest.append(i.data(), i.data() + i.size()); } #endif template SPDLOG_CONSTEXPR_FUNC unsigned int count_digits_fallback(T n) { // taken from fmt: https://github.com/fmtlib/fmt/blob/8.0.1/include/fmt/format.h#L899-L912 unsigned int count = 1; for (;;) { // Integer division is slow so do it for a group of four digits instead // of for every digit. The idea comes from the talk by Alexandrescu // "Three Optimization Tips for C++". See speed-test for a comparison. if (n < 10) return count; if (n < 100) return count + 1; if (n < 1000) return count + 2; if (n < 10000) return count + 3; n /= 10000u; count += 4; } } template inline unsigned int count_digits(T n) { using count_type = typename std::conditional<(sizeof(T) > sizeof(uint32_t)), uint64_t, uint32_t>::type; #ifdef SPDLOG_USE_STD_FORMAT return count_digits_fallback(static_cast(n)); #else return static_cast(fmt:: // fmt 7.0.0 renamed the internal namespace to detail. // See: https://github.com/fmtlib/fmt/issues/1538 #if FMT_VERSION < 70000 internal #else detail #endif ::count_digits(static_cast(n))); #endif } inline void pad2(int n, memory_buf_t &dest) { if (n >= 0 && n < 100) // 0-99 { dest.push_back(static_cast('0' + n / 10)); dest.push_back(static_cast('0' + n % 10)); } else // unlikely, but just in case, let fmt deal with it { fmt_lib::format_to(std::back_inserter(dest), SPDLOG_FMT_STRING("{:02}"), n); } } template inline void pad_uint(T n, unsigned int width, memory_buf_t &dest) { static_assert(std::is_unsigned::value, "pad_uint must get unsigned T"); for (auto digits = count_digits(n); digits < width; digits++) { dest.push_back('0'); } append_int(n, dest); } template inline void pad3(T n, memory_buf_t &dest) { static_assert(std::is_unsigned::value, "pad3 must get unsigned T"); if (n < 1000) { dest.push_back(static_cast(n / 100 + '0')); n = n % 100; dest.push_back(static_cast((n / 10) + '0')); dest.push_back(static_cast((n % 10) + '0')); } else { append_int(n, dest); } } template inline void pad6(T n, memory_buf_t &dest) { pad_uint(n, 6, dest); } template inline void pad9(T n, memory_buf_t &dest) { pad_uint(n, 9, dest); } // return fraction of a second of the given time_point. // e.g. // fraction(tp) -> will return the millis part of the second template inline ToDuration time_fraction(log_clock::time_point tp) { using std::chrono::duration_cast; using std::chrono::seconds; auto duration = tp.time_since_epoch(); auto secs = duration_cast(duration); return duration_cast(duration) - duration_cast(secs); } } // namespace fmt_helper } // namespace details } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/log_msg-inl.h000066400000000000000000000025641475521542100265120ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include namespace spdlog { namespace details { SPDLOG_INLINE log_msg::log_msg(spdlog::log_clock::time_point log_time, spdlog::source_loc loc, string_view_t a_logger_name, spdlog::level::level_enum lvl, spdlog::string_view_t msg) : logger_name(a_logger_name), level(lvl), time(log_time) #ifndef SPDLOG_NO_THREAD_ID , thread_id(os::thread_id()) #endif , source(loc), payload(msg) { } SPDLOG_INLINE log_msg::log_msg(spdlog::source_loc loc, string_view_t a_logger_name, spdlog::level::level_enum lvl, spdlog::string_view_t msg) : log_msg(os::now(), loc, a_logger_name, lvl, msg) {} SPDLOG_INLINE log_msg::log_msg(string_view_t a_logger_name, spdlog::level::level_enum lvl, spdlog::string_view_t msg) : log_msg(os::now(), source_loc{}, a_logger_name, lvl, msg) {} } // namespace details } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/log_msg.h000066400000000000000000000022641475521542100257270ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include namespace spdlog { namespace details { struct SPDLOG_API log_msg { log_msg() = default; log_msg(log_clock::time_point log_time, source_loc loc, string_view_t logger_name, level::level_enum lvl, string_view_t msg); log_msg(source_loc loc, string_view_t logger_name, level::level_enum lvl, string_view_t msg); log_msg(string_view_t logger_name, level::level_enum lvl, string_view_t msg); log_msg(const log_msg &other) = default; log_msg &operator=(const log_msg &other) = default; string_view_t logger_name; level::level_enum level{level::off}; log_clock::time_point time; size_t thread_id{0}; // wrapping the formatted text with color (updated by pattern_formatter). mutable size_t color_range_start{0}; mutable size_t color_range_end{0}; source_loc source; string_view_t payload; }; } // namespace details } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "log_msg-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/log_msg_buffer-inl.h000066400000000000000000000032041475521542100300330ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif namespace spdlog { namespace details { SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg &orig_msg) : log_msg{orig_msg} { buffer.append(logger_name.begin(), logger_name.end()); buffer.append(payload.begin(), payload.end()); update_string_views(); } SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg_buffer &other) : log_msg{other} { buffer.append(logger_name.begin(), logger_name.end()); buffer.append(payload.begin(), payload.end()); update_string_views(); } SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT : log_msg{other}, buffer{std::move(other.buffer)} { update_string_views(); } SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(const log_msg_buffer &other) { log_msg::operator=(other); buffer.clear(); buffer.append(other.buffer.data(), other.buffer.data() + other.buffer.size()); update_string_views(); return *this; } SPDLOG_INLINE log_msg_buffer &log_msg_buffer::operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT { log_msg::operator=(other); buffer = std::move(other.buffer); update_string_views(); return *this; } SPDLOG_INLINE void log_msg_buffer::update_string_views() { logger_name = string_view_t{buffer.data(), logger_name.size()}; payload = string_view_t{buffer.data() + logger_name.size(), payload.size()}; } } // namespace details } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/log_msg_buffer.h000066400000000000000000000016471475521542100272640ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include namespace spdlog { namespace details { // Extend log_msg with internal buffer to store its payload. // This is needed since log_msg holds string_views that points to stack data. class SPDLOG_API log_msg_buffer : public log_msg { memory_buf_t buffer; void update_string_views(); public: log_msg_buffer() = default; explicit log_msg_buffer(const log_msg &orig_msg); log_msg_buffer(const log_msg_buffer &other); log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT; log_msg_buffer &operator=(const log_msg_buffer &other); log_msg_buffer &operator=(log_msg_buffer &&other) SPDLOG_NOEXCEPT; }; } // namespace details } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "log_msg_buffer-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/null_mutex.h000066400000000000000000000016421475521542100264730ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include // null, no cost dummy "mutex" and dummy "atomic" int namespace spdlog { namespace details { struct null_mutex { void lock() const {} void unlock() const {} }; struct null_atomic_int { int value; null_atomic_int() = default; explicit null_atomic_int(int new_value) : value(new_value) {} int load(std::memory_order = std::memory_order_relaxed) const { return value; } void store(int new_value, std::memory_order = std::memory_order_relaxed) { value = new_value; } int exchange(int new_value, std::memory_order = std::memory_order_relaxed) { std::swap(new_value, value); return new_value; // return value before the call } }; } // namespace details } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/os-inl.h000066400000000000000000000434551475521542100255100ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #ifdef _WIN32 #include #include // for FlushFileBuffers #include // for _get_osfhandle, _isatty, _fileno #include // for _get_pid #ifdef __MINGW32__ #include #endif #if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES) #include #include #endif #include // for _mkdir/_wmkdir #else // unix #include #include #ifdef __linux__ #include //Use gettid() syscall under linux to get thread id #elif defined(_AIX) #include // for pthread_getthrds_np #elif defined(__DragonFly__) || defined(__FreeBSD__) #include // for pthread_getthreadid_np #elif defined(__NetBSD__) #include // for _lwp_self #elif defined(__sun) #include // for thr_self #endif #endif // unix #if defined __APPLE__ #include #endif #ifndef __has_feature // Clang - feature checking macros. #define __has_feature(x) 0 // Compatibility with non-clang compilers. #endif namespace spdlog { namespace details { namespace os { SPDLOG_INLINE spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT { #if defined __linux__ && defined SPDLOG_CLOCK_COARSE timespec ts; ::clock_gettime(CLOCK_REALTIME_COARSE, &ts); return std::chrono::time_point( std::chrono::duration_cast( std::chrono::seconds(ts.tv_sec) + std::chrono::nanoseconds(ts.tv_nsec))); #else return log_clock::now(); #endif } SPDLOG_INLINE std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT { #ifdef _WIN32 std::tm tm; ::localtime_s(&tm, &time_tt); #else std::tm tm; ::localtime_r(&time_tt, &tm); #endif return tm; } SPDLOG_INLINE std::tm localtime() SPDLOG_NOEXCEPT { std::time_t now_t = ::time(nullptr); return localtime(now_t); } SPDLOG_INLINE std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT { #ifdef _WIN32 std::tm tm; ::gmtime_s(&tm, &time_tt); #else std::tm tm; ::gmtime_r(&time_tt, &tm); #endif return tm; } SPDLOG_INLINE std::tm gmtime() SPDLOG_NOEXCEPT { std::time_t now_t = ::time(nullptr); return gmtime(now_t); } // fopen_s on non windows for writing SPDLOG_INLINE bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode) { #ifdef _WIN32 #ifdef SPDLOG_WCHAR_FILENAMES *fp = ::_wfsopen((filename.c_str()), mode.c_str(), _SH_DENYNO); #else *fp = ::_fsopen((filename.c_str()), mode.c_str(), _SH_DENYNO); #endif #if defined(SPDLOG_PREVENT_CHILD_FD) if (*fp != nullptr) { auto file_handle = reinterpret_cast(_get_osfhandle(::_fileno(*fp))); if (!::SetHandleInformation(file_handle, HANDLE_FLAG_INHERIT, 0)) { ::fclose(*fp); *fp = nullptr; } } #endif #else // unix #if defined(SPDLOG_PREVENT_CHILD_FD) const int mode_flag = mode == SPDLOG_FILENAME_T("ab") ? O_APPEND : O_TRUNC; const int fd = ::open((filename.c_str()), O_CREAT | O_WRONLY | O_CLOEXEC | mode_flag, mode_t(0644)); if (fd == -1) { return true; } *fp = ::fdopen(fd, mode.c_str()); if (*fp == nullptr) { ::close(fd); } #else *fp = ::fopen((filename.c_str()), mode.c_str()); #endif #endif return *fp == nullptr; } SPDLOG_INLINE int remove(const filename_t &filename) SPDLOG_NOEXCEPT { #if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) return ::_wremove(filename.c_str()); #else return std::remove(filename.c_str()); #endif } SPDLOG_INLINE int remove_if_exists(const filename_t &filename) SPDLOG_NOEXCEPT { return path_exists(filename) ? remove(filename) : 0; } SPDLOG_INLINE int rename(const filename_t &filename1, const filename_t &filename2) SPDLOG_NOEXCEPT { #if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) return ::_wrename(filename1.c_str(), filename2.c_str()); #else return std::rename(filename1.c_str(), filename2.c_str()); #endif } // Return true if path exists (file or directory) SPDLOG_INLINE bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT { #ifdef _WIN32 struct _stat buffer; #ifdef SPDLOG_WCHAR_FILENAMES return (::_wstat(filename.c_str(), &buffer) == 0); #else return (::_stat(filename.c_str(), &buffer) == 0); #endif #else // common linux/unix all have the stat system call struct stat buffer; return (::stat(filename.c_str(), &buffer) == 0); #endif } #ifdef _MSC_VER // avoid warning about unreachable statement at the end of filesize() #pragma warning(push) #pragma warning(disable : 4702) #endif // Return file size according to open FILE* object SPDLOG_INLINE size_t filesize(FILE *f) { if (f == nullptr) { throw_spdlog_ex("Failed getting file size. fd is null"); } #if defined(_WIN32) && !defined(__CYGWIN__) int fd = ::_fileno(f); #if defined(_WIN64) // 64 bits __int64 ret = ::_filelengthi64(fd); if (ret >= 0) { return static_cast(ret); } #else // windows 32 bits long ret = ::_filelength(fd); if (ret >= 0) { return static_cast(ret); } #endif #else // unix // OpenBSD and AIX doesn't compile with :: before the fileno(..) #if defined(__OpenBSD__) || defined(_AIX) int fd = fileno(f); #else int fd = ::fileno(f); #endif // 64 bits(but not in osx, linux/musl or cygwin, where fstat64 is deprecated) #if ((defined(__linux__) && defined(__GLIBC__)) || defined(__sun) || defined(_AIX)) && \ (defined(__LP64__) || defined(_LP64)) struct stat64 st; if (::fstat64(fd, &st) == 0) { return static_cast(st.st_size); } #else // other unix or linux 32 bits or cygwin struct stat st; if (::fstat(fd, &st) == 0) { return static_cast(st.st_size); } #endif #endif throw_spdlog_ex("Failed getting file size from fd", errno); return 0; // will not be reached. } #ifdef _MSC_VER #pragma warning(pop) #endif // Return utc offset in minutes or throw spdlog_ex on failure SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm) { #ifdef _WIN32 #if _WIN32_WINNT < _WIN32_WINNT_WS08 TIME_ZONE_INFORMATION tzinfo; auto rv = ::GetTimeZoneInformation(&tzinfo); #else DYNAMIC_TIME_ZONE_INFORMATION tzinfo; auto rv = ::GetDynamicTimeZoneInformation(&tzinfo); #endif if (rv == TIME_ZONE_ID_INVALID) throw_spdlog_ex("Failed getting timezone info. ", errno); int offset = -tzinfo.Bias; if (tm.tm_isdst) { offset -= tzinfo.DaylightBias; } else { offset -= tzinfo.StandardBias; } return offset; #else #if defined(sun) || defined(__sun) || defined(_AIX) || \ (defined(__NEWLIB__) && !defined(__TM_GMTOFF)) || \ (!defined(_BSD_SOURCE) && !defined(_GNU_SOURCE)) // 'tm_gmtoff' field is BSD extension and it's missing on SunOS/Solaris struct helper { static long int calculate_gmt_offset(const std::tm &localtm = details::os::localtime(), const std::tm &gmtm = details::os::gmtime()) { int local_year = localtm.tm_year + (1900 - 1); int gmt_year = gmtm.tm_year + (1900 - 1); long int days = ( // difference in day of year localtm.tm_yday - gmtm.tm_yday // + intervening leap days + ((local_year >> 2) - (gmt_year >> 2)) - (local_year / 100 - gmt_year / 100) + ((local_year / 100 >> 2) - (gmt_year / 100 >> 2)) // + difference in years * 365 */ + static_cast(local_year - gmt_year) * 365); long int hours = (24 * days) + (localtm.tm_hour - gmtm.tm_hour); long int mins = (60 * hours) + (localtm.tm_min - gmtm.tm_min); long int secs = (60 * mins) + (localtm.tm_sec - gmtm.tm_sec); return secs; } }; auto offset_seconds = helper::calculate_gmt_offset(tm); #else auto offset_seconds = tm.tm_gmtoff; #endif return static_cast(offset_seconds / 60); #endif } // Return current thread id as size_t // It exists because the std::this_thread::get_id() is much slower(especially // under VS 2013) SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT { #ifdef _WIN32 return static_cast(::GetCurrentThreadId()); #elif defined(__linux__) #if defined(__ANDROID__) && defined(__ANDROID_API__) && (__ANDROID_API__ < 21) #define SYS_gettid __NR_gettid #endif return static_cast(::syscall(SYS_gettid)); #elif defined(_AIX) struct __pthrdsinfo buf; int reg_size = 0; pthread_t pt = pthread_self(); int retval = pthread_getthrds_np(&pt, PTHRDSINFO_QUERY_TID, &buf, sizeof(buf), NULL, ®_size); int tid = (!retval) ? buf.__pi_tid : 0; return static_cast(tid); #elif defined(__DragonFly__) || defined(__FreeBSD__) return static_cast(::pthread_getthreadid_np()); #elif defined(__NetBSD__) return static_cast(::_lwp_self()); #elif defined(__OpenBSD__) return static_cast(::getthrid()); #elif defined(__sun) return static_cast(::thr_self()); #elif __APPLE__ uint64_t tid; // There is no pthread_threadid_np prior to Mac OS X 10.6, and it is not supported on any PPC, // including 10.6.8 Rosetta. __POWERPC__ is Apple-specific define encompassing ppc and ppc64. #ifdef MAC_OS_X_VERSION_MAX_ALLOWED { #if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060) || defined(__POWERPC__) tid = pthread_mach_thread_np(pthread_self()); #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060 if (&pthread_threadid_np) { pthread_threadid_np(nullptr, &tid); } else { tid = pthread_mach_thread_np(pthread_self()); } #else pthread_threadid_np(nullptr, &tid); #endif } #else pthread_threadid_np(nullptr, &tid); #endif return static_cast(tid); #else // Default to standard C++11 (other Unix) return static_cast(std::hash()(std::this_thread::get_id())); #endif } // Return current thread id as size_t (from thread local storage) SPDLOG_INLINE size_t thread_id() SPDLOG_NOEXCEPT { #if defined(SPDLOG_NO_TLS) return _thread_id(); #else // cache thread id in tls static thread_local const size_t tid = _thread_id(); return tid; #endif } // This is avoid msvc issue in sleep_for that happens if the clock changes. // See https://github.com/gabime/spdlog/issues/609 SPDLOG_INLINE void sleep_for_millis(unsigned int milliseconds) SPDLOG_NOEXCEPT { #if defined(_WIN32) ::Sleep(milliseconds); #else std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds)); #endif } // wchar support for windows file names (SPDLOG_WCHAR_FILENAMES must be defined) #if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES) SPDLOG_INLINE std::string filename_to_str(const filename_t &filename) { memory_buf_t buf; wstr_to_utf8buf(filename, buf); return SPDLOG_BUF_TO_STRING(buf); } #else SPDLOG_INLINE std::string filename_to_str(const filename_t &filename) { return filename; } #endif SPDLOG_INLINE int pid() SPDLOG_NOEXCEPT { #ifdef _WIN32 return conditional_static_cast(::GetCurrentProcessId()); #else return conditional_static_cast(::getpid()); #endif } // Determine if the terminal supports colors // Based on: https://github.com/agauniyal/rang/ SPDLOG_INLINE bool is_color_terminal() SPDLOG_NOEXCEPT { #ifdef _WIN32 return true; #else static const bool result = []() { const char *env_colorterm_p = std::getenv("COLORTERM"); if (env_colorterm_p != nullptr) { return true; } static constexpr std::array terms = { {"ansi", "color", "console", "cygwin", "gnome", "konsole", "kterm", "linux", "msys", "putty", "rxvt", "screen", "vt100", "xterm", "alacritty", "vt102"}}; const char *env_term_p = std::getenv("TERM"); if (env_term_p == nullptr) { return false; } return std::any_of(terms.begin(), terms.end(), [&](const char *term) { return std::strstr(env_term_p, term) != nullptr; }); }(); return result; #endif } // Determine if the terminal attached // Source: https://github.com/agauniyal/rang/ SPDLOG_INLINE bool in_terminal(FILE *file) SPDLOG_NOEXCEPT { #ifdef _WIN32 return ::_isatty(_fileno(file)) != 0; #else return ::isatty(fileno(file)) != 0; #endif } #if (defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)) && defined(_WIN32) SPDLOG_INLINE void wstr_to_utf8buf(wstring_view_t wstr, memory_buf_t &target) { if (wstr.size() > static_cast((std::numeric_limits::max)()) / 4 - 1) { throw_spdlog_ex("UTF-16 string is too big to be converted to UTF-8"); } int wstr_size = static_cast(wstr.size()); if (wstr_size == 0) { target.resize(0); return; } int result_size = static_cast(target.capacity()); if ((wstr_size + 1) * 4 > result_size) { result_size = ::WideCharToMultiByte(CP_UTF8, 0, wstr.data(), wstr_size, NULL, 0, NULL, NULL); } if (result_size > 0) { target.resize(result_size); result_size = ::WideCharToMultiByte(CP_UTF8, 0, wstr.data(), wstr_size, target.data(), result_size, NULL, NULL); if (result_size > 0) { target.resize(result_size); return; } } throw_spdlog_ex( fmt_lib::format("WideCharToMultiByte failed. Last error: {}", ::GetLastError())); } SPDLOG_INLINE void utf8_to_wstrbuf(string_view_t str, wmemory_buf_t &target) { if (str.size() > static_cast((std::numeric_limits::max)()) - 1) { throw_spdlog_ex("UTF-8 string is too big to be converted to UTF-16"); } int str_size = static_cast(str.size()); if (str_size == 0) { target.resize(0); return; } // find the size to allocate for the result buffer int result_size = ::MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str.data(), str_size, NULL, 0); if (result_size > 0) { target.resize(result_size); result_size = ::MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, str.data(), str_size, target.data(), result_size); if (result_size > 0) { assert(result_size == target.size()); return; } } throw_spdlog_ex( fmt_lib::format("MultiByteToWideChar failed. Last error: {}", ::GetLastError())); } #endif // (defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)) && // defined(_WIN32) // return true on success static SPDLOG_INLINE bool mkdir_(const filename_t &path) { #ifdef _WIN32 #ifdef SPDLOG_WCHAR_FILENAMES return ::_wmkdir(path.c_str()) == 0; #else return ::_mkdir(path.c_str()) == 0; #endif #else return ::mkdir(path.c_str(), mode_t(0755)) == 0; #endif } // create the given directory - and all directories leading to it // return true on success or if the directory already exists SPDLOG_INLINE bool create_dir(const filename_t &path) { if (path_exists(path)) { return true; } if (path.empty()) { return false; } size_t search_offset = 0; do { auto token_pos = path.find_first_of(folder_seps_filename, search_offset); // treat the entire path as a folder if no folder separator not found if (token_pos == filename_t::npos) { token_pos = path.size(); } auto subdir = path.substr(0, token_pos); #ifdef _WIN32 // if subdir is just a drive letter, add a slash e.g. "c:"=>"c:\", // otherwise path_exists(subdir) returns false (issue #3079) const bool is_drive = subdir.length() == 2 && subdir[1] == ':'; if (is_drive) { subdir += '\\'; token_pos++; } #endif if (!subdir.empty() && !path_exists(subdir) && !mkdir_(subdir)) { return false; // return error if failed creating dir } search_offset = token_pos + 1; } while (search_offset < path.size()); return true; } // Return directory name from given path or empty string // "abc/file" => "abc" // "abc/" => "abc" // "abc" => "" // "abc///" => "abc//" SPDLOG_INLINE filename_t dir_name(const filename_t &path) { auto pos = path.find_last_of(folder_seps_filename); return pos != filename_t::npos ? path.substr(0, pos) : filename_t{}; } std::string SPDLOG_INLINE getenv(const char *field) { #if defined(_MSC_VER) #if defined(__cplusplus_winrt) return std::string{}; // not supported under uwp #else size_t len = 0; char buf[128]; bool ok = ::getenv_s(&len, buf, sizeof(buf), field) == 0; return ok ? buf : std::string{}; #endif #else // revert to getenv char *buf = ::getenv(field); return buf ? buf : std::string{}; #endif } // Do fsync by FILE handlerpointer // Return true on success SPDLOG_INLINE bool fsync(FILE *fp) { #ifdef _WIN32 return FlushFileBuffers(reinterpret_cast(_get_osfhandle(_fileno(fp)))) != 0; #else return ::fsync(fileno(fp)) == 0; #endif } } // namespace os } // namespace details } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/os.h000066400000000000000000000075221475521542100247230ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include // std::time_t #include namespace spdlog { namespace details { namespace os { SPDLOG_API spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT; SPDLOG_API std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT; SPDLOG_API std::tm localtime() SPDLOG_NOEXCEPT; SPDLOG_API std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT; SPDLOG_API std::tm gmtime() SPDLOG_NOEXCEPT; // eol definition #if !defined(SPDLOG_EOL) #ifdef _WIN32 #define SPDLOG_EOL "\r\n" #else #define SPDLOG_EOL "\n" #endif #endif SPDLOG_CONSTEXPR static const char *default_eol = SPDLOG_EOL; // folder separator #if !defined(SPDLOG_FOLDER_SEPS) #ifdef _WIN32 #define SPDLOG_FOLDER_SEPS "\\/" #else #define SPDLOG_FOLDER_SEPS "/" #endif #endif SPDLOG_CONSTEXPR static const char folder_seps[] = SPDLOG_FOLDER_SEPS; SPDLOG_CONSTEXPR static const filename_t::value_type folder_seps_filename[] = SPDLOG_FILENAME_T(SPDLOG_FOLDER_SEPS); // fopen_s on non windows for writing SPDLOG_API bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode); // Remove filename. return 0 on success SPDLOG_API int remove(const filename_t &filename) SPDLOG_NOEXCEPT; // Remove file if exists. return 0 on success // Note: Non atomic (might return failure to delete if concurrently deleted by other process/thread) SPDLOG_API int remove_if_exists(const filename_t &filename) SPDLOG_NOEXCEPT; SPDLOG_API int rename(const filename_t &filename1, const filename_t &filename2) SPDLOG_NOEXCEPT; // Return if file exists. SPDLOG_API bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT; // Return file size according to open FILE* object SPDLOG_API size_t filesize(FILE *f); // Return utc offset in minutes or throw spdlog_ex on failure SPDLOG_API int utc_minutes_offset(const std::tm &tm = details::os::localtime()); // Return current thread id as size_t // It exists because the std::this_thread::get_id() is much slower(especially // under VS 2013) SPDLOG_API size_t _thread_id() SPDLOG_NOEXCEPT; // Return current thread id as size_t (from thread local storage) SPDLOG_API size_t thread_id() SPDLOG_NOEXCEPT; // This is avoid msvc issue in sleep_for that happens if the clock changes. // See https://github.com/gabime/spdlog/issues/609 SPDLOG_API void sleep_for_millis(unsigned int milliseconds) SPDLOG_NOEXCEPT; SPDLOG_API std::string filename_to_str(const filename_t &filename); SPDLOG_API int pid() SPDLOG_NOEXCEPT; // Determine if the terminal supports colors // Source: https://github.com/agauniyal/rang/ SPDLOG_API bool is_color_terminal() SPDLOG_NOEXCEPT; // Determine if the terminal attached // Source: https://github.com/agauniyal/rang/ SPDLOG_API bool in_terminal(FILE *file) SPDLOG_NOEXCEPT; #if (defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)) && defined(_WIN32) SPDLOG_API void wstr_to_utf8buf(wstring_view_t wstr, memory_buf_t &target); SPDLOG_API void utf8_to_wstrbuf(string_view_t str, wmemory_buf_t &target); #endif // Return directory name from given path or empty string // "abc/file" => "abc" // "abc/" => "abc" // "abc" => "" // "abc///" => "abc//" SPDLOG_API filename_t dir_name(const filename_t &path); // Create a dir from the given path. // Return true if succeeded or if this dir already exists. SPDLOG_API bool create_dir(const filename_t &path); // non thread safe, cross platform getenv/getenv_s // return empty string if field not found SPDLOG_API std::string getenv(const char *field); // Do fsync by FILE objectpointer. // Return true on success. SPDLOG_API bool fsync(FILE *fp); } // namespace os } // namespace details } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "os-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/periodic_worker-inl.h000066400000000000000000000011541475521542100302440ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif namespace spdlog { namespace details { // stop the worker thread and join it SPDLOG_INLINE periodic_worker::~periodic_worker() { if (worker_thread_.joinable()) { { std::lock_guard lock(mutex_); active_ = false; } cv_.notify_one(); worker_thread_.join(); } } } // namespace details } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/periodic_worker.h000066400000000000000000000034251475521542100274670ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once // periodic worker thread - periodically executes the given callback function. // // RAII over the owned thread: // creates the thread on construction. // stops and joins the thread on destruction (if the thread is executing a callback, wait for it // to finish first). #include #include #include #include #include namespace spdlog { namespace details { class SPDLOG_API periodic_worker { public: template periodic_worker(const std::function &callback_fun, std::chrono::duration interval) { active_ = (interval > std::chrono::duration::zero()); if (!active_) { return; } worker_thread_ = std::thread([this, callback_fun, interval]() { for (;;) { std::unique_lock lock(this->mutex_); if (this->cv_.wait_for(lock, interval, [this] { return !this->active_; })) { return; // active_ == false, so exit this thread } callback_fun(); } }); } std::thread &get_thread() { return worker_thread_; } periodic_worker(const periodic_worker &) = delete; periodic_worker &operator=(const periodic_worker &) = delete; // stop the worker thread and join it ~periodic_worker(); private: bool active_; std::thread worker_thread_; std::mutex mutex_; std::condition_variable cv_; }; } // namespace details } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "periodic_worker-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/registry-inl.h000066400000000000000000000205471475521542100267340ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include #include #include #include #ifndef SPDLOG_DISABLE_DEFAULT_LOGGER // support for the default stdout color logger #ifdef _WIN32 #include #else #include #endif #endif // SPDLOG_DISABLE_DEFAULT_LOGGER #include #include #include #include #include namespace spdlog { namespace details { SPDLOG_INLINE registry::registry() : formatter_(new pattern_formatter()) { #ifndef SPDLOG_DISABLE_DEFAULT_LOGGER // create default logger (ansicolor_stdout_sink_mt or wincolor_stdout_sink_mt in windows). #ifdef _WIN32 auto color_sink = std::make_shared(); #else auto color_sink = std::make_shared(); #endif const char *default_logger_name = ""; default_logger_ = std::make_shared(default_logger_name, std::move(color_sink)); loggers_[default_logger_name] = default_logger_; #endif // SPDLOG_DISABLE_DEFAULT_LOGGER } SPDLOG_INLINE registry::~registry() = default; SPDLOG_INLINE void registry::register_logger(std::shared_ptr new_logger) { std::lock_guard lock(logger_map_mutex_); register_logger_(std::move(new_logger)); } SPDLOG_INLINE void registry::initialize_logger(std::shared_ptr new_logger) { std::lock_guard lock(logger_map_mutex_); new_logger->set_formatter(formatter_->clone()); if (err_handler_) { new_logger->set_error_handler(err_handler_); } // set new level according to previously configured level or default level auto it = log_levels_.find(new_logger->name()); auto new_level = it != log_levels_.end() ? it->second : global_log_level_; new_logger->set_level(new_level); new_logger->flush_on(flush_level_); if (backtrace_n_messages_ > 0) { new_logger->enable_backtrace(backtrace_n_messages_); } if (automatic_registration_) { register_logger_(std::move(new_logger)); } } SPDLOG_INLINE std::shared_ptr registry::get(const std::string &logger_name) { std::lock_guard lock(logger_map_mutex_); auto found = loggers_.find(logger_name); return found == loggers_.end() ? nullptr : found->second; } SPDLOG_INLINE std::shared_ptr registry::default_logger() { std::lock_guard lock(logger_map_mutex_); return default_logger_; } // Return raw ptr to the default logger. // To be used directly by the spdlog default api (e.g. spdlog::info) // This make the default API faster, but cannot be used concurrently with set_default_logger(). // e.g do not call set_default_logger() from one thread while calling spdlog::info() from another. SPDLOG_INLINE logger *registry::get_default_raw() { return default_logger_.get(); } // set default logger. // default logger is stored in default_logger_ (for faster retrieval) and in the loggers_ map. SPDLOG_INLINE void registry::set_default_logger(std::shared_ptr new_default_logger) { std::lock_guard lock(logger_map_mutex_); if (new_default_logger != nullptr) { loggers_[new_default_logger->name()] = new_default_logger; } default_logger_ = std::move(new_default_logger); } SPDLOG_INLINE void registry::set_tp(std::shared_ptr tp) { std::lock_guard lock(tp_mutex_); tp_ = std::move(tp); } SPDLOG_INLINE std::shared_ptr registry::get_tp() { std::lock_guard lock(tp_mutex_); return tp_; } // Set global formatter. Each sink in each logger will get a clone of this object SPDLOG_INLINE void registry::set_formatter(std::unique_ptr formatter) { std::lock_guard lock(logger_map_mutex_); formatter_ = std::move(formatter); for (auto &l : loggers_) { l.second->set_formatter(formatter_->clone()); } } SPDLOG_INLINE void registry::enable_backtrace(size_t n_messages) { std::lock_guard lock(logger_map_mutex_); backtrace_n_messages_ = n_messages; for (auto &l : loggers_) { l.second->enable_backtrace(n_messages); } } SPDLOG_INLINE void registry::disable_backtrace() { std::lock_guard lock(logger_map_mutex_); backtrace_n_messages_ = 0; for (auto &l : loggers_) { l.second->disable_backtrace(); } } SPDLOG_INLINE void registry::set_level(level::level_enum log_level) { std::lock_guard lock(logger_map_mutex_); for (auto &l : loggers_) { l.second->set_level(log_level); } global_log_level_ = log_level; } SPDLOG_INLINE void registry::flush_on(level::level_enum log_level) { std::lock_guard lock(logger_map_mutex_); for (auto &l : loggers_) { l.second->flush_on(log_level); } flush_level_ = log_level; } SPDLOG_INLINE void registry::set_error_handler(err_handler handler) { std::lock_guard lock(logger_map_mutex_); for (auto &l : loggers_) { l.second->set_error_handler(handler); } err_handler_ = std::move(handler); } SPDLOG_INLINE void registry::apply_all( const std::function)> &fun) { std::lock_guard lock(logger_map_mutex_); for (auto &l : loggers_) { fun(l.second); } } SPDLOG_INLINE void registry::flush_all() { std::lock_guard lock(logger_map_mutex_); for (auto &l : loggers_) { l.second->flush(); } } SPDLOG_INLINE void registry::drop(const std::string &logger_name) { std::lock_guard lock(logger_map_mutex_); auto is_default_logger = default_logger_ && default_logger_->name() == logger_name; loggers_.erase(logger_name); if (is_default_logger) { default_logger_.reset(); } } SPDLOG_INLINE void registry::drop_all() { std::lock_guard lock(logger_map_mutex_); loggers_.clear(); default_logger_.reset(); } // clean all resources and threads started by the registry SPDLOG_INLINE void registry::shutdown() { { std::lock_guard lock(flusher_mutex_); periodic_flusher_.reset(); } drop_all(); { std::lock_guard lock(tp_mutex_); tp_.reset(); } } SPDLOG_INLINE std::recursive_mutex ®istry::tp_mutex() { return tp_mutex_; } SPDLOG_INLINE void registry::set_automatic_registration(bool automatic_registration) { std::lock_guard lock(logger_map_mutex_); automatic_registration_ = automatic_registration; } SPDLOG_INLINE void registry::set_levels(log_levels levels, level::level_enum *global_level) { std::lock_guard lock(logger_map_mutex_); log_levels_ = std::move(levels); auto global_level_requested = global_level != nullptr; global_log_level_ = global_level_requested ? *global_level : global_log_level_; for (auto &logger : loggers_) { auto logger_entry = log_levels_.find(logger.first); if (logger_entry != log_levels_.end()) { logger.second->set_level(logger_entry->second); } else if (global_level_requested) { logger.second->set_level(*global_level); } } } SPDLOG_INLINE registry ®istry::instance() { static registry s_instance; return s_instance; } SPDLOG_INLINE void registry::apply_logger_env_levels(std::shared_ptr new_logger) { std::lock_guard lock(logger_map_mutex_); auto it = log_levels_.find(new_logger->name()); auto new_level = it != log_levels_.end() ? it->second : global_log_level_; new_logger->set_level(new_level); } SPDLOG_INLINE void registry::throw_if_exists_(const std::string &logger_name) { if (loggers_.find(logger_name) != loggers_.end()) { throw_spdlog_ex("logger with name '" + logger_name + "' already exists"); } } SPDLOG_INLINE void registry::register_logger_(std::shared_ptr new_logger) { auto logger_name = new_logger->name(); throw_if_exists_(logger_name); loggers_[logger_name] = std::move(new_logger); } } // namespace details } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/registry.h000066400000000000000000000103531475521542100261460ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once // Loggers registry of unique name->logger pointer // An attempt to create a logger with an already existing name will result with spdlog_ex exception. // If user requests a non existing logger, nullptr will be returned // This class is thread safe #include #include #include #include #include #include #include #include namespace spdlog { class logger; namespace details { class thread_pool; class SPDLOG_API registry { public: using log_levels = std::unordered_map; registry(const registry &) = delete; registry &operator=(const registry &) = delete; void register_logger(std::shared_ptr new_logger); void initialize_logger(std::shared_ptr new_logger); std::shared_ptr get(const std::string &logger_name); std::shared_ptr default_logger(); // Return raw ptr to the default logger. // To be used directly by the spdlog default api (e.g. spdlog::info) // This make the default API faster, but cannot be used concurrently with set_default_logger(). // e.g do not call set_default_logger() from one thread while calling spdlog::info() from // another. logger *get_default_raw(); // set default logger and add it to the registry if not registered already. // default logger is stored in default_logger_ (for faster retrieval) and in the loggers_ map. // Note: Make sure to unregister it when no longer needed or before calling again with a new // logger. void set_default_logger(std::shared_ptr new_default_logger); void set_tp(std::shared_ptr tp); std::shared_ptr get_tp(); // Set global formatter. Each sink in each logger will get a clone of this object void set_formatter(std::unique_ptr formatter); void enable_backtrace(size_t n_messages); void disable_backtrace(); void set_level(level::level_enum log_level); void flush_on(level::level_enum log_level); template void flush_every(std::chrono::duration interval) { std::lock_guard lock(flusher_mutex_); auto clbk = [this]() { this->flush_all(); }; periodic_flusher_ = details::make_unique(clbk, interval); } std::unique_ptr &get_flusher() { std::lock_guard lock(flusher_mutex_); return periodic_flusher_; } void set_error_handler(err_handler handler); void apply_all(const std::function)> &fun); void flush_all(); void drop(const std::string &logger_name); void drop_all(); // clean all resources and threads started by the registry void shutdown(); std::recursive_mutex &tp_mutex(); void set_automatic_registration(bool automatic_registration); // set levels for all existing/future loggers. global_level can be null if should not set. void set_levels(log_levels levels, level::level_enum *global_level); static registry &instance(); void apply_logger_env_levels(std::shared_ptr new_logger); private: registry(); ~registry(); void throw_if_exists_(const std::string &logger_name); void register_logger_(std::shared_ptr new_logger); bool set_level_from_cfg_(logger *logger); std::mutex logger_map_mutex_, flusher_mutex_; std::recursive_mutex tp_mutex_; std::unordered_map> loggers_; log_levels log_levels_; std::unique_ptr formatter_; spdlog::level::level_enum global_log_level_ = level::info; level::level_enum flush_level_ = level::off; err_handler err_handler_; std::shared_ptr tp_; std::unique_ptr periodic_flusher_; std::shared_ptr default_logger_; bool automatic_registration_ = true; size_t backtrace_n_messages_ = 0; }; } // namespace details } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "registry-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/synchronous_factory.h000066400000000000000000000013571475521542100304230ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include "registry.h" namespace spdlog { // Default logger factory- creates synchronous loggers class logger; struct synchronous_factory { template static std::shared_ptr create(std::string logger_name, SinkArgs &&...args) { auto sink = std::make_shared(std::forward(args)...); auto new_logger = std::make_shared(std::move(logger_name), std::move(sink)); details::registry::instance().initialize_logger(new_logger); return new_logger; } }; } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/details/windows_include.h000066400000000000000000000002741475521542100274740ustar00rootroot00000000000000#pragma once #ifndef NOMINMAX #define NOMINMAX // prevent windows redefining min/max #endif #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include level-zero-1.20.6/third_party/spdlog_headers/spdlog/fmt/000077500000000000000000000000001475521542100232645ustar00rootroot00000000000000level-zero-1.20.6/third_party/spdlog_headers/spdlog/fmt/bundled/000077500000000000000000000000001475521542100247015ustar00rootroot00000000000000level-zero-1.20.6/third_party/spdlog_headers/spdlog/fmt/bundled/core.h000066400000000000000000003031331475521542100260050ustar00rootroot00000000000000// Formatting library for C++ - the core API for char/UTF-8 // // Copyright (c) 2012 - present, Victor Zverovich // All rights reserved. // // For the license information refer to format.h. #ifndef FMT_CORE_H_ #define FMT_CORE_H_ #include // std::byte #include // std::FILE #include // std::strlen #include #include #include // std::addressof #include #include // The fmt library version in the form major * 10000 + minor * 100 + patch. #define FMT_VERSION 100201 #if defined(__clang__) && !defined(__ibmxl__) # define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__) #else # define FMT_CLANG_VERSION 0 #endif #if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && \ !defined(__NVCOMPILER) # define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) #else # define FMT_GCC_VERSION 0 #endif #ifndef FMT_GCC_PRAGMA // Workaround _Pragma bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59884. # if FMT_GCC_VERSION >= 504 # define FMT_GCC_PRAGMA(arg) _Pragma(arg) # else # define FMT_GCC_PRAGMA(arg) # endif #endif #ifdef __ICL # define FMT_ICC_VERSION __ICL #elif defined(__INTEL_COMPILER) # define FMT_ICC_VERSION __INTEL_COMPILER #else # define FMT_ICC_VERSION 0 #endif #ifdef _MSC_VER # define FMT_MSC_VERSION _MSC_VER # define FMT_MSC_WARNING(...) __pragma(warning(__VA_ARGS__)) #else # define FMT_MSC_VERSION 0 # define FMT_MSC_WARNING(...) #endif #ifdef _MSVC_LANG # define FMT_CPLUSPLUS _MSVC_LANG #else # define FMT_CPLUSPLUS __cplusplus #endif #ifdef __has_feature # define FMT_HAS_FEATURE(x) __has_feature(x) #else # define FMT_HAS_FEATURE(x) 0 #endif #if defined(__has_include) || FMT_ICC_VERSION >= 1600 || FMT_MSC_VERSION > 1900 # define FMT_HAS_INCLUDE(x) __has_include(x) #else # define FMT_HAS_INCLUDE(x) 0 #endif #ifdef __has_cpp_attribute # define FMT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) #else # define FMT_HAS_CPP_ATTRIBUTE(x) 0 #endif #define FMT_HAS_CPP14_ATTRIBUTE(attribute) \ (FMT_CPLUSPLUS >= 201402L && FMT_HAS_CPP_ATTRIBUTE(attribute)) #define FMT_HAS_CPP17_ATTRIBUTE(attribute) \ (FMT_CPLUSPLUS >= 201703L && FMT_HAS_CPP_ATTRIBUTE(attribute)) // Check if relaxed C++14 constexpr is supported. // GCC doesn't allow throw in constexpr until version 6 (bug 67371). #ifndef FMT_USE_CONSTEXPR # if (FMT_HAS_FEATURE(cxx_relaxed_constexpr) || FMT_MSC_VERSION >= 1912 || \ (FMT_GCC_VERSION >= 600 && FMT_CPLUSPLUS >= 201402L)) && \ !FMT_ICC_VERSION && (!defined(__NVCC__) || FMT_CPLUSPLUS >= 202002L) # define FMT_USE_CONSTEXPR 1 # else # define FMT_USE_CONSTEXPR 0 # endif #endif #if FMT_USE_CONSTEXPR # define FMT_CONSTEXPR constexpr #else # define FMT_CONSTEXPR #endif #if (FMT_CPLUSPLUS >= 202002L || \ (FMT_CPLUSPLUS >= 201709L && FMT_GCC_VERSION >= 1002)) && \ ((!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE >= 10) && \ (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION >= 10000) && \ (!FMT_MSC_VERSION || FMT_MSC_VERSION >= 1928)) && \ defined(__cpp_lib_is_constant_evaluated) # define FMT_CONSTEXPR20 constexpr #else # define FMT_CONSTEXPR20 #endif // Check if constexpr std::char_traits<>::{compare,length} are supported. #if defined(__GLIBCXX__) # if FMT_CPLUSPLUS >= 201703L && defined(_GLIBCXX_RELEASE) && \ _GLIBCXX_RELEASE >= 7 // GCC 7+ libstdc++ has _GLIBCXX_RELEASE. # define FMT_CONSTEXPR_CHAR_TRAITS constexpr # endif #elif defined(_LIBCPP_VERSION) && FMT_CPLUSPLUS >= 201703L && \ _LIBCPP_VERSION >= 4000 # define FMT_CONSTEXPR_CHAR_TRAITS constexpr #elif FMT_MSC_VERSION >= 1914 && FMT_CPLUSPLUS >= 201703L # define FMT_CONSTEXPR_CHAR_TRAITS constexpr #endif #ifndef FMT_CONSTEXPR_CHAR_TRAITS # define FMT_CONSTEXPR_CHAR_TRAITS #endif // Check if exceptions are disabled. #ifndef FMT_EXCEPTIONS # if (defined(__GNUC__) && !defined(__EXCEPTIONS)) || \ (FMT_MSC_VERSION && !_HAS_EXCEPTIONS) # define FMT_EXCEPTIONS 0 # else # define FMT_EXCEPTIONS 1 # endif #endif // Disable [[noreturn]] on MSVC/NVCC because of bogus unreachable code warnings. #if FMT_EXCEPTIONS && FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VERSION && \ !defined(__NVCC__) # define FMT_NORETURN [[noreturn]] #else # define FMT_NORETURN #endif #ifndef FMT_NODISCARD # if FMT_HAS_CPP17_ATTRIBUTE(nodiscard) # define FMT_NODISCARD [[nodiscard]] # else # define FMT_NODISCARD # endif #endif #ifndef FMT_INLINE # if FMT_GCC_VERSION || FMT_CLANG_VERSION # define FMT_INLINE inline __attribute__((always_inline)) # else # define FMT_INLINE inline # endif #endif #ifdef _MSC_VER # define FMT_UNCHECKED_ITERATOR(It) \ using _Unchecked_type = It // Mark iterator as checked. #else # define FMT_UNCHECKED_ITERATOR(It) using unchecked_type = It #endif #ifndef FMT_BEGIN_NAMESPACE # define FMT_BEGIN_NAMESPACE \ namespace fmt { \ inline namespace v10 { # define FMT_END_NAMESPACE \ } \ } #endif #ifndef FMT_EXPORT # define FMT_EXPORT # define FMT_BEGIN_EXPORT # define FMT_END_EXPORT #endif #if FMT_GCC_VERSION || FMT_CLANG_VERSION # define FMT_VISIBILITY(value) __attribute__((visibility(value))) #else # define FMT_VISIBILITY(value) #endif #if !defined(FMT_HEADER_ONLY) && defined(_WIN32) # if defined(FMT_LIB_EXPORT) # define FMT_API __declspec(dllexport) # elif defined(FMT_SHARED) # define FMT_API __declspec(dllimport) # endif #elif defined(FMT_LIB_EXPORT) || defined(FMT_SHARED) # define FMT_API FMT_VISIBILITY("default") #endif #ifndef FMT_API # define FMT_API #endif // libc++ supports string_view in pre-c++17. #if FMT_HAS_INCLUDE() && \ (FMT_CPLUSPLUS >= 201703L || defined(_LIBCPP_VERSION)) # include # define FMT_USE_STRING_VIEW #elif FMT_HAS_INCLUDE("experimental/string_view") && FMT_CPLUSPLUS >= 201402L # include # define FMT_USE_EXPERIMENTAL_STRING_VIEW #endif #ifndef FMT_UNICODE # define FMT_UNICODE !FMT_MSC_VERSION #endif #ifndef FMT_CONSTEVAL # if ((FMT_GCC_VERSION >= 1000 || FMT_CLANG_VERSION >= 1101) && \ (!defined(__apple_build_version__) || \ __apple_build_version__ >= 14000029L) && \ FMT_CPLUSPLUS >= 202002L) || \ (defined(__cpp_consteval) && \ (!FMT_MSC_VERSION || FMT_MSC_VERSION >= 1929)) // consteval is broken in MSVC before VS2019 version 16.10 and Apple clang // before 14. # define FMT_CONSTEVAL consteval # define FMT_HAS_CONSTEVAL # else # define FMT_CONSTEVAL # endif #endif #ifndef FMT_USE_NONTYPE_TEMPLATE_ARGS # if defined(__cpp_nontype_template_args) && \ ((FMT_GCC_VERSION >= 903 && FMT_CPLUSPLUS >= 201709L) || \ __cpp_nontype_template_args >= 201911L) && \ !defined(__NVCOMPILER) && !defined(__LCC__) # define FMT_USE_NONTYPE_TEMPLATE_ARGS 1 # else # define FMT_USE_NONTYPE_TEMPLATE_ARGS 0 # endif #endif // GCC < 5 requires this-> in decltype #ifndef FMT_DECLTYPE_THIS # if FMT_GCC_VERSION && FMT_GCC_VERSION < 500 # define FMT_DECLTYPE_THIS this-> # else # define FMT_DECLTYPE_THIS # endif #endif // Enable minimal optimizations for more compact code in debug mode. FMT_GCC_PRAGMA("GCC push_options") #if !defined(__OPTIMIZE__) && !defined(__NVCOMPILER) && !defined(__LCC__) && \ !defined(__CUDACC__) FMT_GCC_PRAGMA("GCC optimize(\"Og\")") #endif FMT_BEGIN_NAMESPACE // Implementations of enable_if_t and other metafunctions for older systems. template using enable_if_t = typename std::enable_if::type; template using conditional_t = typename std::conditional::type; template using bool_constant = std::integral_constant; template using remove_reference_t = typename std::remove_reference::type; template using remove_const_t = typename std::remove_const::type; template using remove_cvref_t = typename std::remove_cv>::type; template struct type_identity { using type = T; }; template using type_identity_t = typename type_identity::type; template using underlying_t = typename std::underlying_type::type; // Checks whether T is a container with contiguous storage. template struct is_contiguous : std::false_type {}; template struct is_contiguous> : std::true_type {}; struct monostate { constexpr monostate() {} }; // An enable_if helper to be used in template parameters which results in much // shorter symbols: https://godbolt.org/z/sWw4vP. Extra parentheses are needed // to workaround a bug in MSVC 2019 (see #1140 and #1186). #ifdef FMT_DOC # define FMT_ENABLE_IF(...) #else # define FMT_ENABLE_IF(...) fmt::enable_if_t<(__VA_ARGS__), int> = 0 #endif // This is defined in core.h instead of format.h to avoid injecting in std. // It is a template to avoid undesirable implicit conversions to std::byte. #ifdef __cpp_lib_byte template ::value)> inline auto format_as(T b) -> unsigned char { return static_cast(b); } #endif namespace detail { // Suppresses "unused variable" warnings with the method described in // https://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/. // (void)var does not work on many Intel compilers. template FMT_CONSTEXPR void ignore_unused(const T&...) {} constexpr FMT_INLINE auto is_constant_evaluated( bool default_value = false) noexcept -> bool { // Workaround for incompatibility between libstdc++ consteval-based // std::is_constant_evaluated() implementation and clang-14. // https://github.com/fmtlib/fmt/issues/3247 #if FMT_CPLUSPLUS >= 202002L && defined(_GLIBCXX_RELEASE) && \ _GLIBCXX_RELEASE >= 12 && \ (FMT_CLANG_VERSION >= 1400 && FMT_CLANG_VERSION < 1500) ignore_unused(default_value); return __builtin_is_constant_evaluated(); #elif defined(__cpp_lib_is_constant_evaluated) ignore_unused(default_value); return std::is_constant_evaluated(); #else return default_value; #endif } // Suppresses "conditional expression is constant" warnings. template constexpr FMT_INLINE auto const_check(T value) -> T { return value; } FMT_NORETURN FMT_API void assert_fail(const char* file, int line, const char* message); #ifndef FMT_ASSERT # ifdef NDEBUG // FMT_ASSERT is not empty to avoid -Wempty-body. # define FMT_ASSERT(condition, message) \ fmt::detail::ignore_unused((condition), (message)) # else # define FMT_ASSERT(condition, message) \ ((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \ ? (void)0 \ : fmt::detail::assert_fail(__FILE__, __LINE__, (message))) # endif #endif #if defined(FMT_USE_STRING_VIEW) template using std_string_view = std::basic_string_view; #elif defined(FMT_USE_EXPERIMENTAL_STRING_VIEW) template using std_string_view = std::experimental::basic_string_view; #else template struct std_string_view {}; #endif #ifdef FMT_USE_INT128 // Do nothing. #elif defined(__SIZEOF_INT128__) && !defined(__NVCC__) && \ !(FMT_CLANG_VERSION && FMT_MSC_VERSION) # define FMT_USE_INT128 1 using int128_opt = __int128_t; // An optional native 128-bit integer. using uint128_opt = __uint128_t; template inline auto convert_for_visit(T value) -> T { return value; } #else # define FMT_USE_INT128 0 #endif #if !FMT_USE_INT128 enum class int128_opt {}; enum class uint128_opt {}; // Reduce template instantiations. template auto convert_for_visit(T) -> monostate { return {}; } #endif // Casts a nonnegative integer to unsigned. template FMT_CONSTEXPR auto to_unsigned(Int value) -> typename std::make_unsigned::type { FMT_ASSERT(std::is_unsigned::value || value >= 0, "negative value"); return static_cast::type>(value); } FMT_CONSTEXPR inline auto is_utf8() -> bool { FMT_MSC_WARNING(suppress : 4566) constexpr unsigned char section[] = "\u00A7"; // Avoid buggy sign extensions in MSVC's constant evaluation mode (#2297). using uchar = unsigned char; return FMT_UNICODE || (sizeof(section) == 3 && uchar(section[0]) == 0xC2 && uchar(section[1]) == 0xA7); } } // namespace detail /** An implementation of ``std::basic_string_view`` for pre-C++17. It provides a subset of the API. ``fmt::basic_string_view`` is used for format strings even if ``std::string_view`` is available to prevent issues when a library is compiled with a different ``-std`` option than the client code (which is not recommended). */ FMT_EXPORT template class basic_string_view { private: const Char* data_; size_t size_; public: using value_type = Char; using iterator = const Char*; constexpr basic_string_view() noexcept : data_(nullptr), size_(0) {} /** Constructs a string reference object from a C string and a size. */ constexpr basic_string_view(const Char* s, size_t count) noexcept : data_(s), size_(count) {} /** \rst Constructs a string reference object from a C string computing the size with ``std::char_traits::length``. \endrst */ FMT_CONSTEXPR_CHAR_TRAITS FMT_INLINE basic_string_view(const Char* s) : data_(s), size_(detail::const_check(std::is_same::value && !detail::is_constant_evaluated(true)) ? std::strlen(reinterpret_cast(s)) : std::char_traits::length(s)) {} /** Constructs a string reference from a ``std::basic_string`` object. */ template FMT_CONSTEXPR basic_string_view( const std::basic_string& s) noexcept : data_(s.data()), size_(s.size()) {} template >::value)> FMT_CONSTEXPR basic_string_view(S s) noexcept : data_(s.data()), size_(s.size()) {} /** Returns a pointer to the string data. */ constexpr auto data() const noexcept -> const Char* { return data_; } /** Returns the string size. */ constexpr auto size() const noexcept -> size_t { return size_; } constexpr auto begin() const noexcept -> iterator { return data_; } constexpr auto end() const noexcept -> iterator { return data_ + size_; } constexpr auto operator[](size_t pos) const noexcept -> const Char& { return data_[pos]; } FMT_CONSTEXPR void remove_prefix(size_t n) noexcept { data_ += n; size_ -= n; } FMT_CONSTEXPR_CHAR_TRAITS auto starts_with( basic_string_view sv) const noexcept -> bool { return size_ >= sv.size_ && std::char_traits::compare(data_, sv.data_, sv.size_) == 0; } FMT_CONSTEXPR_CHAR_TRAITS auto starts_with(Char c) const noexcept -> bool { return size_ >= 1 && std::char_traits::eq(*data_, c); } FMT_CONSTEXPR_CHAR_TRAITS auto starts_with(const Char* s) const -> bool { return starts_with(basic_string_view(s)); } // Lexicographically compare this string reference to other. FMT_CONSTEXPR_CHAR_TRAITS auto compare(basic_string_view other) const -> int { size_t str_size = size_ < other.size_ ? size_ : other.size_; int result = std::char_traits::compare(data_, other.data_, str_size); if (result == 0) result = size_ == other.size_ ? 0 : (size_ < other.size_ ? -1 : 1); return result; } FMT_CONSTEXPR_CHAR_TRAITS friend auto operator==(basic_string_view lhs, basic_string_view rhs) -> bool { return lhs.compare(rhs) == 0; } friend auto operator!=(basic_string_view lhs, basic_string_view rhs) -> bool { return lhs.compare(rhs) != 0; } friend auto operator<(basic_string_view lhs, basic_string_view rhs) -> bool { return lhs.compare(rhs) < 0; } friend auto operator<=(basic_string_view lhs, basic_string_view rhs) -> bool { return lhs.compare(rhs) <= 0; } friend auto operator>(basic_string_view lhs, basic_string_view rhs) -> bool { return lhs.compare(rhs) > 0; } friend auto operator>=(basic_string_view lhs, basic_string_view rhs) -> bool { return lhs.compare(rhs) >= 0; } }; FMT_EXPORT using string_view = basic_string_view; /** Specifies if ``T`` is a character type. Can be specialized by users. */ FMT_EXPORT template struct is_char : std::false_type {}; template <> struct is_char : std::true_type {}; namespace detail { // A base class for compile-time strings. struct compile_string {}; template struct is_compile_string : std::is_base_of {}; template ::value)> FMT_INLINE auto to_string_view(const Char* s) -> basic_string_view { return s; } template inline auto to_string_view(const std::basic_string& s) -> basic_string_view { return s; } template constexpr auto to_string_view(basic_string_view s) -> basic_string_view { return s; } template >::value)> inline auto to_string_view(std_string_view s) -> basic_string_view { return s; } template ::value)> constexpr auto to_string_view(const S& s) -> basic_string_view { return basic_string_view(s); } void to_string_view(...); // Specifies whether S is a string type convertible to fmt::basic_string_view. // It should be a constexpr function but MSVC 2017 fails to compile it in // enable_if and MSVC 2015 fails to compile it as an alias template. // ADL is intentionally disabled as to_string_view is not an extension point. template struct is_string : std::is_class()))> {}; template struct char_t_impl {}; template struct char_t_impl::value>> { using result = decltype(to_string_view(std::declval())); using type = typename result::value_type; }; enum class type { none_type, // Integer types should go first, int_type, uint_type, long_long_type, ulong_long_type, int128_type, uint128_type, bool_type, char_type, last_integer_type = char_type, // followed by floating-point types. float_type, double_type, long_double_type, last_numeric_type = long_double_type, cstring_type, string_type, pointer_type, custom_type }; // Maps core type T to the corresponding type enum constant. template struct type_constant : std::integral_constant {}; #define FMT_TYPE_CONSTANT(Type, constant) \ template \ struct type_constant \ : std::integral_constant {} FMT_TYPE_CONSTANT(int, int_type); FMT_TYPE_CONSTANT(unsigned, uint_type); FMT_TYPE_CONSTANT(long long, long_long_type); FMT_TYPE_CONSTANT(unsigned long long, ulong_long_type); FMT_TYPE_CONSTANT(int128_opt, int128_type); FMT_TYPE_CONSTANT(uint128_opt, uint128_type); FMT_TYPE_CONSTANT(bool, bool_type); FMT_TYPE_CONSTANT(Char, char_type); FMT_TYPE_CONSTANT(float, float_type); FMT_TYPE_CONSTANT(double, double_type); FMT_TYPE_CONSTANT(long double, long_double_type); FMT_TYPE_CONSTANT(const Char*, cstring_type); FMT_TYPE_CONSTANT(basic_string_view, string_type); FMT_TYPE_CONSTANT(const void*, pointer_type); constexpr auto is_integral_type(type t) -> bool { return t > type::none_type && t <= type::last_integer_type; } constexpr auto is_arithmetic_type(type t) -> bool { return t > type::none_type && t <= type::last_numeric_type; } constexpr auto set(type rhs) -> int { return 1 << static_cast(rhs); } constexpr auto in(type t, int set) -> bool { return ((set >> static_cast(t)) & 1) != 0; } // Bitsets of types. enum { sint_set = set(type::int_type) | set(type::long_long_type) | set(type::int128_type), uint_set = set(type::uint_type) | set(type::ulong_long_type) | set(type::uint128_type), bool_set = set(type::bool_type), char_set = set(type::char_type), float_set = set(type::float_type) | set(type::double_type) | set(type::long_double_type), string_set = set(type::string_type), cstring_set = set(type::cstring_type), pointer_set = set(type::pointer_type) }; // DEPRECATED! FMT_NORETURN FMT_API void throw_format_error(const char* message); struct error_handler { constexpr error_handler() = default; // This function is intentionally not constexpr to give a compile-time error. FMT_NORETURN void on_error(const char* message) { throw_format_error(message); } }; } // namespace detail /** Throws ``format_error`` with a given message. */ using detail::throw_format_error; /** String's character type. */ template using char_t = typename detail::char_t_impl::type; /** \rst Parsing context consisting of a format string range being parsed and an argument counter for automatic indexing. You can use the ``format_parse_context`` type alias for ``char`` instead. \endrst */ FMT_EXPORT template class basic_format_parse_context { private: basic_string_view format_str_; int next_arg_id_; FMT_CONSTEXPR void do_check_arg_id(int id); public: using char_type = Char; using iterator = const Char*; explicit constexpr basic_format_parse_context( basic_string_view format_str, int next_arg_id = 0) : format_str_(format_str), next_arg_id_(next_arg_id) {} /** Returns an iterator to the beginning of the format string range being parsed. */ constexpr auto begin() const noexcept -> iterator { return format_str_.begin(); } /** Returns an iterator past the end of the format string range being parsed. */ constexpr auto end() const noexcept -> iterator { return format_str_.end(); } /** Advances the begin iterator to ``it``. */ FMT_CONSTEXPR void advance_to(iterator it) { format_str_.remove_prefix(detail::to_unsigned(it - begin())); } /** Reports an error if using the manual argument indexing; otherwise returns the next argument index and switches to the automatic indexing. */ FMT_CONSTEXPR auto next_arg_id() -> int { if (next_arg_id_ < 0) { detail::throw_format_error( "cannot switch from manual to automatic argument indexing"); return 0; } int id = next_arg_id_++; do_check_arg_id(id); return id; } /** Reports an error if using the automatic argument indexing; otherwise switches to the manual indexing. */ FMT_CONSTEXPR void check_arg_id(int id) { if (next_arg_id_ > 0) { detail::throw_format_error( "cannot switch from automatic to manual argument indexing"); return; } next_arg_id_ = -1; do_check_arg_id(id); } FMT_CONSTEXPR void check_arg_id(basic_string_view) {} FMT_CONSTEXPR void check_dynamic_spec(int arg_id); }; FMT_EXPORT using format_parse_context = basic_format_parse_context; namespace detail { // A parse context with extra data used only in compile-time checks. template class compile_parse_context : public basic_format_parse_context { private: int num_args_; const type* types_; using base = basic_format_parse_context; public: explicit FMT_CONSTEXPR compile_parse_context( basic_string_view format_str, int num_args, const type* types, int next_arg_id = 0) : base(format_str, next_arg_id), num_args_(num_args), types_(types) {} constexpr auto num_args() const -> int { return num_args_; } constexpr auto arg_type(int id) const -> type { return types_[id]; } FMT_CONSTEXPR auto next_arg_id() -> int { int id = base::next_arg_id(); if (id >= num_args_) throw_format_error("argument not found"); return id; } FMT_CONSTEXPR void check_arg_id(int id) { base::check_arg_id(id); if (id >= num_args_) throw_format_error("argument not found"); } using base::check_arg_id; FMT_CONSTEXPR void check_dynamic_spec(int arg_id) { detail::ignore_unused(arg_id); #if !defined(__LCC__) if (arg_id < num_args_ && types_ && !is_integral_type(types_[arg_id])) throw_format_error("width/precision is not integer"); #endif } }; // Extracts a reference to the container from back_insert_iterator. template inline auto get_container(std::back_insert_iterator it) -> Container& { using base = std::back_insert_iterator; struct accessor : base { accessor(base b) : base(b) {} using base::container; }; return *accessor(it).container; } template FMT_CONSTEXPR auto copy_str(InputIt begin, InputIt end, OutputIt out) -> OutputIt { while (begin != end) *out++ = static_cast(*begin++); return out; } template , U>::value&& is_char::value)> FMT_CONSTEXPR auto copy_str(T* begin, T* end, U* out) -> U* { if (is_constant_evaluated()) return copy_str(begin, end, out); auto size = to_unsigned(end - begin); if (size > 0) memcpy(out, begin, size * sizeof(U)); return out + size; } /** \rst A contiguous memory buffer with an optional growing ability. It is an internal class and shouldn't be used directly, only via `~fmt::basic_memory_buffer`. \endrst */ template class buffer { private: T* ptr_; size_t size_; size_t capacity_; protected: // Don't initialize ptr_ since it is not accessed to save a few cycles. FMT_MSC_WARNING(suppress : 26495) FMT_CONSTEXPR buffer(size_t sz) noexcept : size_(sz), capacity_(sz) {} FMT_CONSTEXPR20 buffer(T* p = nullptr, size_t sz = 0, size_t cap = 0) noexcept : ptr_(p), size_(sz), capacity_(cap) {} FMT_CONSTEXPR20 ~buffer() = default; buffer(buffer&&) = default; /** Sets the buffer data and capacity. */ FMT_CONSTEXPR void set(T* buf_data, size_t buf_capacity) noexcept { ptr_ = buf_data; capacity_ = buf_capacity; } /** Increases the buffer capacity to hold at least *capacity* elements. */ // DEPRECATED! virtual FMT_CONSTEXPR20 void grow(size_t capacity) = 0; public: using value_type = T; using const_reference = const T&; buffer(const buffer&) = delete; void operator=(const buffer&) = delete; FMT_INLINE auto begin() noexcept -> T* { return ptr_; } FMT_INLINE auto end() noexcept -> T* { return ptr_ + size_; } FMT_INLINE auto begin() const noexcept -> const T* { return ptr_; } FMT_INLINE auto end() const noexcept -> const T* { return ptr_ + size_; } /** Returns the size of this buffer. */ constexpr auto size() const noexcept -> size_t { return size_; } /** Returns the capacity of this buffer. */ constexpr auto capacity() const noexcept -> size_t { return capacity_; } /** Returns a pointer to the buffer data (not null-terminated). */ FMT_CONSTEXPR auto data() noexcept -> T* { return ptr_; } FMT_CONSTEXPR auto data() const noexcept -> const T* { return ptr_; } /** Clears this buffer. */ void clear() { size_ = 0; } // Tries resizing the buffer to contain *count* elements. If T is a POD type // the new elements may not be initialized. FMT_CONSTEXPR20 void try_resize(size_t count) { try_reserve(count); size_ = count <= capacity_ ? count : capacity_; } // Tries increasing the buffer capacity to *new_capacity*. It can increase the // capacity by a smaller amount than requested but guarantees there is space // for at least one additional element either by increasing the capacity or by // flushing the buffer if it is full. FMT_CONSTEXPR20 void try_reserve(size_t new_capacity) { if (new_capacity > capacity_) grow(new_capacity); } FMT_CONSTEXPR20 void push_back(const T& value) { try_reserve(size_ + 1); ptr_[size_++] = value; } /** Appends data to the end of the buffer. */ template void append(const U* begin, const U* end); template FMT_CONSTEXPR auto operator[](Idx index) -> T& { return ptr_[index]; } template FMT_CONSTEXPR auto operator[](Idx index) const -> const T& { return ptr_[index]; } }; struct buffer_traits { explicit buffer_traits(size_t) {} auto count() const -> size_t { return 0; } auto limit(size_t size) -> size_t { return size; } }; class fixed_buffer_traits { private: size_t count_ = 0; size_t limit_; public: explicit fixed_buffer_traits(size_t limit) : limit_(limit) {} auto count() const -> size_t { return count_; } auto limit(size_t size) -> size_t { size_t n = limit_ > count_ ? limit_ - count_ : 0; count_ += size; return size < n ? size : n; } }; // A buffer that writes to an output iterator when flushed. template class iterator_buffer final : public Traits, public buffer { private: OutputIt out_; enum { buffer_size = 256 }; T data_[buffer_size]; protected: FMT_CONSTEXPR20 void grow(size_t) override { if (this->size() == buffer_size) flush(); } void flush() { auto size = this->size(); this->clear(); out_ = copy_str(data_, data_ + this->limit(size), out_); } public: explicit iterator_buffer(OutputIt out, size_t n = buffer_size) : Traits(n), buffer(data_, 0, buffer_size), out_(out) {} iterator_buffer(iterator_buffer&& other) : Traits(other), buffer(data_, 0, buffer_size), out_(other.out_) {} ~iterator_buffer() { flush(); } auto out() -> OutputIt { flush(); return out_; } auto count() const -> size_t { return Traits::count() + this->size(); } }; template class iterator_buffer final : public fixed_buffer_traits, public buffer { private: T* out_; enum { buffer_size = 256 }; T data_[buffer_size]; protected: FMT_CONSTEXPR20 void grow(size_t) override { if (this->size() == this->capacity()) flush(); } void flush() { size_t n = this->limit(this->size()); if (this->data() == out_) { out_ += n; this->set(data_, buffer_size); } this->clear(); } public: explicit iterator_buffer(T* out, size_t n = buffer_size) : fixed_buffer_traits(n), buffer(out, 0, n), out_(out) {} iterator_buffer(iterator_buffer&& other) : fixed_buffer_traits(other), buffer(std::move(other)), out_(other.out_) { if (this->data() != out_) { this->set(data_, buffer_size); this->clear(); } } ~iterator_buffer() { flush(); } auto out() -> T* { flush(); return out_; } auto count() const -> size_t { return fixed_buffer_traits::count() + this->size(); } }; template class iterator_buffer final : public buffer { protected: FMT_CONSTEXPR20 void grow(size_t) override {} public: explicit iterator_buffer(T* out, size_t = 0) : buffer(out, 0, ~size_t()) {} auto out() -> T* { return &*this->end(); } }; // A buffer that writes to a container with the contiguous storage. template class iterator_buffer, enable_if_t::value, typename Container::value_type>> final : public buffer { private: Container& container_; protected: FMT_CONSTEXPR20 void grow(size_t capacity) override { container_.resize(capacity); this->set(&container_[0], capacity); } public: explicit iterator_buffer(Container& c) : buffer(c.size()), container_(c) {} explicit iterator_buffer(std::back_insert_iterator out, size_t = 0) : iterator_buffer(get_container(out)) {} auto out() -> std::back_insert_iterator { return std::back_inserter(container_); } }; // A buffer that counts the number of code units written discarding the output. template class counting_buffer final : public buffer { private: enum { buffer_size = 256 }; T data_[buffer_size]; size_t count_ = 0; protected: FMT_CONSTEXPR20 void grow(size_t) override { if (this->size() != buffer_size) return; count_ += this->size(); this->clear(); } public: counting_buffer() : buffer(data_, 0, buffer_size) {} auto count() -> size_t { return count_ + this->size(); } }; } // namespace detail template FMT_CONSTEXPR void basic_format_parse_context::do_check_arg_id(int id) { // Argument id is only checked at compile-time during parsing because // formatting has its own validation. if (detail::is_constant_evaluated() && (!FMT_GCC_VERSION || FMT_GCC_VERSION >= 1200)) { using context = detail::compile_parse_context; if (id >= static_cast(this)->num_args()) detail::throw_format_error("argument not found"); } } template FMT_CONSTEXPR void basic_format_parse_context::check_dynamic_spec( int arg_id) { if (detail::is_constant_evaluated() && (!FMT_GCC_VERSION || FMT_GCC_VERSION >= 1200)) { using context = detail::compile_parse_context; static_cast(this)->check_dynamic_spec(arg_id); } } FMT_EXPORT template class basic_format_arg; FMT_EXPORT template class basic_format_args; FMT_EXPORT template class dynamic_format_arg_store; // A formatter for objects of type T. FMT_EXPORT template struct formatter { // A deleted default constructor indicates a disabled formatter. formatter() = delete; }; // Specifies if T has an enabled formatter specialization. A type can be // formattable even if it doesn't have a formatter e.g. via a conversion. template using has_formatter = std::is_constructible>; // An output iterator that appends to a buffer. // It is used to reduce symbol sizes for the common case. class appender : public std::back_insert_iterator> { using base = std::back_insert_iterator>; public: using std::back_insert_iterator>::back_insert_iterator; appender(base it) noexcept : base(it) {} FMT_UNCHECKED_ITERATOR(appender); auto operator++() noexcept -> appender& { return *this; } auto operator++(int) noexcept -> appender { return *this; } }; namespace detail { template constexpr auto has_const_formatter_impl(T*) -> decltype(typename Context::template formatter_type().format( std::declval(), std::declval()), true) { return true; } template constexpr auto has_const_formatter_impl(...) -> bool { return false; } template constexpr auto has_const_formatter() -> bool { return has_const_formatter_impl(static_cast(nullptr)); } template using buffer_appender = conditional_t::value, appender, std::back_insert_iterator>>; // Maps an output iterator to a buffer. template auto get_buffer(OutputIt out) -> iterator_buffer { return iterator_buffer(out); } template , Buf>::value)> auto get_buffer(std::back_insert_iterator out) -> buffer& { return get_container(out); } template FMT_INLINE auto get_iterator(Buf& buf, OutputIt) -> decltype(buf.out()) { return buf.out(); } template auto get_iterator(buffer&, OutputIt out) -> OutputIt { return out; } struct view {}; template struct named_arg : view { const Char* name; const T& value; named_arg(const Char* n, const T& v) : name(n), value(v) {} }; template struct named_arg_info { const Char* name; int id; }; template struct arg_data { // args_[0].named_args points to named_args_ to avoid bloating format_args. // +1 to workaround a bug in gcc 7.5 that causes duplicated-branches warning. T args_[1 + (NUM_ARGS != 0 ? NUM_ARGS : +1)]; named_arg_info named_args_[NUM_NAMED_ARGS]; template arg_data(const U&... init) : args_{T(named_args_, NUM_NAMED_ARGS), init...} {} arg_data(const arg_data& other) = delete; auto args() const -> const T* { return args_ + 1; } auto named_args() -> named_arg_info* { return named_args_; } }; template struct arg_data { // +1 to workaround a bug in gcc 7.5 that causes duplicated-branches warning. T args_[NUM_ARGS != 0 ? NUM_ARGS : +1]; template FMT_CONSTEXPR FMT_INLINE arg_data(const U&... init) : args_{init...} {} FMT_CONSTEXPR FMT_INLINE auto args() const -> const T* { return args_; } FMT_CONSTEXPR FMT_INLINE auto named_args() -> std::nullptr_t { return nullptr; } }; template inline void init_named_args(named_arg_info*, int, int) {} template struct is_named_arg : std::false_type {}; template struct is_statically_named_arg : std::false_type {}; template struct is_named_arg> : std::true_type {}; template ::value)> void init_named_args(named_arg_info* named_args, int arg_count, int named_arg_count, const T&, const Tail&... args) { init_named_args(named_args, arg_count + 1, named_arg_count, args...); } template ::value)> void init_named_args(named_arg_info* named_args, int arg_count, int named_arg_count, const T& arg, const Tail&... args) { named_args[named_arg_count++] = {arg.name, arg_count}; init_named_args(named_args, arg_count + 1, named_arg_count, args...); } template FMT_CONSTEXPR FMT_INLINE void init_named_args(std::nullptr_t, int, int, const Args&...) {} template constexpr auto count() -> size_t { return B ? 1 : 0; } template constexpr auto count() -> size_t { return (B1 ? 1 : 0) + count(); } template constexpr auto count_named_args() -> size_t { return count::value...>(); } template constexpr auto count_statically_named_args() -> size_t { return count::value...>(); } struct unformattable {}; struct unformattable_char : unformattable {}; struct unformattable_pointer : unformattable {}; template struct string_value { const Char* data; size_t size; }; template struct named_arg_value { const named_arg_info* data; size_t size; }; template struct custom_value { using parse_context = typename Context::parse_context_type; void* value; void (*format)(void* arg, parse_context& parse_ctx, Context& ctx); }; // A formatting argument value. template class value { public: using char_type = typename Context::char_type; union { monostate no_value; int int_value; unsigned uint_value; long long long_long_value; unsigned long long ulong_long_value; int128_opt int128_value; uint128_opt uint128_value; bool bool_value; char_type char_value; float float_value; double double_value; long double long_double_value; const void* pointer; string_value string; custom_value custom; named_arg_value named_args; }; constexpr FMT_INLINE value() : no_value() {} constexpr FMT_INLINE value(int val) : int_value(val) {} constexpr FMT_INLINE value(unsigned val) : uint_value(val) {} constexpr FMT_INLINE value(long long val) : long_long_value(val) {} constexpr FMT_INLINE value(unsigned long long val) : ulong_long_value(val) {} FMT_INLINE value(int128_opt val) : int128_value(val) {} FMT_INLINE value(uint128_opt val) : uint128_value(val) {} constexpr FMT_INLINE value(float val) : float_value(val) {} constexpr FMT_INLINE value(double val) : double_value(val) {} FMT_INLINE value(long double val) : long_double_value(val) {} constexpr FMT_INLINE value(bool val) : bool_value(val) {} constexpr FMT_INLINE value(char_type val) : char_value(val) {} FMT_CONSTEXPR FMT_INLINE value(const char_type* val) { string.data = val; if (is_constant_evaluated()) string.size = {}; } FMT_CONSTEXPR FMT_INLINE value(basic_string_view val) { string.data = val.data(); string.size = val.size(); } FMT_INLINE value(const void* val) : pointer(val) {} FMT_INLINE value(const named_arg_info* args, size_t size) : named_args{args, size} {} template FMT_CONSTEXPR20 FMT_INLINE value(T& val) { using value_type = remove_const_t; custom.value = const_cast(std::addressof(val)); // Get the formatter type through the context to allow different contexts // have different extension points, e.g. `formatter` for `format` and // `printf_formatter` for `printf`. custom.format = format_custom_arg< value_type, typename Context::template formatter_type>; } value(unformattable); value(unformattable_char); value(unformattable_pointer); private: // Formats an argument of a custom type, such as a user-defined class. template static void format_custom_arg(void* arg, typename Context::parse_context_type& parse_ctx, Context& ctx) { auto f = Formatter(); parse_ctx.advance_to(f.parse(parse_ctx)); using qualified_type = conditional_t(), const T, T>; // Calling format through a mutable reference is deprecated. ctx.advance_to(f.format(*static_cast(arg), ctx)); } }; // To minimize the number of types we need to deal with, long is translated // either to int or to long long depending on its size. enum { long_short = sizeof(long) == sizeof(int) }; using long_type = conditional_t; using ulong_type = conditional_t; template struct format_as_result { template ::value || std::is_class::value)> static auto map(U*) -> remove_cvref_t()))>; static auto map(...) -> void; using type = decltype(map(static_cast(nullptr))); }; template using format_as_t = typename format_as_result::type; template struct has_format_as : bool_constant, void>::value> {}; // Maps formatting arguments to core types. // arg_mapper reports errors by returning unformattable instead of using // static_assert because it's used in the is_formattable trait. template struct arg_mapper { using char_type = typename Context::char_type; FMT_CONSTEXPR FMT_INLINE auto map(signed char val) -> int { return val; } FMT_CONSTEXPR FMT_INLINE auto map(unsigned char val) -> unsigned { return val; } FMT_CONSTEXPR FMT_INLINE auto map(short val) -> int { return val; } FMT_CONSTEXPR FMT_INLINE auto map(unsigned short val) -> unsigned { return val; } FMT_CONSTEXPR FMT_INLINE auto map(int val) -> int { return val; } FMT_CONSTEXPR FMT_INLINE auto map(unsigned val) -> unsigned { return val; } FMT_CONSTEXPR FMT_INLINE auto map(long val) -> long_type { return val; } FMT_CONSTEXPR FMT_INLINE auto map(unsigned long val) -> ulong_type { return val; } FMT_CONSTEXPR FMT_INLINE auto map(long long val) -> long long { return val; } FMT_CONSTEXPR FMT_INLINE auto map(unsigned long long val) -> unsigned long long { return val; } FMT_CONSTEXPR FMT_INLINE auto map(int128_opt val) -> int128_opt { return val; } FMT_CONSTEXPR FMT_INLINE auto map(uint128_opt val) -> uint128_opt { return val; } FMT_CONSTEXPR FMT_INLINE auto map(bool val) -> bool { return val; } template ::value || std::is_same::value)> FMT_CONSTEXPR FMT_INLINE auto map(T val) -> char_type { return val; } template ::value || #ifdef __cpp_char8_t std::is_same::value || #endif std::is_same::value || std::is_same::value) && !std::is_same::value, int> = 0> FMT_CONSTEXPR FMT_INLINE auto map(T) -> unformattable_char { return {}; } FMT_CONSTEXPR FMT_INLINE auto map(float val) -> float { return val; } FMT_CONSTEXPR FMT_INLINE auto map(double val) -> double { return val; } FMT_CONSTEXPR FMT_INLINE auto map(long double val) -> long double { return val; } FMT_CONSTEXPR FMT_INLINE auto map(char_type* val) -> const char_type* { return val; } FMT_CONSTEXPR FMT_INLINE auto map(const char_type* val) -> const char_type* { return val; } template ::value && !std::is_pointer::value && std::is_same>::value)> FMT_CONSTEXPR FMT_INLINE auto map(const T& val) -> basic_string_view { return to_string_view(val); } template ::value && !std::is_pointer::value && !std::is_same>::value)> FMT_CONSTEXPR FMT_INLINE auto map(const T&) -> unformattable_char { return {}; } FMT_CONSTEXPR FMT_INLINE auto map(void* val) -> const void* { return val; } FMT_CONSTEXPR FMT_INLINE auto map(const void* val) -> const void* { return val; } FMT_CONSTEXPR FMT_INLINE auto map(std::nullptr_t val) -> const void* { return val; } // Use SFINAE instead of a const T* parameter to avoid a conflict with the // array overload. template < typename T, FMT_ENABLE_IF( std::is_pointer::value || std::is_member_pointer::value || std::is_function::type>::value || (std::is_array::value && !std::is_convertible::value))> FMT_CONSTEXPR auto map(const T&) -> unformattable_pointer { return {}; } template ::value)> FMT_CONSTEXPR FMT_INLINE auto map(const T (&values)[N]) -> const T (&)[N] { return values; } // Only map owning types because mapping views can be unsafe. template , FMT_ENABLE_IF(std::is_arithmetic::value)> FMT_CONSTEXPR FMT_INLINE auto map(const T& val) -> decltype(FMT_DECLTYPE_THIS map(U())) { return map(format_as(val)); } template > struct formattable : bool_constant() || (has_formatter::value && !std::is_const::value)> {}; template ::value)> FMT_CONSTEXPR FMT_INLINE auto do_map(T& val) -> T& { return val; } template ::value)> FMT_CONSTEXPR FMT_INLINE auto do_map(T&) -> unformattable { return {}; } template , FMT_ENABLE_IF((std::is_class::value || std::is_enum::value || std::is_union::value) && !is_string::value && !is_char::value && !is_named_arg::value && !std::is_arithmetic>::value)> FMT_CONSTEXPR FMT_INLINE auto map(T& val) -> decltype(FMT_DECLTYPE_THIS do_map(val)) { return do_map(val); } template ::value)> FMT_CONSTEXPR FMT_INLINE auto map(const T& named_arg) -> decltype(FMT_DECLTYPE_THIS map(named_arg.value)) { return map(named_arg.value); } auto map(...) -> unformattable { return {}; } }; // A type constant after applying arg_mapper. template using mapped_type_constant = type_constant().map(std::declval())), typename Context::char_type>; enum { packed_arg_bits = 4 }; // Maximum number of arguments with packed types. enum { max_packed_args = 62 / packed_arg_bits }; enum : unsigned long long { is_unpacked_bit = 1ULL << 63 }; enum : unsigned long long { has_named_args_bit = 1ULL << 62 }; template auto copy_str(InputIt begin, InputIt end, appender out) -> appender { get_container(out).append(begin, end); return out; } template auto copy_str(InputIt begin, InputIt end, std::back_insert_iterator out) -> std::back_insert_iterator { get_container(out).append(begin, end); return out; } template FMT_CONSTEXPR auto copy_str(R&& rng, OutputIt out) -> OutputIt { return detail::copy_str(rng.begin(), rng.end(), out); } #if FMT_GCC_VERSION && FMT_GCC_VERSION < 500 // A workaround for gcc 4.8 to make void_t work in a SFINAE context. template struct void_t_impl { using type = void; }; template using void_t = typename void_t_impl::type; #else template using void_t = void; #endif template struct is_output_iterator : std::false_type {}; template struct is_output_iterator< It, T, void_t::iterator_category, decltype(*std::declval() = std::declval())>> : std::true_type {}; template struct is_back_insert_iterator : std::false_type {}; template struct is_back_insert_iterator> : std::true_type {}; // A type-erased reference to an std::locale to avoid a heavy include. class locale_ref { private: const void* locale_; // A type-erased pointer to std::locale. public: constexpr FMT_INLINE locale_ref() : locale_(nullptr) {} template explicit locale_ref(const Locale& loc); explicit operator bool() const noexcept { return locale_ != nullptr; } template auto get() const -> Locale; }; template constexpr auto encode_types() -> unsigned long long { return 0; } template constexpr auto encode_types() -> unsigned long long { return static_cast(mapped_type_constant::value) | (encode_types() << packed_arg_bits); } #if defined(__cpp_if_constexpr) // This type is intentionally undefined, only used for errors template struct type_is_unformattable_for; #endif template FMT_CONSTEXPR FMT_INLINE auto make_arg(T& val) -> value { using arg_type = remove_cvref_t().map(val))>; constexpr bool formattable_char = !std::is_same::value; static_assert(formattable_char, "Mixing character types is disallowed."); // Formatting of arbitrary pointers is disallowed. If you want to format a // pointer cast it to `void*` or `const void*`. In particular, this forbids // formatting of `[const] volatile char*` printed as bool by iostreams. constexpr bool formattable_pointer = !std::is_same::value; static_assert(formattable_pointer, "Formatting of non-void pointers is disallowed."); constexpr bool formattable = !std::is_same::value; #if defined(__cpp_if_constexpr) if constexpr (!formattable) { type_is_unformattable_for _; } #endif static_assert( formattable, "Cannot format an argument. To make type T formattable provide a " "formatter specialization: https://fmt.dev/latest/api.html#udt"); return {arg_mapper().map(val)}; } template FMT_CONSTEXPR auto make_arg(T& val) -> basic_format_arg { auto arg = basic_format_arg(); arg.type_ = mapped_type_constant::value; arg.value_ = make_arg(val); return arg; } template FMT_CONSTEXPR inline auto make_arg(T& val) -> basic_format_arg { return make_arg(val); } } // namespace detail FMT_BEGIN_EXPORT // A formatting argument. Context is a template parameter for the compiled API // where output can be unbuffered. template class basic_format_arg { private: detail::value value_; detail::type type_; template friend FMT_CONSTEXPR auto detail::make_arg(T& value) -> basic_format_arg; template friend FMT_CONSTEXPR auto visit_format_arg(Visitor&& vis, const basic_format_arg& arg) -> decltype(vis(0)); friend class basic_format_args; friend class dynamic_format_arg_store; using char_type = typename Context::char_type; template friend struct detail::arg_data; basic_format_arg(const detail::named_arg_info* args, size_t size) : value_(args, size) {} public: class handle { public: explicit handle(detail::custom_value custom) : custom_(custom) {} void format(typename Context::parse_context_type& parse_ctx, Context& ctx) const { custom_.format(custom_.value, parse_ctx, ctx); } private: detail::custom_value custom_; }; constexpr basic_format_arg() : type_(detail::type::none_type) {} constexpr explicit operator bool() const noexcept { return type_ != detail::type::none_type; } auto type() const -> detail::type { return type_; } auto is_integral() const -> bool { return detail::is_integral_type(type_); } auto is_arithmetic() const -> bool { return detail::is_arithmetic_type(type_); } FMT_INLINE auto format_custom(const char_type* parse_begin, typename Context::parse_context_type& parse_ctx, Context& ctx) -> bool { if (type_ != detail::type::custom_type) return false; parse_ctx.advance_to(parse_begin); value_.custom.format(value_.custom.value, parse_ctx, ctx); return true; } }; /** \rst Visits an argument dispatching to the appropriate visit method based on the argument type. For example, if the argument type is ``double`` then ``vis(value)`` will be called with the value of type ``double``. \endrst */ // DEPRECATED! template FMT_CONSTEXPR FMT_INLINE auto visit_format_arg( Visitor&& vis, const basic_format_arg& arg) -> decltype(vis(0)) { switch (arg.type_) { case detail::type::none_type: break; case detail::type::int_type: return vis(arg.value_.int_value); case detail::type::uint_type: return vis(arg.value_.uint_value); case detail::type::long_long_type: return vis(arg.value_.long_long_value); case detail::type::ulong_long_type: return vis(arg.value_.ulong_long_value); case detail::type::int128_type: return vis(detail::convert_for_visit(arg.value_.int128_value)); case detail::type::uint128_type: return vis(detail::convert_for_visit(arg.value_.uint128_value)); case detail::type::bool_type: return vis(arg.value_.bool_value); case detail::type::char_type: return vis(arg.value_.char_value); case detail::type::float_type: return vis(arg.value_.float_value); case detail::type::double_type: return vis(arg.value_.double_value); case detail::type::long_double_type: return vis(arg.value_.long_double_value); case detail::type::cstring_type: return vis(arg.value_.string.data); case detail::type::string_type: using sv = basic_string_view; return vis(sv(arg.value_.string.data, arg.value_.string.size)); case detail::type::pointer_type: return vis(arg.value_.pointer); case detail::type::custom_type: return vis(typename basic_format_arg::handle(arg.value_.custom)); } return vis(monostate()); } // Formatting context. template class basic_format_context { private: OutputIt out_; basic_format_args args_; detail::locale_ref loc_; public: using iterator = OutputIt; using format_arg = basic_format_arg; using format_args = basic_format_args; using parse_context_type = basic_format_parse_context; template using formatter_type = formatter; /** The character type for the output. */ using char_type = Char; basic_format_context(basic_format_context&&) = default; basic_format_context(const basic_format_context&) = delete; void operator=(const basic_format_context&) = delete; /** Constructs a ``basic_format_context`` object. References to the arguments are stored in the object so make sure they have appropriate lifetimes. */ constexpr basic_format_context(OutputIt out, format_args ctx_args, detail::locale_ref loc = {}) : out_(out), args_(ctx_args), loc_(loc) {} constexpr auto arg(int id) const -> format_arg { return args_.get(id); } FMT_CONSTEXPR auto arg(basic_string_view name) -> format_arg { return args_.get(name); } FMT_CONSTEXPR auto arg_id(basic_string_view name) -> int { return args_.get_id(name); } auto args() const -> const format_args& { return args_; } // DEPRECATED! FMT_CONSTEXPR auto error_handler() -> detail::error_handler { return {}; } void on_error(const char* message) { error_handler().on_error(message); } // Returns an iterator to the beginning of the output range. FMT_CONSTEXPR auto out() -> iterator { return out_; } // Advances the begin iterator to ``it``. void advance_to(iterator it) { if (!detail::is_back_insert_iterator()) out_ = it; } FMT_CONSTEXPR auto locale() -> detail::locale_ref { return loc_; } }; template using buffer_context = basic_format_context, Char>; using format_context = buffer_context; template using is_formattable = bool_constant>() .map(std::declval()))>::value>; /** \rst An array of references to arguments. It can be implicitly converted into `~fmt::basic_format_args` for passing into type-erased formatting functions such as `~fmt::vformat`. \endrst */ template class format_arg_store #if FMT_GCC_VERSION && FMT_GCC_VERSION < 409 // Workaround a GCC template argument substitution bug. : public basic_format_args #endif { private: static const size_t num_args = sizeof...(Args); static constexpr size_t num_named_args = detail::count_named_args(); static const bool is_packed = num_args <= detail::max_packed_args; using value_type = conditional_t, basic_format_arg>; detail::arg_data data_; friend class basic_format_args; static constexpr unsigned long long desc = (is_packed ? detail::encode_types() : detail::is_unpacked_bit | num_args) | (num_named_args != 0 ? static_cast(detail::has_named_args_bit) : 0); public: template FMT_CONSTEXPR FMT_INLINE format_arg_store(T&... args) : #if FMT_GCC_VERSION && FMT_GCC_VERSION < 409 basic_format_args(*this), #endif data_{detail::make_arg(args)...} { if (detail::const_check(num_named_args != 0)) detail::init_named_args(data_.named_args(), 0, 0, args...); } }; /** \rst Constructs a `~fmt::format_arg_store` object that contains references to arguments and can be implicitly converted to `~fmt::format_args`. `Context` can be omitted in which case it defaults to `~fmt::format_context`. See `~fmt::arg` for lifetime considerations. \endrst */ // Arguments are taken by lvalue references to avoid some lifetime issues. template constexpr auto make_format_args(T&... args) -> format_arg_store...> { return {args...}; } /** \rst Returns a named argument to be used in a formatting function. It should only be used in a call to a formatting function or `dynamic_format_arg_store::push_back`. **Example**:: fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23)); \endrst */ template inline auto arg(const Char* name, const T& arg) -> detail::named_arg { static_assert(!detail::is_named_arg(), "nested named arguments"); return {name, arg}; } FMT_END_EXPORT /** \rst A view of a collection of formatting arguments. To avoid lifetime issues it should only be used as a parameter type in type-erased functions such as ``vformat``:: void vlog(string_view format_str, format_args args); // OK format_args args = make_format_args(); // Error: dangling reference \endrst */ template class basic_format_args { public: using size_type = int; using format_arg = basic_format_arg; private: // A descriptor that contains information about formatting arguments. // If the number of arguments is less or equal to max_packed_args then // argument types are passed in the descriptor. This reduces binary code size // per formatting function call. unsigned long long desc_; union { // If is_packed() returns true then argument values are stored in values_; // otherwise they are stored in args_. This is done to improve cache // locality and reduce compiled code size since storing larger objects // may require more code (at least on x86-64) even if the same amount of // data is actually copied to stack. It saves ~10% on the bloat test. const detail::value* values_; const format_arg* args_; }; constexpr auto is_packed() const -> bool { return (desc_ & detail::is_unpacked_bit) == 0; } auto has_named_args() const -> bool { return (desc_ & detail::has_named_args_bit) != 0; } FMT_CONSTEXPR auto type(int index) const -> detail::type { int shift = index * detail::packed_arg_bits; unsigned int mask = (1 << detail::packed_arg_bits) - 1; return static_cast((desc_ >> shift) & mask); } constexpr FMT_INLINE basic_format_args(unsigned long long desc, const detail::value* values) : desc_(desc), values_(values) {} constexpr basic_format_args(unsigned long long desc, const format_arg* args) : desc_(desc), args_(args) {} public: constexpr basic_format_args() : desc_(0), args_(nullptr) {} /** \rst Constructs a `basic_format_args` object from `~fmt::format_arg_store`. \endrst */ template constexpr FMT_INLINE basic_format_args( const format_arg_store& store) : basic_format_args(format_arg_store::desc, store.data_.args()) {} /** \rst Constructs a `basic_format_args` object from `~fmt::dynamic_format_arg_store`. \endrst */ constexpr FMT_INLINE basic_format_args( const dynamic_format_arg_store& store) : basic_format_args(store.get_types(), store.data()) {} /** \rst Constructs a `basic_format_args` object from a dynamic set of arguments. \endrst */ constexpr basic_format_args(const format_arg* args, int count) : basic_format_args(detail::is_unpacked_bit | detail::to_unsigned(count), args) {} /** Returns the argument with the specified id. */ FMT_CONSTEXPR auto get(int id) const -> format_arg { format_arg arg; if (!is_packed()) { if (id < max_size()) arg = args_[id]; return arg; } if (id >= detail::max_packed_args) return arg; arg.type_ = type(id); if (arg.type_ == detail::type::none_type) return arg; arg.value_ = values_[id]; return arg; } template auto get(basic_string_view name) const -> format_arg { int id = get_id(name); return id >= 0 ? get(id) : format_arg(); } template auto get_id(basic_string_view name) const -> int { if (!has_named_args()) return -1; const auto& named_args = (is_packed() ? values_[-1] : args_[-1].value_).named_args; for (size_t i = 0; i < named_args.size; ++i) { if (named_args.data[i].name == name) return named_args.data[i].id; } return -1; } auto max_size() const -> int { unsigned long long max_packed = detail::max_packed_args; return static_cast(is_packed() ? max_packed : desc_ & ~detail::is_unpacked_bit); } }; /** An alias to ``basic_format_args``. */ // A separate type would result in shorter symbols but break ABI compatibility // between clang and gcc on ARM (#1919). FMT_EXPORT using format_args = basic_format_args; // We cannot use enum classes as bit fields because of a gcc bug, so we put them // in namespaces instead (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414). // Additionally, if an underlying type is specified, older gcc incorrectly warns // that the type is too small. Both bugs are fixed in gcc 9.3. #if FMT_GCC_VERSION && FMT_GCC_VERSION < 903 # define FMT_ENUM_UNDERLYING_TYPE(type) #else # define FMT_ENUM_UNDERLYING_TYPE(type) : type #endif namespace align { enum type FMT_ENUM_UNDERLYING_TYPE(unsigned char){none, left, right, center, numeric}; } using align_t = align::type; namespace sign { enum type FMT_ENUM_UNDERLYING_TYPE(unsigned char){none, minus, plus, space}; } using sign_t = sign::type; namespace detail { // Workaround an array initialization issue in gcc 4.8. template struct fill_t { private: enum { max_size = 4 }; Char data_[max_size] = {Char(' '), Char(0), Char(0), Char(0)}; unsigned char size_ = 1; public: FMT_CONSTEXPR void operator=(basic_string_view s) { auto size = s.size(); FMT_ASSERT(size <= max_size, "invalid fill"); for (size_t i = 0; i < size; ++i) data_[i] = s[i]; size_ = static_cast(size); } constexpr auto size() const -> size_t { return size_; } constexpr auto data() const -> const Char* { return data_; } FMT_CONSTEXPR auto operator[](size_t index) -> Char& { return data_[index]; } FMT_CONSTEXPR auto operator[](size_t index) const -> const Char& { return data_[index]; } }; } // namespace detail enum class presentation_type : unsigned char { none, dec, // 'd' oct, // 'o' hex_lower, // 'x' hex_upper, // 'X' bin_lower, // 'b' bin_upper, // 'B' hexfloat_lower, // 'a' hexfloat_upper, // 'A' exp_lower, // 'e' exp_upper, // 'E' fixed_lower, // 'f' fixed_upper, // 'F' general_lower, // 'g' general_upper, // 'G' chr, // 'c' string, // 's' pointer, // 'p' debug // '?' }; // Format specifiers for built-in and string types. template struct format_specs { int width; int precision; presentation_type type; align_t align : 4; sign_t sign : 3; bool alt : 1; // Alternate form ('#'). bool localized : 1; detail::fill_t fill; constexpr format_specs() : width(0), precision(-1), type(presentation_type::none), align(align::none), sign(sign::none), alt(false), localized(false) {} }; namespace detail { enum class arg_id_kind { none, index, name }; // An argument reference. template struct arg_ref { FMT_CONSTEXPR arg_ref() : kind(arg_id_kind::none), val() {} FMT_CONSTEXPR explicit arg_ref(int index) : kind(arg_id_kind::index), val(index) {} FMT_CONSTEXPR explicit arg_ref(basic_string_view name) : kind(arg_id_kind::name), val(name) {} FMT_CONSTEXPR auto operator=(int idx) -> arg_ref& { kind = arg_id_kind::index; val.index = idx; return *this; } arg_id_kind kind; union value { FMT_CONSTEXPR value(int idx = 0) : index(idx) {} FMT_CONSTEXPR value(basic_string_view n) : name(n) {} int index; basic_string_view name; } val; }; // Format specifiers with width and precision resolved at formatting rather // than parsing time to allow reusing the same parsed specifiers with // different sets of arguments (precompilation of format strings). template struct dynamic_format_specs : format_specs { arg_ref width_ref; arg_ref precision_ref; }; // Converts a character to ASCII. Returns '\0' on conversion failure. template ::value)> constexpr auto to_ascii(Char c) -> char { return c <= 0xff ? static_cast(c) : '\0'; } template ::value)> constexpr auto to_ascii(Char c) -> char { return c <= 0xff ? static_cast(c) : '\0'; } // Returns the number of code units in a code point or 1 on error. template FMT_CONSTEXPR auto code_point_length(const Char* begin) -> int { if (const_check(sizeof(Char) != 1)) return 1; auto c = static_cast(*begin); return static_cast((0x3a55000000000000ull >> (2 * (c >> 3))) & 0x3) + 1; } // Return the result via the out param to workaround gcc bug 77539. template FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr& out) -> bool { for (out = first; out != last; ++out) { if (*out == value) return true; } return false; } template <> inline auto find(const char* first, const char* last, char value, const char*& out) -> bool { out = static_cast( std::memchr(first, value, to_unsigned(last - first))); return out != nullptr; } // Parses the range [begin, end) as an unsigned integer. This function assumes // that the range is non-empty and the first character is a digit. template FMT_CONSTEXPR auto parse_nonnegative_int(const Char*& begin, const Char* end, int error_value) noexcept -> int { FMT_ASSERT(begin != end && '0' <= *begin && *begin <= '9', ""); unsigned value = 0, prev = 0; auto p = begin; do { prev = value; value = value * 10 + unsigned(*p - '0'); ++p; } while (p != end && '0' <= *p && *p <= '9'); auto num_digits = p - begin; begin = p; if (num_digits <= std::numeric_limits::digits10) return static_cast(value); // Check for overflow. const unsigned max = to_unsigned((std::numeric_limits::max)()); return num_digits == std::numeric_limits::digits10 + 1 && prev * 10ull + unsigned(p[-1] - '0') <= max ? static_cast(value) : error_value; } FMT_CONSTEXPR inline auto parse_align(char c) -> align_t { switch (c) { case '<': return align::left; case '>': return align::right; case '^': return align::center; } return align::none; } template constexpr auto is_name_start(Char c) -> bool { return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '_'; } template FMT_CONSTEXPR auto do_parse_arg_id(const Char* begin, const Char* end, Handler&& handler) -> const Char* { Char c = *begin; if (c >= '0' && c <= '9') { int index = 0; constexpr int max = (std::numeric_limits::max)(); if (c != '0') index = parse_nonnegative_int(begin, end, max); else ++begin; if (begin == end || (*begin != '}' && *begin != ':')) throw_format_error("invalid format string"); else handler.on_index(index); return begin; } if (!is_name_start(c)) { throw_format_error("invalid format string"); return begin; } auto it = begin; do { ++it; } while (it != end && (is_name_start(*it) || ('0' <= *it && *it <= '9'))); handler.on_name({begin, to_unsigned(it - begin)}); return it; } template FMT_CONSTEXPR FMT_INLINE auto parse_arg_id(const Char* begin, const Char* end, Handler&& handler) -> const Char* { FMT_ASSERT(begin != end, ""); Char c = *begin; if (c != '}' && c != ':') return do_parse_arg_id(begin, end, handler); handler.on_auto(); return begin; } template struct dynamic_spec_id_handler { basic_format_parse_context& ctx; arg_ref& ref; FMT_CONSTEXPR void on_auto() { int id = ctx.next_arg_id(); ref = arg_ref(id); ctx.check_dynamic_spec(id); } FMT_CONSTEXPR void on_index(int id) { ref = arg_ref(id); ctx.check_arg_id(id); ctx.check_dynamic_spec(id); } FMT_CONSTEXPR void on_name(basic_string_view id) { ref = arg_ref(id); ctx.check_arg_id(id); } }; // Parses [integer | "{" [arg_id] "}"]. template FMT_CONSTEXPR auto parse_dynamic_spec(const Char* begin, const Char* end, int& value, arg_ref& ref, basic_format_parse_context& ctx) -> const Char* { FMT_ASSERT(begin != end, ""); if ('0' <= *begin && *begin <= '9') { int val = parse_nonnegative_int(begin, end, -1); if (val != -1) value = val; else throw_format_error("number is too big"); } else if (*begin == '{') { ++begin; auto handler = dynamic_spec_id_handler{ctx, ref}; if (begin != end) begin = parse_arg_id(begin, end, handler); if (begin != end && *begin == '}') return ++begin; throw_format_error("invalid format string"); } return begin; } template FMT_CONSTEXPR auto parse_precision(const Char* begin, const Char* end, int& value, arg_ref& ref, basic_format_parse_context& ctx) -> const Char* { ++begin; if (begin == end || *begin == '}') { throw_format_error("invalid precision"); return begin; } return parse_dynamic_spec(begin, end, value, ref, ctx); } enum class state { start, align, sign, hash, zero, width, precision, locale }; // Parses standard format specifiers. template FMT_CONSTEXPR FMT_INLINE auto parse_format_specs( const Char* begin, const Char* end, dynamic_format_specs& specs, basic_format_parse_context& ctx, type arg_type) -> const Char* { auto c = '\0'; if (end - begin > 1) { auto next = to_ascii(begin[1]); c = parse_align(next) == align::none ? to_ascii(*begin) : '\0'; } else { if (begin == end) return begin; c = to_ascii(*begin); } struct { state current_state = state::start; FMT_CONSTEXPR void operator()(state s, bool valid = true) { if (current_state >= s || !valid) throw_format_error("invalid format specifier"); current_state = s; } } enter_state; using pres = presentation_type; constexpr auto integral_set = sint_set | uint_set | bool_set | char_set; struct { const Char*& begin; dynamic_format_specs& specs; type arg_type; FMT_CONSTEXPR auto operator()(pres pres_type, int set) -> const Char* { if (!in(arg_type, set)) { if (arg_type == type::none_type) return begin; throw_format_error("invalid format specifier"); } specs.type = pres_type; return begin + 1; } } parse_presentation_type{begin, specs, arg_type}; for (;;) { switch (c) { case '<': case '>': case '^': enter_state(state::align); specs.align = parse_align(c); ++begin; break; case '+': case '-': case ' ': if (arg_type == type::none_type) return begin; enter_state(state::sign, in(arg_type, sint_set | float_set)); switch (c) { case '+': specs.sign = sign::plus; break; case '-': specs.sign = sign::minus; break; case ' ': specs.sign = sign::space; break; } ++begin; break; case '#': if (arg_type == type::none_type) return begin; enter_state(state::hash, is_arithmetic_type(arg_type)); specs.alt = true; ++begin; break; case '0': enter_state(state::zero); if (!is_arithmetic_type(arg_type)) { if (arg_type == type::none_type) return begin; throw_format_error("format specifier requires numeric argument"); } if (specs.align == align::none) { // Ignore 0 if align is specified for compatibility with std::format. specs.align = align::numeric; specs.fill[0] = Char('0'); } ++begin; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '{': enter_state(state::width); begin = parse_dynamic_spec(begin, end, specs.width, specs.width_ref, ctx); break; case '.': if (arg_type == type::none_type) return begin; enter_state(state::precision, in(arg_type, float_set | string_set | cstring_set)); begin = parse_precision(begin, end, specs.precision, specs.precision_ref, ctx); break; case 'L': if (arg_type == type::none_type) return begin; enter_state(state::locale, is_arithmetic_type(arg_type)); specs.localized = true; ++begin; break; case 'd': return parse_presentation_type(pres::dec, integral_set); case 'o': return parse_presentation_type(pres::oct, integral_set); case 'x': return parse_presentation_type(pres::hex_lower, integral_set); case 'X': return parse_presentation_type(pres::hex_upper, integral_set); case 'b': return parse_presentation_type(pres::bin_lower, integral_set); case 'B': return parse_presentation_type(pres::bin_upper, integral_set); case 'a': return parse_presentation_type(pres::hexfloat_lower, float_set); case 'A': return parse_presentation_type(pres::hexfloat_upper, float_set); case 'e': return parse_presentation_type(pres::exp_lower, float_set); case 'E': return parse_presentation_type(pres::exp_upper, float_set); case 'f': return parse_presentation_type(pres::fixed_lower, float_set); case 'F': return parse_presentation_type(pres::fixed_upper, float_set); case 'g': return parse_presentation_type(pres::general_lower, float_set); case 'G': return parse_presentation_type(pres::general_upper, float_set); case 'c': if (arg_type == type::bool_type) throw_format_error("invalid format specifier"); return parse_presentation_type(pres::chr, integral_set); case 's': return parse_presentation_type(pres::string, bool_set | string_set | cstring_set); case 'p': return parse_presentation_type(pres::pointer, pointer_set | cstring_set); case '?': return parse_presentation_type(pres::debug, char_set | string_set | cstring_set); case '}': return begin; default: { if (*begin == '}') return begin; // Parse fill and alignment. auto fill_end = begin + code_point_length(begin); if (end - fill_end <= 0) { throw_format_error("invalid format specifier"); return begin; } if (*begin == '{') { throw_format_error("invalid fill character '{'"); return begin; } auto align = parse_align(to_ascii(*fill_end)); enter_state(state::align, align != align::none); specs.fill = {begin, to_unsigned(fill_end - begin)}; specs.align = align; begin = fill_end + 1; } } if (begin == end) return begin; c = to_ascii(*begin); } } template FMT_CONSTEXPR auto parse_replacement_field(const Char* begin, const Char* end, Handler&& handler) -> const Char* { struct id_adapter { Handler& handler; int arg_id; FMT_CONSTEXPR void on_auto() { arg_id = handler.on_arg_id(); } FMT_CONSTEXPR void on_index(int id) { arg_id = handler.on_arg_id(id); } FMT_CONSTEXPR void on_name(basic_string_view id) { arg_id = handler.on_arg_id(id); } }; ++begin; if (begin == end) return handler.on_error("invalid format string"), end; if (*begin == '}') { handler.on_replacement_field(handler.on_arg_id(), begin); } else if (*begin == '{') { handler.on_text(begin, begin + 1); } else { auto adapter = id_adapter{handler, 0}; begin = parse_arg_id(begin, end, adapter); Char c = begin != end ? *begin : Char(); if (c == '}') { handler.on_replacement_field(adapter.arg_id, begin); } else if (c == ':') { begin = handler.on_format_specs(adapter.arg_id, begin + 1, end); if (begin == end || *begin != '}') return handler.on_error("unknown format specifier"), end; } else { return handler.on_error("missing '}' in format string"), end; } } return begin + 1; } template FMT_CONSTEXPR FMT_INLINE void parse_format_string( basic_string_view format_str, Handler&& handler) { auto begin = format_str.data(); auto end = begin + format_str.size(); if (end - begin < 32) { // Use a simple loop instead of memchr for small strings. const Char* p = begin; while (p != end) { auto c = *p++; if (c == '{') { handler.on_text(begin, p - 1); begin = p = parse_replacement_field(p - 1, end, handler); } else if (c == '}') { if (p == end || *p != '}') return handler.on_error("unmatched '}' in format string"); handler.on_text(begin, p); begin = ++p; } } handler.on_text(begin, end); return; } struct writer { FMT_CONSTEXPR void operator()(const Char* from, const Char* to) { if (from == to) return; for (;;) { const Char* p = nullptr; if (!find(from, to, Char('}'), p)) return handler_.on_text(from, to); ++p; if (p == to || *p != '}') return handler_.on_error("unmatched '}' in format string"); handler_.on_text(from, p); from = p + 1; } } Handler& handler_; } write = {handler}; while (begin != end) { // Doing two passes with memchr (one for '{' and another for '}') is up to // 2.5x faster than the naive one-pass implementation on big format strings. const Char* p = begin; if (*begin != '{' && !find(begin + 1, end, Char('{'), p)) return write(begin, end); write(begin, p); begin = parse_replacement_field(p, end, handler); } } template ::value> struct strip_named_arg { using type = T; }; template struct strip_named_arg { using type = remove_cvref_t; }; template FMT_CONSTEXPR auto parse_format_specs(ParseContext& ctx) -> decltype(ctx.begin()) { using char_type = typename ParseContext::char_type; using context = buffer_context; using mapped_type = conditional_t< mapped_type_constant::value != type::custom_type, decltype(arg_mapper().map(std::declval())), typename strip_named_arg::type>; #if defined(__cpp_if_constexpr) if constexpr (std::is_default_constructible< formatter>::value) { return formatter().parse(ctx); } else { type_is_unformattable_for _; return ctx.begin(); } #else return formatter().parse(ctx); #endif } // Checks char specs and returns true iff the presentation type is char-like. template FMT_CONSTEXPR auto check_char_specs(const format_specs& specs) -> bool { if (specs.type != presentation_type::none && specs.type != presentation_type::chr && specs.type != presentation_type::debug) { return false; } if (specs.align == align::numeric || specs.sign != sign::none || specs.alt) throw_format_error("invalid format specifier for char"); return true; } #if FMT_USE_NONTYPE_TEMPLATE_ARGS template constexpr auto get_arg_index_by_name(basic_string_view name) -> int { if constexpr (is_statically_named_arg()) { if (name == T::name) return N; } if constexpr (sizeof...(Args) > 0) return get_arg_index_by_name(name); (void)name; // Workaround an MSVC bug about "unused" parameter. return -1; } #endif template FMT_CONSTEXPR auto get_arg_index_by_name(basic_string_view name) -> int { #if FMT_USE_NONTYPE_TEMPLATE_ARGS if constexpr (sizeof...(Args) > 0) return get_arg_index_by_name<0, Args...>(name); #endif (void)name; return -1; } template class format_string_checker { private: using parse_context_type = compile_parse_context; static constexpr int num_args = sizeof...(Args); // Format specifier parsing function. // In the future basic_format_parse_context will replace compile_parse_context // here and will use is_constant_evaluated and downcasting to access the data // needed for compile-time checks: https://godbolt.org/z/GvWzcTjh1. using parse_func = const Char* (*)(parse_context_type&); type types_[num_args > 0 ? static_cast(num_args) : 1]; parse_context_type context_; parse_func parse_funcs_[num_args > 0 ? static_cast(num_args) : 1]; public: explicit FMT_CONSTEXPR format_string_checker(basic_string_view fmt) : types_{mapped_type_constant>::value...}, context_(fmt, num_args, types_), parse_funcs_{&parse_format_specs...} {} FMT_CONSTEXPR void on_text(const Char*, const Char*) {} FMT_CONSTEXPR auto on_arg_id() -> int { return context_.next_arg_id(); } FMT_CONSTEXPR auto on_arg_id(int id) -> int { return context_.check_arg_id(id), id; } FMT_CONSTEXPR auto on_arg_id(basic_string_view id) -> int { #if FMT_USE_NONTYPE_TEMPLATE_ARGS auto index = get_arg_index_by_name(id); if (index < 0) on_error("named argument is not found"); return index; #else (void)id; on_error("compile-time checks for named arguments require C++20 support"); return 0; #endif } FMT_CONSTEXPR void on_replacement_field(int id, const Char* begin) { on_format_specs(id, begin, begin); // Call parse() on empty specs. } FMT_CONSTEXPR auto on_format_specs(int id, const Char* begin, const Char*) -> const Char* { context_.advance_to(begin); // id >= 0 check is a workaround for gcc 10 bug (#2065). return id >= 0 && id < num_args ? parse_funcs_[id](context_) : begin; } FMT_CONSTEXPR void on_error(const char* message) { throw_format_error(message); } }; // Reports a compile-time error if S is not a valid format string. template ::value)> FMT_INLINE void check_format_string(const S&) { #ifdef FMT_ENFORCE_COMPILE_STRING static_assert(is_compile_string::value, "FMT_ENFORCE_COMPILE_STRING requires all format strings to use " "FMT_STRING."); #endif } template ::value)> void check_format_string(S format_str) { using char_t = typename S::char_type; FMT_CONSTEXPR auto s = basic_string_view(format_str); using checker = format_string_checker...>; FMT_CONSTEXPR bool error = (parse_format_string(s, checker(s)), true); ignore_unused(error); } template struct vformat_args { using type = basic_format_args< basic_format_context>, Char>>; }; template <> struct vformat_args { using type = format_args; }; // Use vformat_args and avoid type_identity to keep symbols short. template void vformat_to(buffer& buf, basic_string_view fmt, typename vformat_args::type args, locale_ref loc = {}); FMT_API void vprint_mojibake(std::FILE*, string_view, format_args); #ifndef _WIN32 inline void vprint_mojibake(std::FILE*, string_view, format_args) {} #endif } // namespace detail FMT_BEGIN_EXPORT // A formatter specialization for natively supported types. template struct formatter::value != detail::type::custom_type>> { private: detail::dynamic_format_specs specs_; public: template FMT_CONSTEXPR auto parse(ParseContext& ctx) -> const Char* { auto type = detail::type_constant::value; auto end = detail::parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx, type); if (type == detail::type::char_type) detail::check_char_specs(specs_); return end; } template ::value, FMT_ENABLE_IF(U == detail::type::string_type || U == detail::type::cstring_type || U == detail::type::char_type)> FMT_CONSTEXPR void set_debug_format(bool set = true) { specs_.type = set ? presentation_type::debug : presentation_type::none; } template FMT_CONSTEXPR auto format(const T& val, FormatContext& ctx) const -> decltype(ctx.out()); }; template struct runtime_format_string { basic_string_view str; }; /** A compile-time format string. */ template class basic_format_string { private: basic_string_view str_; public: template >::value)> FMT_CONSTEVAL FMT_INLINE basic_format_string(const S& s) : str_(s) { static_assert( detail::count< (std::is_base_of>::value && std::is_reference::value)...>() == 0, "passing views as lvalues is disallowed"); #ifdef FMT_HAS_CONSTEVAL if constexpr (detail::count_named_args() == detail::count_statically_named_args()) { using checker = detail::format_string_checker...>; detail::parse_format_string(str_, checker(s)); } #else detail::check_format_string(s); #endif } basic_format_string(runtime_format_string fmt) : str_(fmt.str) {} FMT_INLINE operator basic_string_view() const { return str_; } FMT_INLINE auto get() const -> basic_string_view { return str_; } }; #if FMT_GCC_VERSION && FMT_GCC_VERSION < 409 // Workaround broken conversion on older gcc. template using format_string = string_view; inline auto runtime(string_view s) -> string_view { return s; } #else template using format_string = basic_format_string...>; /** \rst Creates a runtime format string. **Example**:: // Check format string at runtime instead of compile-time. fmt::print(fmt::runtime("{:d}"), "I am not a number"); \endrst */ inline auto runtime(string_view s) -> runtime_format_string<> { return {{s}}; } #endif FMT_API auto vformat(string_view fmt, format_args args) -> std::string; /** \rst Formats ``args`` according to specifications in ``fmt`` and returns the result as a string. **Example**:: #include std::string message = fmt::format("The answer is {}.", 42); \endrst */ template FMT_NODISCARD FMT_INLINE auto format(format_string fmt, T&&... args) -> std::string { return vformat(fmt, fmt::make_format_args(args...)); } /** Formats a string and writes the output to ``out``. */ template ::value)> auto vformat_to(OutputIt out, string_view fmt, format_args args) -> OutputIt { auto&& buf = detail::get_buffer(out); detail::vformat_to(buf, fmt, args, {}); return detail::get_iterator(buf, out); } /** \rst Formats ``args`` according to specifications in ``fmt``, writes the result to the output iterator ``out`` and returns the iterator past the end of the output range. `format_to` does not append a terminating null character. **Example**:: auto out = std::vector(); fmt::format_to(std::back_inserter(out), "{}", 42); \endrst */ template ::value)> FMT_INLINE auto format_to(OutputIt out, format_string fmt, T&&... args) -> OutputIt { return vformat_to(out, fmt, fmt::make_format_args(args...)); } template struct format_to_n_result { /** Iterator past the end of the output range. */ OutputIt out; /** Total (not truncated) output size. */ size_t size; }; template ::value)> auto vformat_to_n(OutputIt out, size_t n, string_view fmt, format_args args) -> format_to_n_result { using traits = detail::fixed_buffer_traits; auto buf = detail::iterator_buffer(out, n); detail::vformat_to(buf, fmt, args, {}); return {buf.out(), buf.count()}; } /** \rst Formats ``args`` according to specifications in ``fmt``, writes up to ``n`` characters of the result to the output iterator ``out`` and returns the total (not truncated) output size and the iterator past the end of the output range. `format_to_n` does not append a terminating null character. \endrst */ template ::value)> FMT_INLINE auto format_to_n(OutputIt out, size_t n, format_string fmt, T&&... args) -> format_to_n_result { return vformat_to_n(out, n, fmt, fmt::make_format_args(args...)); } /** Returns the number of chars in the output of ``format(fmt, args...)``. */ template FMT_NODISCARD FMT_INLINE auto formatted_size(format_string fmt, T&&... args) -> size_t { auto buf = detail::counting_buffer<>(); detail::vformat_to(buf, fmt, fmt::make_format_args(args...), {}); return buf.count(); } FMT_API void vprint(string_view fmt, format_args args); FMT_API void vprint(std::FILE* f, string_view fmt, format_args args); /** \rst Formats ``args`` according to specifications in ``fmt`` and writes the output to ``stdout``. **Example**:: fmt::print("Elapsed time: {0:.2f} seconds", 1.23); \endrst */ template FMT_INLINE void print(format_string fmt, T&&... args) { const auto& vargs = fmt::make_format_args(args...); return detail::is_utf8() ? vprint(fmt, vargs) : detail::vprint_mojibake(stdout, fmt, vargs); } /** \rst Formats ``args`` according to specifications in ``fmt`` and writes the output to the file ``f``. **Example**:: fmt::print(stderr, "Don't {}!", "panic"); \endrst */ template FMT_INLINE void print(std::FILE* f, format_string fmt, T&&... args) { const auto& vargs = fmt::make_format_args(args...); return detail::is_utf8() ? vprint(f, fmt, vargs) : detail::vprint_mojibake(f, fmt, vargs); } /** Formats ``args`` according to specifications in ``fmt`` and writes the output to the file ``f`` followed by a newline. */ template FMT_INLINE void println(std::FILE* f, format_string fmt, T&&... args) { return fmt::print(f, "{}\n", fmt::format(fmt, std::forward(args)...)); } /** Formats ``args`` according to specifications in ``fmt`` and writes the output to ``stdout`` followed by a newline. */ template FMT_INLINE void println(format_string fmt, T&&... args) { return fmt::println(stdout, fmt, std::forward(args)...); } FMT_END_EXPORT FMT_GCC_PRAGMA("GCC pop_options") FMT_END_NAMESPACE #ifdef FMT_HEADER_ONLY # include "format.h" #endif #endif // FMT_CORE_H_ level-zero-1.20.6/third_party/spdlog_headers/spdlog/fmt/bundled/format-inl.h000066400000000000000000002176561475521542100271430ustar00rootroot00000000000000// Formatting library for C++ - implementation // // Copyright (c) 2012 - 2016, Victor Zverovich // All rights reserved. // // For the license information refer to format.h. #ifndef FMT_FORMAT_INL_H_ #define FMT_FORMAT_INL_H_ #include #include // errno #include #include #include #ifndef FMT_STATIC_THOUSANDS_SEPARATOR # include #endif #if defined(_WIN32) && !defined(FMT_WINDOWS_NO_WCHAR) # include // _isatty #endif #include "format.h" FMT_BEGIN_NAMESPACE namespace detail { FMT_FUNC void assert_fail(const char* file, int line, const char* message) { // Use unchecked std::fprintf to avoid triggering another assertion when // writing to stderr fails std::fprintf(stderr, "%s:%d: assertion failed: %s", file, line, message); // Chosen instead of std::abort to satisfy Clang in CUDA mode during device // code pass. std::terminate(); } FMT_FUNC void throw_format_error(const char* message) { FMT_THROW(format_error(message)); } FMT_FUNC void format_error_code(detail::buffer& out, int error_code, string_view message) noexcept { // Report error code making sure that the output fits into // inline_buffer_size to avoid dynamic memory allocation and potential // bad_alloc. out.try_resize(0); static const char SEP[] = ": "; static const char ERROR_STR[] = "error "; // Subtract 2 to account for terminating null characters in SEP and ERROR_STR. size_t error_code_size = sizeof(SEP) + sizeof(ERROR_STR) - 2; auto abs_value = static_cast>(error_code); if (detail::is_negative(error_code)) { abs_value = 0 - abs_value; ++error_code_size; } error_code_size += detail::to_unsigned(detail::count_digits(abs_value)); auto it = buffer_appender(out); if (message.size() <= inline_buffer_size - error_code_size) fmt::format_to(it, FMT_STRING("{}{}"), message, SEP); fmt::format_to(it, FMT_STRING("{}{}"), ERROR_STR, error_code); FMT_ASSERT(out.size() <= inline_buffer_size, ""); } FMT_FUNC void report_error(format_func func, int error_code, const char* message) noexcept { memory_buffer full_message; func(full_message, error_code, message); // Don't use fwrite_fully because the latter may throw. if (std::fwrite(full_message.data(), full_message.size(), 1, stderr) > 0) std::fputc('\n', stderr); } // A wrapper around fwrite that throws on error. inline void fwrite_fully(const void* ptr, size_t count, FILE* stream) { size_t written = std::fwrite(ptr, 1, count, stream); if (written < count) FMT_THROW(system_error(errno, FMT_STRING("cannot write to file"))); } #ifndef FMT_STATIC_THOUSANDS_SEPARATOR template locale_ref::locale_ref(const Locale& loc) : locale_(&loc) { static_assert(std::is_same::value, ""); } template auto locale_ref::get() const -> Locale { static_assert(std::is_same::value, ""); return locale_ ? *static_cast(locale_) : std::locale(); } template FMT_FUNC auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result { auto& facet = std::use_facet>(loc.get()); auto grouping = facet.grouping(); auto thousands_sep = grouping.empty() ? Char() : facet.thousands_sep(); return {std::move(grouping), thousands_sep}; } template FMT_FUNC auto decimal_point_impl(locale_ref loc) -> Char { return std::use_facet>(loc.get()) .decimal_point(); } #else template FMT_FUNC auto thousands_sep_impl(locale_ref) -> thousands_sep_result { return {"\03", FMT_STATIC_THOUSANDS_SEPARATOR}; } template FMT_FUNC Char decimal_point_impl(locale_ref) { return '.'; } #endif FMT_FUNC auto write_loc(appender out, loc_value value, const format_specs<>& specs, locale_ref loc) -> bool { #ifndef FMT_STATIC_THOUSANDS_SEPARATOR auto locale = loc.get(); // We cannot use the num_put facet because it may produce output in // a wrong encoding. using facet = format_facet; if (std::has_facet(locale)) return std::use_facet(locale).put(out, value, specs); return facet(locale).put(out, value, specs); #endif return false; } } // namespace detail template typename Locale::id format_facet::id; #ifndef FMT_STATIC_THOUSANDS_SEPARATOR template format_facet::format_facet(Locale& loc) { auto& numpunct = std::use_facet>(loc); grouping_ = numpunct.grouping(); if (!grouping_.empty()) separator_ = std::string(1, numpunct.thousands_sep()); } template <> FMT_API FMT_FUNC auto format_facet::do_put( appender out, loc_value val, const format_specs<>& specs) const -> bool { return val.visit( detail::loc_writer<>{out, specs, separator_, grouping_, decimal_point_}); } #endif FMT_FUNC auto vsystem_error(int error_code, string_view fmt, format_args args) -> std::system_error { auto ec = std::error_code(error_code, std::generic_category()); return std::system_error(ec, vformat(fmt, args)); } namespace detail { template inline auto operator==(basic_fp x, basic_fp y) -> bool { return x.f == y.f && x.e == y.e; } // Compilers should be able to optimize this into the ror instruction. FMT_CONSTEXPR inline auto rotr(uint32_t n, uint32_t r) noexcept -> uint32_t { r &= 31; return (n >> r) | (n << (32 - r)); } FMT_CONSTEXPR inline auto rotr(uint64_t n, uint32_t r) noexcept -> uint64_t { r &= 63; return (n >> r) | (n << (64 - r)); } // Implementation of Dragonbox algorithm: https://github.com/jk-jeon/dragonbox. namespace dragonbox { // Computes upper 64 bits of multiplication of a 32-bit unsigned integer and a // 64-bit unsigned integer. inline auto umul96_upper64(uint32_t x, uint64_t y) noexcept -> uint64_t { return umul128_upper64(static_cast(x) << 32, y); } // Computes lower 128 bits of multiplication of a 64-bit unsigned integer and a // 128-bit unsigned integer. inline auto umul192_lower128(uint64_t x, uint128_fallback y) noexcept -> uint128_fallback { uint64_t high = x * y.high(); uint128_fallback high_low = umul128(x, y.low()); return {high + high_low.high(), high_low.low()}; } // Computes lower 64 bits of multiplication of a 32-bit unsigned integer and a // 64-bit unsigned integer. inline auto umul96_lower64(uint32_t x, uint64_t y) noexcept -> uint64_t { return x * y; } // Various fast log computations. inline auto floor_log10_pow2_minus_log10_4_over_3(int e) noexcept -> int { FMT_ASSERT(e <= 2936 && e >= -2985, "too large exponent"); return (e * 631305 - 261663) >> 21; } FMT_INLINE_VARIABLE constexpr struct { uint32_t divisor; int shift_amount; } div_small_pow10_infos[] = {{10, 16}, {100, 16}}; // Replaces n by floor(n / pow(10, N)) returning true if and only if n is // divisible by pow(10, N). // Precondition: n <= pow(10, N + 1). template auto check_divisibility_and_divide_by_pow10(uint32_t& n) noexcept -> bool { // The numbers below are chosen such that: // 1. floor(n/d) = floor(nm / 2^k) where d=10 or d=100, // 2. nm mod 2^k < m if and only if n is divisible by d, // where m is magic_number, k is shift_amount // and d is divisor. // // Item 1 is a common technique of replacing division by a constant with // multiplication, see e.g. "Division by Invariant Integers Using // Multiplication" by Granlund and Montgomery (1994). magic_number (m) is set // to ceil(2^k/d) for large enough k. // The idea for item 2 originates from Schubfach. constexpr auto info = div_small_pow10_infos[N - 1]; FMT_ASSERT(n <= info.divisor * 10, "n is too large"); constexpr uint32_t magic_number = (1u << info.shift_amount) / info.divisor + 1; n *= magic_number; const uint32_t comparison_mask = (1u << info.shift_amount) - 1; bool result = (n & comparison_mask) < magic_number; n >>= info.shift_amount; return result; } // Computes floor(n / pow(10, N)) for small n and N. // Precondition: n <= pow(10, N + 1). template auto small_division_by_pow10(uint32_t n) noexcept -> uint32_t { constexpr auto info = div_small_pow10_infos[N - 1]; FMT_ASSERT(n <= info.divisor * 10, "n is too large"); constexpr uint32_t magic_number = (1u << info.shift_amount) / info.divisor + 1; return (n * magic_number) >> info.shift_amount; } // Computes floor(n / 10^(kappa + 1)) (float) inline auto divide_by_10_to_kappa_plus_1(uint32_t n) noexcept -> uint32_t { // 1374389535 = ceil(2^37/100) return static_cast((static_cast(n) * 1374389535) >> 37); } // Computes floor(n / 10^(kappa + 1)) (double) inline auto divide_by_10_to_kappa_plus_1(uint64_t n) noexcept -> uint64_t { // 2361183241434822607 = ceil(2^(64+7)/1000) return umul128_upper64(n, 2361183241434822607ull) >> 7; } // Various subroutines using pow10 cache template struct cache_accessor; template <> struct cache_accessor { using carrier_uint = float_info::carrier_uint; using cache_entry_type = uint64_t; static auto get_cached_power(int k) noexcept -> uint64_t { FMT_ASSERT(k >= float_info::min_k && k <= float_info::max_k, "k is out of range"); static constexpr const uint64_t pow10_significands[] = { 0x81ceb32c4b43fcf5, 0xa2425ff75e14fc32, 0xcad2f7f5359a3b3f, 0xfd87b5f28300ca0e, 0x9e74d1b791e07e49, 0xc612062576589ddb, 0xf79687aed3eec552, 0x9abe14cd44753b53, 0xc16d9a0095928a28, 0xf1c90080baf72cb2, 0x971da05074da7bef, 0xbce5086492111aeb, 0xec1e4a7db69561a6, 0x9392ee8e921d5d08, 0xb877aa3236a4b44a, 0xe69594bec44de15c, 0x901d7cf73ab0acda, 0xb424dc35095cd810, 0xe12e13424bb40e14, 0x8cbccc096f5088cc, 0xafebff0bcb24aaff, 0xdbe6fecebdedd5bf, 0x89705f4136b4a598, 0xabcc77118461cefd, 0xd6bf94d5e57a42bd, 0x8637bd05af6c69b6, 0xa7c5ac471b478424, 0xd1b71758e219652c, 0x83126e978d4fdf3c, 0xa3d70a3d70a3d70b, 0xcccccccccccccccd, 0x8000000000000000, 0xa000000000000000, 0xc800000000000000, 0xfa00000000000000, 0x9c40000000000000, 0xc350000000000000, 0xf424000000000000, 0x9896800000000000, 0xbebc200000000000, 0xee6b280000000000, 0x9502f90000000000, 0xba43b74000000000, 0xe8d4a51000000000, 0x9184e72a00000000, 0xb5e620f480000000, 0xe35fa931a0000000, 0x8e1bc9bf04000000, 0xb1a2bc2ec5000000, 0xde0b6b3a76400000, 0x8ac7230489e80000, 0xad78ebc5ac620000, 0xd8d726b7177a8000, 0x878678326eac9000, 0xa968163f0a57b400, 0xd3c21bcecceda100, 0x84595161401484a0, 0xa56fa5b99019a5c8, 0xcecb8f27f4200f3a, 0x813f3978f8940985, 0xa18f07d736b90be6, 0xc9f2c9cd04674edf, 0xfc6f7c4045812297, 0x9dc5ada82b70b59e, 0xc5371912364ce306, 0xf684df56c3e01bc7, 0x9a130b963a6c115d, 0xc097ce7bc90715b4, 0xf0bdc21abb48db21, 0x96769950b50d88f5, 0xbc143fa4e250eb32, 0xeb194f8e1ae525fe, 0x92efd1b8d0cf37bf, 0xb7abc627050305ae, 0xe596b7b0c643c71a, 0x8f7e32ce7bea5c70, 0xb35dbf821ae4f38c, 0xe0352f62a19e306f}; return pow10_significands[k - float_info::min_k]; } struct compute_mul_result { carrier_uint result; bool is_integer; }; struct compute_mul_parity_result { bool parity; bool is_integer; }; static auto compute_mul(carrier_uint u, const cache_entry_type& cache) noexcept -> compute_mul_result { auto r = umul96_upper64(u, cache); return {static_cast(r >> 32), static_cast(r) == 0}; } static auto compute_delta(const cache_entry_type& cache, int beta) noexcept -> uint32_t { return static_cast(cache >> (64 - 1 - beta)); } static auto compute_mul_parity(carrier_uint two_f, const cache_entry_type& cache, int beta) noexcept -> compute_mul_parity_result { FMT_ASSERT(beta >= 1, ""); FMT_ASSERT(beta < 64, ""); auto r = umul96_lower64(two_f, cache); return {((r >> (64 - beta)) & 1) != 0, static_cast(r >> (32 - beta)) == 0}; } static auto compute_left_endpoint_for_shorter_interval_case( const cache_entry_type& cache, int beta) noexcept -> carrier_uint { return static_cast( (cache - (cache >> (num_significand_bits() + 2))) >> (64 - num_significand_bits() - 1 - beta)); } static auto compute_right_endpoint_for_shorter_interval_case( const cache_entry_type& cache, int beta) noexcept -> carrier_uint { return static_cast( (cache + (cache >> (num_significand_bits() + 1))) >> (64 - num_significand_bits() - 1 - beta)); } static auto compute_round_up_for_shorter_interval_case( const cache_entry_type& cache, int beta) noexcept -> carrier_uint { return (static_cast( cache >> (64 - num_significand_bits() - 2 - beta)) + 1) / 2; } }; template <> struct cache_accessor { using carrier_uint = float_info::carrier_uint; using cache_entry_type = uint128_fallback; static auto get_cached_power(int k) noexcept -> uint128_fallback { FMT_ASSERT(k >= float_info::min_k && k <= float_info::max_k, "k is out of range"); static constexpr const uint128_fallback pow10_significands[] = { #if FMT_USE_FULL_CACHE_DRAGONBOX {0xff77b1fcbebcdc4f, 0x25e8e89c13bb0f7b}, {0x9faacf3df73609b1, 0x77b191618c54e9ad}, {0xc795830d75038c1d, 0xd59df5b9ef6a2418}, {0xf97ae3d0d2446f25, 0x4b0573286b44ad1e}, {0x9becce62836ac577, 0x4ee367f9430aec33}, {0xc2e801fb244576d5, 0x229c41f793cda740}, {0xf3a20279ed56d48a, 0x6b43527578c11110}, {0x9845418c345644d6, 0x830a13896b78aaaa}, {0xbe5691ef416bd60c, 0x23cc986bc656d554}, {0xedec366b11c6cb8f, 0x2cbfbe86b7ec8aa9}, {0x94b3a202eb1c3f39, 0x7bf7d71432f3d6aa}, {0xb9e08a83a5e34f07, 0xdaf5ccd93fb0cc54}, {0xe858ad248f5c22c9, 0xd1b3400f8f9cff69}, {0x91376c36d99995be, 0x23100809b9c21fa2}, {0xb58547448ffffb2d, 0xabd40a0c2832a78b}, {0xe2e69915b3fff9f9, 0x16c90c8f323f516d}, {0x8dd01fad907ffc3b, 0xae3da7d97f6792e4}, {0xb1442798f49ffb4a, 0x99cd11cfdf41779d}, {0xdd95317f31c7fa1d, 0x40405643d711d584}, {0x8a7d3eef7f1cfc52, 0x482835ea666b2573}, {0xad1c8eab5ee43b66, 0xda3243650005eed0}, {0xd863b256369d4a40, 0x90bed43e40076a83}, {0x873e4f75e2224e68, 0x5a7744a6e804a292}, {0xa90de3535aaae202, 0x711515d0a205cb37}, {0xd3515c2831559a83, 0x0d5a5b44ca873e04}, {0x8412d9991ed58091, 0xe858790afe9486c3}, {0xa5178fff668ae0b6, 0x626e974dbe39a873}, {0xce5d73ff402d98e3, 0xfb0a3d212dc81290}, {0x80fa687f881c7f8e, 0x7ce66634bc9d0b9a}, {0xa139029f6a239f72, 0x1c1fffc1ebc44e81}, {0xc987434744ac874e, 0xa327ffb266b56221}, {0xfbe9141915d7a922, 0x4bf1ff9f0062baa9}, {0x9d71ac8fada6c9b5, 0x6f773fc3603db4aa}, {0xc4ce17b399107c22, 0xcb550fb4384d21d4}, {0xf6019da07f549b2b, 0x7e2a53a146606a49}, {0x99c102844f94e0fb, 0x2eda7444cbfc426e}, {0xc0314325637a1939, 0xfa911155fefb5309}, {0xf03d93eebc589f88, 0x793555ab7eba27cb}, {0x96267c7535b763b5, 0x4bc1558b2f3458df}, {0xbbb01b9283253ca2, 0x9eb1aaedfb016f17}, {0xea9c227723ee8bcb, 0x465e15a979c1cadd}, {0x92a1958a7675175f, 0x0bfacd89ec191eca}, {0xb749faed14125d36, 0xcef980ec671f667c}, {0xe51c79a85916f484, 0x82b7e12780e7401b}, {0x8f31cc0937ae58d2, 0xd1b2ecb8b0908811}, {0xb2fe3f0b8599ef07, 0x861fa7e6dcb4aa16}, {0xdfbdcece67006ac9, 0x67a791e093e1d49b}, {0x8bd6a141006042bd, 0xe0c8bb2c5c6d24e1}, {0xaecc49914078536d, 0x58fae9f773886e19}, {0xda7f5bf590966848, 0xaf39a475506a899f}, {0x888f99797a5e012d, 0x6d8406c952429604}, {0xaab37fd7d8f58178, 0xc8e5087ba6d33b84}, {0xd5605fcdcf32e1d6, 0xfb1e4a9a90880a65}, {0x855c3be0a17fcd26, 0x5cf2eea09a550680}, {0xa6b34ad8c9dfc06f, 0xf42faa48c0ea481f}, {0xd0601d8efc57b08b, 0xf13b94daf124da27}, {0x823c12795db6ce57, 0x76c53d08d6b70859}, {0xa2cb1717b52481ed, 0x54768c4b0c64ca6f}, {0xcb7ddcdda26da268, 0xa9942f5dcf7dfd0a}, {0xfe5d54150b090b02, 0xd3f93b35435d7c4d}, {0x9efa548d26e5a6e1, 0xc47bc5014a1a6db0}, {0xc6b8e9b0709f109a, 0x359ab6419ca1091c}, {0xf867241c8cc6d4c0, 0xc30163d203c94b63}, {0x9b407691d7fc44f8, 0x79e0de63425dcf1e}, {0xc21094364dfb5636, 0x985915fc12f542e5}, {0xf294b943e17a2bc4, 0x3e6f5b7b17b2939e}, {0x979cf3ca6cec5b5a, 0xa705992ceecf9c43}, {0xbd8430bd08277231, 0x50c6ff782a838354}, {0xece53cec4a314ebd, 0xa4f8bf5635246429}, {0x940f4613ae5ed136, 0x871b7795e136be9a}, {0xb913179899f68584, 0x28e2557b59846e40}, {0xe757dd7ec07426e5, 0x331aeada2fe589d0}, {0x9096ea6f3848984f, 0x3ff0d2c85def7622}, {0xb4bca50b065abe63, 0x0fed077a756b53aa}, {0xe1ebce4dc7f16dfb, 0xd3e8495912c62895}, {0x8d3360f09cf6e4bd, 0x64712dd7abbbd95d}, {0xb080392cc4349dec, 0xbd8d794d96aacfb4}, {0xdca04777f541c567, 0xecf0d7a0fc5583a1}, {0x89e42caaf9491b60, 0xf41686c49db57245}, {0xac5d37d5b79b6239, 0x311c2875c522ced6}, {0xd77485cb25823ac7, 0x7d633293366b828c}, {0x86a8d39ef77164bc, 0xae5dff9c02033198}, {0xa8530886b54dbdeb, 0xd9f57f830283fdfd}, {0xd267caa862a12d66, 0xd072df63c324fd7c}, {0x8380dea93da4bc60, 0x4247cb9e59f71e6e}, {0xa46116538d0deb78, 0x52d9be85f074e609}, {0xcd795be870516656, 0x67902e276c921f8c}, {0x806bd9714632dff6, 0x00ba1cd8a3db53b7}, {0xa086cfcd97bf97f3, 0x80e8a40eccd228a5}, {0xc8a883c0fdaf7df0, 0x6122cd128006b2ce}, {0xfad2a4b13d1b5d6c, 0x796b805720085f82}, {0x9cc3a6eec6311a63, 0xcbe3303674053bb1}, {0xc3f490aa77bd60fc, 0xbedbfc4411068a9d}, {0xf4f1b4d515acb93b, 0xee92fb5515482d45}, {0x991711052d8bf3c5, 0x751bdd152d4d1c4b}, {0xbf5cd54678eef0b6, 0xd262d45a78a0635e}, {0xef340a98172aace4, 0x86fb897116c87c35}, {0x9580869f0e7aac0e, 0xd45d35e6ae3d4da1}, {0xbae0a846d2195712, 0x8974836059cca10a}, {0xe998d258869facd7, 0x2bd1a438703fc94c}, {0x91ff83775423cc06, 0x7b6306a34627ddd0}, {0xb67f6455292cbf08, 0x1a3bc84c17b1d543}, {0xe41f3d6a7377eeca, 0x20caba5f1d9e4a94}, {0x8e938662882af53e, 0x547eb47b7282ee9d}, {0xb23867fb2a35b28d, 0xe99e619a4f23aa44}, {0xdec681f9f4c31f31, 0x6405fa00e2ec94d5}, {0x8b3c113c38f9f37e, 0xde83bc408dd3dd05}, {0xae0b158b4738705e, 0x9624ab50b148d446}, {0xd98ddaee19068c76, 0x3badd624dd9b0958}, {0x87f8a8d4cfa417c9, 0xe54ca5d70a80e5d7}, {0xa9f6d30a038d1dbc, 0x5e9fcf4ccd211f4d}, {0xd47487cc8470652b, 0x7647c32000696720}, {0x84c8d4dfd2c63f3b, 0x29ecd9f40041e074}, {0xa5fb0a17c777cf09, 0xf468107100525891}, {0xcf79cc9db955c2cc, 0x7182148d4066eeb5}, {0x81ac1fe293d599bf, 0xc6f14cd848405531}, {0xa21727db38cb002f, 0xb8ada00e5a506a7d}, {0xca9cf1d206fdc03b, 0xa6d90811f0e4851d}, {0xfd442e4688bd304a, 0x908f4a166d1da664}, {0x9e4a9cec15763e2e, 0x9a598e4e043287ff}, {0xc5dd44271ad3cdba, 0x40eff1e1853f29fe}, {0xf7549530e188c128, 0xd12bee59e68ef47d}, {0x9a94dd3e8cf578b9, 0x82bb74f8301958cf}, {0xc13a148e3032d6e7, 0xe36a52363c1faf02}, {0xf18899b1bc3f8ca1, 0xdc44e6c3cb279ac2}, {0x96f5600f15a7b7e5, 0x29ab103a5ef8c0ba}, {0xbcb2b812db11a5de, 0x7415d448f6b6f0e8}, {0xebdf661791d60f56, 0x111b495b3464ad22}, {0x936b9fcebb25c995, 0xcab10dd900beec35}, {0xb84687c269ef3bfb, 0x3d5d514f40eea743}, {0xe65829b3046b0afa, 0x0cb4a5a3112a5113}, {0x8ff71a0fe2c2e6dc, 0x47f0e785eaba72ac}, {0xb3f4e093db73a093, 0x59ed216765690f57}, {0xe0f218b8d25088b8, 0x306869c13ec3532d}, {0x8c974f7383725573, 0x1e414218c73a13fc}, {0xafbd2350644eeacf, 0xe5d1929ef90898fb}, {0xdbac6c247d62a583, 0xdf45f746b74abf3a}, {0x894bc396ce5da772, 0x6b8bba8c328eb784}, {0xab9eb47c81f5114f, 0x066ea92f3f326565}, {0xd686619ba27255a2, 0xc80a537b0efefebe}, {0x8613fd0145877585, 0xbd06742ce95f5f37}, {0xa798fc4196e952e7, 0x2c48113823b73705}, {0xd17f3b51fca3a7a0, 0xf75a15862ca504c6}, {0x82ef85133de648c4, 0x9a984d73dbe722fc}, {0xa3ab66580d5fdaf5, 0xc13e60d0d2e0ebbb}, {0xcc963fee10b7d1b3, 0x318df905079926a9}, {0xffbbcfe994e5c61f, 0xfdf17746497f7053}, {0x9fd561f1fd0f9bd3, 0xfeb6ea8bedefa634}, {0xc7caba6e7c5382c8, 0xfe64a52ee96b8fc1}, {0xf9bd690a1b68637b, 0x3dfdce7aa3c673b1}, {0x9c1661a651213e2d, 0x06bea10ca65c084f}, {0xc31bfa0fe5698db8, 0x486e494fcff30a63}, {0xf3e2f893dec3f126, 0x5a89dba3c3efccfb}, {0x986ddb5c6b3a76b7, 0xf89629465a75e01d}, {0xbe89523386091465, 0xf6bbb397f1135824}, {0xee2ba6c0678b597f, 0x746aa07ded582e2d}, {0x94db483840b717ef, 0xa8c2a44eb4571cdd}, {0xba121a4650e4ddeb, 0x92f34d62616ce414}, {0xe896a0d7e51e1566, 0x77b020baf9c81d18}, {0x915e2486ef32cd60, 0x0ace1474dc1d122f}, {0xb5b5ada8aaff80b8, 0x0d819992132456bb}, {0xe3231912d5bf60e6, 0x10e1fff697ed6c6a}, {0x8df5efabc5979c8f, 0xca8d3ffa1ef463c2}, {0xb1736b96b6fd83b3, 0xbd308ff8a6b17cb3}, {0xddd0467c64bce4a0, 0xac7cb3f6d05ddbdf}, {0x8aa22c0dbef60ee4, 0x6bcdf07a423aa96c}, {0xad4ab7112eb3929d, 0x86c16c98d2c953c7}, {0xd89d64d57a607744, 0xe871c7bf077ba8b8}, {0x87625f056c7c4a8b, 0x11471cd764ad4973}, {0xa93af6c6c79b5d2d, 0xd598e40d3dd89bd0}, {0xd389b47879823479, 0x4aff1d108d4ec2c4}, {0x843610cb4bf160cb, 0xcedf722a585139bb}, {0xa54394fe1eedb8fe, 0xc2974eb4ee658829}, {0xce947a3da6a9273e, 0x733d226229feea33}, {0x811ccc668829b887, 0x0806357d5a3f5260}, {0xa163ff802a3426a8, 0xca07c2dcb0cf26f8}, {0xc9bcff6034c13052, 0xfc89b393dd02f0b6}, {0xfc2c3f3841f17c67, 0xbbac2078d443ace3}, {0x9d9ba7832936edc0, 0xd54b944b84aa4c0e}, {0xc5029163f384a931, 0x0a9e795e65d4df12}, {0xf64335bcf065d37d, 0x4d4617b5ff4a16d6}, {0x99ea0196163fa42e, 0x504bced1bf8e4e46}, {0xc06481fb9bcf8d39, 0xe45ec2862f71e1d7}, {0xf07da27a82c37088, 0x5d767327bb4e5a4d}, {0x964e858c91ba2655, 0x3a6a07f8d510f870}, {0xbbe226efb628afea, 0x890489f70a55368c}, {0xeadab0aba3b2dbe5, 0x2b45ac74ccea842f}, {0x92c8ae6b464fc96f, 0x3b0b8bc90012929e}, {0xb77ada0617e3bbcb, 0x09ce6ebb40173745}, {0xe55990879ddcaabd, 0xcc420a6a101d0516}, {0x8f57fa54c2a9eab6, 0x9fa946824a12232e}, {0xb32df8e9f3546564, 0x47939822dc96abfa}, {0xdff9772470297ebd, 0x59787e2b93bc56f8}, {0x8bfbea76c619ef36, 0x57eb4edb3c55b65b}, {0xaefae51477a06b03, 0xede622920b6b23f2}, {0xdab99e59958885c4, 0xe95fab368e45ecee}, {0x88b402f7fd75539b, 0x11dbcb0218ebb415}, {0xaae103b5fcd2a881, 0xd652bdc29f26a11a}, {0xd59944a37c0752a2, 0x4be76d3346f04960}, {0x857fcae62d8493a5, 0x6f70a4400c562ddc}, {0xa6dfbd9fb8e5b88e, 0xcb4ccd500f6bb953}, {0xd097ad07a71f26b2, 0x7e2000a41346a7a8}, {0x825ecc24c873782f, 0x8ed400668c0c28c9}, {0xa2f67f2dfa90563b, 0x728900802f0f32fb}, {0xcbb41ef979346bca, 0x4f2b40a03ad2ffba}, {0xfea126b7d78186bc, 0xe2f610c84987bfa9}, {0x9f24b832e6b0f436, 0x0dd9ca7d2df4d7ca}, {0xc6ede63fa05d3143, 0x91503d1c79720dbc}, {0xf8a95fcf88747d94, 0x75a44c6397ce912b}, {0x9b69dbe1b548ce7c, 0xc986afbe3ee11abb}, {0xc24452da229b021b, 0xfbe85badce996169}, {0xf2d56790ab41c2a2, 0xfae27299423fb9c4}, {0x97c560ba6b0919a5, 0xdccd879fc967d41b}, {0xbdb6b8e905cb600f, 0x5400e987bbc1c921}, {0xed246723473e3813, 0x290123e9aab23b69}, {0x9436c0760c86e30b, 0xf9a0b6720aaf6522}, {0xb94470938fa89bce, 0xf808e40e8d5b3e6a}, {0xe7958cb87392c2c2, 0xb60b1d1230b20e05}, {0x90bd77f3483bb9b9, 0xb1c6f22b5e6f48c3}, {0xb4ecd5f01a4aa828, 0x1e38aeb6360b1af4}, {0xe2280b6c20dd5232, 0x25c6da63c38de1b1}, {0x8d590723948a535f, 0x579c487e5a38ad0f}, {0xb0af48ec79ace837, 0x2d835a9df0c6d852}, {0xdcdb1b2798182244, 0xf8e431456cf88e66}, {0x8a08f0f8bf0f156b, 0x1b8e9ecb641b5900}, {0xac8b2d36eed2dac5, 0xe272467e3d222f40}, {0xd7adf884aa879177, 0x5b0ed81dcc6abb10}, {0x86ccbb52ea94baea, 0x98e947129fc2b4ea}, {0xa87fea27a539e9a5, 0x3f2398d747b36225}, {0xd29fe4b18e88640e, 0x8eec7f0d19a03aae}, {0x83a3eeeef9153e89, 0x1953cf68300424ad}, {0xa48ceaaab75a8e2b, 0x5fa8c3423c052dd8}, {0xcdb02555653131b6, 0x3792f412cb06794e}, {0x808e17555f3ebf11, 0xe2bbd88bbee40bd1}, {0xa0b19d2ab70e6ed6, 0x5b6aceaeae9d0ec5}, {0xc8de047564d20a8b, 0xf245825a5a445276}, {0xfb158592be068d2e, 0xeed6e2f0f0d56713}, {0x9ced737bb6c4183d, 0x55464dd69685606c}, {0xc428d05aa4751e4c, 0xaa97e14c3c26b887}, {0xf53304714d9265df, 0xd53dd99f4b3066a9}, {0x993fe2c6d07b7fab, 0xe546a8038efe402a}, {0xbf8fdb78849a5f96, 0xde98520472bdd034}, {0xef73d256a5c0f77c, 0x963e66858f6d4441}, {0x95a8637627989aad, 0xdde7001379a44aa9}, {0xbb127c53b17ec159, 0x5560c018580d5d53}, {0xe9d71b689dde71af, 0xaab8f01e6e10b4a7}, {0x9226712162ab070d, 0xcab3961304ca70e9}, {0xb6b00d69bb55c8d1, 0x3d607b97c5fd0d23}, {0xe45c10c42a2b3b05, 0x8cb89a7db77c506b}, {0x8eb98a7a9a5b04e3, 0x77f3608e92adb243}, {0xb267ed1940f1c61c, 0x55f038b237591ed4}, {0xdf01e85f912e37a3, 0x6b6c46dec52f6689}, {0x8b61313bbabce2c6, 0x2323ac4b3b3da016}, {0xae397d8aa96c1b77, 0xabec975e0a0d081b}, {0xd9c7dced53c72255, 0x96e7bd358c904a22}, {0x881cea14545c7575, 0x7e50d64177da2e55}, {0xaa242499697392d2, 0xdde50bd1d5d0b9ea}, {0xd4ad2dbfc3d07787, 0x955e4ec64b44e865}, {0x84ec3c97da624ab4, 0xbd5af13bef0b113f}, {0xa6274bbdd0fadd61, 0xecb1ad8aeacdd58f}, {0xcfb11ead453994ba, 0x67de18eda5814af3}, {0x81ceb32c4b43fcf4, 0x80eacf948770ced8}, {0xa2425ff75e14fc31, 0xa1258379a94d028e}, {0xcad2f7f5359a3b3e, 0x096ee45813a04331}, {0xfd87b5f28300ca0d, 0x8bca9d6e188853fd}, {0x9e74d1b791e07e48, 0x775ea264cf55347e}, {0xc612062576589dda, 0x95364afe032a819e}, {0xf79687aed3eec551, 0x3a83ddbd83f52205}, {0x9abe14cd44753b52, 0xc4926a9672793543}, {0xc16d9a0095928a27, 0x75b7053c0f178294}, {0xf1c90080baf72cb1, 0x5324c68b12dd6339}, {0x971da05074da7bee, 0xd3f6fc16ebca5e04}, {0xbce5086492111aea, 0x88f4bb1ca6bcf585}, {0xec1e4a7db69561a5, 0x2b31e9e3d06c32e6}, {0x9392ee8e921d5d07, 0x3aff322e62439fd0}, {0xb877aa3236a4b449, 0x09befeb9fad487c3}, {0xe69594bec44de15b, 0x4c2ebe687989a9b4}, {0x901d7cf73ab0acd9, 0x0f9d37014bf60a11}, {0xb424dc35095cd80f, 0x538484c19ef38c95}, {0xe12e13424bb40e13, 0x2865a5f206b06fba}, {0x8cbccc096f5088cb, 0xf93f87b7442e45d4}, {0xafebff0bcb24aafe, 0xf78f69a51539d749}, {0xdbe6fecebdedd5be, 0xb573440e5a884d1c}, {0x89705f4136b4a597, 0x31680a88f8953031}, {0xabcc77118461cefc, 0xfdc20d2b36ba7c3e}, {0xd6bf94d5e57a42bc, 0x3d32907604691b4d}, {0x8637bd05af6c69b5, 0xa63f9a49c2c1b110}, {0xa7c5ac471b478423, 0x0fcf80dc33721d54}, {0xd1b71758e219652b, 0xd3c36113404ea4a9}, {0x83126e978d4fdf3b, 0x645a1cac083126ea}, {0xa3d70a3d70a3d70a, 0x3d70a3d70a3d70a4}, {0xcccccccccccccccc, 0xcccccccccccccccd}, {0x8000000000000000, 0x0000000000000000}, {0xa000000000000000, 0x0000000000000000}, {0xc800000000000000, 0x0000000000000000}, {0xfa00000000000000, 0x0000000000000000}, {0x9c40000000000000, 0x0000000000000000}, {0xc350000000000000, 0x0000000000000000}, {0xf424000000000000, 0x0000000000000000}, {0x9896800000000000, 0x0000000000000000}, {0xbebc200000000000, 0x0000000000000000}, {0xee6b280000000000, 0x0000000000000000}, {0x9502f90000000000, 0x0000000000000000}, {0xba43b74000000000, 0x0000000000000000}, {0xe8d4a51000000000, 0x0000000000000000}, {0x9184e72a00000000, 0x0000000000000000}, {0xb5e620f480000000, 0x0000000000000000}, {0xe35fa931a0000000, 0x0000000000000000}, {0x8e1bc9bf04000000, 0x0000000000000000}, {0xb1a2bc2ec5000000, 0x0000000000000000}, {0xde0b6b3a76400000, 0x0000000000000000}, {0x8ac7230489e80000, 0x0000000000000000}, {0xad78ebc5ac620000, 0x0000000000000000}, {0xd8d726b7177a8000, 0x0000000000000000}, {0x878678326eac9000, 0x0000000000000000}, {0xa968163f0a57b400, 0x0000000000000000}, {0xd3c21bcecceda100, 0x0000000000000000}, {0x84595161401484a0, 0x0000000000000000}, {0xa56fa5b99019a5c8, 0x0000000000000000}, {0xcecb8f27f4200f3a, 0x0000000000000000}, {0x813f3978f8940984, 0x4000000000000000}, {0xa18f07d736b90be5, 0x5000000000000000}, {0xc9f2c9cd04674ede, 0xa400000000000000}, {0xfc6f7c4045812296, 0x4d00000000000000}, {0x9dc5ada82b70b59d, 0xf020000000000000}, {0xc5371912364ce305, 0x6c28000000000000}, {0xf684df56c3e01bc6, 0xc732000000000000}, {0x9a130b963a6c115c, 0x3c7f400000000000}, {0xc097ce7bc90715b3, 0x4b9f100000000000}, {0xf0bdc21abb48db20, 0x1e86d40000000000}, {0x96769950b50d88f4, 0x1314448000000000}, {0xbc143fa4e250eb31, 0x17d955a000000000}, {0xeb194f8e1ae525fd, 0x5dcfab0800000000}, {0x92efd1b8d0cf37be, 0x5aa1cae500000000}, {0xb7abc627050305ad, 0xf14a3d9e40000000}, {0xe596b7b0c643c719, 0x6d9ccd05d0000000}, {0x8f7e32ce7bea5c6f, 0xe4820023a2000000}, {0xb35dbf821ae4f38b, 0xdda2802c8a800000}, {0xe0352f62a19e306e, 0xd50b2037ad200000}, {0x8c213d9da502de45, 0x4526f422cc340000}, {0xaf298d050e4395d6, 0x9670b12b7f410000}, {0xdaf3f04651d47b4c, 0x3c0cdd765f114000}, {0x88d8762bf324cd0f, 0xa5880a69fb6ac800}, {0xab0e93b6efee0053, 0x8eea0d047a457a00}, {0xd5d238a4abe98068, 0x72a4904598d6d880}, {0x85a36366eb71f041, 0x47a6da2b7f864750}, {0xa70c3c40a64e6c51, 0x999090b65f67d924}, {0xd0cf4b50cfe20765, 0xfff4b4e3f741cf6d}, {0x82818f1281ed449f, 0xbff8f10e7a8921a5}, {0xa321f2d7226895c7, 0xaff72d52192b6a0e}, {0xcbea6f8ceb02bb39, 0x9bf4f8a69f764491}, {0xfee50b7025c36a08, 0x02f236d04753d5b5}, {0x9f4f2726179a2245, 0x01d762422c946591}, {0xc722f0ef9d80aad6, 0x424d3ad2b7b97ef6}, {0xf8ebad2b84e0d58b, 0xd2e0898765a7deb3}, {0x9b934c3b330c8577, 0x63cc55f49f88eb30}, {0xc2781f49ffcfa6d5, 0x3cbf6b71c76b25fc}, {0xf316271c7fc3908a, 0x8bef464e3945ef7b}, {0x97edd871cfda3a56, 0x97758bf0e3cbb5ad}, {0xbde94e8e43d0c8ec, 0x3d52eeed1cbea318}, {0xed63a231d4c4fb27, 0x4ca7aaa863ee4bde}, {0x945e455f24fb1cf8, 0x8fe8caa93e74ef6b}, {0xb975d6b6ee39e436, 0xb3e2fd538e122b45}, {0xe7d34c64a9c85d44, 0x60dbbca87196b617}, {0x90e40fbeea1d3a4a, 0xbc8955e946fe31ce}, {0xb51d13aea4a488dd, 0x6babab6398bdbe42}, {0xe264589a4dcdab14, 0xc696963c7eed2dd2}, {0x8d7eb76070a08aec, 0xfc1e1de5cf543ca3}, {0xb0de65388cc8ada8, 0x3b25a55f43294bcc}, {0xdd15fe86affad912, 0x49ef0eb713f39ebf}, {0x8a2dbf142dfcc7ab, 0x6e3569326c784338}, {0xacb92ed9397bf996, 0x49c2c37f07965405}, {0xd7e77a8f87daf7fb, 0xdc33745ec97be907}, {0x86f0ac99b4e8dafd, 0x69a028bb3ded71a4}, {0xa8acd7c0222311bc, 0xc40832ea0d68ce0d}, {0xd2d80db02aabd62b, 0xf50a3fa490c30191}, {0x83c7088e1aab65db, 0x792667c6da79e0fb}, {0xa4b8cab1a1563f52, 0x577001b891185939}, {0xcde6fd5e09abcf26, 0xed4c0226b55e6f87}, {0x80b05e5ac60b6178, 0x544f8158315b05b5}, {0xa0dc75f1778e39d6, 0x696361ae3db1c722}, {0xc913936dd571c84c, 0x03bc3a19cd1e38ea}, {0xfb5878494ace3a5f, 0x04ab48a04065c724}, {0x9d174b2dcec0e47b, 0x62eb0d64283f9c77}, {0xc45d1df942711d9a, 0x3ba5d0bd324f8395}, {0xf5746577930d6500, 0xca8f44ec7ee3647a}, {0x9968bf6abbe85f20, 0x7e998b13cf4e1ecc}, {0xbfc2ef456ae276e8, 0x9e3fedd8c321a67f}, {0xefb3ab16c59b14a2, 0xc5cfe94ef3ea101f}, {0x95d04aee3b80ece5, 0xbba1f1d158724a13}, {0xbb445da9ca61281f, 0x2a8a6e45ae8edc98}, {0xea1575143cf97226, 0xf52d09d71a3293be}, {0x924d692ca61be758, 0x593c2626705f9c57}, {0xb6e0c377cfa2e12e, 0x6f8b2fb00c77836d}, {0xe498f455c38b997a, 0x0b6dfb9c0f956448}, {0x8edf98b59a373fec, 0x4724bd4189bd5ead}, {0xb2977ee300c50fe7, 0x58edec91ec2cb658}, {0xdf3d5e9bc0f653e1, 0x2f2967b66737e3ee}, {0x8b865b215899f46c, 0xbd79e0d20082ee75}, {0xae67f1e9aec07187, 0xecd8590680a3aa12}, {0xda01ee641a708de9, 0xe80e6f4820cc9496}, {0x884134fe908658b2, 0x3109058d147fdcde}, {0xaa51823e34a7eede, 0xbd4b46f0599fd416}, {0xd4e5e2cdc1d1ea96, 0x6c9e18ac7007c91b}, {0x850fadc09923329e, 0x03e2cf6bc604ddb1}, {0xa6539930bf6bff45, 0x84db8346b786151d}, {0xcfe87f7cef46ff16, 0xe612641865679a64}, {0x81f14fae158c5f6e, 0x4fcb7e8f3f60c07f}, {0xa26da3999aef7749, 0xe3be5e330f38f09e}, {0xcb090c8001ab551c, 0x5cadf5bfd3072cc6}, {0xfdcb4fa002162a63, 0x73d9732fc7c8f7f7}, {0x9e9f11c4014dda7e, 0x2867e7fddcdd9afb}, {0xc646d63501a1511d, 0xb281e1fd541501b9}, {0xf7d88bc24209a565, 0x1f225a7ca91a4227}, {0x9ae757596946075f, 0x3375788de9b06959}, {0xc1a12d2fc3978937, 0x0052d6b1641c83af}, {0xf209787bb47d6b84, 0xc0678c5dbd23a49b}, {0x9745eb4d50ce6332, 0xf840b7ba963646e1}, {0xbd176620a501fbff, 0xb650e5a93bc3d899}, {0xec5d3fa8ce427aff, 0xa3e51f138ab4cebf}, {0x93ba47c980e98cdf, 0xc66f336c36b10138}, {0xb8a8d9bbe123f017, 0xb80b0047445d4185}, {0xe6d3102ad96cec1d, 0xa60dc059157491e6}, {0x9043ea1ac7e41392, 0x87c89837ad68db30}, {0xb454e4a179dd1877, 0x29babe4598c311fc}, {0xe16a1dc9d8545e94, 0xf4296dd6fef3d67b}, {0x8ce2529e2734bb1d, 0x1899e4a65f58660d}, {0xb01ae745b101e9e4, 0x5ec05dcff72e7f90}, {0xdc21a1171d42645d, 0x76707543f4fa1f74}, {0x899504ae72497eba, 0x6a06494a791c53a9}, {0xabfa45da0edbde69, 0x0487db9d17636893}, {0xd6f8d7509292d603, 0x45a9d2845d3c42b7}, {0x865b86925b9bc5c2, 0x0b8a2392ba45a9b3}, {0xa7f26836f282b732, 0x8e6cac7768d7141f}, {0xd1ef0244af2364ff, 0x3207d795430cd927}, {0x8335616aed761f1f, 0x7f44e6bd49e807b9}, {0xa402b9c5a8d3a6e7, 0x5f16206c9c6209a7}, {0xcd036837130890a1, 0x36dba887c37a8c10}, {0x802221226be55a64, 0xc2494954da2c978a}, {0xa02aa96b06deb0fd, 0xf2db9baa10b7bd6d}, {0xc83553c5c8965d3d, 0x6f92829494e5acc8}, {0xfa42a8b73abbf48c, 0xcb772339ba1f17fa}, {0x9c69a97284b578d7, 0xff2a760414536efc}, {0xc38413cf25e2d70d, 0xfef5138519684abb}, {0xf46518c2ef5b8cd1, 0x7eb258665fc25d6a}, {0x98bf2f79d5993802, 0xef2f773ffbd97a62}, {0xbeeefb584aff8603, 0xaafb550ffacfd8fb}, {0xeeaaba2e5dbf6784, 0x95ba2a53f983cf39}, {0x952ab45cfa97a0b2, 0xdd945a747bf26184}, {0xba756174393d88df, 0x94f971119aeef9e5}, {0xe912b9d1478ceb17, 0x7a37cd5601aab85e}, {0x91abb422ccb812ee, 0xac62e055c10ab33b}, {0xb616a12b7fe617aa, 0x577b986b314d600a}, {0xe39c49765fdf9d94, 0xed5a7e85fda0b80c}, {0x8e41ade9fbebc27d, 0x14588f13be847308}, {0xb1d219647ae6b31c, 0x596eb2d8ae258fc9}, {0xde469fbd99a05fe3, 0x6fca5f8ed9aef3bc}, {0x8aec23d680043bee, 0x25de7bb9480d5855}, {0xada72ccc20054ae9, 0xaf561aa79a10ae6b}, {0xd910f7ff28069da4, 0x1b2ba1518094da05}, {0x87aa9aff79042286, 0x90fb44d2f05d0843}, {0xa99541bf57452b28, 0x353a1607ac744a54}, {0xd3fa922f2d1675f2, 0x42889b8997915ce9}, {0x847c9b5d7c2e09b7, 0x69956135febada12}, {0xa59bc234db398c25, 0x43fab9837e699096}, {0xcf02b2c21207ef2e, 0x94f967e45e03f4bc}, {0x8161afb94b44f57d, 0x1d1be0eebac278f6}, {0xa1ba1ba79e1632dc, 0x6462d92a69731733}, {0xca28a291859bbf93, 0x7d7b8f7503cfdcff}, {0xfcb2cb35e702af78, 0x5cda735244c3d43f}, {0x9defbf01b061adab, 0x3a0888136afa64a8}, {0xc56baec21c7a1916, 0x088aaa1845b8fdd1}, {0xf6c69a72a3989f5b, 0x8aad549e57273d46}, {0x9a3c2087a63f6399, 0x36ac54e2f678864c}, {0xc0cb28a98fcf3c7f, 0x84576a1bb416a7de}, {0xf0fdf2d3f3c30b9f, 0x656d44a2a11c51d6}, {0x969eb7c47859e743, 0x9f644ae5a4b1b326}, {0xbc4665b596706114, 0x873d5d9f0dde1fef}, {0xeb57ff22fc0c7959, 0xa90cb506d155a7eb}, {0x9316ff75dd87cbd8, 0x09a7f12442d588f3}, {0xb7dcbf5354e9bece, 0x0c11ed6d538aeb30}, {0xe5d3ef282a242e81, 0x8f1668c8a86da5fb}, {0x8fa475791a569d10, 0xf96e017d694487bd}, {0xb38d92d760ec4455, 0x37c981dcc395a9ad}, {0xe070f78d3927556a, 0x85bbe253f47b1418}, {0x8c469ab843b89562, 0x93956d7478ccec8f}, {0xaf58416654a6babb, 0x387ac8d1970027b3}, {0xdb2e51bfe9d0696a, 0x06997b05fcc0319f}, {0x88fcf317f22241e2, 0x441fece3bdf81f04}, {0xab3c2fddeeaad25a, 0xd527e81cad7626c4}, {0xd60b3bd56a5586f1, 0x8a71e223d8d3b075}, {0x85c7056562757456, 0xf6872d5667844e4a}, {0xa738c6bebb12d16c, 0xb428f8ac016561dc}, {0xd106f86e69d785c7, 0xe13336d701beba53}, {0x82a45b450226b39c, 0xecc0024661173474}, {0xa34d721642b06084, 0x27f002d7f95d0191}, {0xcc20ce9bd35c78a5, 0x31ec038df7b441f5}, {0xff290242c83396ce, 0x7e67047175a15272}, {0x9f79a169bd203e41, 0x0f0062c6e984d387}, {0xc75809c42c684dd1, 0x52c07b78a3e60869}, {0xf92e0c3537826145, 0xa7709a56ccdf8a83}, {0x9bbcc7a142b17ccb, 0x88a66076400bb692}, {0xc2abf989935ddbfe, 0x6acff893d00ea436}, {0xf356f7ebf83552fe, 0x0583f6b8c4124d44}, {0x98165af37b2153de, 0xc3727a337a8b704b}, {0xbe1bf1b059e9a8d6, 0x744f18c0592e4c5d}, {0xeda2ee1c7064130c, 0x1162def06f79df74}, {0x9485d4d1c63e8be7, 0x8addcb5645ac2ba9}, {0xb9a74a0637ce2ee1, 0x6d953e2bd7173693}, {0xe8111c87c5c1ba99, 0xc8fa8db6ccdd0438}, {0x910ab1d4db9914a0, 0x1d9c9892400a22a3}, {0xb54d5e4a127f59c8, 0x2503beb6d00cab4c}, {0xe2a0b5dc971f303a, 0x2e44ae64840fd61e}, {0x8da471a9de737e24, 0x5ceaecfed289e5d3}, {0xb10d8e1456105dad, 0x7425a83e872c5f48}, {0xdd50f1996b947518, 0xd12f124e28f7771a}, {0x8a5296ffe33cc92f, 0x82bd6b70d99aaa70}, {0xace73cbfdc0bfb7b, 0x636cc64d1001550c}, {0xd8210befd30efa5a, 0x3c47f7e05401aa4f}, {0x8714a775e3e95c78, 0x65acfaec34810a72}, {0xa8d9d1535ce3b396, 0x7f1839a741a14d0e}, {0xd31045a8341ca07c, 0x1ede48111209a051}, {0x83ea2b892091e44d, 0x934aed0aab460433}, {0xa4e4b66b68b65d60, 0xf81da84d56178540}, {0xce1de40642e3f4b9, 0x36251260ab9d668f}, {0x80d2ae83e9ce78f3, 0xc1d72b7c6b42601a}, {0xa1075a24e4421730, 0xb24cf65b8612f820}, {0xc94930ae1d529cfc, 0xdee033f26797b628}, {0xfb9b7cd9a4a7443c, 0x169840ef017da3b2}, {0x9d412e0806e88aa5, 0x8e1f289560ee864f}, {0xc491798a08a2ad4e, 0xf1a6f2bab92a27e3}, {0xf5b5d7ec8acb58a2, 0xae10af696774b1dc}, {0x9991a6f3d6bf1765, 0xacca6da1e0a8ef2a}, {0xbff610b0cc6edd3f, 0x17fd090a58d32af4}, {0xeff394dcff8a948e, 0xddfc4b4cef07f5b1}, {0x95f83d0a1fb69cd9, 0x4abdaf101564f98f}, {0xbb764c4ca7a4440f, 0x9d6d1ad41abe37f2}, {0xea53df5fd18d5513, 0x84c86189216dc5ee}, {0x92746b9be2f8552c, 0x32fd3cf5b4e49bb5}, {0xb7118682dbb66a77, 0x3fbc8c33221dc2a2}, {0xe4d5e82392a40515, 0x0fabaf3feaa5334b}, {0x8f05b1163ba6832d, 0x29cb4d87f2a7400f}, {0xb2c71d5bca9023f8, 0x743e20e9ef511013}, {0xdf78e4b2bd342cf6, 0x914da9246b255417}, {0x8bab8eefb6409c1a, 0x1ad089b6c2f7548f}, {0xae9672aba3d0c320, 0xa184ac2473b529b2}, {0xda3c0f568cc4f3e8, 0xc9e5d72d90a2741f}, {0x8865899617fb1871, 0x7e2fa67c7a658893}, {0xaa7eebfb9df9de8d, 0xddbb901b98feeab8}, {0xd51ea6fa85785631, 0x552a74227f3ea566}, {0x8533285c936b35de, 0xd53a88958f872760}, {0xa67ff273b8460356, 0x8a892abaf368f138}, {0xd01fef10a657842c, 0x2d2b7569b0432d86}, {0x8213f56a67f6b29b, 0x9c3b29620e29fc74}, {0xa298f2c501f45f42, 0x8349f3ba91b47b90}, {0xcb3f2f7642717713, 0x241c70a936219a74}, {0xfe0efb53d30dd4d7, 0xed238cd383aa0111}, {0x9ec95d1463e8a506, 0xf4363804324a40ab}, {0xc67bb4597ce2ce48, 0xb143c6053edcd0d6}, {0xf81aa16fdc1b81da, 0xdd94b7868e94050b}, {0x9b10a4e5e9913128, 0xca7cf2b4191c8327}, {0xc1d4ce1f63f57d72, 0xfd1c2f611f63a3f1}, {0xf24a01a73cf2dccf, 0xbc633b39673c8ced}, {0x976e41088617ca01, 0xd5be0503e085d814}, {0xbd49d14aa79dbc82, 0x4b2d8644d8a74e19}, {0xec9c459d51852ba2, 0xddf8e7d60ed1219f}, {0x93e1ab8252f33b45, 0xcabb90e5c942b504}, {0xb8da1662e7b00a17, 0x3d6a751f3b936244}, {0xe7109bfba19c0c9d, 0x0cc512670a783ad5}, {0x906a617d450187e2, 0x27fb2b80668b24c6}, {0xb484f9dc9641e9da, 0xb1f9f660802dedf7}, {0xe1a63853bbd26451, 0x5e7873f8a0396974}, {0x8d07e33455637eb2, 0xdb0b487b6423e1e9}, {0xb049dc016abc5e5f, 0x91ce1a9a3d2cda63}, {0xdc5c5301c56b75f7, 0x7641a140cc7810fc}, {0x89b9b3e11b6329ba, 0xa9e904c87fcb0a9e}, {0xac2820d9623bf429, 0x546345fa9fbdcd45}, {0xd732290fbacaf133, 0xa97c177947ad4096}, {0x867f59a9d4bed6c0, 0x49ed8eabcccc485e}, {0xa81f301449ee8c70, 0x5c68f256bfff5a75}, {0xd226fc195c6a2f8c, 0x73832eec6fff3112}, {0x83585d8fd9c25db7, 0xc831fd53c5ff7eac}, {0xa42e74f3d032f525, 0xba3e7ca8b77f5e56}, {0xcd3a1230c43fb26f, 0x28ce1bd2e55f35ec}, {0x80444b5e7aa7cf85, 0x7980d163cf5b81b4}, {0xa0555e361951c366, 0xd7e105bcc3326220}, {0xc86ab5c39fa63440, 0x8dd9472bf3fefaa8}, {0xfa856334878fc150, 0xb14f98f6f0feb952}, {0x9c935e00d4b9d8d2, 0x6ed1bf9a569f33d4}, {0xc3b8358109e84f07, 0x0a862f80ec4700c9}, {0xf4a642e14c6262c8, 0xcd27bb612758c0fb}, {0x98e7e9cccfbd7dbd, 0x8038d51cb897789d}, {0xbf21e44003acdd2c, 0xe0470a63e6bd56c4}, {0xeeea5d5004981478, 0x1858ccfce06cac75}, {0x95527a5202df0ccb, 0x0f37801e0c43ebc9}, {0xbaa718e68396cffd, 0xd30560258f54e6bb}, {0xe950df20247c83fd, 0x47c6b82ef32a206a}, {0x91d28b7416cdd27e, 0x4cdc331d57fa5442}, {0xb6472e511c81471d, 0xe0133fe4adf8e953}, {0xe3d8f9e563a198e5, 0x58180fddd97723a7}, {0x8e679c2f5e44ff8f, 0x570f09eaa7ea7649}, {0xb201833b35d63f73, 0x2cd2cc6551e513db}, {0xde81e40a034bcf4f, 0xf8077f7ea65e58d2}, {0x8b112e86420f6191, 0xfb04afaf27faf783}, {0xadd57a27d29339f6, 0x79c5db9af1f9b564}, {0xd94ad8b1c7380874, 0x18375281ae7822bd}, {0x87cec76f1c830548, 0x8f2293910d0b15b6}, {0xa9c2794ae3a3c69a, 0xb2eb3875504ddb23}, {0xd433179d9c8cb841, 0x5fa60692a46151ec}, {0x849feec281d7f328, 0xdbc7c41ba6bcd334}, {0xa5c7ea73224deff3, 0x12b9b522906c0801}, {0xcf39e50feae16bef, 0xd768226b34870a01}, {0x81842f29f2cce375, 0xe6a1158300d46641}, {0xa1e53af46f801c53, 0x60495ae3c1097fd1}, {0xca5e89b18b602368, 0x385bb19cb14bdfc5}, {0xfcf62c1dee382c42, 0x46729e03dd9ed7b6}, {0x9e19db92b4e31ba9, 0x6c07a2c26a8346d2}, {0xc5a05277621be293, 0xc7098b7305241886}, {0xf70867153aa2db38, 0xb8cbee4fc66d1ea8}, {0x9a65406d44a5c903, 0x737f74f1dc043329}, {0xc0fe908895cf3b44, 0x505f522e53053ff3}, {0xf13e34aabb430a15, 0x647726b9e7c68ff0}, {0x96c6e0eab509e64d, 0x5eca783430dc19f6}, {0xbc789925624c5fe0, 0xb67d16413d132073}, {0xeb96bf6ebadf77d8, 0xe41c5bd18c57e890}, {0x933e37a534cbaae7, 0x8e91b962f7b6f15a}, {0xb80dc58e81fe95a1, 0x723627bbb5a4adb1}, {0xe61136f2227e3b09, 0xcec3b1aaa30dd91d}, {0x8fcac257558ee4e6, 0x213a4f0aa5e8a7b2}, {0xb3bd72ed2af29e1f, 0xa988e2cd4f62d19e}, {0xe0accfa875af45a7, 0x93eb1b80a33b8606}, {0x8c6c01c9498d8b88, 0xbc72f130660533c4}, {0xaf87023b9bf0ee6a, 0xeb8fad7c7f8680b5}, {0xdb68c2ca82ed2a05, 0xa67398db9f6820e2}, #else {0xff77b1fcbebcdc4f, 0x25e8e89c13bb0f7b}, {0xce5d73ff402d98e3, 0xfb0a3d212dc81290}, {0xa6b34ad8c9dfc06f, 0xf42faa48c0ea481f}, {0x86a8d39ef77164bc, 0xae5dff9c02033198}, {0xd98ddaee19068c76, 0x3badd624dd9b0958}, {0xafbd2350644eeacf, 0xe5d1929ef90898fb}, {0x8df5efabc5979c8f, 0xca8d3ffa1ef463c2}, {0xe55990879ddcaabd, 0xcc420a6a101d0516}, {0xb94470938fa89bce, 0xf808e40e8d5b3e6a}, {0x95a8637627989aad, 0xdde7001379a44aa9}, {0xf1c90080baf72cb1, 0x5324c68b12dd6339}, {0xc350000000000000, 0x0000000000000000}, {0x9dc5ada82b70b59d, 0xf020000000000000}, {0xfee50b7025c36a08, 0x02f236d04753d5b5}, {0xcde6fd5e09abcf26, 0xed4c0226b55e6f87}, {0xa6539930bf6bff45, 0x84db8346b786151d}, {0x865b86925b9bc5c2, 0x0b8a2392ba45a9b3}, {0xd910f7ff28069da4, 0x1b2ba1518094da05}, {0xaf58416654a6babb, 0x387ac8d1970027b3}, {0x8da471a9de737e24, 0x5ceaecfed289e5d3}, {0xe4d5e82392a40515, 0x0fabaf3feaa5334b}, {0xb8da1662e7b00a17, 0x3d6a751f3b936244}, {0x95527a5202df0ccb, 0x0f37801e0c43ebc9}, {0xf13e34aabb430a15, 0x647726b9e7c68ff0} #endif }; #if FMT_USE_FULL_CACHE_DRAGONBOX return pow10_significands[k - float_info::min_k]; #else static constexpr const uint64_t powers_of_5_64[] = { 0x0000000000000001, 0x0000000000000005, 0x0000000000000019, 0x000000000000007d, 0x0000000000000271, 0x0000000000000c35, 0x0000000000003d09, 0x000000000001312d, 0x000000000005f5e1, 0x00000000001dcd65, 0x00000000009502f9, 0x0000000002e90edd, 0x000000000e8d4a51, 0x0000000048c27395, 0x000000016bcc41e9, 0x000000071afd498d, 0x0000002386f26fc1, 0x000000b1a2bc2ec5, 0x000003782dace9d9, 0x00001158e460913d, 0x000056bc75e2d631, 0x0001b1ae4d6e2ef5, 0x000878678326eac9, 0x002a5a058fc295ed, 0x00d3c21bcecceda1, 0x0422ca8b0a00a425, 0x14adf4b7320334b9}; static const int compression_ratio = 27; // Compute base index. int cache_index = (k - float_info::min_k) / compression_ratio; int kb = cache_index * compression_ratio + float_info::min_k; int offset = k - kb; // Get base cache. uint128_fallback base_cache = pow10_significands[cache_index]; if (offset == 0) return base_cache; // Compute the required amount of bit-shift. int alpha = floor_log2_pow10(kb + offset) - floor_log2_pow10(kb) - offset; FMT_ASSERT(alpha > 0 && alpha < 64, "shifting error detected"); // Try to recover the real cache. uint64_t pow5 = powers_of_5_64[offset]; uint128_fallback recovered_cache = umul128(base_cache.high(), pow5); uint128_fallback middle_low = umul128(base_cache.low(), pow5); recovered_cache += middle_low.high(); uint64_t high_to_middle = recovered_cache.high() << (64 - alpha); uint64_t middle_to_low = recovered_cache.low() << (64 - alpha); recovered_cache = uint128_fallback{(recovered_cache.low() >> alpha) | high_to_middle, ((middle_low.low() >> alpha) | middle_to_low)}; FMT_ASSERT(recovered_cache.low() + 1 != 0, ""); return {recovered_cache.high(), recovered_cache.low() + 1}; #endif } struct compute_mul_result { carrier_uint result; bool is_integer; }; struct compute_mul_parity_result { bool parity; bool is_integer; }; static auto compute_mul(carrier_uint u, const cache_entry_type& cache) noexcept -> compute_mul_result { auto r = umul192_upper128(u, cache); return {r.high(), r.low() == 0}; } static auto compute_delta(cache_entry_type const& cache, int beta) noexcept -> uint32_t { return static_cast(cache.high() >> (64 - 1 - beta)); } static auto compute_mul_parity(carrier_uint two_f, const cache_entry_type& cache, int beta) noexcept -> compute_mul_parity_result { FMT_ASSERT(beta >= 1, ""); FMT_ASSERT(beta < 64, ""); auto r = umul192_lower128(two_f, cache); return {((r.high() >> (64 - beta)) & 1) != 0, ((r.high() << beta) | (r.low() >> (64 - beta))) == 0}; } static auto compute_left_endpoint_for_shorter_interval_case( const cache_entry_type& cache, int beta) noexcept -> carrier_uint { return (cache.high() - (cache.high() >> (num_significand_bits() + 2))) >> (64 - num_significand_bits() - 1 - beta); } static auto compute_right_endpoint_for_shorter_interval_case( const cache_entry_type& cache, int beta) noexcept -> carrier_uint { return (cache.high() + (cache.high() >> (num_significand_bits() + 1))) >> (64 - num_significand_bits() - 1 - beta); } static auto compute_round_up_for_shorter_interval_case( const cache_entry_type& cache, int beta) noexcept -> carrier_uint { return ((cache.high() >> (64 - num_significand_bits() - 2 - beta)) + 1) / 2; } }; FMT_FUNC auto get_cached_power(int k) noexcept -> uint128_fallback { return cache_accessor::get_cached_power(k); } // Various integer checks template auto is_left_endpoint_integer_shorter_interval(int exponent) noexcept -> bool { const int case_shorter_interval_left_endpoint_lower_threshold = 2; const int case_shorter_interval_left_endpoint_upper_threshold = 3; return exponent >= case_shorter_interval_left_endpoint_lower_threshold && exponent <= case_shorter_interval_left_endpoint_upper_threshold; } // Remove trailing zeros from n and return the number of zeros removed (float) FMT_INLINE int remove_trailing_zeros(uint32_t& n, int s = 0) noexcept { FMT_ASSERT(n != 0, ""); // Modular inverse of 5 (mod 2^32): (mod_inv_5 * 5) mod 2^32 = 1. constexpr uint32_t mod_inv_5 = 0xcccccccd; constexpr uint32_t mod_inv_25 = 0xc28f5c29; // = mod_inv_5 * mod_inv_5 while (true) { auto q = rotr(n * mod_inv_25, 2); if (q > max_value() / 100) break; n = q; s += 2; } auto q = rotr(n * mod_inv_5, 1); if (q <= max_value() / 10) { n = q; s |= 1; } return s; } // Removes trailing zeros and returns the number of zeros removed (double) FMT_INLINE int remove_trailing_zeros(uint64_t& n) noexcept { FMT_ASSERT(n != 0, ""); // This magic number is ceil(2^90 / 10^8). constexpr uint64_t magic_number = 12379400392853802749ull; auto nm = umul128(n, magic_number); // Is n is divisible by 10^8? if ((nm.high() & ((1ull << (90 - 64)) - 1)) == 0 && nm.low() < magic_number) { // If yes, work with the quotient... auto n32 = static_cast(nm.high() >> (90 - 64)); // ... and use the 32 bit variant of the function int s = remove_trailing_zeros(n32, 8); n = n32; return s; } // If n is not divisible by 10^8, work with n itself. constexpr uint64_t mod_inv_5 = 0xcccccccccccccccd; constexpr uint64_t mod_inv_25 = 0x8f5c28f5c28f5c29; // mod_inv_5 * mod_inv_5 int s = 0; while (true) { auto q = rotr(n * mod_inv_25, 2); if (q > max_value() / 100) break; n = q; s += 2; } auto q = rotr(n * mod_inv_5, 1); if (q <= max_value() / 10) { n = q; s |= 1; } return s; } // The main algorithm for shorter interval case template FMT_INLINE decimal_fp shorter_interval_case(int exponent) noexcept { decimal_fp ret_value; // Compute k and beta const int minus_k = floor_log10_pow2_minus_log10_4_over_3(exponent); const int beta = exponent + floor_log2_pow10(-minus_k); // Compute xi and zi using cache_entry_type = typename cache_accessor::cache_entry_type; const cache_entry_type cache = cache_accessor::get_cached_power(-minus_k); auto xi = cache_accessor::compute_left_endpoint_for_shorter_interval_case( cache, beta); auto zi = cache_accessor::compute_right_endpoint_for_shorter_interval_case( cache, beta); // If the left endpoint is not an integer, increase it if (!is_left_endpoint_integer_shorter_interval(exponent)) ++xi; // Try bigger divisor ret_value.significand = zi / 10; // If succeed, remove trailing zeros if necessary and return if (ret_value.significand * 10 >= xi) { ret_value.exponent = minus_k + 1; ret_value.exponent += remove_trailing_zeros(ret_value.significand); return ret_value; } // Otherwise, compute the round-up of y ret_value.significand = cache_accessor::compute_round_up_for_shorter_interval_case(cache, beta); ret_value.exponent = minus_k; // When tie occurs, choose one of them according to the rule if (exponent >= float_info::shorter_interval_tie_lower_threshold && exponent <= float_info::shorter_interval_tie_upper_threshold) { ret_value.significand = ret_value.significand % 2 == 0 ? ret_value.significand : ret_value.significand - 1; } else if (ret_value.significand < xi) { ++ret_value.significand; } return ret_value; } template auto to_decimal(T x) noexcept -> decimal_fp { // Step 1: integer promotion & Schubfach multiplier calculation. using carrier_uint = typename float_info::carrier_uint; using cache_entry_type = typename cache_accessor::cache_entry_type; auto br = bit_cast(x); // Extract significand bits and exponent bits. const carrier_uint significand_mask = (static_cast(1) << num_significand_bits()) - 1; carrier_uint significand = (br & significand_mask); int exponent = static_cast((br & exponent_mask()) >> num_significand_bits()); if (exponent != 0) { // Check if normal. exponent -= exponent_bias() + num_significand_bits(); // Shorter interval case; proceed like Schubfach. // In fact, when exponent == 1 and significand == 0, the interval is // regular. However, it can be shown that the end-results are anyway same. if (significand == 0) return shorter_interval_case(exponent); significand |= (static_cast(1) << num_significand_bits()); } else { // Subnormal case; the interval is always regular. if (significand == 0) return {0, 0}; exponent = std::numeric_limits::min_exponent - num_significand_bits() - 1; } const bool include_left_endpoint = (significand % 2 == 0); const bool include_right_endpoint = include_left_endpoint; // Compute k and beta. const int minus_k = floor_log10_pow2(exponent) - float_info::kappa; const cache_entry_type cache = cache_accessor::get_cached_power(-minus_k); const int beta = exponent + floor_log2_pow10(-minus_k); // Compute zi and deltai. // 10^kappa <= deltai < 10^(kappa + 1) const uint32_t deltai = cache_accessor::compute_delta(cache, beta); const carrier_uint two_fc = significand << 1; // For the case of binary32, the result of integer check is not correct for // 29711844 * 2^-82 // = 6.1442653300000000008655037797566933477355632930994033813476... * 10^-18 // and 29711844 * 2^-81 // = 1.2288530660000000001731007559513386695471126586198806762695... * 10^-17, // and they are the unique counterexamples. However, since 29711844 is even, // this does not cause any problem for the endpoints calculations; it can only // cause a problem when we need to perform integer check for the center. // Fortunately, with these inputs, that branch is never executed, so we are // fine. const typename cache_accessor::compute_mul_result z_mul = cache_accessor::compute_mul((two_fc | 1) << beta, cache); // Step 2: Try larger divisor; remove trailing zeros if necessary. // Using an upper bound on zi, we might be able to optimize the division // better than the compiler; we are computing zi / big_divisor here. decimal_fp ret_value; ret_value.significand = divide_by_10_to_kappa_plus_1(z_mul.result); uint32_t r = static_cast(z_mul.result - float_info::big_divisor * ret_value.significand); if (r < deltai) { // Exclude the right endpoint if necessary. if (r == 0 && (z_mul.is_integer & !include_right_endpoint)) { --ret_value.significand; r = float_info::big_divisor; goto small_divisor_case_label; } } else if (r > deltai) { goto small_divisor_case_label; } else { // r == deltai; compare fractional parts. const typename cache_accessor::compute_mul_parity_result x_mul = cache_accessor::compute_mul_parity(two_fc - 1, cache, beta); if (!(x_mul.parity | (x_mul.is_integer & include_left_endpoint))) goto small_divisor_case_label; } ret_value.exponent = minus_k + float_info::kappa + 1; // We may need to remove trailing zeros. ret_value.exponent += remove_trailing_zeros(ret_value.significand); return ret_value; // Step 3: Find the significand with the smaller divisor. small_divisor_case_label: ret_value.significand *= 10; ret_value.exponent = minus_k + float_info::kappa; uint32_t dist = r - (deltai / 2) + (float_info::small_divisor / 2); const bool approx_y_parity = ((dist ^ (float_info::small_divisor / 2)) & 1) != 0; // Is dist divisible by 10^kappa? const bool divisible_by_small_divisor = check_divisibility_and_divide_by_pow10::kappa>(dist); // Add dist / 10^kappa to the significand. ret_value.significand += dist; if (!divisible_by_small_divisor) return ret_value; // Check z^(f) >= epsilon^(f). // We have either yi == zi - epsiloni or yi == (zi - epsiloni) - 1, // where yi == zi - epsiloni if and only if z^(f) >= epsilon^(f). // Since there are only 2 possibilities, we only need to care about the // parity. Also, zi and r should have the same parity since the divisor // is an even number. const auto y_mul = cache_accessor::compute_mul_parity(two_fc, cache, beta); // If z^(f) >= epsilon^(f), we might have a tie when z^(f) == epsilon^(f), // or equivalently, when y is an integer. if (y_mul.parity != approx_y_parity) --ret_value.significand; else if (y_mul.is_integer & (ret_value.significand % 2 != 0)) --ret_value.significand; return ret_value; } } // namespace dragonbox } // namespace detail template <> struct formatter { FMT_CONSTEXPR auto parse(format_parse_context& ctx) -> format_parse_context::iterator { return ctx.begin(); } auto format(const detail::bigint& n, format_context& ctx) const -> format_context::iterator { auto out = ctx.out(); bool first = true; for (auto i = n.bigits_.size(); i > 0; --i) { auto value = n.bigits_[i - 1u]; if (first) { out = fmt::format_to(out, FMT_STRING("{:x}"), value); first = false; continue; } out = fmt::format_to(out, FMT_STRING("{:08x}"), value); } if (n.exp_ > 0) out = fmt::format_to(out, FMT_STRING("p{}"), n.exp_ * detail::bigint::bigit_bits); return out; } }; FMT_FUNC detail::utf8_to_utf16::utf8_to_utf16(string_view s) { for_each_codepoint(s, [this](uint32_t cp, string_view) { if (cp == invalid_code_point) FMT_THROW(std::runtime_error("invalid utf8")); if (cp <= 0xFFFF) { buffer_.push_back(static_cast(cp)); } else { cp -= 0x10000; buffer_.push_back(static_cast(0xD800 + (cp >> 10))); buffer_.push_back(static_cast(0xDC00 + (cp & 0x3FF))); } return true; }); buffer_.push_back(0); } FMT_FUNC void format_system_error(detail::buffer& out, int error_code, const char* message) noexcept { FMT_TRY { auto ec = std::error_code(error_code, std::generic_category()); write(std::back_inserter(out), std::system_error(ec, message).what()); return; } FMT_CATCH(...) {} format_error_code(out, error_code, message); } FMT_FUNC void report_system_error(int error_code, const char* message) noexcept { report_error(format_system_error, error_code, message); } FMT_FUNC auto vformat(string_view fmt, format_args args) -> std::string { // Don't optimize the "{}" case to keep the binary size small and because it // can be better optimized in fmt::format anyway. auto buffer = memory_buffer(); detail::vformat_to(buffer, fmt, args); return to_string(buffer); } namespace detail { #if !defined(_WIN32) || defined(FMT_WINDOWS_NO_WCHAR) FMT_FUNC auto write_console(int, string_view) -> bool { return false; } FMT_FUNC auto write_console(std::FILE*, string_view) -> bool { return false; } #else using dword = conditional_t; extern "C" __declspec(dllimport) int __stdcall WriteConsoleW( // void*, const void*, dword, dword*, void*); FMT_FUNC bool write_console(int fd, string_view text) { auto u16 = utf8_to_utf16(text); return WriteConsoleW(reinterpret_cast(_get_osfhandle(fd)), u16.c_str(), static_cast(u16.size()), nullptr, nullptr) != 0; } FMT_FUNC auto write_console(std::FILE* f, string_view text) -> bool { return write_console(_fileno(f), text); } #endif #ifdef _WIN32 // Print assuming legacy (non-Unicode) encoding. FMT_FUNC void vprint_mojibake(std::FILE* f, string_view fmt, format_args args) { auto buffer = memory_buffer(); detail::vformat_to(buffer, fmt, args); fwrite_fully(buffer.data(), buffer.size(), f); } #endif FMT_FUNC void print(std::FILE* f, string_view text) { #ifdef _WIN32 int fd = _fileno(f); if (_isatty(fd)) { std::fflush(f); if (write_console(fd, text)) return; } #endif fwrite_fully(text.data(), text.size(), f); } } // namespace detail FMT_FUNC void vprint(std::FILE* f, string_view fmt, format_args args) { auto buffer = memory_buffer(); detail::vformat_to(buffer, fmt, args); detail::print(f, {buffer.data(), buffer.size()}); } FMT_FUNC void vprint(string_view fmt, format_args args) { vprint(stdout, fmt, args); } namespace detail { struct singleton { unsigned char upper; unsigned char lower_count; }; inline auto is_printable(uint16_t x, const singleton* singletons, size_t singletons_size, const unsigned char* singleton_lowers, const unsigned char* normal, size_t normal_size) -> bool { auto upper = x >> 8; auto lower_start = 0; for (size_t i = 0; i < singletons_size; ++i) { auto s = singletons[i]; auto lower_end = lower_start + s.lower_count; if (upper < s.upper) break; if (upper == s.upper) { for (auto j = lower_start; j < lower_end; ++j) { if (singleton_lowers[j] == (x & 0xff)) return false; } } lower_start = lower_end; } auto xsigned = static_cast(x); auto current = true; for (size_t i = 0; i < normal_size; ++i) { auto v = static_cast(normal[i]); auto len = (v & 0x80) != 0 ? (v & 0x7f) << 8 | normal[++i] : v; xsigned -= len; if (xsigned < 0) break; current = !current; } return current; } // This code is generated by support/printable.py. FMT_FUNC auto is_printable(uint32_t cp) -> bool { static constexpr singleton singletons0[] = { {0x00, 1}, {0x03, 5}, {0x05, 6}, {0x06, 3}, {0x07, 6}, {0x08, 8}, {0x09, 17}, {0x0a, 28}, {0x0b, 25}, {0x0c, 20}, {0x0d, 16}, {0x0e, 13}, {0x0f, 4}, {0x10, 3}, {0x12, 18}, {0x13, 9}, {0x16, 1}, {0x17, 5}, {0x18, 2}, {0x19, 3}, {0x1a, 7}, {0x1c, 2}, {0x1d, 1}, {0x1f, 22}, {0x20, 3}, {0x2b, 3}, {0x2c, 2}, {0x2d, 11}, {0x2e, 1}, {0x30, 3}, {0x31, 2}, {0x32, 1}, {0xa7, 2}, {0xa9, 2}, {0xaa, 4}, {0xab, 8}, {0xfa, 2}, {0xfb, 5}, {0xfd, 4}, {0xfe, 3}, {0xff, 9}, }; static constexpr unsigned char singletons0_lower[] = { 0xad, 0x78, 0x79, 0x8b, 0x8d, 0xa2, 0x30, 0x57, 0x58, 0x8b, 0x8c, 0x90, 0x1c, 0x1d, 0xdd, 0x0e, 0x0f, 0x4b, 0x4c, 0xfb, 0xfc, 0x2e, 0x2f, 0x3f, 0x5c, 0x5d, 0x5f, 0xb5, 0xe2, 0x84, 0x8d, 0x8e, 0x91, 0x92, 0xa9, 0xb1, 0xba, 0xbb, 0xc5, 0xc6, 0xc9, 0xca, 0xde, 0xe4, 0xe5, 0xff, 0x00, 0x04, 0x11, 0x12, 0x29, 0x31, 0x34, 0x37, 0x3a, 0x3b, 0x3d, 0x49, 0x4a, 0x5d, 0x84, 0x8e, 0x92, 0xa9, 0xb1, 0xb4, 0xba, 0xbb, 0xc6, 0xca, 0xce, 0xcf, 0xe4, 0xe5, 0x00, 0x04, 0x0d, 0x0e, 0x11, 0x12, 0x29, 0x31, 0x34, 0x3a, 0x3b, 0x45, 0x46, 0x49, 0x4a, 0x5e, 0x64, 0x65, 0x84, 0x91, 0x9b, 0x9d, 0xc9, 0xce, 0xcf, 0x0d, 0x11, 0x29, 0x45, 0x49, 0x57, 0x64, 0x65, 0x8d, 0x91, 0xa9, 0xb4, 0xba, 0xbb, 0xc5, 0xc9, 0xdf, 0xe4, 0xe5, 0xf0, 0x0d, 0x11, 0x45, 0x49, 0x64, 0x65, 0x80, 0x84, 0xb2, 0xbc, 0xbe, 0xbf, 0xd5, 0xd7, 0xf0, 0xf1, 0x83, 0x85, 0x8b, 0xa4, 0xa6, 0xbe, 0xbf, 0xc5, 0xc7, 0xce, 0xcf, 0xda, 0xdb, 0x48, 0x98, 0xbd, 0xcd, 0xc6, 0xce, 0xcf, 0x49, 0x4e, 0x4f, 0x57, 0x59, 0x5e, 0x5f, 0x89, 0x8e, 0x8f, 0xb1, 0xb6, 0xb7, 0xbf, 0xc1, 0xc6, 0xc7, 0xd7, 0x11, 0x16, 0x17, 0x5b, 0x5c, 0xf6, 0xf7, 0xfe, 0xff, 0x80, 0x0d, 0x6d, 0x71, 0xde, 0xdf, 0x0e, 0x0f, 0x1f, 0x6e, 0x6f, 0x1c, 0x1d, 0x5f, 0x7d, 0x7e, 0xae, 0xaf, 0xbb, 0xbc, 0xfa, 0x16, 0x17, 0x1e, 0x1f, 0x46, 0x47, 0x4e, 0x4f, 0x58, 0x5a, 0x5c, 0x5e, 0x7e, 0x7f, 0xb5, 0xc5, 0xd4, 0xd5, 0xdc, 0xf0, 0xf1, 0xf5, 0x72, 0x73, 0x8f, 0x74, 0x75, 0x96, 0x2f, 0x5f, 0x26, 0x2e, 0x2f, 0xa7, 0xaf, 0xb7, 0xbf, 0xc7, 0xcf, 0xd7, 0xdf, 0x9a, 0x40, 0x97, 0x98, 0x30, 0x8f, 0x1f, 0xc0, 0xc1, 0xce, 0xff, 0x4e, 0x4f, 0x5a, 0x5b, 0x07, 0x08, 0x0f, 0x10, 0x27, 0x2f, 0xee, 0xef, 0x6e, 0x6f, 0x37, 0x3d, 0x3f, 0x42, 0x45, 0x90, 0x91, 0xfe, 0xff, 0x53, 0x67, 0x75, 0xc8, 0xc9, 0xd0, 0xd1, 0xd8, 0xd9, 0xe7, 0xfe, 0xff, }; static constexpr singleton singletons1[] = { {0x00, 6}, {0x01, 1}, {0x03, 1}, {0x04, 2}, {0x08, 8}, {0x09, 2}, {0x0a, 5}, {0x0b, 2}, {0x0e, 4}, {0x10, 1}, {0x11, 2}, {0x12, 5}, {0x13, 17}, {0x14, 1}, {0x15, 2}, {0x17, 2}, {0x19, 13}, {0x1c, 5}, {0x1d, 8}, {0x24, 1}, {0x6a, 3}, {0x6b, 2}, {0xbc, 2}, {0xd1, 2}, {0xd4, 12}, {0xd5, 9}, {0xd6, 2}, {0xd7, 2}, {0xda, 1}, {0xe0, 5}, {0xe1, 2}, {0xe8, 2}, {0xee, 32}, {0xf0, 4}, {0xf8, 2}, {0xf9, 2}, {0xfa, 2}, {0xfb, 1}, }; static constexpr unsigned char singletons1_lower[] = { 0x0c, 0x27, 0x3b, 0x3e, 0x4e, 0x4f, 0x8f, 0x9e, 0x9e, 0x9f, 0x06, 0x07, 0x09, 0x36, 0x3d, 0x3e, 0x56, 0xf3, 0xd0, 0xd1, 0x04, 0x14, 0x18, 0x36, 0x37, 0x56, 0x57, 0x7f, 0xaa, 0xae, 0xaf, 0xbd, 0x35, 0xe0, 0x12, 0x87, 0x89, 0x8e, 0x9e, 0x04, 0x0d, 0x0e, 0x11, 0x12, 0x29, 0x31, 0x34, 0x3a, 0x45, 0x46, 0x49, 0x4a, 0x4e, 0x4f, 0x64, 0x65, 0x5c, 0xb6, 0xb7, 0x1b, 0x1c, 0x07, 0x08, 0x0a, 0x0b, 0x14, 0x17, 0x36, 0x39, 0x3a, 0xa8, 0xa9, 0xd8, 0xd9, 0x09, 0x37, 0x90, 0x91, 0xa8, 0x07, 0x0a, 0x3b, 0x3e, 0x66, 0x69, 0x8f, 0x92, 0x6f, 0x5f, 0xee, 0xef, 0x5a, 0x62, 0x9a, 0x9b, 0x27, 0x28, 0x55, 0x9d, 0xa0, 0xa1, 0xa3, 0xa4, 0xa7, 0xa8, 0xad, 0xba, 0xbc, 0xc4, 0x06, 0x0b, 0x0c, 0x15, 0x1d, 0x3a, 0x3f, 0x45, 0x51, 0xa6, 0xa7, 0xcc, 0xcd, 0xa0, 0x07, 0x19, 0x1a, 0x22, 0x25, 0x3e, 0x3f, 0xc5, 0xc6, 0x04, 0x20, 0x23, 0x25, 0x26, 0x28, 0x33, 0x38, 0x3a, 0x48, 0x4a, 0x4c, 0x50, 0x53, 0x55, 0x56, 0x58, 0x5a, 0x5c, 0x5e, 0x60, 0x63, 0x65, 0x66, 0x6b, 0x73, 0x78, 0x7d, 0x7f, 0x8a, 0xa4, 0xaa, 0xaf, 0xb0, 0xc0, 0xd0, 0xae, 0xaf, 0x79, 0xcc, 0x6e, 0x6f, 0x93, }; static constexpr unsigned char normal0[] = { 0x00, 0x20, 0x5f, 0x22, 0x82, 0xdf, 0x04, 0x82, 0x44, 0x08, 0x1b, 0x04, 0x06, 0x11, 0x81, 0xac, 0x0e, 0x80, 0xab, 0x35, 0x28, 0x0b, 0x80, 0xe0, 0x03, 0x19, 0x08, 0x01, 0x04, 0x2f, 0x04, 0x34, 0x04, 0x07, 0x03, 0x01, 0x07, 0x06, 0x07, 0x11, 0x0a, 0x50, 0x0f, 0x12, 0x07, 0x55, 0x07, 0x03, 0x04, 0x1c, 0x0a, 0x09, 0x03, 0x08, 0x03, 0x07, 0x03, 0x02, 0x03, 0x03, 0x03, 0x0c, 0x04, 0x05, 0x03, 0x0b, 0x06, 0x01, 0x0e, 0x15, 0x05, 0x3a, 0x03, 0x11, 0x07, 0x06, 0x05, 0x10, 0x07, 0x57, 0x07, 0x02, 0x07, 0x15, 0x0d, 0x50, 0x04, 0x43, 0x03, 0x2d, 0x03, 0x01, 0x04, 0x11, 0x06, 0x0f, 0x0c, 0x3a, 0x04, 0x1d, 0x25, 0x5f, 0x20, 0x6d, 0x04, 0x6a, 0x25, 0x80, 0xc8, 0x05, 0x82, 0xb0, 0x03, 0x1a, 0x06, 0x82, 0xfd, 0x03, 0x59, 0x07, 0x15, 0x0b, 0x17, 0x09, 0x14, 0x0c, 0x14, 0x0c, 0x6a, 0x06, 0x0a, 0x06, 0x1a, 0x06, 0x59, 0x07, 0x2b, 0x05, 0x46, 0x0a, 0x2c, 0x04, 0x0c, 0x04, 0x01, 0x03, 0x31, 0x0b, 0x2c, 0x04, 0x1a, 0x06, 0x0b, 0x03, 0x80, 0xac, 0x06, 0x0a, 0x06, 0x21, 0x3f, 0x4c, 0x04, 0x2d, 0x03, 0x74, 0x08, 0x3c, 0x03, 0x0f, 0x03, 0x3c, 0x07, 0x38, 0x08, 0x2b, 0x05, 0x82, 0xff, 0x11, 0x18, 0x08, 0x2f, 0x11, 0x2d, 0x03, 0x20, 0x10, 0x21, 0x0f, 0x80, 0x8c, 0x04, 0x82, 0x97, 0x19, 0x0b, 0x15, 0x88, 0x94, 0x05, 0x2f, 0x05, 0x3b, 0x07, 0x02, 0x0e, 0x18, 0x09, 0x80, 0xb3, 0x2d, 0x74, 0x0c, 0x80, 0xd6, 0x1a, 0x0c, 0x05, 0x80, 0xff, 0x05, 0x80, 0xdf, 0x0c, 0xee, 0x0d, 0x03, 0x84, 0x8d, 0x03, 0x37, 0x09, 0x81, 0x5c, 0x14, 0x80, 0xb8, 0x08, 0x80, 0xcb, 0x2a, 0x38, 0x03, 0x0a, 0x06, 0x38, 0x08, 0x46, 0x08, 0x0c, 0x06, 0x74, 0x0b, 0x1e, 0x03, 0x5a, 0x04, 0x59, 0x09, 0x80, 0x83, 0x18, 0x1c, 0x0a, 0x16, 0x09, 0x4c, 0x04, 0x80, 0x8a, 0x06, 0xab, 0xa4, 0x0c, 0x17, 0x04, 0x31, 0xa1, 0x04, 0x81, 0xda, 0x26, 0x07, 0x0c, 0x05, 0x05, 0x80, 0xa5, 0x11, 0x81, 0x6d, 0x10, 0x78, 0x28, 0x2a, 0x06, 0x4c, 0x04, 0x80, 0x8d, 0x04, 0x80, 0xbe, 0x03, 0x1b, 0x03, 0x0f, 0x0d, }; static constexpr unsigned char normal1[] = { 0x5e, 0x22, 0x7b, 0x05, 0x03, 0x04, 0x2d, 0x03, 0x66, 0x03, 0x01, 0x2f, 0x2e, 0x80, 0x82, 0x1d, 0x03, 0x31, 0x0f, 0x1c, 0x04, 0x24, 0x09, 0x1e, 0x05, 0x2b, 0x05, 0x44, 0x04, 0x0e, 0x2a, 0x80, 0xaa, 0x06, 0x24, 0x04, 0x24, 0x04, 0x28, 0x08, 0x34, 0x0b, 0x01, 0x80, 0x90, 0x81, 0x37, 0x09, 0x16, 0x0a, 0x08, 0x80, 0x98, 0x39, 0x03, 0x63, 0x08, 0x09, 0x30, 0x16, 0x05, 0x21, 0x03, 0x1b, 0x05, 0x01, 0x40, 0x38, 0x04, 0x4b, 0x05, 0x2f, 0x04, 0x0a, 0x07, 0x09, 0x07, 0x40, 0x20, 0x27, 0x04, 0x0c, 0x09, 0x36, 0x03, 0x3a, 0x05, 0x1a, 0x07, 0x04, 0x0c, 0x07, 0x50, 0x49, 0x37, 0x33, 0x0d, 0x33, 0x07, 0x2e, 0x08, 0x0a, 0x81, 0x26, 0x52, 0x4e, 0x28, 0x08, 0x2a, 0x56, 0x1c, 0x14, 0x17, 0x09, 0x4e, 0x04, 0x1e, 0x0f, 0x43, 0x0e, 0x19, 0x07, 0x0a, 0x06, 0x48, 0x08, 0x27, 0x09, 0x75, 0x0b, 0x3f, 0x41, 0x2a, 0x06, 0x3b, 0x05, 0x0a, 0x06, 0x51, 0x06, 0x01, 0x05, 0x10, 0x03, 0x05, 0x80, 0x8b, 0x62, 0x1e, 0x48, 0x08, 0x0a, 0x80, 0xa6, 0x5e, 0x22, 0x45, 0x0b, 0x0a, 0x06, 0x0d, 0x13, 0x39, 0x07, 0x0a, 0x36, 0x2c, 0x04, 0x10, 0x80, 0xc0, 0x3c, 0x64, 0x53, 0x0c, 0x48, 0x09, 0x0a, 0x46, 0x45, 0x1b, 0x48, 0x08, 0x53, 0x1d, 0x39, 0x81, 0x07, 0x46, 0x0a, 0x1d, 0x03, 0x47, 0x49, 0x37, 0x03, 0x0e, 0x08, 0x0a, 0x06, 0x39, 0x07, 0x0a, 0x81, 0x36, 0x19, 0x80, 0xb7, 0x01, 0x0f, 0x32, 0x0d, 0x83, 0x9b, 0x66, 0x75, 0x0b, 0x80, 0xc4, 0x8a, 0xbc, 0x84, 0x2f, 0x8f, 0xd1, 0x82, 0x47, 0xa1, 0xb9, 0x82, 0x39, 0x07, 0x2a, 0x04, 0x02, 0x60, 0x26, 0x0a, 0x46, 0x0a, 0x28, 0x05, 0x13, 0x82, 0xb0, 0x5b, 0x65, 0x4b, 0x04, 0x39, 0x07, 0x11, 0x40, 0x05, 0x0b, 0x02, 0x0e, 0x97, 0xf8, 0x08, 0x84, 0xd6, 0x2a, 0x09, 0xa2, 0xf7, 0x81, 0x1f, 0x31, 0x03, 0x11, 0x04, 0x08, 0x81, 0x8c, 0x89, 0x04, 0x6b, 0x05, 0x0d, 0x03, 0x09, 0x07, 0x10, 0x93, 0x60, 0x80, 0xf6, 0x0a, 0x73, 0x08, 0x6e, 0x17, 0x46, 0x80, 0x9a, 0x14, 0x0c, 0x57, 0x09, 0x19, 0x80, 0x87, 0x81, 0x47, 0x03, 0x85, 0x42, 0x0f, 0x15, 0x85, 0x50, 0x2b, 0x80, 0xd5, 0x2d, 0x03, 0x1a, 0x04, 0x02, 0x81, 0x70, 0x3a, 0x05, 0x01, 0x85, 0x00, 0x80, 0xd7, 0x29, 0x4c, 0x04, 0x0a, 0x04, 0x02, 0x83, 0x11, 0x44, 0x4c, 0x3d, 0x80, 0xc2, 0x3c, 0x06, 0x01, 0x04, 0x55, 0x05, 0x1b, 0x34, 0x02, 0x81, 0x0e, 0x2c, 0x04, 0x64, 0x0c, 0x56, 0x0a, 0x80, 0xae, 0x38, 0x1d, 0x0d, 0x2c, 0x04, 0x09, 0x07, 0x02, 0x0e, 0x06, 0x80, 0x9a, 0x83, 0xd8, 0x08, 0x0d, 0x03, 0x0d, 0x03, 0x74, 0x0c, 0x59, 0x07, 0x0c, 0x14, 0x0c, 0x04, 0x38, 0x08, 0x0a, 0x06, 0x28, 0x08, 0x22, 0x4e, 0x81, 0x54, 0x0c, 0x15, 0x03, 0x03, 0x05, 0x07, 0x09, 0x19, 0x07, 0x07, 0x09, 0x03, 0x0d, 0x07, 0x29, 0x80, 0xcb, 0x25, 0x0a, 0x84, 0x06, }; auto lower = static_cast(cp); if (cp < 0x10000) { return is_printable(lower, singletons0, sizeof(singletons0) / sizeof(*singletons0), singletons0_lower, normal0, sizeof(normal0)); } if (cp < 0x20000) { return is_printable(lower, singletons1, sizeof(singletons1) / sizeof(*singletons1), singletons1_lower, normal1, sizeof(normal1)); } if (0x2a6de <= cp && cp < 0x2a700) return false; if (0x2b735 <= cp && cp < 0x2b740) return false; if (0x2b81e <= cp && cp < 0x2b820) return false; if (0x2cea2 <= cp && cp < 0x2ceb0) return false; if (0x2ebe1 <= cp && cp < 0x2f800) return false; if (0x2fa1e <= cp && cp < 0x30000) return false; if (0x3134b <= cp && cp < 0xe0100) return false; if (0xe01f0 <= cp && cp < 0x110000) return false; return cp < 0x110000; } } // namespace detail FMT_END_NAMESPACE #endif // FMT_FORMAT_INL_H_ level-zero-1.20.6/third_party/spdlog_headers/spdlog/fmt/bundled/format.h000066400000000000000000005013541475521542100263520ustar00rootroot00000000000000/* Formatting library for C++ Copyright (c) 2012 - present, Victor Zverovich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- Optional exception to the license --- As an exception, if, as a result of your compiling your source code, portions of this Software are embedded into a machine-executable object form of such source code, you may redistribute such embedded portions in such object form without including the above copyright and permission notices. */ #ifndef FMT_FORMAT_H_ #define FMT_FORMAT_H_ #include // std::signbit #include // uint32_t #include // std::memcpy #include // std::initializer_list #include // std::numeric_limits #include // std::uninitialized_copy #include // std::runtime_error #include // std::system_error #ifdef __cpp_lib_bit_cast # include // std::bit_cast #endif #include "core.h" #if defined __cpp_inline_variables && __cpp_inline_variables >= 201606L # define FMT_INLINE_VARIABLE inline #else # define FMT_INLINE_VARIABLE #endif #if FMT_HAS_CPP17_ATTRIBUTE(fallthrough) # define FMT_FALLTHROUGH [[fallthrough]] #elif defined(__clang__) # define FMT_FALLTHROUGH [[clang::fallthrough]] #elif FMT_GCC_VERSION >= 700 && \ (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 520) # define FMT_FALLTHROUGH [[gnu::fallthrough]] #else # define FMT_FALLTHROUGH #endif #ifndef FMT_DEPRECATED # if FMT_HAS_CPP14_ATTRIBUTE(deprecated) || FMT_MSC_VERSION >= 1900 # define FMT_DEPRECATED [[deprecated]] # else # if (defined(__GNUC__) && !defined(__LCC__)) || defined(__clang__) # define FMT_DEPRECATED __attribute__((deprecated)) # elif FMT_MSC_VERSION # define FMT_DEPRECATED __declspec(deprecated) # else # define FMT_DEPRECATED /* deprecated */ # endif # endif #endif #ifndef FMT_NO_UNIQUE_ADDRESS # if FMT_CPLUSPLUS >= 202002L # if FMT_HAS_CPP_ATTRIBUTE(no_unique_address) # define FMT_NO_UNIQUE_ADDRESS [[no_unique_address]] // VS2019 v16.10 and later except clang-cl (https://reviews.llvm.org/D110485) # elif (FMT_MSC_VERSION >= 1929) && !FMT_CLANG_VERSION # define FMT_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] # endif # endif #endif #ifndef FMT_NO_UNIQUE_ADDRESS # define FMT_NO_UNIQUE_ADDRESS #endif // Visibility when compiled as a shared library/object. #if defined(FMT_LIB_EXPORT) || defined(FMT_SHARED) # define FMT_SO_VISIBILITY(value) FMT_VISIBILITY(value) #else # define FMT_SO_VISIBILITY(value) #endif #ifdef __has_builtin # define FMT_HAS_BUILTIN(x) __has_builtin(x) #else # define FMT_HAS_BUILTIN(x) 0 #endif #if FMT_GCC_VERSION || FMT_CLANG_VERSION # define FMT_NOINLINE __attribute__((noinline)) #else # define FMT_NOINLINE #endif #ifndef FMT_THROW # if FMT_EXCEPTIONS # if FMT_MSC_VERSION || defined(__NVCC__) FMT_BEGIN_NAMESPACE namespace detail { template inline void do_throw(const Exception& x) { // Silence unreachable code warnings in MSVC and NVCC because these // are nearly impossible to fix in a generic code. volatile bool b = true; if (b) throw x; } } // namespace detail FMT_END_NAMESPACE # define FMT_THROW(x) detail::do_throw(x) # else # define FMT_THROW(x) throw x # endif # else # define FMT_THROW(x) \ ::fmt::detail::assert_fail(__FILE__, __LINE__, (x).what()) # endif #endif #if FMT_EXCEPTIONS # define FMT_TRY try # define FMT_CATCH(x) catch (x) #else # define FMT_TRY if (true) # define FMT_CATCH(x) if (false) #endif #ifndef FMT_MAYBE_UNUSED # if FMT_HAS_CPP17_ATTRIBUTE(maybe_unused) # define FMT_MAYBE_UNUSED [[maybe_unused]] # else # define FMT_MAYBE_UNUSED # endif #endif #ifndef FMT_USE_USER_DEFINED_LITERALS // EDG based compilers (Intel, NVIDIA, Elbrus, etc), GCC and MSVC support UDLs. // // GCC before 4.9 requires a space in `operator"" _a` which is invalid in later // compiler versions. # if (FMT_HAS_FEATURE(cxx_user_literals) || FMT_GCC_VERSION >= 409 || \ FMT_MSC_VERSION >= 1900) && \ (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= /* UDL feature */ 480) # define FMT_USE_USER_DEFINED_LITERALS 1 # else # define FMT_USE_USER_DEFINED_LITERALS 0 # endif #endif // Defining FMT_REDUCE_INT_INSTANTIATIONS to 1, will reduce the number of // integer formatter template instantiations to just one by only using the // largest integer type. This results in a reduction in binary size but will // cause a decrease in integer formatting performance. #if !defined(FMT_REDUCE_INT_INSTANTIATIONS) # define FMT_REDUCE_INT_INSTANTIATIONS 0 #endif // __builtin_clz is broken in clang with Microsoft CodeGen: // https://github.com/fmtlib/fmt/issues/519. #if !FMT_MSC_VERSION # if FMT_HAS_BUILTIN(__builtin_clz) || FMT_GCC_VERSION || FMT_ICC_VERSION # define FMT_BUILTIN_CLZ(n) __builtin_clz(n) # endif # if FMT_HAS_BUILTIN(__builtin_clzll) || FMT_GCC_VERSION || FMT_ICC_VERSION # define FMT_BUILTIN_CLZLL(n) __builtin_clzll(n) # endif #endif // __builtin_ctz is broken in Intel Compiler Classic on Windows: // https://github.com/fmtlib/fmt/issues/2510. #ifndef __ICL # if FMT_HAS_BUILTIN(__builtin_ctz) || FMT_GCC_VERSION || FMT_ICC_VERSION || \ defined(__NVCOMPILER) # define FMT_BUILTIN_CTZ(n) __builtin_ctz(n) # endif # if FMT_HAS_BUILTIN(__builtin_ctzll) || FMT_GCC_VERSION || \ FMT_ICC_VERSION || defined(__NVCOMPILER) # define FMT_BUILTIN_CTZLL(n) __builtin_ctzll(n) # endif #endif #if FMT_MSC_VERSION # include // _BitScanReverse[64], _BitScanForward[64], _umul128 #endif // Some compilers masquerade as both MSVC and GCC-likes or otherwise support // __builtin_clz and __builtin_clzll, so only define FMT_BUILTIN_CLZ using the // MSVC intrinsics if the clz and clzll builtins are not available. #if FMT_MSC_VERSION && !defined(FMT_BUILTIN_CLZLL) && \ !defined(FMT_BUILTIN_CTZLL) FMT_BEGIN_NAMESPACE namespace detail { // Avoid Clang with Microsoft CodeGen's -Wunknown-pragmas warning. # if !defined(__clang__) # pragma intrinsic(_BitScanForward) # pragma intrinsic(_BitScanReverse) # if defined(_WIN64) # pragma intrinsic(_BitScanForward64) # pragma intrinsic(_BitScanReverse64) # endif # endif inline auto clz(uint32_t x) -> int { unsigned long r = 0; _BitScanReverse(&r, x); FMT_ASSERT(x != 0, ""); // Static analysis complains about using uninitialized data // "r", but the only way that can happen is if "x" is 0, // which the callers guarantee to not happen. FMT_MSC_WARNING(suppress : 6102) return 31 ^ static_cast(r); } # define FMT_BUILTIN_CLZ(n) detail::clz(n) inline auto clzll(uint64_t x) -> int { unsigned long r = 0; # ifdef _WIN64 _BitScanReverse64(&r, x); # else // Scan the high 32 bits. if (_BitScanReverse(&r, static_cast(x >> 32))) return 63 ^ static_cast(r + 32); // Scan the low 32 bits. _BitScanReverse(&r, static_cast(x)); # endif FMT_ASSERT(x != 0, ""); FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning. return 63 ^ static_cast(r); } # define FMT_BUILTIN_CLZLL(n) detail::clzll(n) inline auto ctz(uint32_t x) -> int { unsigned long r = 0; _BitScanForward(&r, x); FMT_ASSERT(x != 0, ""); FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning. return static_cast(r); } # define FMT_BUILTIN_CTZ(n) detail::ctz(n) inline auto ctzll(uint64_t x) -> int { unsigned long r = 0; FMT_ASSERT(x != 0, ""); FMT_MSC_WARNING(suppress : 6102) // Suppress a bogus static analysis warning. # ifdef _WIN64 _BitScanForward64(&r, x); # else // Scan the low 32 bits. if (_BitScanForward(&r, static_cast(x))) return static_cast(r); // Scan the high 32 bits. _BitScanForward(&r, static_cast(x >> 32)); r += 32; # endif return static_cast(r); } # define FMT_BUILTIN_CTZLL(n) detail::ctzll(n) } // namespace detail FMT_END_NAMESPACE #endif FMT_BEGIN_NAMESPACE namespace detail { FMT_CONSTEXPR inline void abort_fuzzing_if(bool condition) { ignore_unused(condition); #ifdef FMT_FUZZ if (condition) throw std::runtime_error("fuzzing limit reached"); #endif } template struct string_literal { static constexpr CharT value[sizeof...(C)] = {C...}; constexpr operator basic_string_view() const { return {value, sizeof...(C)}; } }; #if FMT_CPLUSPLUS < 201703L template constexpr CharT string_literal::value[sizeof...(C)]; #endif // Implementation of std::bit_cast for pre-C++20. template FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To { #ifdef __cpp_lib_bit_cast if (is_constant_evaluated()) return std::bit_cast(from); #endif auto to = To(); // The cast suppresses a bogus -Wclass-memaccess on GCC. std::memcpy(static_cast(&to), &from, sizeof(to)); return to; } inline auto is_big_endian() -> bool { #ifdef _WIN32 return false; #elif defined(__BIG_ENDIAN__) return true; #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) return __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__; #else struct bytes { char data[sizeof(int)]; }; return bit_cast(1).data[0] == 0; #endif } class uint128_fallback { private: uint64_t lo_, hi_; public: constexpr uint128_fallback(uint64_t hi, uint64_t lo) : lo_(lo), hi_(hi) {} constexpr uint128_fallback(uint64_t value = 0) : lo_(value), hi_(0) {} constexpr auto high() const noexcept -> uint64_t { return hi_; } constexpr auto low() const noexcept -> uint64_t { return lo_; } template ::value)> constexpr explicit operator T() const { return static_cast(lo_); } friend constexpr auto operator==(const uint128_fallback& lhs, const uint128_fallback& rhs) -> bool { return lhs.hi_ == rhs.hi_ && lhs.lo_ == rhs.lo_; } friend constexpr auto operator!=(const uint128_fallback& lhs, const uint128_fallback& rhs) -> bool { return !(lhs == rhs); } friend constexpr auto operator>(const uint128_fallback& lhs, const uint128_fallback& rhs) -> bool { return lhs.hi_ != rhs.hi_ ? lhs.hi_ > rhs.hi_ : lhs.lo_ > rhs.lo_; } friend constexpr auto operator|(const uint128_fallback& lhs, const uint128_fallback& rhs) -> uint128_fallback { return {lhs.hi_ | rhs.hi_, lhs.lo_ | rhs.lo_}; } friend constexpr auto operator&(const uint128_fallback& lhs, const uint128_fallback& rhs) -> uint128_fallback { return {lhs.hi_ & rhs.hi_, lhs.lo_ & rhs.lo_}; } friend constexpr auto operator~(const uint128_fallback& n) -> uint128_fallback { return {~n.hi_, ~n.lo_}; } friend auto operator+(const uint128_fallback& lhs, const uint128_fallback& rhs) -> uint128_fallback { auto result = uint128_fallback(lhs); result += rhs; return result; } friend auto operator*(const uint128_fallback& lhs, uint32_t rhs) -> uint128_fallback { FMT_ASSERT(lhs.hi_ == 0, ""); uint64_t hi = (lhs.lo_ >> 32) * rhs; uint64_t lo = (lhs.lo_ & ~uint32_t()) * rhs; uint64_t new_lo = (hi << 32) + lo; return {(hi >> 32) + (new_lo < lo ? 1 : 0), new_lo}; } friend auto operator-(const uint128_fallback& lhs, uint64_t rhs) -> uint128_fallback { return {lhs.hi_ - (lhs.lo_ < rhs ? 1 : 0), lhs.lo_ - rhs}; } FMT_CONSTEXPR auto operator>>(int shift) const -> uint128_fallback { if (shift == 64) return {0, hi_}; if (shift > 64) return uint128_fallback(0, hi_) >> (shift - 64); return {hi_ >> shift, (hi_ << (64 - shift)) | (lo_ >> shift)}; } FMT_CONSTEXPR auto operator<<(int shift) const -> uint128_fallback { if (shift == 64) return {lo_, 0}; if (shift > 64) return uint128_fallback(lo_, 0) << (shift - 64); return {hi_ << shift | (lo_ >> (64 - shift)), (lo_ << shift)}; } FMT_CONSTEXPR auto operator>>=(int shift) -> uint128_fallback& { return *this = *this >> shift; } FMT_CONSTEXPR void operator+=(uint128_fallback n) { uint64_t new_lo = lo_ + n.lo_; uint64_t new_hi = hi_ + n.hi_ + (new_lo < lo_ ? 1 : 0); FMT_ASSERT(new_hi >= hi_, ""); lo_ = new_lo; hi_ = new_hi; } FMT_CONSTEXPR void operator&=(uint128_fallback n) { lo_ &= n.lo_; hi_ &= n.hi_; } FMT_CONSTEXPR20 auto operator+=(uint64_t n) noexcept -> uint128_fallback& { if (is_constant_evaluated()) { lo_ += n; hi_ += (lo_ < n ? 1 : 0); return *this; } #if FMT_HAS_BUILTIN(__builtin_addcll) && !defined(__ibmxl__) unsigned long long carry; lo_ = __builtin_addcll(lo_, n, 0, &carry); hi_ += carry; #elif FMT_HAS_BUILTIN(__builtin_ia32_addcarryx_u64) && !defined(__ibmxl__) unsigned long long result; auto carry = __builtin_ia32_addcarryx_u64(0, lo_, n, &result); lo_ = result; hi_ += carry; #elif defined(_MSC_VER) && defined(_M_X64) auto carry = _addcarry_u64(0, lo_, n, &lo_); _addcarry_u64(carry, hi_, 0, &hi_); #else lo_ += n; hi_ += (lo_ < n ? 1 : 0); #endif return *this; } }; using uint128_t = conditional_t; #ifdef UINTPTR_MAX using uintptr_t = ::uintptr_t; #else using uintptr_t = uint128_t; #endif // Returns the largest possible value for type T. Same as // std::numeric_limits::max() but shorter and not affected by the max macro. template constexpr auto max_value() -> T { return (std::numeric_limits::max)(); } template constexpr auto num_bits() -> int { return std::numeric_limits::digits; } // std::numeric_limits::digits may return 0 for 128-bit ints. template <> constexpr auto num_bits() -> int { return 128; } template <> constexpr auto num_bits() -> int { return 128; } // A heterogeneous bit_cast used for converting 96-bit long double to uint128_t // and 128-bit pointers to uint128_fallback. template sizeof(From))> inline auto bit_cast(const From& from) -> To { constexpr auto size = static_cast(sizeof(From) / sizeof(unsigned)); struct data_t { unsigned value[static_cast(size)]; } data = bit_cast(from); auto result = To(); if (const_check(is_big_endian())) { for (int i = 0; i < size; ++i) result = (result << num_bits()) | data.value[i]; } else { for (int i = size - 1; i >= 0; --i) result = (result << num_bits()) | data.value[i]; } return result; } template FMT_CONSTEXPR20 inline auto countl_zero_fallback(UInt n) -> int { int lz = 0; constexpr UInt msb_mask = static_cast(1) << (num_bits() - 1); for (; (n & msb_mask) == 0; n <<= 1) lz++; return lz; } FMT_CONSTEXPR20 inline auto countl_zero(uint32_t n) -> int { #ifdef FMT_BUILTIN_CLZ if (!is_constant_evaluated()) return FMT_BUILTIN_CLZ(n); #endif return countl_zero_fallback(n); } FMT_CONSTEXPR20 inline auto countl_zero(uint64_t n) -> int { #ifdef FMT_BUILTIN_CLZLL if (!is_constant_evaluated()) return FMT_BUILTIN_CLZLL(n); #endif return countl_zero_fallback(n); } FMT_INLINE void assume(bool condition) { (void)condition; #if FMT_HAS_BUILTIN(__builtin_assume) && !FMT_ICC_VERSION __builtin_assume(condition); #elif FMT_GCC_VERSION if (!condition) __builtin_unreachable(); #endif } // An approximation of iterator_t for pre-C++20 systems. template using iterator_t = decltype(std::begin(std::declval())); template using sentinel_t = decltype(std::end(std::declval())); // A workaround for std::string not having mutable data() until C++17. template inline auto get_data(std::basic_string& s) -> Char* { return &s[0]; } template inline auto get_data(Container& c) -> typename Container::value_type* { return c.data(); } // Attempts to reserve space for n extra characters in the output range. // Returns a pointer to the reserved range or a reference to it. template ::value)> #if FMT_CLANG_VERSION >= 307 && !FMT_ICC_VERSION __attribute__((no_sanitize("undefined"))) #endif inline auto reserve(std::back_insert_iterator it, size_t n) -> typename Container::value_type* { Container& c = get_container(it); size_t size = c.size(); c.resize(size + n); return get_data(c) + size; } template inline auto reserve(buffer_appender it, size_t n) -> buffer_appender { buffer& buf = get_container(it); buf.try_reserve(buf.size() + n); return it; } template constexpr auto reserve(Iterator& it, size_t) -> Iterator& { return it; } template using reserve_iterator = remove_reference_t(), 0))>; template constexpr auto to_pointer(OutputIt, size_t) -> T* { return nullptr; } template auto to_pointer(buffer_appender it, size_t n) -> T* { buffer& buf = get_container(it); auto size = buf.size(); if (buf.capacity() < size + n) return nullptr; buf.try_resize(size + n); return buf.data() + size; } template ::value)> inline auto base_iterator(std::back_insert_iterator it, typename Container::value_type*) -> std::back_insert_iterator { return it; } template constexpr auto base_iterator(Iterator, Iterator it) -> Iterator { return it; } // is spectacularly slow to compile in C++20 so use a simple fill_n // instead (#1998). template FMT_CONSTEXPR auto fill_n(OutputIt out, Size count, const T& value) -> OutputIt { for (Size i = 0; i < count; ++i) *out++ = value; return out; } template FMT_CONSTEXPR20 auto fill_n(T* out, Size count, char value) -> T* { if (is_constant_evaluated()) { return fill_n(out, count, value); } std::memset(out, value, to_unsigned(count)); return out + count; } #ifdef __cpp_char8_t using char8_type = char8_t; #else enum char8_type : unsigned char {}; #endif template FMT_CONSTEXPR FMT_NOINLINE auto copy_str_noinline(InputIt begin, InputIt end, OutputIt out) -> OutputIt { return copy_str(begin, end, out); } // A public domain branchless UTF-8 decoder by Christopher Wellons: // https://github.com/skeeto/branchless-utf8 /* Decode the next character, c, from s, reporting errors in e. * * Since this is a branchless decoder, four bytes will be read from the * buffer regardless of the actual length of the next character. This * means the buffer _must_ have at least three bytes of zero padding * following the end of the data stream. * * Errors are reported in e, which will be non-zero if the parsed * character was somehow invalid: invalid byte sequence, non-canonical * encoding, or a surrogate half. * * The function returns a pointer to the next character. When an error * occurs, this pointer will be a guess that depends on the particular * error, but it will always advance at least one byte. */ FMT_CONSTEXPR inline auto utf8_decode(const char* s, uint32_t* c, int* e) -> const char* { constexpr const int masks[] = {0x00, 0x7f, 0x1f, 0x0f, 0x07}; constexpr const uint32_t mins[] = {4194304, 0, 128, 2048, 65536}; constexpr const int shiftc[] = {0, 18, 12, 6, 0}; constexpr const int shifte[] = {0, 6, 4, 2, 0}; int len = "\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\0\0\0\0\0\0\0\0\2\2\2\2\3\3\4" [static_cast(*s) >> 3]; // Compute the pointer to the next character early so that the next // iteration can start working on the next character. Neither Clang // nor GCC figure out this reordering on their own. const char* next = s + len + !len; using uchar = unsigned char; // Assume a four-byte character and load four bytes. Unused bits are // shifted out. *c = uint32_t(uchar(s[0]) & masks[len]) << 18; *c |= uint32_t(uchar(s[1]) & 0x3f) << 12; *c |= uint32_t(uchar(s[2]) & 0x3f) << 6; *c |= uint32_t(uchar(s[3]) & 0x3f) << 0; *c >>= shiftc[len]; // Accumulate the various error conditions. *e = (*c < mins[len]) << 6; // non-canonical encoding *e |= ((*c >> 11) == 0x1b) << 7; // surrogate half? *e |= (*c > 0x10FFFF) << 8; // out of range? *e |= (uchar(s[1]) & 0xc0) >> 2; *e |= (uchar(s[2]) & 0xc0) >> 4; *e |= uchar(s[3]) >> 6; *e ^= 0x2a; // top two bits of each tail byte correct? *e >>= shifte[len]; return next; } constexpr FMT_INLINE_VARIABLE uint32_t invalid_code_point = ~uint32_t(); // Invokes f(cp, sv) for every code point cp in s with sv being the string view // corresponding to the code point. cp is invalid_code_point on error. template FMT_CONSTEXPR void for_each_codepoint(string_view s, F f) { auto decode = [f](const char* buf_ptr, const char* ptr) { auto cp = uint32_t(); auto error = 0; auto end = utf8_decode(buf_ptr, &cp, &error); bool result = f(error ? invalid_code_point : cp, string_view(ptr, error ? 1 : to_unsigned(end - buf_ptr))); return result ? (error ? buf_ptr + 1 : end) : nullptr; }; auto p = s.data(); const size_t block_size = 4; // utf8_decode always reads blocks of 4 chars. if (s.size() >= block_size) { for (auto end = p + s.size() - block_size + 1; p < end;) { p = decode(p, p); if (!p) return; } } if (auto num_chars_left = s.data() + s.size() - p) { char buf[2 * block_size - 1] = {}; copy_str(p, p + num_chars_left, buf); const char* buf_ptr = buf; do { auto end = decode(buf_ptr, p); if (!end) return; p += end - buf_ptr; buf_ptr = end; } while (buf_ptr - buf < num_chars_left); } } template inline auto compute_width(basic_string_view s) -> size_t { return s.size(); } // Computes approximate display width of a UTF-8 string. FMT_CONSTEXPR inline auto compute_width(string_view s) -> size_t { size_t num_code_points = 0; // It is not a lambda for compatibility with C++14. struct count_code_points { size_t* count; FMT_CONSTEXPR auto operator()(uint32_t cp, string_view) const -> bool { *count += detail::to_unsigned( 1 + (cp >= 0x1100 && (cp <= 0x115f || // Hangul Jamo init. consonants cp == 0x2329 || // LEFT-POINTING ANGLE BRACKET cp == 0x232a || // RIGHT-POINTING ANGLE BRACKET // CJK ... Yi except IDEOGRAPHIC HALF FILL SPACE: (cp >= 0x2e80 && cp <= 0xa4cf && cp != 0x303f) || (cp >= 0xac00 && cp <= 0xd7a3) || // Hangul Syllables (cp >= 0xf900 && cp <= 0xfaff) || // CJK Compatibility Ideographs (cp >= 0xfe10 && cp <= 0xfe19) || // Vertical Forms (cp >= 0xfe30 && cp <= 0xfe6f) || // CJK Compatibility Forms (cp >= 0xff00 && cp <= 0xff60) || // Fullwidth Forms (cp >= 0xffe0 && cp <= 0xffe6) || // Fullwidth Forms (cp >= 0x20000 && cp <= 0x2fffd) || // CJK (cp >= 0x30000 && cp <= 0x3fffd) || // Miscellaneous Symbols and Pictographs + Emoticons: (cp >= 0x1f300 && cp <= 0x1f64f) || // Supplemental Symbols and Pictographs: (cp >= 0x1f900 && cp <= 0x1f9ff)))); return true; } }; // We could avoid branches by using utf8_decode directly. for_each_codepoint(s, count_code_points{&num_code_points}); return num_code_points; } inline auto compute_width(basic_string_view s) -> size_t { return compute_width( string_view(reinterpret_cast(s.data()), s.size())); } template inline auto code_point_index(basic_string_view s, size_t n) -> size_t { size_t size = s.size(); return n < size ? n : size; } // Calculates the index of the nth code point in a UTF-8 string. inline auto code_point_index(string_view s, size_t n) -> size_t { size_t result = s.size(); const char* begin = s.begin(); for_each_codepoint(s, [begin, &n, &result](uint32_t, string_view sv) { if (n != 0) { --n; return true; } result = to_unsigned(sv.begin() - begin); return false; }); return result; } inline auto code_point_index(basic_string_view s, size_t n) -> size_t { return code_point_index( string_view(reinterpret_cast(s.data()), s.size()), n); } template struct is_integral : std::is_integral {}; template <> struct is_integral : std::true_type {}; template <> struct is_integral : std::true_type {}; template using is_signed = std::integral_constant::is_signed || std::is_same::value>; template using is_integer = bool_constant::value && !std::is_same::value && !std::is_same::value && !std::is_same::value>; #ifndef FMT_USE_FLOAT # define FMT_USE_FLOAT 1 #endif #ifndef FMT_USE_DOUBLE # define FMT_USE_DOUBLE 1 #endif #ifndef FMT_USE_LONG_DOUBLE # define FMT_USE_LONG_DOUBLE 1 #endif #ifndef FMT_USE_FLOAT128 # ifdef __clang__ // Clang emulates GCC, so it has to appear early. # if FMT_HAS_INCLUDE() # define FMT_USE_FLOAT128 1 # endif # elif defined(__GNUC__) // GNU C++: # if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) # define FMT_USE_FLOAT128 1 # endif # endif # ifndef FMT_USE_FLOAT128 # define FMT_USE_FLOAT128 0 # endif #endif #if FMT_USE_FLOAT128 using float128 = __float128; #else using float128 = void; #endif template using is_float128 = std::is_same; template using is_floating_point = bool_constant::value || is_float128::value>; template ::value> struct is_fast_float : bool_constant::is_iec559 && sizeof(T) <= sizeof(double)> {}; template struct is_fast_float : std::false_type {}; template using is_double_double = bool_constant::digits == 106>; #ifndef FMT_USE_FULL_CACHE_DRAGONBOX # define FMT_USE_FULL_CACHE_DRAGONBOX 0 #endif template template void buffer::append(const U* begin, const U* end) { while (begin != end) { auto count = to_unsigned(end - begin); try_reserve(size_ + count); auto free_cap = capacity_ - size_; if (free_cap < count) count = free_cap; std::uninitialized_copy_n(begin, count, ptr_ + size_); size_ += count; begin += count; } } template struct is_locale : std::false_type {}; template struct is_locale> : std::true_type {}; } // namespace detail FMT_BEGIN_EXPORT // The number of characters to store in the basic_memory_buffer object itself // to avoid dynamic memory allocation. enum { inline_buffer_size = 500 }; /** \rst A dynamically growing memory buffer for trivially copyable/constructible types with the first ``SIZE`` elements stored in the object itself. You can use the ``memory_buffer`` type alias for ``char`` instead. **Example**:: auto out = fmt::memory_buffer(); fmt::format_to(std::back_inserter(out), "The answer is {}.", 42); This will append the following output to the ``out`` object: .. code-block:: none The answer is 42. The output can be converted to an ``std::string`` with ``to_string(out)``. \endrst */ template > class basic_memory_buffer final : public detail::buffer { private: T store_[SIZE]; // Don't inherit from Allocator to avoid generating type_info for it. FMT_NO_UNIQUE_ADDRESS Allocator alloc_; // Deallocate memory allocated by the buffer. FMT_CONSTEXPR20 void deallocate() { T* data = this->data(); if (data != store_) alloc_.deallocate(data, this->capacity()); } protected: FMT_CONSTEXPR20 void grow(size_t size) override { detail::abort_fuzzing_if(size > 5000); const size_t max_size = std::allocator_traits::max_size(alloc_); size_t old_capacity = this->capacity(); size_t new_capacity = old_capacity + old_capacity / 2; if (size > new_capacity) new_capacity = size; else if (new_capacity > max_size) new_capacity = size > max_size ? size : max_size; T* old_data = this->data(); T* new_data = std::allocator_traits::allocate(alloc_, new_capacity); // Suppress a bogus -Wstringop-overflow in gcc 13.1 (#3481). detail::assume(this->size() <= new_capacity); // The following code doesn't throw, so the raw pointer above doesn't leak. std::uninitialized_copy_n(old_data, this->size(), new_data); this->set(new_data, new_capacity); // deallocate must not throw according to the standard, but even if it does, // the buffer already uses the new storage and will deallocate it in // destructor. if (old_data != store_) alloc_.deallocate(old_data, old_capacity); } public: using value_type = T; using const_reference = const T&; FMT_CONSTEXPR20 explicit basic_memory_buffer( const Allocator& alloc = Allocator()) : alloc_(alloc) { this->set(store_, SIZE); if (detail::is_constant_evaluated()) detail::fill_n(store_, SIZE, T()); } FMT_CONSTEXPR20 ~basic_memory_buffer() { deallocate(); } private: // Move data from other to this buffer. FMT_CONSTEXPR20 void move(basic_memory_buffer& other) { alloc_ = std::move(other.alloc_); T* data = other.data(); size_t size = other.size(), capacity = other.capacity(); if (data == other.store_) { this->set(store_, capacity); detail::copy_str(other.store_, other.store_ + size, store_); } else { this->set(data, capacity); // Set pointer to the inline array so that delete is not called // when deallocating. other.set(other.store_, 0); other.clear(); } this->resize(size); } public: /** \rst Constructs a :class:`fmt::basic_memory_buffer` object moving the content of the other object to it. \endrst */ FMT_CONSTEXPR20 basic_memory_buffer(basic_memory_buffer&& other) noexcept { move(other); } /** \rst Moves the content of the other ``basic_memory_buffer`` object to this one. \endrst */ auto operator=(basic_memory_buffer&& other) noexcept -> basic_memory_buffer& { FMT_ASSERT(this != &other, ""); deallocate(); move(other); return *this; } // Returns a copy of the allocator associated with this buffer. auto get_allocator() const -> Allocator { return alloc_; } /** Resizes the buffer to contain *count* elements. If T is a POD type new elements may not be initialized. */ FMT_CONSTEXPR20 void resize(size_t count) { this->try_resize(count); } /** Increases the buffer capacity to *new_capacity*. */ void reserve(size_t new_capacity) { this->try_reserve(new_capacity); } using detail::buffer::append; template void append(const ContiguousRange& range) { append(range.data(), range.data() + range.size()); } }; using memory_buffer = basic_memory_buffer; template struct is_contiguous> : std::true_type { }; FMT_END_EXPORT namespace detail { FMT_API auto write_console(int fd, string_view text) -> bool; FMT_API auto write_console(std::FILE* f, string_view text) -> bool; FMT_API void print(std::FILE*, string_view); } // namespace detail FMT_BEGIN_EXPORT // Suppress a misleading warning in older versions of clang. #if FMT_CLANG_VERSION # pragma clang diagnostic ignored "-Wweak-vtables" #endif /** An error reported from a formatting function. */ class FMT_SO_VISIBILITY("default") format_error : public std::runtime_error { public: using std::runtime_error::runtime_error; }; namespace detail_exported { #if FMT_USE_NONTYPE_TEMPLATE_ARGS template struct fixed_string { constexpr fixed_string(const Char (&str)[N]) { detail::copy_str(static_cast(str), str + N, data); } Char data[N] = {}; }; #endif // Converts a compile-time string to basic_string_view. template constexpr auto compile_string_to_view(const Char (&s)[N]) -> basic_string_view { // Remove trailing NUL character if needed. Won't be present if this is used // with a raw character array (i.e. not defined as a string). return {s, N - (std::char_traits::to_int_type(s[N - 1]) == 0 ? 1 : 0)}; } template constexpr auto compile_string_to_view(detail::std_string_view s) -> basic_string_view { return {s.data(), s.size()}; } } // namespace detail_exported class loc_value { private: basic_format_arg value_; public: template ::value)> loc_value(T value) : value_(detail::make_arg(value)) {} template ::value)> loc_value(T) {} template auto visit(Visitor&& vis) -> decltype(vis(0)) { return visit_format_arg(vis, value_); } }; // A locale facet that formats values in UTF-8. // It is parameterized on the locale to avoid the heavy include. template class format_facet : public Locale::facet { private: std::string separator_; std::string grouping_; std::string decimal_point_; protected: virtual auto do_put(appender out, loc_value val, const format_specs<>& specs) const -> bool; public: static FMT_API typename Locale::id id; explicit format_facet(Locale& loc); explicit format_facet(string_view sep = "", std::initializer_list g = {3}, std::string decimal_point = ".") : separator_(sep.data(), sep.size()), grouping_(g.begin(), g.end()), decimal_point_(decimal_point) {} auto put(appender out, loc_value val, const format_specs<>& specs) const -> bool { return do_put(out, val, specs); } }; namespace detail { // Returns true if value is negative, false otherwise. // Same as `value < 0` but doesn't produce warnings if T is an unsigned type. template ::value)> constexpr auto is_negative(T value) -> bool { return value < 0; } template ::value)> constexpr auto is_negative(T) -> bool { return false; } template FMT_CONSTEXPR auto is_supported_floating_point(T) -> bool { if (std::is_same()) return FMT_USE_FLOAT; if (std::is_same()) return FMT_USE_DOUBLE; if (std::is_same()) return FMT_USE_LONG_DOUBLE; return true; } // Smallest of uint32_t, uint64_t, uint128_t that is large enough to // represent all values of an integral type T. template using uint32_or_64_or_128_t = conditional_t() <= 32 && !FMT_REDUCE_INT_INSTANTIATIONS, uint32_t, conditional_t() <= 64, uint64_t, uint128_t>>; template using uint64_or_128_t = conditional_t() <= 64, uint64_t, uint128_t>; #define FMT_POWERS_OF_10(factor) \ factor * 10, (factor) * 100, (factor) * 1000, (factor) * 10000, \ (factor) * 100000, (factor) * 1000000, (factor) * 10000000, \ (factor) * 100000000, (factor) * 1000000000 // Converts value in the range [0, 100) to a string. constexpr auto digits2(size_t value) -> const char* { // GCC generates slightly better code when value is pointer-size. return &"0001020304050607080910111213141516171819" "2021222324252627282930313233343536373839" "4041424344454647484950515253545556575859" "6061626364656667686970717273747576777879" "8081828384858687888990919293949596979899"[value * 2]; } // Sign is a template parameter to workaround a bug in gcc 4.8. template constexpr auto sign(Sign s) -> Char { #if !FMT_GCC_VERSION || FMT_GCC_VERSION >= 604 static_assert(std::is_same::value, ""); #endif return static_cast("\0-+ "[s]); } template FMT_CONSTEXPR auto count_digits_fallback(T n) -> int { int count = 1; for (;;) { // Integer division is slow so do it for a group of four digits instead // of for every digit. The idea comes from the talk by Alexandrescu // "Three Optimization Tips for C++". See speed-test for a comparison. if (n < 10) return count; if (n < 100) return count + 1; if (n < 1000) return count + 2; if (n < 10000) return count + 3; n /= 10000u; count += 4; } } #if FMT_USE_INT128 FMT_CONSTEXPR inline auto count_digits(uint128_opt n) -> int { return count_digits_fallback(n); } #endif #ifdef FMT_BUILTIN_CLZLL // It is a separate function rather than a part of count_digits to workaround // the lack of static constexpr in constexpr functions. inline auto do_count_digits(uint64_t n) -> int { // This has comparable performance to the version by Kendall Willets // (https://github.com/fmtlib/format-benchmark/blob/master/digits10) // but uses smaller tables. // Maps bsr(n) to ceil(log10(pow(2, bsr(n) + 1) - 1)). static constexpr uint8_t bsr2log10[] = { 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 19, 20}; auto t = bsr2log10[FMT_BUILTIN_CLZLL(n | 1) ^ 63]; static constexpr const uint64_t zero_or_powers_of_10[] = { 0, 0, FMT_POWERS_OF_10(1U), FMT_POWERS_OF_10(1000000000ULL), 10000000000000000000ULL}; return t - (n < zero_or_powers_of_10[t]); } #endif // Returns the number of decimal digits in n. Leading zeros are not counted // except for n == 0 in which case count_digits returns 1. FMT_CONSTEXPR20 inline auto count_digits(uint64_t n) -> int { #ifdef FMT_BUILTIN_CLZLL if (!is_constant_evaluated()) { return do_count_digits(n); } #endif return count_digits_fallback(n); } // Counts the number of digits in n. BITS = log2(radix). template FMT_CONSTEXPR auto count_digits(UInt n) -> int { #ifdef FMT_BUILTIN_CLZ if (!is_constant_evaluated() && num_bits() == 32) return (FMT_BUILTIN_CLZ(static_cast(n) | 1) ^ 31) / BITS + 1; #endif // Lambda avoids unreachable code warnings from NVHPC. return [](UInt m) { int num_digits = 0; do { ++num_digits; } while ((m >>= BITS) != 0); return num_digits; }(n); } #ifdef FMT_BUILTIN_CLZ // It is a separate function rather than a part of count_digits to workaround // the lack of static constexpr in constexpr functions. FMT_INLINE auto do_count_digits(uint32_t n) -> int { // An optimization by Kendall Willets from https://bit.ly/3uOIQrB. // This increments the upper 32 bits (log10(T) - 1) when >= T is added. # define FMT_INC(T) (((sizeof(#T) - 1ull) << 32) - T) static constexpr uint64_t table[] = { FMT_INC(0), FMT_INC(0), FMT_INC(0), // 8 FMT_INC(10), FMT_INC(10), FMT_INC(10), // 64 FMT_INC(100), FMT_INC(100), FMT_INC(100), // 512 FMT_INC(1000), FMT_INC(1000), FMT_INC(1000), // 4096 FMT_INC(10000), FMT_INC(10000), FMT_INC(10000), // 32k FMT_INC(100000), FMT_INC(100000), FMT_INC(100000), // 256k FMT_INC(1000000), FMT_INC(1000000), FMT_INC(1000000), // 2048k FMT_INC(10000000), FMT_INC(10000000), FMT_INC(10000000), // 16M FMT_INC(100000000), FMT_INC(100000000), FMT_INC(100000000), // 128M FMT_INC(1000000000), FMT_INC(1000000000), FMT_INC(1000000000), // 1024M FMT_INC(1000000000), FMT_INC(1000000000) // 4B }; auto inc = table[FMT_BUILTIN_CLZ(n | 1) ^ 31]; return static_cast((n + inc) >> 32); } #endif // Optional version of count_digits for better performance on 32-bit platforms. FMT_CONSTEXPR20 inline auto count_digits(uint32_t n) -> int { #ifdef FMT_BUILTIN_CLZ if (!is_constant_evaluated()) { return do_count_digits(n); } #endif return count_digits_fallback(n); } template constexpr auto digits10() noexcept -> int { return std::numeric_limits::digits10; } template <> constexpr auto digits10() noexcept -> int { return 38; } template <> constexpr auto digits10() noexcept -> int { return 38; } template struct thousands_sep_result { std::string grouping; Char thousands_sep; }; template FMT_API auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result; template inline auto thousands_sep(locale_ref loc) -> thousands_sep_result { auto result = thousands_sep_impl(loc); return {result.grouping, Char(result.thousands_sep)}; } template <> inline auto thousands_sep(locale_ref loc) -> thousands_sep_result { return thousands_sep_impl(loc); } template FMT_API auto decimal_point_impl(locale_ref loc) -> Char; template inline auto decimal_point(locale_ref loc) -> Char { return Char(decimal_point_impl(loc)); } template <> inline auto decimal_point(locale_ref loc) -> wchar_t { return decimal_point_impl(loc); } // Compares two characters for equality. template auto equal2(const Char* lhs, const char* rhs) -> bool { return lhs[0] == Char(rhs[0]) && lhs[1] == Char(rhs[1]); } inline auto equal2(const char* lhs, const char* rhs) -> bool { return memcmp(lhs, rhs, 2) == 0; } // Copies two characters from src to dst. template FMT_CONSTEXPR20 FMT_INLINE void copy2(Char* dst, const char* src) { if (!is_constant_evaluated() && sizeof(Char) == sizeof(char)) { memcpy(dst, src, 2); return; } *dst++ = static_cast(*src++); *dst = static_cast(*src); } template struct format_decimal_result { Iterator begin; Iterator end; }; // Formats a decimal unsigned integer value writing into out pointing to a // buffer of specified size. The caller must ensure that the buffer is large // enough. template FMT_CONSTEXPR20 auto format_decimal(Char* out, UInt value, int size) -> format_decimal_result { FMT_ASSERT(size >= count_digits(value), "invalid digit count"); out += size; Char* end = out; while (value >= 100) { // Integer division is slow so do it for a group of two digits instead // of for every digit. The idea comes from the talk by Alexandrescu // "Three Optimization Tips for C++". See speed-test for a comparison. out -= 2; copy2(out, digits2(static_cast(value % 100))); value /= 100; } if (value < 10) { *--out = static_cast('0' + value); return {out, end}; } out -= 2; copy2(out, digits2(static_cast(value))); return {out, end}; } template >::value)> FMT_CONSTEXPR inline auto format_decimal(Iterator out, UInt value, int size) -> format_decimal_result { // Buffer is large enough to hold all digits (digits10 + 1). Char buffer[digits10() + 1] = {}; auto end = format_decimal(buffer, value, size).end; return {out, detail::copy_str_noinline(buffer, end, out)}; } template FMT_CONSTEXPR auto format_uint(Char* buffer, UInt value, int num_digits, bool upper = false) -> Char* { buffer += num_digits; Char* end = buffer; do { const char* digits = upper ? "0123456789ABCDEF" : "0123456789abcdef"; unsigned digit = static_cast(value & ((1 << BASE_BITS) - 1)); *--buffer = static_cast(BASE_BITS < 4 ? static_cast('0' + digit) : digits[digit]); } while ((value >>= BASE_BITS) != 0); return end; } template FMT_CONSTEXPR inline auto format_uint(It out, UInt value, int num_digits, bool upper = false) -> It { if (auto ptr = to_pointer(out, to_unsigned(num_digits))) { format_uint(ptr, value, num_digits, upper); return out; } // Buffer should be large enough to hold all digits (digits / BASE_BITS + 1). char buffer[num_bits() / BASE_BITS + 1] = {}; format_uint(buffer, value, num_digits, upper); return detail::copy_str_noinline(buffer, buffer + num_digits, out); } // A converter from UTF-8 to UTF-16. class utf8_to_utf16 { private: basic_memory_buffer buffer_; public: FMT_API explicit utf8_to_utf16(string_view s); operator basic_string_view() const { return {&buffer_[0], size()}; } auto size() const -> size_t { return buffer_.size() - 1; } auto c_str() const -> const wchar_t* { return &buffer_[0]; } auto str() const -> std::wstring { return {&buffer_[0], size()}; } }; enum class to_utf8_error_policy { abort, replace }; // A converter from UTF-16/UTF-32 (host endian) to UTF-8. template class to_utf8 { private: Buffer buffer_; public: to_utf8() {} explicit to_utf8(basic_string_view s, to_utf8_error_policy policy = to_utf8_error_policy::abort) { static_assert(sizeof(WChar) == 2 || sizeof(WChar) == 4, "Expect utf16 or utf32"); if (!convert(s, policy)) FMT_THROW(std::runtime_error(sizeof(WChar) == 2 ? "invalid utf16" : "invalid utf32")); } operator string_view() const { return string_view(&buffer_[0], size()); } auto size() const -> size_t { return buffer_.size() - 1; } auto c_str() const -> const char* { return &buffer_[0]; } auto str() const -> std::string { return std::string(&buffer_[0], size()); } // Performs conversion returning a bool instead of throwing exception on // conversion error. This method may still throw in case of memory allocation // error. auto convert(basic_string_view s, to_utf8_error_policy policy = to_utf8_error_policy::abort) -> bool { if (!convert(buffer_, s, policy)) return false; buffer_.push_back(0); return true; } static auto convert(Buffer& buf, basic_string_view s, to_utf8_error_policy policy = to_utf8_error_policy::abort) -> bool { for (auto p = s.begin(); p != s.end(); ++p) { uint32_t c = static_cast(*p); if (sizeof(WChar) == 2 && c >= 0xd800 && c <= 0xdfff) { // Handle a surrogate pair. ++p; if (p == s.end() || (c & 0xfc00) != 0xd800 || (*p & 0xfc00) != 0xdc00) { if (policy == to_utf8_error_policy::abort) return false; buf.append(string_view("\xEF\xBF\xBD")); --p; } else { c = (c << 10) + static_cast(*p) - 0x35fdc00; } } else if (c < 0x80) { buf.push_back(static_cast(c)); } else if (c < 0x800) { buf.push_back(static_cast(0xc0 | (c >> 6))); buf.push_back(static_cast(0x80 | (c & 0x3f))); } else if ((c >= 0x800 && c <= 0xd7ff) || (c >= 0xe000 && c <= 0xffff)) { buf.push_back(static_cast(0xe0 | (c >> 12))); buf.push_back(static_cast(0x80 | ((c & 0xfff) >> 6))); buf.push_back(static_cast(0x80 | (c & 0x3f))); } else if (c >= 0x10000 && c <= 0x10ffff) { buf.push_back(static_cast(0xf0 | (c >> 18))); buf.push_back(static_cast(0x80 | ((c & 0x3ffff) >> 12))); buf.push_back(static_cast(0x80 | ((c & 0xfff) >> 6))); buf.push_back(static_cast(0x80 | (c & 0x3f))); } else { return false; } } return true; } }; // Computes 128-bit result of multiplication of two 64-bit unsigned integers. inline auto umul128(uint64_t x, uint64_t y) noexcept -> uint128_fallback { #if FMT_USE_INT128 auto p = static_cast(x) * static_cast(y); return {static_cast(p >> 64), static_cast(p)}; #elif defined(_MSC_VER) && defined(_M_X64) auto hi = uint64_t(); auto lo = _umul128(x, y, &hi); return {hi, lo}; #else const uint64_t mask = static_cast(max_value()); uint64_t a = x >> 32; uint64_t b = x & mask; uint64_t c = y >> 32; uint64_t d = y & mask; uint64_t ac = a * c; uint64_t bc = b * c; uint64_t ad = a * d; uint64_t bd = b * d; uint64_t intermediate = (bd >> 32) + (ad & mask) + (bc & mask); return {ac + (intermediate >> 32) + (ad >> 32) + (bc >> 32), (intermediate << 32) + (bd & mask)}; #endif } namespace dragonbox { // Computes floor(log10(pow(2, e))) for e in [-2620, 2620] using the method from // https://fmt.dev/papers/Dragonbox.pdf#page=28, section 6.1. inline auto floor_log10_pow2(int e) noexcept -> int { FMT_ASSERT(e <= 2620 && e >= -2620, "too large exponent"); static_assert((-1 >> 1) == -1, "right shift is not arithmetic"); return (e * 315653) >> 20; } inline auto floor_log2_pow10(int e) noexcept -> int { FMT_ASSERT(e <= 1233 && e >= -1233, "too large exponent"); return (e * 1741647) >> 19; } // Computes upper 64 bits of multiplication of two 64-bit unsigned integers. inline auto umul128_upper64(uint64_t x, uint64_t y) noexcept -> uint64_t { #if FMT_USE_INT128 auto p = static_cast(x) * static_cast(y); return static_cast(p >> 64); #elif defined(_MSC_VER) && defined(_M_X64) return __umulh(x, y); #else return umul128(x, y).high(); #endif } // Computes upper 128 bits of multiplication of a 64-bit unsigned integer and a // 128-bit unsigned integer. inline auto umul192_upper128(uint64_t x, uint128_fallback y) noexcept -> uint128_fallback { uint128_fallback r = umul128(x, y.high()); r += umul128_upper64(x, y.low()); return r; } FMT_API auto get_cached_power(int k) noexcept -> uint128_fallback; // Type-specific information that Dragonbox uses. template struct float_info; template <> struct float_info { using carrier_uint = uint32_t; static const int exponent_bits = 8; static const int kappa = 1; static const int big_divisor = 100; static const int small_divisor = 10; static const int min_k = -31; static const int max_k = 46; static const int shorter_interval_tie_lower_threshold = -35; static const int shorter_interval_tie_upper_threshold = -35; }; template <> struct float_info { using carrier_uint = uint64_t; static const int exponent_bits = 11; static const int kappa = 2; static const int big_divisor = 1000; static const int small_divisor = 100; static const int min_k = -292; static const int max_k = 341; static const int shorter_interval_tie_lower_threshold = -77; static const int shorter_interval_tie_upper_threshold = -77; }; // An 80- or 128-bit floating point number. template struct float_info::digits == 64 || std::numeric_limits::digits == 113 || is_float128::value>> { using carrier_uint = detail::uint128_t; static const int exponent_bits = 15; }; // A double-double floating point number. template struct float_info::value>> { using carrier_uint = detail::uint128_t; }; template struct decimal_fp { using significand_type = typename float_info::carrier_uint; significand_type significand; int exponent; }; template FMT_API auto to_decimal(T x) noexcept -> decimal_fp; } // namespace dragonbox // Returns true iff Float has the implicit bit which is not stored. template constexpr auto has_implicit_bit() -> bool { // An 80-bit FP number has a 64-bit significand an no implicit bit. return std::numeric_limits::digits != 64; } // Returns the number of significand bits stored in Float. The implicit bit is // not counted since it is not stored. template constexpr auto num_significand_bits() -> int { // std::numeric_limits may not support __float128. return is_float128() ? 112 : (std::numeric_limits::digits - (has_implicit_bit() ? 1 : 0)); } template constexpr auto exponent_mask() -> typename dragonbox::float_info::carrier_uint { using float_uint = typename dragonbox::float_info::carrier_uint; return ((float_uint(1) << dragonbox::float_info::exponent_bits) - 1) << num_significand_bits(); } template constexpr auto exponent_bias() -> int { // std::numeric_limits may not support __float128. return is_float128() ? 16383 : std::numeric_limits::max_exponent - 1; } // Writes the exponent exp in the form "[+-]d{2,3}" to buffer. template FMT_CONSTEXPR auto write_exponent(int exp, It it) -> It { FMT_ASSERT(-10000 < exp && exp < 10000, "exponent out of range"); if (exp < 0) { *it++ = static_cast('-'); exp = -exp; } else { *it++ = static_cast('+'); } if (exp >= 100) { const char* top = digits2(to_unsigned(exp / 100)); if (exp >= 1000) *it++ = static_cast(top[0]); *it++ = static_cast(top[1]); exp %= 100; } const char* d = digits2(to_unsigned(exp)); *it++ = static_cast(d[0]); *it++ = static_cast(d[1]); return it; } // A floating-point number f * pow(2, e) where F is an unsigned type. template struct basic_fp { F f; int e; static constexpr const int num_significand_bits = static_cast(sizeof(F) * num_bits()); constexpr basic_fp() : f(0), e(0) {} constexpr basic_fp(uint64_t f_val, int e_val) : f(f_val), e(e_val) {} // Constructs fp from an IEEE754 floating-point number. template FMT_CONSTEXPR basic_fp(Float n) { assign(n); } // Assigns n to this and return true iff predecessor is closer than successor. template ::value)> FMT_CONSTEXPR auto assign(Float n) -> bool { static_assert(std::numeric_limits::digits <= 113, "unsupported FP"); // Assume Float is in the format [sign][exponent][significand]. using carrier_uint = typename dragonbox::float_info::carrier_uint; const auto num_float_significand_bits = detail::num_significand_bits(); const auto implicit_bit = carrier_uint(1) << num_float_significand_bits; const auto significand_mask = implicit_bit - 1; auto u = bit_cast(n); f = static_cast(u & significand_mask); auto biased_e = static_cast((u & exponent_mask()) >> num_float_significand_bits); // The predecessor is closer if n is a normalized power of 2 (f == 0) // other than the smallest normalized number (biased_e > 1). auto is_predecessor_closer = f == 0 && biased_e > 1; if (biased_e == 0) biased_e = 1; // Subnormals use biased exponent 1 (min exponent). else if (has_implicit_bit()) f += static_cast(implicit_bit); e = biased_e - exponent_bias() - num_float_significand_bits; if (!has_implicit_bit()) ++e; return is_predecessor_closer; } template ::value)> FMT_CONSTEXPR auto assign(Float n) -> bool { static_assert(std::numeric_limits::is_iec559, "unsupported FP"); return assign(static_cast(n)); } }; using fp = basic_fp; // Normalizes the value converted from double and multiplied by (1 << SHIFT). template FMT_CONSTEXPR auto normalize(basic_fp value) -> basic_fp { // Handle subnormals. const auto implicit_bit = F(1) << num_significand_bits(); const auto shifted_implicit_bit = implicit_bit << SHIFT; while ((value.f & shifted_implicit_bit) == 0) { value.f <<= 1; --value.e; } // Subtract 1 to account for hidden bit. const auto offset = basic_fp::num_significand_bits - num_significand_bits() - SHIFT - 1; value.f <<= offset; value.e -= offset; return value; } // Computes lhs * rhs / pow(2, 64) rounded to nearest with half-up tie breaking. FMT_CONSTEXPR inline auto multiply(uint64_t lhs, uint64_t rhs) -> uint64_t { #if FMT_USE_INT128 auto product = static_cast<__uint128_t>(lhs) * rhs; auto f = static_cast(product >> 64); return (static_cast(product) & (1ULL << 63)) != 0 ? f + 1 : f; #else // Multiply 32-bit parts of significands. uint64_t mask = (1ULL << 32) - 1; uint64_t a = lhs >> 32, b = lhs & mask; uint64_t c = rhs >> 32, d = rhs & mask; uint64_t ac = a * c, bc = b * c, ad = a * d, bd = b * d; // Compute mid 64-bit of result and round. uint64_t mid = (bd >> 32) + (ad & mask) + (bc & mask) + (1U << 31); return ac + (ad >> 32) + (bc >> 32) + (mid >> 32); #endif } FMT_CONSTEXPR inline auto operator*(fp x, fp y) -> fp { return {multiply(x.f, y.f), x.e + y.e + 64}; } template () == num_bits()> using convert_float_result = conditional_t::value || doublish, double, T>; template constexpr auto convert_float(T value) -> convert_float_result { return static_cast>(value); } template FMT_NOINLINE FMT_CONSTEXPR auto fill(OutputIt it, size_t n, const fill_t& fill) -> OutputIt { auto fill_size = fill.size(); if (fill_size == 1) return detail::fill_n(it, n, fill[0]); auto data = fill.data(); for (size_t i = 0; i < n; ++i) it = copy_str(data, data + fill_size, it); return it; } // Writes the output of f, padded according to format specifications in specs. // size: output size in code units. // width: output display width in (terminal) column positions. template FMT_CONSTEXPR auto write_padded(OutputIt out, const format_specs& specs, size_t size, size_t width, F&& f) -> OutputIt { static_assert(align == align::left || align == align::right, ""); unsigned spec_width = to_unsigned(specs.width); size_t padding = spec_width > width ? spec_width - width : 0; // Shifts are encoded as string literals because static constexpr is not // supported in constexpr functions. auto* shifts = align == align::left ? "\x1f\x1f\x00\x01" : "\x00\x1f\x00\x01"; size_t left_padding = padding >> shifts[specs.align]; size_t right_padding = padding - left_padding; auto it = reserve(out, size + padding * specs.fill.size()); if (left_padding != 0) it = fill(it, left_padding, specs.fill); it = f(it); if (right_padding != 0) it = fill(it, right_padding, specs.fill); return base_iterator(out, it); } template constexpr auto write_padded(OutputIt out, const format_specs& specs, size_t size, F&& f) -> OutputIt { return write_padded(out, specs, size, size, f); } template FMT_CONSTEXPR auto write_bytes(OutputIt out, string_view bytes, const format_specs& specs) -> OutputIt { return write_padded( out, specs, bytes.size(), [bytes](reserve_iterator it) { const char* data = bytes.data(); return copy_str(data, data + bytes.size(), it); }); } template auto write_ptr(OutputIt out, UIntPtr value, const format_specs* specs) -> OutputIt { int num_digits = count_digits<4>(value); auto size = to_unsigned(num_digits) + size_t(2); auto write = [=](reserve_iterator it) { *it++ = static_cast('0'); *it++ = static_cast('x'); return format_uint<4, Char>(it, value, num_digits); }; return specs ? write_padded(out, *specs, size, write) : base_iterator(out, write(reserve(out, size))); } // Returns true iff the code point cp is printable. FMT_API auto is_printable(uint32_t cp) -> bool; inline auto needs_escape(uint32_t cp) -> bool { return cp < 0x20 || cp == 0x7f || cp == '"' || cp == '\\' || !is_printable(cp); } template struct find_escape_result { const Char* begin; const Char* end; uint32_t cp; }; template using make_unsigned_char = typename conditional_t::value, std::make_unsigned, type_identity>::type; template auto find_escape(const Char* begin, const Char* end) -> find_escape_result { for (; begin != end; ++begin) { uint32_t cp = static_cast>(*begin); if (const_check(sizeof(Char) == 1) && cp >= 0x80) continue; if (needs_escape(cp)) return {begin, begin + 1, cp}; } return {begin, nullptr, 0}; } inline auto find_escape(const char* begin, const char* end) -> find_escape_result { if (!is_utf8()) return find_escape(begin, end); auto result = find_escape_result{end, nullptr, 0}; for_each_codepoint(string_view(begin, to_unsigned(end - begin)), [&](uint32_t cp, string_view sv) { if (needs_escape(cp)) { result = {sv.begin(), sv.end(), cp}; return false; } return true; }); return result; } #define FMT_STRING_IMPL(s, base, explicit) \ [] { \ /* Use the hidden visibility as a workaround for a GCC bug (#1973). */ \ /* Use a macro-like name to avoid shadowing warnings. */ \ struct FMT_VISIBILITY("hidden") FMT_COMPILE_STRING : base { \ using char_type FMT_MAYBE_UNUSED = fmt::remove_cvref_t; \ FMT_MAYBE_UNUSED FMT_CONSTEXPR explicit \ operator fmt::basic_string_view() const { \ return fmt::detail_exported::compile_string_to_view(s); \ } \ }; \ return FMT_COMPILE_STRING(); \ }() /** \rst Constructs a compile-time format string from a string literal *s*. **Example**:: // A compile-time error because 'd' is an invalid specifier for strings. std::string s = fmt::format(FMT_STRING("{:d}"), "foo"); \endrst */ #define FMT_STRING(s) FMT_STRING_IMPL(s, fmt::detail::compile_string, ) template auto write_codepoint(OutputIt out, char prefix, uint32_t cp) -> OutputIt { *out++ = static_cast('\\'); *out++ = static_cast(prefix); Char buf[width]; fill_n(buf, width, static_cast('0')); format_uint<4>(buf, cp, width); return copy_str(buf, buf + width, out); } template auto write_escaped_cp(OutputIt out, const find_escape_result& escape) -> OutputIt { auto c = static_cast(escape.cp); switch (escape.cp) { case '\n': *out++ = static_cast('\\'); c = static_cast('n'); break; case '\r': *out++ = static_cast('\\'); c = static_cast('r'); break; case '\t': *out++ = static_cast('\\'); c = static_cast('t'); break; case '"': FMT_FALLTHROUGH; case '\'': FMT_FALLTHROUGH; case '\\': *out++ = static_cast('\\'); break; default: if (escape.cp < 0x100) { return write_codepoint<2, Char>(out, 'x', escape.cp); } if (escape.cp < 0x10000) { return write_codepoint<4, Char>(out, 'u', escape.cp); } if (escape.cp < 0x110000) { return write_codepoint<8, Char>(out, 'U', escape.cp); } for (Char escape_char : basic_string_view( escape.begin, to_unsigned(escape.end - escape.begin))) { out = write_codepoint<2, Char>(out, 'x', static_cast(escape_char) & 0xFF); } return out; } *out++ = c; return out; } template auto write_escaped_string(OutputIt out, basic_string_view str) -> OutputIt { *out++ = static_cast('"'); auto begin = str.begin(), end = str.end(); do { auto escape = find_escape(begin, end); out = copy_str(begin, escape.begin, out); begin = escape.end; if (!begin) break; out = write_escaped_cp(out, escape); } while (begin != end); *out++ = static_cast('"'); return out; } template auto write_escaped_char(OutputIt out, Char v) -> OutputIt { Char v_array[1] = {v}; *out++ = static_cast('\''); if ((needs_escape(static_cast(v)) && v != static_cast('"')) || v == static_cast('\'')) { out = write_escaped_cp(out, find_escape_result{v_array, v_array + 1, static_cast(v)}); } else { *out++ = v; } *out++ = static_cast('\''); return out; } template FMT_CONSTEXPR auto write_char(OutputIt out, Char value, const format_specs& specs) -> OutputIt { bool is_debug = specs.type == presentation_type::debug; return write_padded(out, specs, 1, [=](reserve_iterator it) { if (is_debug) return write_escaped_char(it, value); *it++ = value; return it; }); } template FMT_CONSTEXPR auto write(OutputIt out, Char value, const format_specs& specs, locale_ref loc = {}) -> OutputIt { // char is formatted as unsigned char for consistency across platforms. using unsigned_type = conditional_t::value, unsigned char, unsigned>; return check_char_specs(specs) ? write_char(out, value, specs) : write(out, static_cast(value), specs, loc); } // Data for write_int that doesn't depend on output iterator type. It is used to // avoid template code bloat. template struct write_int_data { size_t size; size_t padding; FMT_CONSTEXPR write_int_data(int num_digits, unsigned prefix, const format_specs& specs) : size((prefix >> 24) + to_unsigned(num_digits)), padding(0) { if (specs.align == align::numeric) { auto width = to_unsigned(specs.width); if (width > size) { padding = width - size; size = width; } } else if (specs.precision > num_digits) { size = (prefix >> 24) + to_unsigned(specs.precision); padding = to_unsigned(specs.precision - num_digits); } } }; // Writes an integer in the format // // where are written by write_digits(it). // prefix contains chars in three lower bytes and the size in the fourth byte. template FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, int num_digits, unsigned prefix, const format_specs& specs, W write_digits) -> OutputIt { // Slightly faster check for specs.width == 0 && specs.precision == -1. if ((specs.width | (specs.precision + 1)) == 0) { auto it = reserve(out, to_unsigned(num_digits) + (prefix >> 24)); if (prefix != 0) { for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) *it++ = static_cast(p & 0xff); } return base_iterator(out, write_digits(it)); } auto data = write_int_data(num_digits, prefix, specs); return write_padded( out, specs, data.size, [=](reserve_iterator it) { for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) *it++ = static_cast(p & 0xff); it = detail::fill_n(it, data.padding, static_cast('0')); return write_digits(it); }); } template class digit_grouping { private: std::string grouping_; std::basic_string thousands_sep_; struct next_state { std::string::const_iterator group; int pos; }; auto initial_state() const -> next_state { return {grouping_.begin(), 0}; } // Returns the next digit group separator position. auto next(next_state& state) const -> int { if (thousands_sep_.empty()) return max_value(); if (state.group == grouping_.end()) return state.pos += grouping_.back(); if (*state.group <= 0 || *state.group == max_value()) return max_value(); state.pos += *state.group++; return state.pos; } public: explicit digit_grouping(locale_ref loc, bool localized = true) { if (!localized) return; auto sep = thousands_sep(loc); grouping_ = sep.grouping; if (sep.thousands_sep) thousands_sep_.assign(1, sep.thousands_sep); } digit_grouping(std::string grouping, std::basic_string sep) : grouping_(std::move(grouping)), thousands_sep_(std::move(sep)) {} auto has_separator() const -> bool { return !thousands_sep_.empty(); } auto count_separators(int num_digits) const -> int { int count = 0; auto state = initial_state(); while (num_digits > next(state)) ++count; return count; } // Applies grouping to digits and write the output to out. template auto apply(Out out, basic_string_view digits) const -> Out { auto num_digits = static_cast(digits.size()); auto separators = basic_memory_buffer(); separators.push_back(0); auto state = initial_state(); while (int i = next(state)) { if (i >= num_digits) break; separators.push_back(i); } for (int i = 0, sep_index = static_cast(separators.size() - 1); i < num_digits; ++i) { if (num_digits - i == separators[sep_index]) { out = copy_str(thousands_sep_.data(), thousands_sep_.data() + thousands_sep_.size(), out); --sep_index; } *out++ = static_cast(digits[to_unsigned(i)]); } return out; } }; FMT_CONSTEXPR inline void prefix_append(unsigned& prefix, unsigned value) { prefix |= prefix != 0 ? value << 8 : value; prefix += (1u + (value > 0xff ? 1 : 0)) << 24; } // Writes a decimal integer with digit grouping. template auto write_int(OutputIt out, UInt value, unsigned prefix, const format_specs& specs, const digit_grouping& grouping) -> OutputIt { static_assert(std::is_same, UInt>::value, ""); int num_digits = 0; auto buffer = memory_buffer(); switch (specs.type) { case presentation_type::none: case presentation_type::dec: { num_digits = count_digits(value); format_decimal(appender(buffer), value, num_digits); break; } case presentation_type::hex_lower: case presentation_type::hex_upper: { bool upper = specs.type == presentation_type::hex_upper; if (specs.alt) prefix_append(prefix, unsigned(upper ? 'X' : 'x') << 8 | '0'); num_digits = count_digits<4>(value); format_uint<4, char>(appender(buffer), value, num_digits, upper); break; } case presentation_type::bin_lower: case presentation_type::bin_upper: { bool upper = specs.type == presentation_type::bin_upper; if (specs.alt) prefix_append(prefix, unsigned(upper ? 'B' : 'b') << 8 | '0'); num_digits = count_digits<1>(value); format_uint<1, char>(appender(buffer), value, num_digits); break; } case presentation_type::oct: { num_digits = count_digits<3>(value); // Octal prefix '0' is counted as a digit, so only add it if precision // is not greater than the number of digits. if (specs.alt && specs.precision <= num_digits && value != 0) prefix_append(prefix, '0'); format_uint<3, char>(appender(buffer), value, num_digits); break; } case presentation_type::chr: return write_char(out, static_cast(value), specs); default: throw_format_error("invalid format specifier"); } unsigned size = (prefix != 0 ? prefix >> 24 : 0) + to_unsigned(num_digits) + to_unsigned(grouping.count_separators(num_digits)); return write_padded( out, specs, size, size, [&](reserve_iterator it) { for (unsigned p = prefix & 0xffffff; p != 0; p >>= 8) *it++ = static_cast(p & 0xff); return grouping.apply(it, string_view(buffer.data(), buffer.size())); }); } // Writes a localized value. FMT_API auto write_loc(appender out, loc_value value, const format_specs<>& specs, locale_ref loc) -> bool; template inline auto write_loc(OutputIt, loc_value, const format_specs&, locale_ref) -> bool { return false; } template struct write_int_arg { UInt abs_value; unsigned prefix; }; template FMT_CONSTEXPR auto make_write_int_arg(T value, sign_t sign) -> write_int_arg> { auto prefix = 0u; auto abs_value = static_cast>(value); if (is_negative(value)) { prefix = 0x01000000 | '-'; abs_value = 0 - abs_value; } else { constexpr const unsigned prefixes[4] = {0, 0, 0x1000000u | '+', 0x1000000u | ' '}; prefix = prefixes[sign]; } return {abs_value, prefix}; } template struct loc_writer { buffer_appender out; const format_specs& specs; std::basic_string sep; std::string grouping; std::basic_string decimal_point; template ::value)> auto operator()(T value) -> bool { auto arg = make_write_int_arg(value, specs.sign); write_int(out, static_cast>(arg.abs_value), arg.prefix, specs, digit_grouping(grouping, sep)); return true; } template ::value)> auto operator()(T) -> bool { return false; } }; template FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg arg, const format_specs& specs, locale_ref) -> OutputIt { static_assert(std::is_same>::value, ""); auto abs_value = arg.abs_value; auto prefix = arg.prefix; switch (specs.type) { case presentation_type::none: case presentation_type::dec: { auto num_digits = count_digits(abs_value); return write_int( out, num_digits, prefix, specs, [=](reserve_iterator it) { return format_decimal(it, abs_value, num_digits).end; }); } case presentation_type::hex_lower: case presentation_type::hex_upper: { bool upper = specs.type == presentation_type::hex_upper; if (specs.alt) prefix_append(prefix, unsigned(upper ? 'X' : 'x') << 8 | '0'); int num_digits = count_digits<4>(abs_value); return write_int( out, num_digits, prefix, specs, [=](reserve_iterator it) { return format_uint<4, Char>(it, abs_value, num_digits, upper); }); } case presentation_type::bin_lower: case presentation_type::bin_upper: { bool upper = specs.type == presentation_type::bin_upper; if (specs.alt) prefix_append(prefix, unsigned(upper ? 'B' : 'b') << 8 | '0'); int num_digits = count_digits<1>(abs_value); return write_int(out, num_digits, prefix, specs, [=](reserve_iterator it) { return format_uint<1, Char>(it, abs_value, num_digits); }); } case presentation_type::oct: { int num_digits = count_digits<3>(abs_value); // Octal prefix '0' is counted as a digit, so only add it if precision // is not greater than the number of digits. if (specs.alt && specs.precision <= num_digits && abs_value != 0) prefix_append(prefix, '0'); return write_int(out, num_digits, prefix, specs, [=](reserve_iterator it) { return format_uint<3, Char>(it, abs_value, num_digits); }); } case presentation_type::chr: return write_char(out, static_cast(abs_value), specs); default: throw_format_error("invalid format specifier"); } return out; } template FMT_CONSTEXPR FMT_NOINLINE auto write_int_noinline( OutputIt out, write_int_arg arg, const format_specs& specs, locale_ref loc) -> OutputIt { return write_int(out, arg, specs, loc); } template ::value && !std::is_same::value && std::is_same>::value)> FMT_CONSTEXPR FMT_INLINE auto write(OutputIt out, T value, const format_specs& specs, locale_ref loc) -> OutputIt { if (specs.localized && write_loc(out, value, specs, loc)) return out; return write_int_noinline(out, make_write_int_arg(value, specs.sign), specs, loc); } // An inlined version of write used in format string compilation. template ::value && !std::is_same::value && !std::is_same>::value)> FMT_CONSTEXPR FMT_INLINE auto write(OutputIt out, T value, const format_specs& specs, locale_ref loc) -> OutputIt { if (specs.localized && write_loc(out, value, specs, loc)) return out; return write_int(out, make_write_int_arg(value, specs.sign), specs, loc); } // An output iterator that counts the number of objects written to it and // discards them. class counting_iterator { private: size_t count_; public: using iterator_category = std::output_iterator_tag; using difference_type = std::ptrdiff_t; using pointer = void; using reference = void; FMT_UNCHECKED_ITERATOR(counting_iterator); struct value_type { template FMT_CONSTEXPR void operator=(const T&) {} }; FMT_CONSTEXPR counting_iterator() : count_(0) {} FMT_CONSTEXPR auto count() const -> size_t { return count_; } FMT_CONSTEXPR auto operator++() -> counting_iterator& { ++count_; return *this; } FMT_CONSTEXPR auto operator++(int) -> counting_iterator { auto it = *this; ++*this; return it; } FMT_CONSTEXPR friend auto operator+(counting_iterator it, difference_type n) -> counting_iterator { it.count_ += static_cast(n); return it; } FMT_CONSTEXPR auto operator*() const -> value_type { return {}; } }; template FMT_CONSTEXPR auto write(OutputIt out, basic_string_view s, const format_specs& specs) -> OutputIt { auto data = s.data(); auto size = s.size(); if (specs.precision >= 0 && to_unsigned(specs.precision) < size) size = code_point_index(s, to_unsigned(specs.precision)); bool is_debug = specs.type == presentation_type::debug; size_t width = 0; if (specs.width != 0) { if (is_debug) width = write_escaped_string(counting_iterator{}, s).count(); else width = compute_width(basic_string_view(data, size)); } return write_padded(out, specs, size, width, [=](reserve_iterator it) { if (is_debug) return write_escaped_string(it, s); return copy_str(data, data + size, it); }); } template FMT_CONSTEXPR auto write(OutputIt out, basic_string_view> s, const format_specs& specs, locale_ref) -> OutputIt { return write(out, s, specs); } template FMT_CONSTEXPR auto write(OutputIt out, const Char* s, const format_specs& specs, locale_ref) -> OutputIt { if (specs.type == presentation_type::pointer) return write_ptr(out, bit_cast(s), &specs); if (!s) throw_format_error("string pointer is null"); return write(out, basic_string_view(s), specs, {}); } template ::value && !std::is_same::value && !std::is_same::value)> FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { auto abs_value = static_cast>(value); bool negative = is_negative(value); // Don't do -abs_value since it trips unsigned-integer-overflow sanitizer. if (negative) abs_value = ~abs_value + 1; int num_digits = count_digits(abs_value); auto size = (negative ? 1 : 0) + static_cast(num_digits); auto it = reserve(out, size); if (auto ptr = to_pointer(it, size)) { if (negative) *ptr++ = static_cast('-'); format_decimal(ptr, abs_value, num_digits); return out; } if (negative) *it++ = static_cast('-'); it = format_decimal(it, abs_value, num_digits).end; return base_iterator(out, it); } // DEPRECATED! template FMT_CONSTEXPR auto parse_align(const Char* begin, const Char* end, format_specs& specs) -> const Char* { FMT_ASSERT(begin != end, ""); auto align = align::none; auto p = begin + code_point_length(begin); if (end - p <= 0) p = begin; for (;;) { switch (to_ascii(*p)) { case '<': align = align::left; break; case '>': align = align::right; break; case '^': align = align::center; break; } if (align != align::none) { if (p != begin) { auto c = *begin; if (c == '}') return begin; if (c == '{') { throw_format_error("invalid fill character '{'"); return begin; } specs.fill = {begin, to_unsigned(p - begin)}; begin = p + 1; } else { ++begin; } break; } else if (p == begin) { break; } p = begin; } specs.align = align; return begin; } // A floating-point presentation format. enum class float_format : unsigned char { general, // General: exponent notation or fixed point based on magnitude. exp, // Exponent notation with the default precision of 6, e.g. 1.2e-3. fixed, // Fixed point with the default precision of 6, e.g. 0.0012. hex }; struct float_specs { int precision; float_format format : 8; sign_t sign : 8; bool upper : 1; bool locale : 1; bool binary32 : 1; bool showpoint : 1; }; template FMT_CONSTEXPR auto parse_float_type_spec(const format_specs& specs) -> float_specs { auto result = float_specs(); result.showpoint = specs.alt; result.locale = specs.localized; switch (specs.type) { case presentation_type::none: result.format = float_format::general; break; case presentation_type::general_upper: result.upper = true; FMT_FALLTHROUGH; case presentation_type::general_lower: result.format = float_format::general; break; case presentation_type::exp_upper: result.upper = true; FMT_FALLTHROUGH; case presentation_type::exp_lower: result.format = float_format::exp; result.showpoint |= specs.precision != 0; break; case presentation_type::fixed_upper: result.upper = true; FMT_FALLTHROUGH; case presentation_type::fixed_lower: result.format = float_format::fixed; result.showpoint |= specs.precision != 0; break; case presentation_type::hexfloat_upper: result.upper = true; FMT_FALLTHROUGH; case presentation_type::hexfloat_lower: result.format = float_format::hex; break; default: throw_format_error("invalid format specifier"); break; } return result; } template FMT_CONSTEXPR20 auto write_nonfinite(OutputIt out, bool isnan, format_specs specs, const float_specs& fspecs) -> OutputIt { auto str = isnan ? (fspecs.upper ? "NAN" : "nan") : (fspecs.upper ? "INF" : "inf"); constexpr size_t str_size = 3; auto sign = fspecs.sign; auto size = str_size + (sign ? 1 : 0); // Replace '0'-padding with space for non-finite values. const bool is_zero_fill = specs.fill.size() == 1 && *specs.fill.data() == static_cast('0'); if (is_zero_fill) specs.fill[0] = static_cast(' '); return write_padded(out, specs, size, [=](reserve_iterator it) { if (sign) *it++ = detail::sign(sign); return copy_str(str, str + str_size, it); }); } // A decimal floating-point number significand * pow(10, exp). struct big_decimal_fp { const char* significand; int significand_size; int exponent; }; constexpr auto get_significand_size(const big_decimal_fp& f) -> int { return f.significand_size; } template inline auto get_significand_size(const dragonbox::decimal_fp& f) -> int { return count_digits(f.significand); } template constexpr auto write_significand(OutputIt out, const char* significand, int significand_size) -> OutputIt { return copy_str(significand, significand + significand_size, out); } template inline auto write_significand(OutputIt out, UInt significand, int significand_size) -> OutputIt { return format_decimal(out, significand, significand_size).end; } template FMT_CONSTEXPR20 auto write_significand(OutputIt out, T significand, int significand_size, int exponent, const Grouping& grouping) -> OutputIt { if (!grouping.has_separator()) { out = write_significand(out, significand, significand_size); return detail::fill_n(out, exponent, static_cast('0')); } auto buffer = memory_buffer(); write_significand(appender(buffer), significand, significand_size); detail::fill_n(appender(buffer), exponent, '0'); return grouping.apply(out, string_view(buffer.data(), buffer.size())); } template ::value)> inline auto write_significand(Char* out, UInt significand, int significand_size, int integral_size, Char decimal_point) -> Char* { if (!decimal_point) return format_decimal(out, significand, significand_size).end; out += significand_size + 1; Char* end = out; int floating_size = significand_size - integral_size; for (int i = floating_size / 2; i > 0; --i) { out -= 2; copy2(out, digits2(static_cast(significand % 100))); significand /= 100; } if (floating_size % 2 != 0) { *--out = static_cast('0' + significand % 10); significand /= 10; } *--out = decimal_point; format_decimal(out - integral_size, significand, integral_size); return end; } template >::value)> inline auto write_significand(OutputIt out, UInt significand, int significand_size, int integral_size, Char decimal_point) -> OutputIt { // Buffer is large enough to hold digits (digits10 + 1) and a decimal point. Char buffer[digits10() + 2]; auto end = write_significand(buffer, significand, significand_size, integral_size, decimal_point); return detail::copy_str_noinline(buffer, end, out); } template FMT_CONSTEXPR auto write_significand(OutputIt out, const char* significand, int significand_size, int integral_size, Char decimal_point) -> OutputIt { out = detail::copy_str_noinline(significand, significand + integral_size, out); if (!decimal_point) return out; *out++ = decimal_point; return detail::copy_str_noinline(significand + integral_size, significand + significand_size, out); } template FMT_CONSTEXPR20 auto write_significand(OutputIt out, T significand, int significand_size, int integral_size, Char decimal_point, const Grouping& grouping) -> OutputIt { if (!grouping.has_separator()) { return write_significand(out, significand, significand_size, integral_size, decimal_point); } auto buffer = basic_memory_buffer(); write_significand(buffer_appender(buffer), significand, significand_size, integral_size, decimal_point); grouping.apply( out, basic_string_view(buffer.data(), to_unsigned(integral_size))); return detail::copy_str_noinline(buffer.data() + integral_size, buffer.end(), out); } template > FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f, const format_specs& specs, float_specs fspecs, locale_ref loc) -> OutputIt { auto significand = f.significand; int significand_size = get_significand_size(f); const Char zero = static_cast('0'); auto sign = fspecs.sign; size_t size = to_unsigned(significand_size) + (sign ? 1 : 0); using iterator = reserve_iterator; Char decimal_point = fspecs.locale ? detail::decimal_point(loc) : static_cast('.'); int output_exp = f.exponent + significand_size - 1; auto use_exp_format = [=]() { if (fspecs.format == float_format::exp) return true; if (fspecs.format != float_format::general) return false; // Use the fixed notation if the exponent is in [exp_lower, exp_upper), // e.g. 0.0001 instead of 1e-04. Otherwise use the exponent notation. const int exp_lower = -4, exp_upper = 16; return output_exp < exp_lower || output_exp >= (fspecs.precision > 0 ? fspecs.precision : exp_upper); }; if (use_exp_format()) { int num_zeros = 0; if (fspecs.showpoint) { num_zeros = fspecs.precision - significand_size; if (num_zeros < 0) num_zeros = 0; size += to_unsigned(num_zeros); } else if (significand_size == 1) { decimal_point = Char(); } auto abs_output_exp = output_exp >= 0 ? output_exp : -output_exp; int exp_digits = 2; if (abs_output_exp >= 100) exp_digits = abs_output_exp >= 1000 ? 4 : 3; size += to_unsigned((decimal_point ? 1 : 0) + 2 + exp_digits); char exp_char = fspecs.upper ? 'E' : 'e'; auto write = [=](iterator it) { if (sign) *it++ = detail::sign(sign); // Insert a decimal point after the first digit and add an exponent. it = write_significand(it, significand, significand_size, 1, decimal_point); if (num_zeros > 0) it = detail::fill_n(it, num_zeros, zero); *it++ = static_cast(exp_char); return write_exponent(output_exp, it); }; return specs.width > 0 ? write_padded(out, specs, size, write) : base_iterator(out, write(reserve(out, size))); } int exp = f.exponent + significand_size; if (f.exponent >= 0) { // 1234e5 -> 123400000[.0+] size += to_unsigned(f.exponent); int num_zeros = fspecs.precision - exp; abort_fuzzing_if(num_zeros > 5000); if (fspecs.showpoint) { ++size; if (num_zeros <= 0 && fspecs.format != float_format::fixed) num_zeros = 0; if (num_zeros > 0) size += to_unsigned(num_zeros); } auto grouping = Grouping(loc, fspecs.locale); size += to_unsigned(grouping.count_separators(exp)); return write_padded(out, specs, size, [&](iterator it) { if (sign) *it++ = detail::sign(sign); it = write_significand(it, significand, significand_size, f.exponent, grouping); if (!fspecs.showpoint) return it; *it++ = decimal_point; return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; }); } else if (exp > 0) { // 1234e-2 -> 12.34[0+] int num_zeros = fspecs.showpoint ? fspecs.precision - significand_size : 0; size += 1 + to_unsigned(num_zeros > 0 ? num_zeros : 0); auto grouping = Grouping(loc, fspecs.locale); size += to_unsigned(grouping.count_separators(exp)); return write_padded(out, specs, size, [&](iterator it) { if (sign) *it++ = detail::sign(sign); it = write_significand(it, significand, significand_size, exp, decimal_point, grouping); return num_zeros > 0 ? detail::fill_n(it, num_zeros, zero) : it; }); } // 1234e-6 -> 0.001234 int num_zeros = -exp; if (significand_size == 0 && fspecs.precision >= 0 && fspecs.precision < num_zeros) { num_zeros = fspecs.precision; } bool pointy = num_zeros != 0 || significand_size != 0 || fspecs.showpoint; size += 1 + (pointy ? 1 : 0) + to_unsigned(num_zeros); return write_padded(out, specs, size, [&](iterator it) { if (sign) *it++ = detail::sign(sign); *it++ = zero; if (!pointy) return it; *it++ = decimal_point; it = detail::fill_n(it, num_zeros, zero); return write_significand(it, significand, significand_size); }); } template class fallback_digit_grouping { public: constexpr fallback_digit_grouping(locale_ref, bool) {} constexpr auto has_separator() const -> bool { return false; } constexpr auto count_separators(int) const -> int { return 0; } template constexpr auto apply(Out out, basic_string_view) const -> Out { return out; } }; template FMT_CONSTEXPR20 auto write_float(OutputIt out, const DecimalFP& f, const format_specs& specs, float_specs fspecs, locale_ref loc) -> OutputIt { if (is_constant_evaluated()) { return do_write_float>(out, f, specs, fspecs, loc); } else { return do_write_float(out, f, specs, fspecs, loc); } } template constexpr auto isnan(T value) -> bool { return !(value >= value); // std::isnan doesn't support __float128. } template struct has_isfinite : std::false_type {}; template struct has_isfinite> : std::true_type {}; template ::value&& has_isfinite::value)> FMT_CONSTEXPR20 auto isfinite(T value) -> bool { constexpr T inf = T(std::numeric_limits::infinity()); if (is_constant_evaluated()) return !detail::isnan(value) && value < inf && value > -inf; return std::isfinite(value); } template ::value)> FMT_CONSTEXPR auto isfinite(T value) -> bool { T inf = T(std::numeric_limits::infinity()); // std::isfinite doesn't support __float128. return !detail::isnan(value) && value < inf && value > -inf; } template ::value)> FMT_INLINE FMT_CONSTEXPR bool signbit(T value) { if (is_constant_evaluated()) { #ifdef __cpp_if_constexpr if constexpr (std::numeric_limits::is_iec559) { auto bits = detail::bit_cast(static_cast(value)); return (bits >> (num_bits() - 1)) != 0; } #endif } return std::signbit(static_cast(value)); } inline FMT_CONSTEXPR20 void adjust_precision(int& precision, int exp10) { // Adjust fixed precision by exponent because it is relative to decimal // point. if (exp10 > 0 && precision > max_value() - exp10) FMT_THROW(format_error("number is too big")); precision += exp10; } class bigint { private: // A bigint is stored as an array of bigits (big digits), with bigit at index // 0 being the least significant one. using bigit = uint32_t; using double_bigit = uint64_t; enum { bigits_capacity = 32 }; basic_memory_buffer bigits_; int exp_; FMT_CONSTEXPR20 auto operator[](int index) const -> bigit { return bigits_[to_unsigned(index)]; } FMT_CONSTEXPR20 auto operator[](int index) -> bigit& { return bigits_[to_unsigned(index)]; } static constexpr const int bigit_bits = num_bits(); friend struct formatter; FMT_CONSTEXPR20 void subtract_bigits(int index, bigit other, bigit& borrow) { auto result = static_cast((*this)[index]) - other - borrow; (*this)[index] = static_cast(result); borrow = static_cast(result >> (bigit_bits * 2 - 1)); } FMT_CONSTEXPR20 void remove_leading_zeros() { int num_bigits = static_cast(bigits_.size()) - 1; while (num_bigits > 0 && (*this)[num_bigits] == 0) --num_bigits; bigits_.resize(to_unsigned(num_bigits + 1)); } // Computes *this -= other assuming aligned bigints and *this >= other. FMT_CONSTEXPR20 void subtract_aligned(const bigint& other) { FMT_ASSERT(other.exp_ >= exp_, "unaligned bigints"); FMT_ASSERT(compare(*this, other) >= 0, ""); bigit borrow = 0; int i = other.exp_ - exp_; for (size_t j = 0, n = other.bigits_.size(); j != n; ++i, ++j) subtract_bigits(i, other.bigits_[j], borrow); while (borrow > 0) subtract_bigits(i, 0, borrow); remove_leading_zeros(); } FMT_CONSTEXPR20 void multiply(uint32_t value) { const double_bigit wide_value = value; bigit carry = 0; for (size_t i = 0, n = bigits_.size(); i < n; ++i) { double_bigit result = bigits_[i] * wide_value + carry; bigits_[i] = static_cast(result); carry = static_cast(result >> bigit_bits); } if (carry != 0) bigits_.push_back(carry); } template ::value || std::is_same::value)> FMT_CONSTEXPR20 void multiply(UInt value) { using half_uint = conditional_t::value, uint64_t, uint32_t>; const int shift = num_bits() - bigit_bits; const UInt lower = static_cast(value); const UInt upper = value >> num_bits(); UInt carry = 0; for (size_t i = 0, n = bigits_.size(); i < n; ++i) { UInt result = lower * bigits_[i] + static_cast(carry); carry = (upper * bigits_[i] << shift) + (result >> bigit_bits) + (carry >> bigit_bits); bigits_[i] = static_cast(result); } while (carry != 0) { bigits_.push_back(static_cast(carry)); carry >>= bigit_bits; } } template ::value || std::is_same::value)> FMT_CONSTEXPR20 void assign(UInt n) { size_t num_bigits = 0; do { bigits_[num_bigits++] = static_cast(n); n >>= bigit_bits; } while (n != 0); bigits_.resize(num_bigits); exp_ = 0; } public: FMT_CONSTEXPR20 bigint() : exp_(0) {} explicit bigint(uint64_t n) { assign(n); } bigint(const bigint&) = delete; void operator=(const bigint&) = delete; FMT_CONSTEXPR20 void assign(const bigint& other) { auto size = other.bigits_.size(); bigits_.resize(size); auto data = other.bigits_.data(); copy_str(data, data + size, bigits_.data()); exp_ = other.exp_; } template FMT_CONSTEXPR20 void operator=(Int n) { FMT_ASSERT(n > 0, ""); assign(uint64_or_128_t(n)); } FMT_CONSTEXPR20 auto num_bigits() const -> int { return static_cast(bigits_.size()) + exp_; } FMT_NOINLINE FMT_CONSTEXPR20 auto operator<<=(int shift) -> bigint& { FMT_ASSERT(shift >= 0, ""); exp_ += shift / bigit_bits; shift %= bigit_bits; if (shift == 0) return *this; bigit carry = 0; for (size_t i = 0, n = bigits_.size(); i < n; ++i) { bigit c = bigits_[i] >> (bigit_bits - shift); bigits_[i] = (bigits_[i] << shift) + carry; carry = c; } if (carry != 0) bigits_.push_back(carry); return *this; } template FMT_CONSTEXPR20 auto operator*=(Int value) -> bigint& { FMT_ASSERT(value > 0, ""); multiply(uint32_or_64_or_128_t(value)); return *this; } friend FMT_CONSTEXPR20 auto compare(const bigint& lhs, const bigint& rhs) -> int { int num_lhs_bigits = lhs.num_bigits(), num_rhs_bigits = rhs.num_bigits(); if (num_lhs_bigits != num_rhs_bigits) return num_lhs_bigits > num_rhs_bigits ? 1 : -1; int i = static_cast(lhs.bigits_.size()) - 1; int j = static_cast(rhs.bigits_.size()) - 1; int end = i - j; if (end < 0) end = 0; for (; i >= end; --i, --j) { bigit lhs_bigit = lhs[i], rhs_bigit = rhs[j]; if (lhs_bigit != rhs_bigit) return lhs_bigit > rhs_bigit ? 1 : -1; } if (i != j) return i > j ? 1 : -1; return 0; } // Returns compare(lhs1 + lhs2, rhs). friend FMT_CONSTEXPR20 auto add_compare(const bigint& lhs1, const bigint& lhs2, const bigint& rhs) -> int { auto minimum = [](int a, int b) { return a < b ? a : b; }; auto maximum = [](int a, int b) { return a > b ? a : b; }; int max_lhs_bigits = maximum(lhs1.num_bigits(), lhs2.num_bigits()); int num_rhs_bigits = rhs.num_bigits(); if (max_lhs_bigits + 1 < num_rhs_bigits) return -1; if (max_lhs_bigits > num_rhs_bigits) return 1; auto get_bigit = [](const bigint& n, int i) -> bigit { return i >= n.exp_ && i < n.num_bigits() ? n[i - n.exp_] : 0; }; double_bigit borrow = 0; int min_exp = minimum(minimum(lhs1.exp_, lhs2.exp_), rhs.exp_); for (int i = num_rhs_bigits - 1; i >= min_exp; --i) { double_bigit sum = static_cast(get_bigit(lhs1, i)) + get_bigit(lhs2, i); bigit rhs_bigit = get_bigit(rhs, i); if (sum > rhs_bigit + borrow) return 1; borrow = rhs_bigit + borrow - sum; if (borrow > 1) return -1; borrow <<= bigit_bits; } return borrow != 0 ? -1 : 0; } // Assigns pow(10, exp) to this bigint. FMT_CONSTEXPR20 void assign_pow10(int exp) { FMT_ASSERT(exp >= 0, ""); if (exp == 0) return *this = 1; // Find the top bit. int bitmask = 1; while (exp >= bitmask) bitmask <<= 1; bitmask >>= 1; // pow(10, exp) = pow(5, exp) * pow(2, exp). First compute pow(5, exp) by // repeated squaring and multiplication. *this = 5; bitmask >>= 1; while (bitmask != 0) { square(); if ((exp & bitmask) != 0) *this *= 5; bitmask >>= 1; } *this <<= exp; // Multiply by pow(2, exp) by shifting. } FMT_CONSTEXPR20 void square() { int num_bigits = static_cast(bigits_.size()); int num_result_bigits = 2 * num_bigits; basic_memory_buffer n(std::move(bigits_)); bigits_.resize(to_unsigned(num_result_bigits)); auto sum = uint128_t(); for (int bigit_index = 0; bigit_index < num_bigits; ++bigit_index) { // Compute bigit at position bigit_index of the result by adding // cross-product terms n[i] * n[j] such that i + j == bigit_index. for (int i = 0, j = bigit_index; j >= 0; ++i, --j) { // Most terms are multiplied twice which can be optimized in the future. sum += static_cast(n[i]) * n[j]; } (*this)[bigit_index] = static_cast(sum); sum >>= num_bits(); // Compute the carry. } // Do the same for the top half. for (int bigit_index = num_bigits; bigit_index < num_result_bigits; ++bigit_index) { for (int j = num_bigits - 1, i = bigit_index - j; i < num_bigits;) sum += static_cast(n[i++]) * n[j--]; (*this)[bigit_index] = static_cast(sum); sum >>= num_bits(); } remove_leading_zeros(); exp_ *= 2; } // If this bigint has a bigger exponent than other, adds trailing zero to make // exponents equal. This simplifies some operations such as subtraction. FMT_CONSTEXPR20 void align(const bigint& other) { int exp_difference = exp_ - other.exp_; if (exp_difference <= 0) return; int num_bigits = static_cast(bigits_.size()); bigits_.resize(to_unsigned(num_bigits + exp_difference)); for (int i = num_bigits - 1, j = i + exp_difference; i >= 0; --i, --j) bigits_[j] = bigits_[i]; std::uninitialized_fill_n(bigits_.data(), exp_difference, 0u); exp_ -= exp_difference; } // Divides this bignum by divisor, assigning the remainder to this and // returning the quotient. FMT_CONSTEXPR20 auto divmod_assign(const bigint& divisor) -> int { FMT_ASSERT(this != &divisor, ""); if (compare(*this, divisor) < 0) return 0; FMT_ASSERT(divisor.bigits_[divisor.bigits_.size() - 1u] != 0, ""); align(divisor); int quotient = 0; do { subtract_aligned(divisor); ++quotient; } while (compare(*this, divisor) >= 0); return quotient; } }; // format_dragon flags. enum dragon { predecessor_closer = 1, fixup = 2, // Run fixup to correct exp10 which can be off by one. fixed = 4, }; // Formats a floating-point number using a variation of the Fixed-Precision // Positive Floating-Point Printout ((FPP)^2) algorithm by Steele & White: // https://fmt.dev/papers/p372-steele.pdf. FMT_CONSTEXPR20 inline void format_dragon(basic_fp value, unsigned flags, int num_digits, buffer& buf, int& exp10) { bigint numerator; // 2 * R in (FPP)^2. bigint denominator; // 2 * S in (FPP)^2. // lower and upper are differences between value and corresponding boundaries. bigint lower; // (M^- in (FPP)^2). bigint upper_store; // upper's value if different from lower. bigint* upper = nullptr; // (M^+ in (FPP)^2). // Shift numerator and denominator by an extra bit or two (if lower boundary // is closer) to make lower and upper integers. This eliminates multiplication // by 2 during later computations. bool is_predecessor_closer = (flags & dragon::predecessor_closer) != 0; int shift = is_predecessor_closer ? 2 : 1; if (value.e >= 0) { numerator = value.f; numerator <<= value.e + shift; lower = 1; lower <<= value.e; if (is_predecessor_closer) { upper_store = 1; upper_store <<= value.e + 1; upper = &upper_store; } denominator.assign_pow10(exp10); denominator <<= shift; } else if (exp10 < 0) { numerator.assign_pow10(-exp10); lower.assign(numerator); if (is_predecessor_closer) { upper_store.assign(numerator); upper_store <<= 1; upper = &upper_store; } numerator *= value.f; numerator <<= shift; denominator = 1; denominator <<= shift - value.e; } else { numerator = value.f; numerator <<= shift; denominator.assign_pow10(exp10); denominator <<= shift - value.e; lower = 1; if (is_predecessor_closer) { upper_store = 1ULL << 1; upper = &upper_store; } } int even = static_cast((value.f & 1) == 0); if (!upper) upper = &lower; bool shortest = num_digits < 0; if ((flags & dragon::fixup) != 0) { if (add_compare(numerator, *upper, denominator) + even <= 0) { --exp10; numerator *= 10; if (num_digits < 0) { lower *= 10; if (upper != &lower) *upper *= 10; } } if ((flags & dragon::fixed) != 0) adjust_precision(num_digits, exp10 + 1); } // Invariant: value == (numerator / denominator) * pow(10, exp10). if (shortest) { // Generate the shortest representation. num_digits = 0; char* data = buf.data(); for (;;) { int digit = numerator.divmod_assign(denominator); bool low = compare(numerator, lower) - even < 0; // numerator <[=] lower. // numerator + upper >[=] pow10: bool high = add_compare(numerator, *upper, denominator) + even > 0; data[num_digits++] = static_cast('0' + digit); if (low || high) { if (!low) { ++data[num_digits - 1]; } else if (high) { int result = add_compare(numerator, numerator, denominator); // Round half to even. if (result > 0 || (result == 0 && (digit % 2) != 0)) ++data[num_digits - 1]; } buf.try_resize(to_unsigned(num_digits)); exp10 -= num_digits - 1; return; } numerator *= 10; lower *= 10; if (upper != &lower) *upper *= 10; } } // Generate the given number of digits. exp10 -= num_digits - 1; if (num_digits <= 0) { denominator *= 10; auto digit = add_compare(numerator, numerator, denominator) > 0 ? '1' : '0'; buf.push_back(digit); return; } buf.try_resize(to_unsigned(num_digits)); for (int i = 0; i < num_digits - 1; ++i) { int digit = numerator.divmod_assign(denominator); buf[i] = static_cast('0' + digit); numerator *= 10; } int digit = numerator.divmod_assign(denominator); auto result = add_compare(numerator, numerator, denominator); if (result > 0 || (result == 0 && (digit % 2) != 0)) { if (digit == 9) { const auto overflow = '0' + 10; buf[num_digits - 1] = overflow; // Propagate the carry. for (int i = num_digits - 1; i > 0 && buf[i] == overflow; --i) { buf[i] = '0'; ++buf[i - 1]; } if (buf[0] == overflow) { buf[0] = '1'; if ((flags & dragon::fixed) != 0) buf.push_back('0'); else ++exp10; } return; } ++digit; } buf[num_digits - 1] = static_cast('0' + digit); } // Formats a floating-point number using the hexfloat format. template ::value)> FMT_CONSTEXPR20 void format_hexfloat(Float value, int precision, float_specs specs, buffer& buf) { // float is passed as double to reduce the number of instantiations and to // simplify implementation. static_assert(!std::is_same::value, ""); using info = dragonbox::float_info; // Assume Float is in the format [sign][exponent][significand]. using carrier_uint = typename info::carrier_uint; constexpr auto num_float_significand_bits = detail::num_significand_bits(); basic_fp f(value); f.e += num_float_significand_bits; if (!has_implicit_bit()) --f.e; constexpr auto num_fraction_bits = num_float_significand_bits + (has_implicit_bit() ? 1 : 0); constexpr auto num_xdigits = (num_fraction_bits + 3) / 4; constexpr auto leading_shift = ((num_xdigits - 1) * 4); const auto leading_mask = carrier_uint(0xF) << leading_shift; const auto leading_xdigit = static_cast((f.f & leading_mask) >> leading_shift); if (leading_xdigit > 1) f.e -= (32 - countl_zero(leading_xdigit) - 1); int print_xdigits = num_xdigits - 1; if (precision >= 0 && print_xdigits > precision) { const int shift = ((print_xdigits - precision - 1) * 4); const auto mask = carrier_uint(0xF) << shift; const auto v = static_cast((f.f & mask) >> shift); if (v >= 8) { const auto inc = carrier_uint(1) << (shift + 4); f.f += inc; f.f &= ~(inc - 1); } // Check long double overflow if (!has_implicit_bit()) { const auto implicit_bit = carrier_uint(1) << num_float_significand_bits; if ((f.f & implicit_bit) == implicit_bit) { f.f >>= 4; f.e += 4; } } print_xdigits = precision; } char xdigits[num_bits() / 4]; detail::fill_n(xdigits, sizeof(xdigits), '0'); format_uint<4>(xdigits, f.f, num_xdigits, specs.upper); // Remove zero tail while (print_xdigits > 0 && xdigits[print_xdigits] == '0') --print_xdigits; buf.push_back('0'); buf.push_back(specs.upper ? 'X' : 'x'); buf.push_back(xdigits[0]); if (specs.showpoint || print_xdigits > 0 || print_xdigits < precision) buf.push_back('.'); buf.append(xdigits + 1, xdigits + 1 + print_xdigits); for (; print_xdigits < precision; ++print_xdigits) buf.push_back('0'); buf.push_back(specs.upper ? 'P' : 'p'); uint32_t abs_e; if (f.e < 0) { buf.push_back('-'); abs_e = static_cast(-f.e); } else { buf.push_back('+'); abs_e = static_cast(f.e); } format_decimal(appender(buf), abs_e, detail::count_digits(abs_e)); } template ::value)> FMT_CONSTEXPR20 void format_hexfloat(Float value, int precision, float_specs specs, buffer& buf) { format_hexfloat(static_cast(value), precision, specs, buf); } constexpr auto fractional_part_rounding_thresholds(int index) -> uint32_t { // For checking rounding thresholds. // The kth entry is chosen to be the smallest integer such that the // upper 32-bits of 10^(k+1) times it is strictly bigger than 5 * 10^k. // It is equal to ceil(2^31 + 2^32/10^(k + 1)). // These are stored in a string literal because we cannot have static arrays // in constexpr functions and non-static ones are poorly optimized. return U"\x9999999a\x828f5c29\x80418938\x80068db9\x8000a7c6\x800010c7" U"\x800001ae\x8000002b"[index]; } template FMT_CONSTEXPR20 auto format_float(Float value, int precision, float_specs specs, buffer& buf) -> int { // float is passed as double to reduce the number of instantiations. static_assert(!std::is_same::value, ""); FMT_ASSERT(value >= 0, "value is negative"); auto converted_value = convert_float(value); const bool fixed = specs.format == float_format::fixed; if (value <= 0) { // <= instead of == to silence a warning. if (precision <= 0 || !fixed) { buf.push_back('0'); return 0; } buf.try_resize(to_unsigned(precision)); fill_n(buf.data(), precision, '0'); return -precision; } int exp = 0; bool use_dragon = true; unsigned dragon_flags = 0; if (!is_fast_float() || is_constant_evaluated()) { const auto inv_log2_10 = 0.3010299956639812; // 1 / log2(10) using info = dragonbox::float_info; const auto f = basic_fp(converted_value); // Compute exp, an approximate power of 10, such that // 10^(exp - 1) <= value < 10^exp or 10^exp <= value < 10^(exp + 1). // This is based on log10(value) == log2(value) / log2(10) and approximation // of log2(value) by e + num_fraction_bits idea from double-conversion. auto e = (f.e + count_digits<1>(f.f) - 1) * inv_log2_10 - 1e-10; exp = static_cast(e); if (e > exp) ++exp; // Compute ceil. dragon_flags = dragon::fixup; } else if (precision < 0) { // Use Dragonbox for the shortest format. if (specs.binary32) { auto dec = dragonbox::to_decimal(static_cast(value)); write(buffer_appender(buf), dec.significand); return dec.exponent; } auto dec = dragonbox::to_decimal(static_cast(value)); write(buffer_appender(buf), dec.significand); return dec.exponent; } else { // Extract significand bits and exponent bits. using info = dragonbox::float_info; auto br = bit_cast(static_cast(value)); const uint64_t significand_mask = (static_cast(1) << num_significand_bits()) - 1; uint64_t significand = (br & significand_mask); int exponent = static_cast((br & exponent_mask()) >> num_significand_bits()); if (exponent != 0) { // Check if normal. exponent -= exponent_bias() + num_significand_bits(); significand |= (static_cast(1) << num_significand_bits()); significand <<= 1; } else { // Normalize subnormal inputs. FMT_ASSERT(significand != 0, "zeros should not appear here"); int shift = countl_zero(significand); FMT_ASSERT(shift >= num_bits() - num_significand_bits(), ""); shift -= (num_bits() - num_significand_bits() - 2); exponent = (std::numeric_limits::min_exponent - num_significand_bits()) - shift; significand <<= shift; } // Compute the first several nonzero decimal significand digits. // We call the number we get the first segment. const int k = info::kappa - dragonbox::floor_log10_pow2(exponent); exp = -k; const int beta = exponent + dragonbox::floor_log2_pow10(k); uint64_t first_segment; bool has_more_segments; int digits_in_the_first_segment; { const auto r = dragonbox::umul192_upper128( significand << beta, dragonbox::get_cached_power(k)); first_segment = r.high(); has_more_segments = r.low() != 0; // The first segment can have 18 ~ 19 digits. if (first_segment >= 1000000000000000000ULL) { digits_in_the_first_segment = 19; } else { // When it is of 18-digits, we align it to 19-digits by adding a bogus // zero at the end. digits_in_the_first_segment = 18; first_segment *= 10; } } // Compute the actual number of decimal digits to print. if (fixed) adjust_precision(precision, exp + digits_in_the_first_segment); // Use Dragon4 only when there might be not enough digits in the first // segment. if (digits_in_the_first_segment > precision) { use_dragon = false; if (precision <= 0) { exp += digits_in_the_first_segment; if (precision < 0) { // Nothing to do, since all we have are just leading zeros. buf.try_resize(0); } else { // We may need to round-up. buf.try_resize(1); if ((first_segment | static_cast(has_more_segments)) > 5000000000000000000ULL) { buf[0] = '1'; } else { buf[0] = '0'; } } } // precision <= 0 else { exp += digits_in_the_first_segment - precision; // When precision > 0, we divide the first segment into three // subsegments, each with 9, 9, and 0 ~ 1 digits so that each fits // in 32-bits which usually allows faster calculation than in // 64-bits. Since some compiler (e.g. MSVC) doesn't know how to optimize // division-by-constant for large 64-bit divisors, we do it here // manually. The magic number 7922816251426433760 below is equal to // ceil(2^(64+32) / 10^10). const uint32_t first_subsegment = static_cast( dragonbox::umul128_upper64(first_segment, 7922816251426433760ULL) >> 32); const uint64_t second_third_subsegments = first_segment - first_subsegment * 10000000000ULL; uint64_t prod; uint32_t digits; bool should_round_up; int number_of_digits_to_print = precision > 9 ? 9 : precision; // Print a 9-digits subsegment, either the first or the second. auto print_subsegment = [&](uint32_t subsegment, char* buffer) { int number_of_digits_printed = 0; // If we want to print an odd number of digits from the subsegment, if ((number_of_digits_to_print & 1) != 0) { // Convert to 64-bit fixed-point fractional form with 1-digit // integer part. The magic number 720575941 is a good enough // approximation of 2^(32 + 24) / 10^8; see // https://jk-jeon.github.io/posts/2022/12/fixed-precision-formatting/#fixed-length-case // for details. prod = ((subsegment * static_cast(720575941)) >> 24) + 1; digits = static_cast(prod >> 32); *buffer = static_cast('0' + digits); number_of_digits_printed++; } // If we want to print an even number of digits from the // first_subsegment, else { // Convert to 64-bit fixed-point fractional form with 2-digits // integer part. The magic number 450359963 is a good enough // approximation of 2^(32 + 20) / 10^7; see // https://jk-jeon.github.io/posts/2022/12/fixed-precision-formatting/#fixed-length-case // for details. prod = ((subsegment * static_cast(450359963)) >> 20) + 1; digits = static_cast(prod >> 32); copy2(buffer, digits2(digits)); number_of_digits_printed += 2; } // Print all digit pairs. while (number_of_digits_printed < number_of_digits_to_print) { prod = static_cast(prod) * static_cast(100); digits = static_cast(prod >> 32); copy2(buffer + number_of_digits_printed, digits2(digits)); number_of_digits_printed += 2; } }; // Print first subsegment. print_subsegment(first_subsegment, buf.data()); // Perform rounding if the first subsegment is the last subsegment to // print. if (precision <= 9) { // Rounding inside the subsegment. // We round-up if: // - either the fractional part is strictly larger than 1/2, or // - the fractional part is exactly 1/2 and the last digit is odd. // We rely on the following observations: // - If fractional_part >= threshold, then the fractional part is // strictly larger than 1/2. // - If the MSB of fractional_part is set, then the fractional part // must be at least 1/2. // - When the MSB of fractional_part is set, either // second_third_subsegments being nonzero or has_more_segments // being true means there are further digits not printed, so the // fractional part is strictly larger than 1/2. if (precision < 9) { uint32_t fractional_part = static_cast(prod); should_round_up = fractional_part >= fractional_part_rounding_thresholds( 8 - number_of_digits_to_print) || ((fractional_part >> 31) & ((digits & 1) | (second_third_subsegments != 0) | has_more_segments)) != 0; } // Rounding at the subsegment boundary. // In this case, the fractional part is at least 1/2 if and only if // second_third_subsegments >= 5000000000ULL, and is strictly larger // than 1/2 if we further have either second_third_subsegments > // 5000000000ULL or has_more_segments == true. else { should_round_up = second_third_subsegments > 5000000000ULL || (second_third_subsegments == 5000000000ULL && ((digits & 1) != 0 || has_more_segments)); } } // Otherwise, print the second subsegment. else { // Compilers are not aware of how to leverage the maximum value of // second_third_subsegments to find out a better magic number which // allows us to eliminate an additional shift. 1844674407370955162 = // ceil(2^64/10) < ceil(2^64*(10^9/(10^10 - 1))). const uint32_t second_subsegment = static_cast(dragonbox::umul128_upper64( second_third_subsegments, 1844674407370955162ULL)); const uint32_t third_subsegment = static_cast(second_third_subsegments) - second_subsegment * 10; number_of_digits_to_print = precision - 9; print_subsegment(second_subsegment, buf.data() + 9); // Rounding inside the subsegment. if (precision < 18) { // The condition third_subsegment != 0 implies that the segment was // of 19 digits, so in this case the third segment should be // consisting of a genuine digit from the input. uint32_t fractional_part = static_cast(prod); should_round_up = fractional_part >= fractional_part_rounding_thresholds( 8 - number_of_digits_to_print) || ((fractional_part >> 31) & ((digits & 1) | (third_subsegment != 0) | has_more_segments)) != 0; } // Rounding at the subsegment boundary. else { // In this case, the segment must be of 19 digits, thus // the third subsegment should be consisting of a genuine digit from // the input. should_round_up = third_subsegment > 5 || (third_subsegment == 5 && ((digits & 1) != 0 || has_more_segments)); } } // Round-up if necessary. if (should_round_up) { ++buf[precision - 1]; for (int i = precision - 1; i > 0 && buf[i] > '9'; --i) { buf[i] = '0'; ++buf[i - 1]; } if (buf[0] > '9') { buf[0] = '1'; if (fixed) buf[precision++] = '0'; else ++exp; } } buf.try_resize(to_unsigned(precision)); } } // if (digits_in_the_first_segment > precision) else { // Adjust the exponent for its use in Dragon4. exp += digits_in_the_first_segment - 1; } } if (use_dragon) { auto f = basic_fp(); bool is_predecessor_closer = specs.binary32 ? f.assign(static_cast(value)) : f.assign(converted_value); if (is_predecessor_closer) dragon_flags |= dragon::predecessor_closer; if (fixed) dragon_flags |= dragon::fixed; // Limit precision to the maximum possible number of significant digits in // an IEEE754 double because we don't need to generate zeros. const int max_double_digits = 767; if (precision > max_double_digits) precision = max_double_digits; format_dragon(f, dragon_flags, precision, buf, exp); } if (!fixed && !specs.showpoint) { // Remove trailing zeros. auto num_digits = buf.size(); while (num_digits > 0 && buf[num_digits - 1] == '0') { --num_digits; ++exp; } buf.try_resize(num_digits); } return exp; } template FMT_CONSTEXPR20 auto write_float(OutputIt out, T value, format_specs specs, locale_ref loc) -> OutputIt { float_specs fspecs = parse_float_type_spec(specs); fspecs.sign = specs.sign; if (detail::signbit(value)) { // value < 0 is false for NaN so use signbit. fspecs.sign = sign::minus; value = -value; } else if (fspecs.sign == sign::minus) { fspecs.sign = sign::none; } if (!detail::isfinite(value)) return write_nonfinite(out, detail::isnan(value), specs, fspecs); if (specs.align == align::numeric && fspecs.sign) { auto it = reserve(out, 1); *it++ = detail::sign(fspecs.sign); out = base_iterator(out, it); fspecs.sign = sign::none; if (specs.width != 0) --specs.width; } memory_buffer buffer; if (fspecs.format == float_format::hex) { if (fspecs.sign) buffer.push_back(detail::sign(fspecs.sign)); format_hexfloat(convert_float(value), specs.precision, fspecs, buffer); return write_bytes(out, {buffer.data(), buffer.size()}, specs); } int precision = specs.precision >= 0 || specs.type == presentation_type::none ? specs.precision : 6; if (fspecs.format == float_format::exp) { if (precision == max_value()) throw_format_error("number is too big"); else ++precision; } else if (fspecs.format != float_format::fixed && precision == 0) { precision = 1; } if (const_check(std::is_same())) fspecs.binary32 = true; int exp = format_float(convert_float(value), precision, fspecs, buffer); fspecs.precision = precision; auto f = big_decimal_fp{buffer.data(), static_cast(buffer.size()), exp}; return write_float(out, f, specs, fspecs, loc); } template ::value)> FMT_CONSTEXPR20 auto write(OutputIt out, T value, format_specs specs, locale_ref loc = {}) -> OutputIt { if (const_check(!is_supported_floating_point(value))) return out; return specs.localized && write_loc(out, value, specs, loc) ? out : write_float(out, value, specs, loc); } template ::value)> FMT_CONSTEXPR20 auto write(OutputIt out, T value) -> OutputIt { if (is_constant_evaluated()) return write(out, value, format_specs()); if (const_check(!is_supported_floating_point(value))) return out; auto fspecs = float_specs(); if (detail::signbit(value)) { fspecs.sign = sign::minus; value = -value; } constexpr auto specs = format_specs(); using floaty = conditional_t::value, double, T>; using floaty_uint = typename dragonbox::float_info::carrier_uint; floaty_uint mask = exponent_mask(); if ((bit_cast(value) & mask) == mask) return write_nonfinite(out, std::isnan(value), specs, fspecs); auto dec = dragonbox::to_decimal(static_cast(value)); return write_float(out, dec, specs, fspecs, {}); } template ::value && !is_fast_float::value)> inline auto write(OutputIt out, T value) -> OutputIt { return write(out, value, format_specs()); } template auto write(OutputIt out, monostate, format_specs = {}, locale_ref = {}) -> OutputIt { FMT_ASSERT(false, ""); return out; } template FMT_CONSTEXPR auto write(OutputIt out, basic_string_view value) -> OutputIt { auto it = reserve(out, value.size()); it = copy_str_noinline(value.begin(), value.end(), it); return base_iterator(out, it); } template ::value)> constexpr auto write(OutputIt out, const T& value) -> OutputIt { return write(out, to_string_view(value)); } // FMT_ENABLE_IF() condition separated to workaround an MSVC bug. template < typename Char, typename OutputIt, typename T, bool check = std::is_enum::value && !std::is_same::value && mapped_type_constant>::value != type::custom_type, FMT_ENABLE_IF(check)> FMT_CONSTEXPR auto write(OutputIt out, T value) -> OutputIt { return write(out, static_cast>(value)); } template ::value)> FMT_CONSTEXPR auto write(OutputIt out, T value, const format_specs& specs = {}, locale_ref = {}) -> OutputIt { return specs.type != presentation_type::none && specs.type != presentation_type::string ? write(out, value ? 1 : 0, specs, {}) : write_bytes(out, value ? "true" : "false", specs); } template FMT_CONSTEXPR auto write(OutputIt out, Char value) -> OutputIt { auto it = reserve(out, 1); *it++ = value; return base_iterator(out, it); } template FMT_CONSTEXPR_CHAR_TRAITS auto write(OutputIt out, const Char* value) -> OutputIt { if (value) return write(out, basic_string_view(value)); throw_format_error("string pointer is null"); return out; } template ::value)> auto write(OutputIt out, const T* value, const format_specs& specs = {}, locale_ref = {}) -> OutputIt { return write_ptr(out, bit_cast(value), &specs); } // A write overload that handles implicit conversions. template > FMT_CONSTEXPR auto write(OutputIt out, const T& value) -> enable_if_t< std::is_class::value && !is_string::value && !is_floating_point::value && !std::is_same::value && !std::is_same().map( value))>>::value, OutputIt> { return write(out, arg_mapper().map(value)); } template > FMT_CONSTEXPR auto write(OutputIt out, const T& value) -> enable_if_t::value == type::custom_type, OutputIt> { auto formatter = typename Context::template formatter_type(); auto parse_ctx = typename Context::parse_context_type({}); formatter.parse(parse_ctx); auto ctx = Context(out, {}, {}); return formatter.format(value, ctx); } // An argument visitor that formats the argument and writes it via the output // iterator. It's a class and not a generic lambda for compatibility with C++11. template struct default_arg_formatter { using iterator = buffer_appender; using context = buffer_context; iterator out; basic_format_args args; locale_ref loc; template auto operator()(T value) -> iterator { return write(out, value); } auto operator()(typename basic_format_arg::handle h) -> iterator { basic_format_parse_context parse_ctx({}); context format_ctx(out, args, loc); h.format(parse_ctx, format_ctx); return format_ctx.out(); } }; template struct arg_formatter { using iterator = buffer_appender; using context = buffer_context; iterator out; const format_specs& specs; locale_ref locale; template FMT_CONSTEXPR FMT_INLINE auto operator()(T value) -> iterator { return detail::write(out, value, specs, locale); } auto operator()(typename basic_format_arg::handle) -> iterator { // User-defined types are handled separately because they require access // to the parse context. return out; } }; struct width_checker { template ::value)> FMT_CONSTEXPR auto operator()(T value) -> unsigned long long { if (is_negative(value)) throw_format_error("negative width"); return static_cast(value); } template ::value)> FMT_CONSTEXPR auto operator()(T) -> unsigned long long { throw_format_error("width is not integer"); return 0; } }; struct precision_checker { template ::value)> FMT_CONSTEXPR auto operator()(T value) -> unsigned long long { if (is_negative(value)) throw_format_error("negative precision"); return static_cast(value); } template ::value)> FMT_CONSTEXPR auto operator()(T) -> unsigned long long { throw_format_error("precision is not integer"); return 0; } }; template FMT_CONSTEXPR auto get_dynamic_spec(FormatArg arg) -> int { unsigned long long value = visit_format_arg(Handler(), arg); if (value > to_unsigned(max_value())) throw_format_error("number is too big"); return static_cast(value); } template FMT_CONSTEXPR auto get_arg(Context& ctx, ID id) -> decltype(ctx.arg(id)) { auto arg = ctx.arg(id); if (!arg) ctx.on_error("argument not found"); return arg; } template FMT_CONSTEXPR void handle_dynamic_spec(int& value, arg_ref ref, Context& ctx) { switch (ref.kind) { case arg_id_kind::none: break; case arg_id_kind::index: value = detail::get_dynamic_spec(get_arg(ctx, ref.val.index)); break; case arg_id_kind::name: value = detail::get_dynamic_spec(get_arg(ctx, ref.val.name)); break; } } #if FMT_USE_USER_DEFINED_LITERALS # if FMT_USE_NONTYPE_TEMPLATE_ARGS template Str> struct statically_named_arg : view { static constexpr auto name = Str.data; const T& value; statically_named_arg(const T& v) : value(v) {} }; template Str> struct is_named_arg> : std::true_type {}; template Str> struct is_statically_named_arg> : std::true_type {}; template Str> struct udl_arg { template auto operator=(T&& value) const { return statically_named_arg(std::forward(value)); } }; # else template struct udl_arg { const Char* str; template auto operator=(T&& value) const -> named_arg { return {str, std::forward(value)}; } }; # endif #endif // FMT_USE_USER_DEFINED_LITERALS template auto vformat(const Locale& loc, basic_string_view fmt, basic_format_args>> args) -> std::basic_string { auto buf = basic_memory_buffer(); detail::vformat_to(buf, fmt, args, detail::locale_ref(loc)); return {buf.data(), buf.size()}; } using format_func = void (*)(detail::buffer&, int, const char*); FMT_API void format_error_code(buffer& out, int error_code, string_view message) noexcept; FMT_API void report_error(format_func func, int error_code, const char* message) noexcept; } // namespace detail FMT_API auto vsystem_error(int error_code, string_view format_str, format_args args) -> std::system_error; /** \rst Constructs :class:`std::system_error` with a message formatted with ``fmt::format(fmt, args...)``. *error_code* is a system error code as given by ``errno``. **Example**:: // This throws std::system_error with the description // cannot open file 'madeup': No such file or directory // or similar (system message may vary). const char* filename = "madeup"; std::FILE* file = std::fopen(filename, "r"); if (!file) throw fmt::system_error(errno, "cannot open file '{}'", filename); \endrst */ template auto system_error(int error_code, format_string fmt, T&&... args) -> std::system_error { return vsystem_error(error_code, fmt, fmt::make_format_args(args...)); } /** \rst Formats an error message for an error returned by an operating system or a language runtime, for example a file opening error, and writes it to *out*. The format is the same as the one used by ``std::system_error(ec, message)`` where ``ec`` is ``std::error_code(error_code, std::generic_category()})``. It is implementation-defined but normally looks like: .. parsed-literal:: **: ** where ** is the passed message and ** is the system message corresponding to the error code. *error_code* is a system error code as given by ``errno``. \endrst */ FMT_API void format_system_error(detail::buffer& out, int error_code, const char* message) noexcept; // Reports a system error without throwing an exception. // Can be used to report errors from destructors. FMT_API void report_system_error(int error_code, const char* message) noexcept; /** Fast integer formatter. */ class format_int { private: // Buffer should be large enough to hold all digits (digits10 + 1), // a sign and a null character. enum { buffer_size = std::numeric_limits::digits10 + 3 }; mutable char buffer_[buffer_size]; char* str_; template auto format_unsigned(UInt value) -> char* { auto n = static_cast>(value); return detail::format_decimal(buffer_, n, buffer_size - 1).begin; } template auto format_signed(Int value) -> char* { auto abs_value = static_cast>(value); bool negative = value < 0; if (negative) abs_value = 0 - abs_value; auto begin = format_unsigned(abs_value); if (negative) *--begin = '-'; return begin; } public: explicit format_int(int value) : str_(format_signed(value)) {} explicit format_int(long value) : str_(format_signed(value)) {} explicit format_int(long long value) : str_(format_signed(value)) {} explicit format_int(unsigned value) : str_(format_unsigned(value)) {} explicit format_int(unsigned long value) : str_(format_unsigned(value)) {} explicit format_int(unsigned long long value) : str_(format_unsigned(value)) {} /** Returns the number of characters written to the output buffer. */ auto size() const -> size_t { return detail::to_unsigned(buffer_ - str_ + buffer_size - 1); } /** Returns a pointer to the output buffer content. No terminating null character is appended. */ auto data() const -> const char* { return str_; } /** Returns a pointer to the output buffer content with terminating null character appended. */ auto c_str() const -> const char* { buffer_[buffer_size - 1] = '\0'; return str_; } /** \rst Returns the content of the output buffer as an ``std::string``. \endrst */ auto str() const -> std::string { return std::string(str_, size()); } }; template struct formatter::value>> : formatter, Char> { template auto format(const T& value, FormatContext& ctx) const -> decltype(ctx.out()) { using base = formatter, Char>; return base::format(format_as(value), ctx); } }; #define FMT_FORMAT_AS(Type, Base) \ template \ struct formatter : formatter {} FMT_FORMAT_AS(signed char, int); FMT_FORMAT_AS(unsigned char, unsigned); FMT_FORMAT_AS(short, int); FMT_FORMAT_AS(unsigned short, unsigned); FMT_FORMAT_AS(long, detail::long_type); FMT_FORMAT_AS(unsigned long, detail::ulong_type); FMT_FORMAT_AS(Char*, const Char*); FMT_FORMAT_AS(std::basic_string, basic_string_view); FMT_FORMAT_AS(std::nullptr_t, const void*); FMT_FORMAT_AS(detail::std_string_view, basic_string_view); FMT_FORMAT_AS(void*, const void*); template struct formatter : formatter, Char> {}; /** \rst Converts ``p`` to ``const void*`` for pointer formatting. **Example**:: auto s = fmt::format("{}", fmt::ptr(p)); \endrst */ template auto ptr(T p) -> const void* { static_assert(std::is_pointer::value, ""); return detail::bit_cast(p); } template auto ptr(const std::unique_ptr& p) -> const void* { return p.get(); } template auto ptr(const std::shared_ptr& p) -> const void* { return p.get(); } /** \rst Converts ``e`` to the underlying type. **Example**:: enum class color { red, green, blue }; auto s = fmt::format("{}", fmt::underlying(color::red)); \endrst */ template constexpr auto underlying(Enum e) noexcept -> underlying_t { return static_cast>(e); } namespace enums { template ::value)> constexpr auto format_as(Enum e) noexcept -> underlying_t { return static_cast>(e); } } // namespace enums class bytes { private: string_view data_; friend struct formatter; public: explicit bytes(string_view data) : data_(data) {} }; template <> struct formatter { private: detail::dynamic_format_specs<> specs_; public: template FMT_CONSTEXPR auto parse(ParseContext& ctx) -> const char* { return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx, detail::type::string_type); } template auto format(bytes b, FormatContext& ctx) -> decltype(ctx.out()) { detail::handle_dynamic_spec(specs_.width, specs_.width_ref, ctx); detail::handle_dynamic_spec( specs_.precision, specs_.precision_ref, ctx); return detail::write_bytes(ctx.out(), b.data_, specs_); } }; // group_digits_view is not derived from view because it copies the argument. template struct group_digits_view { T value; }; /** \rst Returns a view that formats an integer value using ',' as a locale-independent thousands separator. **Example**:: fmt::print("{}", fmt::group_digits(12345)); // Output: "12,345" \endrst */ template auto group_digits(T value) -> group_digits_view { return {value}; } template struct formatter> : formatter { private: detail::dynamic_format_specs<> specs_; public: template FMT_CONSTEXPR auto parse(ParseContext& ctx) -> const char* { return parse_format_specs(ctx.begin(), ctx.end(), specs_, ctx, detail::type::int_type); } template auto format(group_digits_view t, FormatContext& ctx) -> decltype(ctx.out()) { detail::handle_dynamic_spec(specs_.width, specs_.width_ref, ctx); detail::handle_dynamic_spec( specs_.precision, specs_.precision_ref, ctx); return detail::write_int( ctx.out(), static_cast>(t.value), 0, specs_, detail::digit_grouping("\3", ",")); } }; template struct nested_view { const formatter* fmt; const T* value; }; template struct formatter> { FMT_CONSTEXPR auto parse(format_parse_context& ctx) -> const char* { return ctx.begin(); } auto format(nested_view view, format_context& ctx) const -> decltype(ctx.out()) { return view.fmt->format(*view.value, ctx); } }; template struct nested_formatter { private: int width_; detail::fill_t fill_; align_t align_ : 4; formatter formatter_; public: constexpr nested_formatter() : width_(0), align_(align_t::none) {} FMT_CONSTEXPR auto parse(format_parse_context& ctx) -> const char* { auto specs = detail::dynamic_format_specs(); auto it = parse_format_specs(ctx.begin(), ctx.end(), specs, ctx, detail::type::none_type); width_ = specs.width; fill_ = specs.fill; align_ = specs.align; ctx.advance_to(it); return formatter_.parse(ctx); } template auto write_padded(format_context& ctx, F write) const -> decltype(ctx.out()) { if (width_ == 0) return write(ctx.out()); auto buf = memory_buffer(); write(std::back_inserter(buf)); auto specs = format_specs<>(); specs.width = width_; specs.fill = fill_; specs.align = align_; return detail::write(ctx.out(), string_view(buf.data(), buf.size()), specs); } auto nested(const T& value) const -> nested_view { return nested_view{&formatter_, &value}; } }; // DEPRECATED! join_view will be moved to ranges.h. template struct join_view : detail::view { It begin; Sentinel end; basic_string_view sep; join_view(It b, Sentinel e, basic_string_view s) : begin(b), end(e), sep(s) {} }; template struct formatter, Char> { private: using value_type = #ifdef __cpp_lib_ranges std::iter_value_t; #else typename std::iterator_traits::value_type; #endif formatter, Char> value_formatter_; public: template FMT_CONSTEXPR auto parse(ParseContext& ctx) -> const Char* { return value_formatter_.parse(ctx); } template auto format(const join_view& value, FormatContext& ctx) const -> decltype(ctx.out()) { auto it = value.begin; auto out = ctx.out(); if (it != value.end) { out = value_formatter_.format(*it, ctx); ++it; while (it != value.end) { out = detail::copy_str(value.sep.begin(), value.sep.end(), out); ctx.advance_to(out); out = value_formatter_.format(*it, ctx); ++it; } } return out; } }; /** Returns a view that formats the iterator range `[begin, end)` with elements separated by `sep`. */ template auto join(It begin, Sentinel end, string_view sep) -> join_view { return {begin, end, sep}; } /** \rst Returns a view that formats `range` with elements separated by `sep`. **Example**:: std::vector v = {1, 2, 3}; fmt::print("{}", fmt::join(v, ", ")); // Output: "1, 2, 3" ``fmt::join`` applies passed format specifiers to the range elements:: fmt::print("{:02}", fmt::join(v, ", ")); // Output: "01, 02, 03" \endrst */ template auto join(Range&& range, string_view sep) -> join_view, detail::sentinel_t> { return join(std::begin(range), std::end(range), sep); } /** \rst Converts *value* to ``std::string`` using the default format for type *T*. **Example**:: #include std::string answer = fmt::to_string(42); \endrst */ template ::value && !detail::has_format_as::value)> inline auto to_string(const T& value) -> std::string { auto buffer = memory_buffer(); detail::write(appender(buffer), value); return {buffer.data(), buffer.size()}; } template ::value)> FMT_NODISCARD inline auto to_string(T value) -> std::string { // The buffer should be large enough to store the number including the sign // or "false" for bool. constexpr int max_size = detail::digits10() + 2; char buffer[max_size > 5 ? static_cast(max_size) : 5]; char* begin = buffer; return std::string(begin, detail::write(begin, value)); } template FMT_NODISCARD auto to_string(const basic_memory_buffer& buf) -> std::basic_string { auto size = buf.size(); detail::assume(size < std::basic_string().max_size()); return std::basic_string(buf.data(), size); } template ::value && detail::has_format_as::value)> inline auto to_string(const T& value) -> std::string { return to_string(format_as(value)); } FMT_END_EXPORT namespace detail { template void vformat_to(buffer& buf, basic_string_view fmt, typename vformat_args::type args, locale_ref loc) { auto out = buffer_appender(buf); if (fmt.size() == 2 && equal2(fmt.data(), "{}")) { auto arg = args.get(0); if (!arg) throw_format_error("argument not found"); visit_format_arg(default_arg_formatter{out, args, loc}, arg); return; } struct format_handler : error_handler { basic_format_parse_context parse_context; buffer_context context; format_handler(buffer_appender p_out, basic_string_view str, basic_format_args> p_args, locale_ref p_loc) : parse_context(str), context(p_out, p_args, p_loc) {} void on_text(const Char* begin, const Char* end) { auto text = basic_string_view(begin, to_unsigned(end - begin)); context.advance_to(write(context.out(), text)); } FMT_CONSTEXPR auto on_arg_id() -> int { return parse_context.next_arg_id(); } FMT_CONSTEXPR auto on_arg_id(int id) -> int { return parse_context.check_arg_id(id), id; } FMT_CONSTEXPR auto on_arg_id(basic_string_view id) -> int { int arg_id = context.arg_id(id); if (arg_id < 0) throw_format_error("argument not found"); return arg_id; } FMT_INLINE void on_replacement_field(int id, const Char*) { auto arg = get_arg(context, id); context.advance_to(visit_format_arg( default_arg_formatter{context.out(), context.args(), context.locale()}, arg)); } auto on_format_specs(int id, const Char* begin, const Char* end) -> const Char* { auto arg = get_arg(context, id); // Not using a visitor for custom types gives better codegen. if (arg.format_custom(begin, parse_context, context)) return parse_context.begin(); auto specs = detail::dynamic_format_specs(); begin = parse_format_specs(begin, end, specs, parse_context, arg.type()); detail::handle_dynamic_spec( specs.width, specs.width_ref, context); detail::handle_dynamic_spec( specs.precision, specs.precision_ref, context); if (begin == end || *begin != '}') throw_format_error("missing '}' in format string"); auto f = arg_formatter{context.out(), specs, context.locale()}; context.advance_to(visit_format_arg(f, arg)); return begin; } }; detail::parse_format_string(fmt, format_handler(out, fmt, args, loc)); } FMT_BEGIN_EXPORT #ifndef FMT_HEADER_ONLY extern template FMT_API void vformat_to(buffer&, string_view, typename vformat_args<>::type, locale_ref); extern template FMT_API auto thousands_sep_impl(locale_ref) -> thousands_sep_result; extern template FMT_API auto thousands_sep_impl(locale_ref) -> thousands_sep_result; extern template FMT_API auto decimal_point_impl(locale_ref) -> char; extern template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; #endif // FMT_HEADER_ONLY } // namespace detail #if FMT_USE_USER_DEFINED_LITERALS inline namespace literals { /** \rst User-defined literal equivalent of :func:`fmt::arg`. **Example**:: using namespace fmt::literals; fmt::print("Elapsed time: {s:.2f} seconds", "s"_a=1.23); \endrst */ # if FMT_USE_NONTYPE_TEMPLATE_ARGS template constexpr auto operator""_a() { using char_t = remove_cvref_t; return detail::udl_arg(); } # else constexpr auto operator""_a(const char* s, size_t) -> detail::udl_arg { return {s}; } # endif } // namespace literals #endif // FMT_USE_USER_DEFINED_LITERALS template ::value)> inline auto vformat(const Locale& loc, string_view fmt, format_args args) -> std::string { return detail::vformat(loc, fmt, args); } template ::value)> inline auto format(const Locale& loc, format_string fmt, T&&... args) -> std::string { return fmt::vformat(loc, string_view(fmt), fmt::make_format_args(args...)); } template ::value&& detail::is_locale::value)> auto vformat_to(OutputIt out, const Locale& loc, string_view fmt, format_args args) -> OutputIt { using detail::get_buffer; auto&& buf = get_buffer(out); detail::vformat_to(buf, fmt, args, detail::locale_ref(loc)); return detail::get_iterator(buf, out); } template ::value&& detail::is_locale::value)> FMT_INLINE auto format_to(OutputIt out, const Locale& loc, format_string fmt, T&&... args) -> OutputIt { return vformat_to(out, loc, fmt, fmt::make_format_args(args...)); } template ::value)> FMT_NODISCARD FMT_INLINE auto formatted_size(const Locale& loc, format_string fmt, T&&... args) -> size_t { auto buf = detail::counting_buffer<>(); detail::vformat_to(buf, fmt, fmt::make_format_args(args...), detail::locale_ref(loc)); return buf.count(); } FMT_END_EXPORT template template FMT_CONSTEXPR FMT_INLINE auto formatter::value != detail::type::custom_type>>::format(const T& val, FormatContext& ctx) const -> decltype(ctx.out()) { if (specs_.width_ref.kind == detail::arg_id_kind::none && specs_.precision_ref.kind == detail::arg_id_kind::none) { return detail::write(ctx.out(), val, specs_, ctx.locale()); } auto specs = specs_; detail::handle_dynamic_spec(specs.width, specs.width_ref, ctx); detail::handle_dynamic_spec( specs.precision, specs.precision_ref, ctx); return detail::write(ctx.out(), val, specs, ctx.locale()); } FMT_END_NAMESPACE #ifdef FMT_HEADER_ONLY # define FMT_FUNC inline # include "format-inl.h" #else # define FMT_FUNC #endif #endif // FMT_FORMAT_H_ level-zero-1.20.6/third_party/spdlog_headers/spdlog/fmt/fmt.h000066400000000000000000000014711475521542100242260ustar00rootroot00000000000000// // Copyright(c) 2016-2018 Gabi Melman. // Distributed under the MIT License (http://opensource.org/licenses/MIT) // #pragma once // // Include a bundled header-only copy of fmtlib or an external one. // By default spdlog include its own copy. // #include #if defined(SPDLOG_USE_STD_FORMAT) // SPDLOG_USE_STD_FORMAT is defined - use std::format #include #elif !defined(SPDLOG_FMT_EXTERNAL) #if !defined(SPDLOG_COMPILED_LIB) && !defined(FMT_HEADER_ONLY) #define FMT_HEADER_ONLY #endif #ifndef FMT_USE_WINDOWS_H #define FMT_USE_WINDOWS_H 0 #endif #include #include #else // SPDLOG_FMT_EXTERNAL is defined - use external fmtlib #include #include #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/formatter.h000066400000000000000000000007171475521542100246570ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include namespace spdlog { class formatter { public: virtual ~formatter() = default; virtual void format(const details::log_msg &msg, memory_buf_t &dest) = 0; virtual std::unique_ptr clone() const = 0; }; } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/logger-inl.h000066400000000000000000000151051475521542100247100ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include #include #include #include namespace spdlog { // public methods SPDLOG_INLINE logger::logger(const logger &other) : name_(other.name_), sinks_(other.sinks_), level_(other.level_.load(std::memory_order_relaxed)), flush_level_(other.flush_level_.load(std::memory_order_relaxed)), custom_err_handler_(other.custom_err_handler_), tracer_(other.tracer_) {} SPDLOG_INLINE logger::logger(logger &&other) SPDLOG_NOEXCEPT : name_(std::move(other.name_)), sinks_(std::move(other.sinks_)), level_(other.level_.load(std::memory_order_relaxed)), flush_level_(other.flush_level_.load(std::memory_order_relaxed)), custom_err_handler_(std::move(other.custom_err_handler_)), tracer_(std::move(other.tracer_)) {} SPDLOG_INLINE logger &logger::operator=(logger other) SPDLOG_NOEXCEPT { this->swap(other); return *this; } SPDLOG_INLINE void logger::swap(spdlog::logger &other) SPDLOG_NOEXCEPT { name_.swap(other.name_); sinks_.swap(other.sinks_); // swap level_ auto other_level = other.level_.load(); auto my_level = level_.exchange(other_level); other.level_.store(my_level); // swap flush level_ other_level = other.flush_level_.load(); my_level = flush_level_.exchange(other_level); other.flush_level_.store(my_level); custom_err_handler_.swap(other.custom_err_handler_); std::swap(tracer_, other.tracer_); } SPDLOG_INLINE void swap(logger &a, logger &b) { a.swap(b); } SPDLOG_INLINE void logger::set_level(level::level_enum log_level) { level_.store(log_level); } SPDLOG_INLINE level::level_enum logger::level() const { return static_cast(level_.load(std::memory_order_relaxed)); } SPDLOG_INLINE const std::string &logger::name() const { return name_; } // set formatting for the sinks in this logger. // each sink will get a separate instance of the formatter object. SPDLOG_INLINE void logger::set_formatter(std::unique_ptr f) { for (auto it = sinks_.begin(); it != sinks_.end(); ++it) { if (std::next(it) == sinks_.end()) { // last element - we can be move it. (*it)->set_formatter(std::move(f)); break; // to prevent clang-tidy warning } else { (*it)->set_formatter(f->clone()); } } } SPDLOG_INLINE void logger::set_pattern(std::string pattern, pattern_time_type time_type) { auto new_formatter = details::make_unique(std::move(pattern), time_type); set_formatter(std::move(new_formatter)); } // create new backtrace sink and move to it all our child sinks SPDLOG_INLINE void logger::enable_backtrace(size_t n_messages) { tracer_.enable(n_messages); } // restore orig sinks and level and delete the backtrace sink SPDLOG_INLINE void logger::disable_backtrace() { tracer_.disable(); } SPDLOG_INLINE void logger::dump_backtrace() { dump_backtrace_(); } // flush functions SPDLOG_INLINE void logger::flush() { flush_(); } SPDLOG_INLINE void logger::flush_on(level::level_enum log_level) { flush_level_.store(log_level); } SPDLOG_INLINE level::level_enum logger::flush_level() const { return static_cast(flush_level_.load(std::memory_order_relaxed)); } // sinks SPDLOG_INLINE const std::vector &logger::sinks() const { return sinks_; } SPDLOG_INLINE std::vector &logger::sinks() { return sinks_; } // error handler SPDLOG_INLINE void logger::set_error_handler(err_handler handler) { custom_err_handler_ = std::move(handler); } // create new logger with same sinks and configuration. SPDLOG_INLINE std::shared_ptr logger::clone(std::string logger_name) { auto cloned = std::make_shared(*this); cloned->name_ = std::move(logger_name); return cloned; } // protected methods SPDLOG_INLINE void logger::log_it_(const spdlog::details::log_msg &log_msg, bool log_enabled, bool traceback_enabled) { if (log_enabled) { sink_it_(log_msg); } if (traceback_enabled) { tracer_.push_back(log_msg); } } SPDLOG_INLINE void logger::sink_it_(const details::log_msg &msg) { for (auto &sink : sinks_) { if (sink->should_log(msg.level)) { SPDLOG_TRY { sink->log(msg); } SPDLOG_LOGGER_CATCH(msg.source) } } if (should_flush_(msg)) { flush_(); } } SPDLOG_INLINE void logger::flush_() { for (auto &sink : sinks_) { SPDLOG_TRY { sink->flush(); } SPDLOG_LOGGER_CATCH(source_loc()) } } SPDLOG_INLINE void logger::dump_backtrace_() { using details::log_msg; if (tracer_.enabled() && !tracer_.empty()) { sink_it_( log_msg{name(), level::info, "****************** Backtrace Start ******************"}); tracer_.foreach_pop([this](const log_msg &msg) { this->sink_it_(msg); }); sink_it_( log_msg{name(), level::info, "****************** Backtrace End ********************"}); } } SPDLOG_INLINE bool logger::should_flush_(const details::log_msg &msg) { auto flush_level = flush_level_.load(std::memory_order_relaxed); return (msg.level >= flush_level) && (msg.level != level::off); } SPDLOG_INLINE void logger::err_handler_(const std::string &msg) { if (custom_err_handler_) { custom_err_handler_(msg); } else { using std::chrono::system_clock; static std::mutex mutex; static std::chrono::system_clock::time_point last_report_time; static size_t err_counter = 0; std::lock_guard lk{mutex}; auto now = system_clock::now(); err_counter++; if (now - last_report_time < std::chrono::seconds(1)) { return; } last_report_time = now; auto tm_time = details::os::localtime(system_clock::to_time_t(now)); char date_buf[64]; std::strftime(date_buf, sizeof(date_buf), "%Y-%m-%d %H:%M:%S", &tm_time); #if defined(USING_R) && defined(R_R_H) // if in R environment REprintf("[*** LOG ERROR #%04zu ***] [%s] [%s] %s\n", err_counter, date_buf, name().c_str(), msg.c_str()); #else std::fprintf(stderr, "[*** LOG ERROR #%04zu ***] [%s] [%s] %s\n", err_counter, date_buf, name().c_str(), msg.c_str()); #endif } } } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/logger.h000066400000000000000000000321441475521542100241320ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once // Thread safe logger (except for set_error_handler()) // Has name, log level, vector of std::shared sink pointers and formatter // Upon each log write the logger: // 1. Checks if its log level is enough to log the message and if yes: // 2. Call the underlying sinks to do the job. // 3. Each sink use its own private copy of a formatter to format the message // and send to its destination. // // The use of private formatter per sink provides the opportunity to cache some // formatted data, and support for different format per sink. #include #include #include #ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT #ifndef _WIN32 #error SPDLOG_WCHAR_TO_UTF8_SUPPORT only supported on windows #endif #include #endif #include #ifndef SPDLOG_NO_EXCEPTIONS #define SPDLOG_LOGGER_CATCH(location) \ catch (const std::exception &ex) { \ if (location.filename) { \ err_handler_(fmt_lib::format(SPDLOG_FMT_STRING("{} [{}({})]"), ex.what(), \ location.filename, location.line)); \ } else { \ err_handler_(ex.what()); \ } \ } \ catch (...) { \ err_handler_("Rethrowing unknown exception in logger"); \ throw; \ } #else #define SPDLOG_LOGGER_CATCH(location) #endif namespace spdlog { class SPDLOG_API logger { public: // Empty logger explicit logger(std::string name) : name_(std::move(name)), sinks_() {} // Logger with range on sinks template logger(std::string name, It begin, It end) : name_(std::move(name)), sinks_(begin, end) {} // Logger with single sink logger(std::string name, sink_ptr single_sink) : logger(std::move(name), {std::move(single_sink)}) {} // Logger with sinks init list logger(std::string name, sinks_init_list sinks) : logger(std::move(name), sinks.begin(), sinks.end()) {} virtual ~logger() = default; logger(const logger &other); logger(logger &&other) SPDLOG_NOEXCEPT; logger &operator=(logger other) SPDLOG_NOEXCEPT; void swap(spdlog::logger &other) SPDLOG_NOEXCEPT; template void log(source_loc loc, level::level_enum lvl, format_string_t fmt, Args &&...args) { log_(loc, lvl, details::to_string_view(fmt), std::forward(args)...); } template void log(level::level_enum lvl, format_string_t fmt, Args &&...args) { log(source_loc{}, lvl, fmt, std::forward(args)...); } template void log(level::level_enum lvl, const T &msg) { log(source_loc{}, lvl, msg); } // T cannot be statically converted to format string (including string_view/wstring_view) template ::value, int>::type = 0> void log(source_loc loc, level::level_enum lvl, const T &msg) { log(loc, lvl, "{}", msg); } void log(log_clock::time_point log_time, source_loc loc, level::level_enum lvl, string_view_t msg) { bool log_enabled = should_log(lvl); bool traceback_enabled = tracer_.enabled(); if (!log_enabled && !traceback_enabled) { return; } details::log_msg log_msg(log_time, loc, name_, lvl, msg); log_it_(log_msg, log_enabled, traceback_enabled); } void log(source_loc loc, level::level_enum lvl, string_view_t msg) { bool log_enabled = should_log(lvl); bool traceback_enabled = tracer_.enabled(); if (!log_enabled && !traceback_enabled) { return; } details::log_msg log_msg(loc, name_, lvl, msg); log_it_(log_msg, log_enabled, traceback_enabled); } void log(level::level_enum lvl, string_view_t msg) { log(source_loc{}, lvl, msg); } template void trace(format_string_t fmt, Args &&...args) { log(level::trace, fmt, std::forward(args)...); } template void debug(format_string_t fmt, Args &&...args) { log(level::debug, fmt, std::forward(args)...); } template void info(format_string_t fmt, Args &&...args) { log(level::info, fmt, std::forward(args)...); } template void warn(format_string_t fmt, Args &&...args) { log(level::warn, fmt, std::forward(args)...); } template void error(format_string_t fmt, Args &&...args) { log(level::err, fmt, std::forward(args)...); } template void critical(format_string_t fmt, Args &&...args) { log(level::critical, fmt, std::forward(args)...); } #ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT template void log(source_loc loc, level::level_enum lvl, wformat_string_t fmt, Args &&...args) { log_(loc, lvl, details::to_string_view(fmt), std::forward(args)...); } template void log(level::level_enum lvl, wformat_string_t fmt, Args &&...args) { log(source_loc{}, lvl, fmt, std::forward(args)...); } void log(log_clock::time_point log_time, source_loc loc, level::level_enum lvl, wstring_view_t msg) { bool log_enabled = should_log(lvl); bool traceback_enabled = tracer_.enabled(); if (!log_enabled && !traceback_enabled) { return; } memory_buf_t buf; details::os::wstr_to_utf8buf(wstring_view_t(msg.data(), msg.size()), buf); details::log_msg log_msg(log_time, loc, name_, lvl, string_view_t(buf.data(), buf.size())); log_it_(log_msg, log_enabled, traceback_enabled); } void log(source_loc loc, level::level_enum lvl, wstring_view_t msg) { bool log_enabled = should_log(lvl); bool traceback_enabled = tracer_.enabled(); if (!log_enabled && !traceback_enabled) { return; } memory_buf_t buf; details::os::wstr_to_utf8buf(wstring_view_t(msg.data(), msg.size()), buf); details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size())); log_it_(log_msg, log_enabled, traceback_enabled); } void log(level::level_enum lvl, wstring_view_t msg) { log(source_loc{}, lvl, msg); } template void trace(wformat_string_t fmt, Args &&...args) { log(level::trace, fmt, std::forward(args)...); } template void debug(wformat_string_t fmt, Args &&...args) { log(level::debug, fmt, std::forward(args)...); } template void info(wformat_string_t fmt, Args &&...args) { log(level::info, fmt, std::forward(args)...); } template void warn(wformat_string_t fmt, Args &&...args) { log(level::warn, fmt, std::forward(args)...); } template void error(wformat_string_t fmt, Args &&...args) { log(level::err, fmt, std::forward(args)...); } template void critical(wformat_string_t fmt, Args &&...args) { log(level::critical, fmt, std::forward(args)...); } #endif template void trace(const T &msg) { log(level::trace, msg); } template void debug(const T &msg) { log(level::debug, msg); } template void info(const T &msg) { log(level::info, msg); } template void warn(const T &msg) { log(level::warn, msg); } template void error(const T &msg) { log(level::err, msg); } template void critical(const T &msg) { log(level::critical, msg); } // return true logging is enabled for the given level. bool should_log(level::level_enum msg_level) const { return msg_level >= level_.load(std::memory_order_relaxed); } // return true if backtrace logging is enabled. bool should_backtrace() const { return tracer_.enabled(); } void set_level(level::level_enum log_level); level::level_enum level() const; const std::string &name() const; // set formatting for the sinks in this logger. // each sink will get a separate instance of the formatter object. void set_formatter(std::unique_ptr f); // set formatting for the sinks in this logger. // equivalent to // set_formatter(make_unique(pattern, time_type)) // Note: each sink will get a new instance of a formatter object, replacing the old one. void set_pattern(std::string pattern, pattern_time_type time_type = pattern_time_type::local); // backtrace support. // efficiently store all debug/trace messages in a circular buffer until needed for debugging. void enable_backtrace(size_t n_messages); void disable_backtrace(); void dump_backtrace(); // flush functions void flush(); void flush_on(level::level_enum log_level); level::level_enum flush_level() const; // sinks const std::vector &sinks() const; std::vector &sinks(); // error handler void set_error_handler(err_handler); // create new logger with same sinks and configuration. virtual std::shared_ptr clone(std::string logger_name); protected: std::string name_; std::vector sinks_; spdlog::level_t level_{level::info}; spdlog::level_t flush_level_{level::off}; err_handler custom_err_handler_{nullptr}; details::backtracer tracer_; // common implementation for after templated public api has been resolved template void log_(source_loc loc, level::level_enum lvl, string_view_t fmt, Args &&...args) { bool log_enabled = should_log(lvl); bool traceback_enabled = tracer_.enabled(); if (!log_enabled && !traceback_enabled) { return; } SPDLOG_TRY { memory_buf_t buf; #ifdef SPDLOG_USE_STD_FORMAT fmt_lib::vformat_to(std::back_inserter(buf), fmt, fmt_lib::make_format_args(args...)); #else fmt::vformat_to(fmt::appender(buf), fmt, fmt::make_format_args(args...)); #endif details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size())); log_it_(log_msg, log_enabled, traceback_enabled); } SPDLOG_LOGGER_CATCH(loc) } #ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT template void log_(source_loc loc, level::level_enum lvl, wstring_view_t fmt, Args &&...args) { bool log_enabled = should_log(lvl); bool traceback_enabled = tracer_.enabled(); if (!log_enabled && !traceback_enabled) { return; } SPDLOG_TRY { // format to wmemory_buffer and convert to utf8 wmemory_buf_t wbuf; fmt_lib::vformat_to(std::back_inserter(wbuf), fmt, fmt_lib::make_format_args(args...)); memory_buf_t buf; details::os::wstr_to_utf8buf(wstring_view_t(wbuf.data(), wbuf.size()), buf); details::log_msg log_msg(loc, name_, lvl, string_view_t(buf.data(), buf.size())); log_it_(log_msg, log_enabled, traceback_enabled); } SPDLOG_LOGGER_CATCH(loc) } #endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT // log the given message (if the given log level is high enough), // and save backtrace (if backtrace is enabled). void log_it_(const details::log_msg &log_msg, bool log_enabled, bool traceback_enabled); virtual void sink_it_(const details::log_msg &msg); virtual void flush_(); void dump_backtrace_(); bool should_flush_(const details::log_msg &msg); // handle errors during logging. // default handler prints the error to stderr at max rate of 1 message/sec. void err_handler_(const std::string &msg); }; void swap(logger &a, logger &b); } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "logger-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/mdc.h000066400000000000000000000025221475521542100234130ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include #include // MDC is a simple map of key->string values stored in thread local storage whose content will be printed by the loggers. // Note: Not supported in async mode (thread local storage - so the async thread pool have different copy). // // Usage example: // spdlog::mdc::put("mdc_key_1", "mdc_value_1"); // spdlog::info("Hello, {}", "World!"); // => [2024-04-26 02:08:05.040] [info] [mdc_key_1:mdc_value_1] Hello, World! namespace spdlog { class SPDLOG_API mdc { public: using mdc_map_t = std::map; static void put(const std::string &key, const std::string &value) { get_context()[key] = value; } static std::string get(const std::string &key) { auto &context = get_context(); auto it = context.find(key); if (it != context.end()) { return it->second; } return ""; } static void remove(const std::string &key) { get_context().erase(key); } static void clear() { get_context().clear(); } static mdc_map_t &get_context() { static thread_local mdc_map_t context; return context; } }; } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/pattern_formatter-inl.h000066400000000000000000001325651475521542100272030ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace spdlog { namespace details { /////////////////////////////////////////////////////////////////////// // name & level pattern appender /////////////////////////////////////////////////////////////////////// class scoped_padder { public: scoped_padder(size_t wrapped_size, const padding_info &padinfo, memory_buf_t &dest) : padinfo_(padinfo), dest_(dest) { remaining_pad_ = static_cast(padinfo.width_) - static_cast(wrapped_size); if (remaining_pad_ <= 0) { return; } if (padinfo_.side_ == padding_info::pad_side::left) { pad_it(remaining_pad_); remaining_pad_ = 0; } else if (padinfo_.side_ == padding_info::pad_side::center) { auto half_pad = remaining_pad_ / 2; auto reminder = remaining_pad_ & 1; pad_it(half_pad); remaining_pad_ = half_pad + reminder; // for the right side } } template static unsigned int count_digits(T n) { return fmt_helper::count_digits(n); } ~scoped_padder() { if (remaining_pad_ >= 0) { pad_it(remaining_pad_); } else if (padinfo_.truncate_) { long new_size = static_cast(dest_.size()) + remaining_pad_; dest_.resize(static_cast(new_size)); } } private: void pad_it(long count) { fmt_helper::append_string_view(string_view_t(spaces_.data(), static_cast(count)), dest_); } const padding_info &padinfo_; memory_buf_t &dest_; long remaining_pad_; string_view_t spaces_{" ", 64}; }; struct null_scoped_padder { null_scoped_padder(size_t /*wrapped_size*/, const padding_info & /*padinfo*/, memory_buf_t & /*dest*/) {} template static unsigned int count_digits(T /* number */) { return 0; } }; template class name_formatter final : public flag_formatter { public: explicit name_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { ScopedPadder p(msg.logger_name.size(), padinfo_, dest); fmt_helper::append_string_view(msg.logger_name, dest); } }; // log level appender template class level_formatter final : public flag_formatter { public: explicit level_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { const string_view_t &level_name = level::to_string_view(msg.level); ScopedPadder p(level_name.size(), padinfo_, dest); fmt_helper::append_string_view(level_name, dest); } }; // short log level appender template class short_level_formatter final : public flag_formatter { public: explicit short_level_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { string_view_t level_name{level::to_short_c_str(msg.level)}; ScopedPadder p(level_name.size(), padinfo_, dest); fmt_helper::append_string_view(level_name, dest); } }; /////////////////////////////////////////////////////////////////////// // Date time pattern appenders /////////////////////////////////////////////////////////////////////// static const char *ampm(const tm &t) { return t.tm_hour >= 12 ? "PM" : "AM"; } static int to12h(const tm &t) { return t.tm_hour > 12 ? t.tm_hour - 12 : t.tm_hour; } // Abbreviated weekday name static std::array days{{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}}; template class a_formatter final : public flag_formatter { public: explicit a_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { string_view_t field_value{days[static_cast(tm_time.tm_wday)]}; ScopedPadder p(field_value.size(), padinfo_, dest); fmt_helper::append_string_view(field_value, dest); } }; // Full weekday name static std::array full_days{ {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}}; template class A_formatter : public flag_formatter { public: explicit A_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { string_view_t field_value{full_days[static_cast(tm_time.tm_wday)]}; ScopedPadder p(field_value.size(), padinfo_, dest); fmt_helper::append_string_view(field_value, dest); } }; // Abbreviated month static const std::array months{ {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"}}; template class b_formatter final : public flag_formatter { public: explicit b_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { string_view_t field_value{months[static_cast(tm_time.tm_mon)]}; ScopedPadder p(field_value.size(), padinfo_, dest); fmt_helper::append_string_view(field_value, dest); } }; // Full month name static const std::array full_months{{"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}}; template class B_formatter final : public flag_formatter { public: explicit B_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { string_view_t field_value{full_months[static_cast(tm_time.tm_mon)]}; ScopedPadder p(field_value.size(), padinfo_, dest); fmt_helper::append_string_view(field_value, dest); } }; // Date and time representation (Thu Aug 23 15:35:46 2014) template class c_formatter final : public flag_formatter { public: explicit c_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 24; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::append_string_view(days[static_cast(tm_time.tm_wday)], dest); dest.push_back(' '); fmt_helper::append_string_view(months[static_cast(tm_time.tm_mon)], dest); dest.push_back(' '); fmt_helper::append_int(tm_time.tm_mday, dest); dest.push_back(' '); // time fmt_helper::pad2(tm_time.tm_hour, dest); dest.push_back(':'); fmt_helper::pad2(tm_time.tm_min, dest); dest.push_back(':'); fmt_helper::pad2(tm_time.tm_sec, dest); dest.push_back(' '); fmt_helper::append_int(tm_time.tm_year + 1900, dest); } }; // year - 2 digit template class C_formatter final : public flag_formatter { public: explicit C_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 2; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad2(tm_time.tm_year % 100, dest); } }; // Short MM/DD/YY date, equivalent to %m/%d/%y 08/23/01 template class D_formatter final : public flag_formatter { public: explicit D_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 10; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad2(tm_time.tm_mon + 1, dest); dest.push_back('/'); fmt_helper::pad2(tm_time.tm_mday, dest); dest.push_back('/'); fmt_helper::pad2(tm_time.tm_year % 100, dest); } }; // year - 4 digit template class Y_formatter final : public flag_formatter { public: explicit Y_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 4; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::append_int(tm_time.tm_year + 1900, dest); } }; // month 1-12 template class m_formatter final : public flag_formatter { public: explicit m_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 2; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad2(tm_time.tm_mon + 1, dest); } }; // day of month 1-31 template class d_formatter final : public flag_formatter { public: explicit d_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 2; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad2(tm_time.tm_mday, dest); } }; // hours in 24 format 0-23 template class H_formatter final : public flag_formatter { public: explicit H_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 2; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad2(tm_time.tm_hour, dest); } }; // hours in 12 format 1-12 template class I_formatter final : public flag_formatter { public: explicit I_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 2; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad2(to12h(tm_time), dest); } }; // minutes 0-59 template class M_formatter final : public flag_formatter { public: explicit M_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 2; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad2(tm_time.tm_min, dest); } }; // seconds 0-59 template class S_formatter final : public flag_formatter { public: explicit S_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 2; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad2(tm_time.tm_sec, dest); } }; // milliseconds template class e_formatter final : public flag_formatter { public: explicit e_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { auto millis = fmt_helper::time_fraction(msg.time); const size_t field_size = 3; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad3(static_cast(millis.count()), dest); } }; // microseconds template class f_formatter final : public flag_formatter { public: explicit f_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { auto micros = fmt_helper::time_fraction(msg.time); const size_t field_size = 6; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad6(static_cast(micros.count()), dest); } }; // nanoseconds template class F_formatter final : public flag_formatter { public: explicit F_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { auto ns = fmt_helper::time_fraction(msg.time); const size_t field_size = 9; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad9(static_cast(ns.count()), dest); } }; // seconds since epoch template class E_formatter final : public flag_formatter { public: explicit E_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { const size_t field_size = 10; ScopedPadder p(field_size, padinfo_, dest); auto duration = msg.time.time_since_epoch(); auto seconds = std::chrono::duration_cast(duration).count(); fmt_helper::append_int(seconds, dest); } }; // AM/PM template class p_formatter final : public flag_formatter { public: explicit p_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 2; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::append_string_view(ampm(tm_time), dest); } }; // 12 hour clock 02:55:02 pm template class r_formatter final : public flag_formatter { public: explicit r_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 11; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad2(to12h(tm_time), dest); dest.push_back(':'); fmt_helper::pad2(tm_time.tm_min, dest); dest.push_back(':'); fmt_helper::pad2(tm_time.tm_sec, dest); dest.push_back(' '); fmt_helper::append_string_view(ampm(tm_time), dest); } }; // 24-hour HH:MM time, equivalent to %H:%M template class R_formatter final : public flag_formatter { public: explicit R_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 5; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad2(tm_time.tm_hour, dest); dest.push_back(':'); fmt_helper::pad2(tm_time.tm_min, dest); } }; // ISO 8601 time format (HH:MM:SS), equivalent to %H:%M:%S template class T_formatter final : public flag_formatter { public: explicit T_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 8; ScopedPadder p(field_size, padinfo_, dest); fmt_helper::pad2(tm_time.tm_hour, dest); dest.push_back(':'); fmt_helper::pad2(tm_time.tm_min, dest); dest.push_back(':'); fmt_helper::pad2(tm_time.tm_sec, dest); } }; // ISO 8601 offset from UTC in timezone (+-HH:MM) template class z_formatter final : public flag_formatter { public: explicit z_formatter(padding_info padinfo) : flag_formatter(padinfo) {} z_formatter() = default; z_formatter(const z_formatter &) = delete; z_formatter &operator=(const z_formatter &) = delete; void format(const details::log_msg &msg, const std::tm &tm_time, memory_buf_t &dest) override { const size_t field_size = 6; ScopedPadder p(field_size, padinfo_, dest); auto total_minutes = get_cached_offset(msg, tm_time); bool is_negative = total_minutes < 0; if (is_negative) { total_minutes = -total_minutes; dest.push_back('-'); } else { dest.push_back('+'); } fmt_helper::pad2(total_minutes / 60, dest); // hours dest.push_back(':'); fmt_helper::pad2(total_minutes % 60, dest); // minutes } private: log_clock::time_point last_update_{std::chrono::seconds(0)}; int offset_minutes_{0}; int get_cached_offset(const log_msg &msg, const std::tm &tm_time) { // refresh every 10 seconds if (msg.time - last_update_ >= std::chrono::seconds(10)) { offset_minutes_ = os::utc_minutes_offset(tm_time); last_update_ = msg.time; } return offset_minutes_; } }; // Thread id template class t_formatter final : public flag_formatter { public: explicit t_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { const auto field_size = ScopedPadder::count_digits(msg.thread_id); ScopedPadder p(field_size, padinfo_, dest); fmt_helper::append_int(msg.thread_id, dest); } }; // Current pid template class pid_formatter final : public flag_formatter { public: explicit pid_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &, memory_buf_t &dest) override { const auto pid = static_cast(details::os::pid()); auto field_size = ScopedPadder::count_digits(pid); ScopedPadder p(field_size, padinfo_, dest); fmt_helper::append_int(pid, dest); } }; template class v_formatter final : public flag_formatter { public: explicit v_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { ScopedPadder p(msg.payload.size(), padinfo_, dest); fmt_helper::append_string_view(msg.payload, dest); } }; class ch_formatter final : public flag_formatter { public: explicit ch_formatter(char ch) : ch_(ch) {} void format(const details::log_msg &, const std::tm &, memory_buf_t &dest) override { dest.push_back(ch_); } private: char ch_; }; // aggregate user chars to display as is class aggregate_formatter final : public flag_formatter { public: aggregate_formatter() = default; void add_ch(char ch) { str_ += ch; } void format(const details::log_msg &, const std::tm &, memory_buf_t &dest) override { fmt_helper::append_string_view(str_, dest); } private: std::string str_; }; // mark the color range. expect it to be in the form of "%^colored text%$" class color_start_formatter final : public flag_formatter { public: explicit color_start_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { msg.color_range_start = dest.size(); } }; class color_stop_formatter final : public flag_formatter { public: explicit color_stop_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { msg.color_range_end = dest.size(); } }; // print source location template class source_location_formatter final : public flag_formatter { public: explicit source_location_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { if (msg.source.empty()) { ScopedPadder p(0, padinfo_, dest); return; } size_t text_size; if (padinfo_.enabled()) { // calc text size for padding based on "filename:line" text_size = std::char_traits::length(msg.source.filename) + ScopedPadder::count_digits(msg.source.line) + 1; } else { text_size = 0; } ScopedPadder p(text_size, padinfo_, dest); fmt_helper::append_string_view(msg.source.filename, dest); dest.push_back(':'); fmt_helper::append_int(msg.source.line, dest); } }; // print source filename template class source_filename_formatter final : public flag_formatter { public: explicit source_filename_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { if (msg.source.empty()) { ScopedPadder p(0, padinfo_, dest); return; } size_t text_size = padinfo_.enabled() ? std::char_traits::length(msg.source.filename) : 0; ScopedPadder p(text_size, padinfo_, dest); fmt_helper::append_string_view(msg.source.filename, dest); } }; template class short_filename_formatter final : public flag_formatter { public: explicit short_filename_formatter(padding_info padinfo) : flag_formatter(padinfo) {} #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable : 4127) // consider using 'if constexpr' instead #endif // _MSC_VER static const char *basename(const char *filename) { // if the size is 2 (1 character + null terminator) we can use the more efficient strrchr // the branch will be elided by optimizations if (sizeof(os::folder_seps) == 2) { const char *rv = std::strrchr(filename, os::folder_seps[0]); return rv != nullptr ? rv + 1 : filename; } else { const std::reverse_iterator begin(filename + std::strlen(filename)); const std::reverse_iterator end(filename); const auto it = std::find_first_of(begin, end, std::begin(os::folder_seps), std::end(os::folder_seps) - 1); return it != end ? it.base() : filename; } } #ifdef _MSC_VER #pragma warning(pop) #endif // _MSC_VER void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { if (msg.source.empty()) { ScopedPadder p(0, padinfo_, dest); return; } auto filename = basename(msg.source.filename); size_t text_size = padinfo_.enabled() ? std::char_traits::length(filename) : 0; ScopedPadder p(text_size, padinfo_, dest); fmt_helper::append_string_view(filename, dest); } }; template class source_linenum_formatter final : public flag_formatter { public: explicit source_linenum_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { if (msg.source.empty()) { ScopedPadder p(0, padinfo_, dest); return; } auto field_size = ScopedPadder::count_digits(msg.source.line); ScopedPadder p(field_size, padinfo_, dest); fmt_helper::append_int(msg.source.line, dest); } }; // print source funcname template class source_funcname_formatter final : public flag_formatter { public: explicit source_funcname_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { if (msg.source.empty()) { ScopedPadder p(0, padinfo_, dest); return; } size_t text_size = padinfo_.enabled() ? std::char_traits::length(msg.source.funcname) : 0; ScopedPadder p(text_size, padinfo_, dest); fmt_helper::append_string_view(msg.source.funcname, dest); } }; // print elapsed time since last message template class elapsed_formatter final : public flag_formatter { public: using DurationUnits = Units; explicit elapsed_formatter(padding_info padinfo) : flag_formatter(padinfo), last_message_time_(log_clock::now()) {} void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override { auto delta = (std::max)(msg.time - last_message_time_, log_clock::duration::zero()); auto delta_units = std::chrono::duration_cast(delta); last_message_time_ = msg.time; auto delta_count = static_cast(delta_units.count()); auto n_digits = static_cast(ScopedPadder::count_digits(delta_count)); ScopedPadder p(n_digits, padinfo_, dest); fmt_helper::append_int(delta_count, dest); } private: log_clock::time_point last_message_time_; }; // Class for formatting Mapped Diagnostic Context (MDC) in log messages. // Example: [logger-name] [info] [mdc_key_1:mdc_value_1 mdc_key_2:mdc_value_2] some message template class mdc_formatter : public flag_formatter { public: explicit mdc_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &, const std::tm &, memory_buf_t &dest) override { auto &mdc_map = mdc::get_context(); if (mdc_map.empty()) { ScopedPadder p(0, padinfo_, dest); return; } else { format_mdc(mdc_map, dest); } } void format_mdc(const mdc::mdc_map_t &mdc_map, memory_buf_t &dest) { auto last_element = --mdc_map.end(); for (auto it = mdc_map.begin(); it != mdc_map.end(); ++it) { auto &pair = *it; const auto &key = pair.first; const auto &value = pair.second; size_t content_size = key.size() + value.size() + 1; // 1 for ':' if (it != last_element) { content_size++; // 1 for ' ' } ScopedPadder p(content_size, padinfo_, dest); fmt_helper::append_string_view(key, dest); fmt_helper::append_string_view(":", dest); fmt_helper::append_string_view(value, dest); if (it != last_element) { fmt_helper::append_string_view(" ", dest); } } } }; // Full info formatter // pattern: [%Y-%m-%d %H:%M:%S.%e] [%n] [%l] [%s:%#] %v class full_formatter final : public flag_formatter { public: explicit full_formatter(padding_info padinfo) : flag_formatter(padinfo) {} void format(const details::log_msg &msg, const std::tm &tm_time, memory_buf_t &dest) override { using std::chrono::duration_cast; using std::chrono::milliseconds; using std::chrono::seconds; // cache the date/time part for the next second. auto duration = msg.time.time_since_epoch(); auto secs = duration_cast(duration); if (cache_timestamp_ != secs || cached_datetime_.size() == 0) { cached_datetime_.clear(); cached_datetime_.push_back('['); fmt_helper::append_int(tm_time.tm_year + 1900, cached_datetime_); cached_datetime_.push_back('-'); fmt_helper::pad2(tm_time.tm_mon + 1, cached_datetime_); cached_datetime_.push_back('-'); fmt_helper::pad2(tm_time.tm_mday, cached_datetime_); cached_datetime_.push_back(' '); fmt_helper::pad2(tm_time.tm_hour, cached_datetime_); cached_datetime_.push_back(':'); fmt_helper::pad2(tm_time.tm_min, cached_datetime_); cached_datetime_.push_back(':'); fmt_helper::pad2(tm_time.tm_sec, cached_datetime_); cached_datetime_.push_back('.'); cache_timestamp_ = secs; } dest.append(cached_datetime_.begin(), cached_datetime_.end()); auto millis = fmt_helper::time_fraction(msg.time); fmt_helper::pad3(static_cast(millis.count()), dest); dest.push_back(']'); dest.push_back(' '); // append logger name if exists if (msg.logger_name.size() > 0) { dest.push_back('['); fmt_helper::append_string_view(msg.logger_name, dest); dest.push_back(']'); dest.push_back(' '); } dest.push_back('['); // wrap the level name with color msg.color_range_start = dest.size(); // fmt_helper::append_string_view(level::to_c_str(msg.level), dest); fmt_helper::append_string_view(level::to_string_view(msg.level), dest); msg.color_range_end = dest.size(); dest.push_back(']'); dest.push_back(' '); // add source location if present if (!msg.source.empty()) { dest.push_back('['); const char *filename = details::short_filename_formatter::basename( msg.source.filename); fmt_helper::append_string_view(filename, dest); dest.push_back(':'); fmt_helper::append_int(msg.source.line, dest); dest.push_back(']'); dest.push_back(' '); } // add mdc if present auto &mdc_map = mdc::get_context(); if (!mdc_map.empty()) { dest.push_back('['); mdc_formatter_.format_mdc(mdc_map, dest); dest.push_back(']'); dest.push_back(' '); } // fmt_helper::append_string_view(msg.msg(), dest); fmt_helper::append_string_view(msg.payload, dest); } private: std::chrono::seconds cache_timestamp_{0}; memory_buf_t cached_datetime_; mdc_formatter mdc_formatter_{padding_info{}}; }; } // namespace details SPDLOG_INLINE pattern_formatter::pattern_formatter(std::string pattern, pattern_time_type time_type, std::string eol, custom_flags custom_user_flags) : pattern_(std::move(pattern)), eol_(std::move(eol)), pattern_time_type_(time_type), need_localtime_(false), last_log_secs_(0), custom_handlers_(std::move(custom_user_flags)) { std::memset(&cached_tm_, 0, sizeof(cached_tm_)); compile_pattern_(pattern_); } // use by default full formatter for if pattern is not given SPDLOG_INLINE pattern_formatter::pattern_formatter(pattern_time_type time_type, std::string eol) : pattern_("%+"), eol_(std::move(eol)), pattern_time_type_(time_type), need_localtime_(true), last_log_secs_(0) { std::memset(&cached_tm_, 0, sizeof(cached_tm_)); formatters_.push_back(details::make_unique(details::padding_info{})); } SPDLOG_INLINE std::unique_ptr pattern_formatter::clone() const { custom_flags cloned_custom_formatters; for (auto &it : custom_handlers_) { cloned_custom_formatters[it.first] = it.second->clone(); } auto cloned = details::make_unique(pattern_, pattern_time_type_, eol_, std::move(cloned_custom_formatters)); cloned->need_localtime(need_localtime_); #if defined(__GNUC__) && __GNUC__ < 5 return std::move(cloned); #else return cloned; #endif } SPDLOG_INLINE void pattern_formatter::format(const details::log_msg &msg, memory_buf_t &dest) { if (need_localtime_) { const auto secs = std::chrono::duration_cast(msg.time.time_since_epoch()); if (secs != last_log_secs_) { cached_tm_ = get_time_(msg); last_log_secs_ = secs; } } for (auto &f : formatters_) { f->format(msg, cached_tm_, dest); } // write eol details::fmt_helper::append_string_view(eol_, dest); } SPDLOG_INLINE void pattern_formatter::set_pattern(std::string pattern) { pattern_ = std::move(pattern); need_localtime_ = false; compile_pattern_(pattern_); } SPDLOG_INLINE void pattern_formatter::need_localtime(bool need) { need_localtime_ = need; } SPDLOG_INLINE std::tm pattern_formatter::get_time_(const details::log_msg &msg) { if (pattern_time_type_ == pattern_time_type::local) { return details::os::localtime(log_clock::to_time_t(msg.time)); } return details::os::gmtime(log_clock::to_time_t(msg.time)); } template SPDLOG_INLINE void pattern_formatter::handle_flag_(char flag, details::padding_info padding) { // process custom flags auto it = custom_handlers_.find(flag); if (it != custom_handlers_.end()) { auto custom_handler = it->second->clone(); custom_handler->set_padding_info(padding); formatters_.push_back(std::move(custom_handler)); return; } // process built-in flags switch (flag) { case ('+'): // default formatter formatters_.push_back(details::make_unique(padding)); need_localtime_ = true; break; case 'n': // logger name formatters_.push_back(details::make_unique>(padding)); break; case 'l': // level formatters_.push_back(details::make_unique>(padding)); break; case 'L': // short level formatters_.push_back( details::make_unique>(padding)); break; case ('t'): // thread id formatters_.push_back(details::make_unique>(padding)); break; case ('v'): // the message text formatters_.push_back(details::make_unique>(padding)); break; case ('a'): // weekday formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('A'): // short weekday formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('b'): case ('h'): // month formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('B'): // short month formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('c'): // datetime formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('C'): // year 2 digits formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('Y'): // year 4 digits formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('D'): case ('x'): // datetime MM/DD/YY formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('m'): // month 1-12 formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('d'): // day of month 1-31 formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('H'): // hours 24 formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('I'): // hours 12 formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('M'): // minutes formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('S'): // seconds formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('e'): // milliseconds formatters_.push_back(details::make_unique>(padding)); break; case ('f'): // microseconds formatters_.push_back(details::make_unique>(padding)); break; case ('F'): // nanoseconds formatters_.push_back(details::make_unique>(padding)); break; case ('E'): // seconds since epoch formatters_.push_back(details::make_unique>(padding)); break; case ('p'): // am/pm formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('r'): // 12 hour clock 02:55:02 pm formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('R'): // 24-hour HH:MM time formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('T'): case ('X'): // ISO 8601 time format (HH:MM:SS) formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('z'): // timezone formatters_.push_back(details::make_unique>(padding)); need_localtime_ = true; break; case ('P'): // pid formatters_.push_back(details::make_unique>(padding)); break; case ('^'): // color range start formatters_.push_back(details::make_unique(padding)); break; case ('$'): // color range end formatters_.push_back(details::make_unique(padding)); break; case ('@'): // source location (filename:filenumber) formatters_.push_back( details::make_unique>(padding)); break; case ('s'): // short source filename - without directory name formatters_.push_back( details::make_unique>(padding)); break; case ('g'): // full source filename formatters_.push_back( details::make_unique>(padding)); break; case ('#'): // source line number formatters_.push_back( details::make_unique>(padding)); break; case ('!'): // source funcname formatters_.push_back( details::make_unique>(padding)); break; case ('%'): // % char formatters_.push_back(details::make_unique('%')); break; case ('u'): // elapsed time since last log message in nanos formatters_.push_back( details::make_unique>( padding)); break; case ('i'): // elapsed time since last log message in micros formatters_.push_back( details::make_unique>( padding)); break; case ('o'): // elapsed time since last log message in millis formatters_.push_back( details::make_unique>( padding)); break; case ('O'): // elapsed time since last log message in seconds formatters_.push_back( details::make_unique>( padding)); break; case ('&'): formatters_.push_back(details::make_unique>(padding)); break; default: // Unknown flag appears as is auto unknown_flag = details::make_unique(); if (!padding.truncate_) { unknown_flag->add_ch('%'); unknown_flag->add_ch(flag); formatters_.push_back((std::move(unknown_flag))); } // fix issue #1617 (prev char was '!' and should have been treated as funcname flag // instead of truncating flag) spdlog::set_pattern("[%10!] %v") => "[ main] some // message" spdlog::set_pattern("[%3!!] %v") => "[mai] some message" else { padding.truncate_ = false; formatters_.push_back( details::make_unique>(padding)); unknown_flag->add_ch(flag); formatters_.push_back((std::move(unknown_flag))); } break; } } // Extract given pad spec (e.g. %8X, %=8X, %-8!X, %8!X, %=8!X, %-8!X, %+8!X) // Advance the given it pass the end of the padding spec found (if any) // Return padding. SPDLOG_INLINE details::padding_info pattern_formatter::handle_padspec_( std::string::const_iterator &it, std::string::const_iterator end) { using details::padding_info; using details::scoped_padder; const size_t max_width = 64; if (it == end) { return padding_info{}; } padding_info::pad_side side; switch (*it) { case '-': side = padding_info::pad_side::right; ++it; break; case '=': side = padding_info::pad_side::center; ++it; break; default: side = details::padding_info::pad_side::left; break; } if (it == end || !std::isdigit(static_cast(*it))) { return padding_info{}; // no padding if no digit found here } auto width = static_cast(*it) - '0'; for (++it; it != end && std::isdigit(static_cast(*it)); ++it) { auto digit = static_cast(*it) - '0'; width = width * 10 + digit; } // search for the optional truncate marker '!' bool truncate; if (it != end && *it == '!') { truncate = true; ++it; } else { truncate = false; } return details::padding_info{std::min(width, max_width), side, truncate}; } SPDLOG_INLINE void pattern_formatter::compile_pattern_(const std::string &pattern) { auto end = pattern.end(); std::unique_ptr user_chars; formatters_.clear(); for (auto it = pattern.begin(); it != end; ++it) { if (*it == '%') { if (user_chars) // append user chars found so far { formatters_.push_back(std::move(user_chars)); } auto padding = handle_padspec_(++it, end); if (it != end) { if (padding.enabled()) { handle_flag_(*it, padding); } else { handle_flag_(*it, padding); } } else { break; } } else // chars not following the % sign should be displayed as is { if (!user_chars) { user_chars = details::make_unique(); } user_chars->add_ch(*it); } } if (user_chars) // append raw chars found so far { formatters_.push_back(std::move(user_chars)); } } } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/pattern_formatter.h000066400000000000000000000072561475521542100264210ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include #include #include #include #include #include #include #include #include namespace spdlog { namespace details { // padding information. struct padding_info { enum class pad_side { left, right, center }; padding_info() = default; padding_info(size_t width, padding_info::pad_side side, bool truncate) : width_(width), side_(side), truncate_(truncate), enabled_(true) {} bool enabled() const { return enabled_; } size_t width_ = 0; pad_side side_ = pad_side::left; bool truncate_ = false; bool enabled_ = false; }; class SPDLOG_API flag_formatter { public: explicit flag_formatter(padding_info padinfo) : padinfo_(padinfo) {} flag_formatter() = default; virtual ~flag_formatter() = default; virtual void format(const details::log_msg &msg, const std::tm &tm_time, memory_buf_t &dest) = 0; protected: padding_info padinfo_; }; } // namespace details class SPDLOG_API custom_flag_formatter : public details::flag_formatter { public: virtual std::unique_ptr clone() const = 0; void set_padding_info(const details::padding_info &padding) { flag_formatter::padinfo_ = padding; } }; class SPDLOG_API pattern_formatter final : public formatter { public: using custom_flags = std::unordered_map>; explicit pattern_formatter(std::string pattern, pattern_time_type time_type = pattern_time_type::local, std::string eol = spdlog::details::os::default_eol, custom_flags custom_user_flags = custom_flags()); // use default pattern is not given explicit pattern_formatter(pattern_time_type time_type = pattern_time_type::local, std::string eol = spdlog::details::os::default_eol); pattern_formatter(const pattern_formatter &other) = delete; pattern_formatter &operator=(const pattern_formatter &other) = delete; std::unique_ptr clone() const override; void format(const details::log_msg &msg, memory_buf_t &dest) override; template pattern_formatter &add_flag(char flag, Args &&...args) { custom_handlers_[flag] = details::make_unique(std::forward(args)...); return *this; } void set_pattern(std::string pattern); void need_localtime(bool need = true); private: std::string pattern_; std::string eol_; pattern_time_type pattern_time_type_; bool need_localtime_; std::tm cached_tm_; std::chrono::seconds last_log_secs_; std::vector> formatters_; custom_flags custom_handlers_; std::tm get_time_(const details::log_msg &msg); template void handle_flag_(char flag, details::padding_info padding); // Extract given pad spec (e.g. %8X) // Advance the given it pass the end of the padding spec found (if any) // Return padding. static details::padding_info handle_padspec_(std::string::const_iterator &it, std::string::const_iterator end); void compile_pattern_(const std::string &pattern); }; } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "pattern_formatter-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/sinks/000077500000000000000000000000001475521542100236255ustar00rootroot00000000000000level-zero-1.20.6/third_party/spdlog_headers/spdlog/sinks/ansicolor_sink-inl.h000066400000000000000000000114131475521542100275730ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include #include namespace spdlog { namespace sinks { template SPDLOG_INLINE ansicolor_sink::ansicolor_sink(FILE *target_file, color_mode mode) : target_file_(target_file), mutex_(ConsoleMutex::mutex()), formatter_(details::make_unique()) { set_color_mode(mode); colors_.at(level::trace) = to_string_(white); colors_.at(level::debug) = to_string_(cyan); colors_.at(level::info) = to_string_(green); colors_.at(level::warn) = to_string_(yellow_bold); colors_.at(level::err) = to_string_(red_bold); colors_.at(level::critical) = to_string_(bold_on_red); colors_.at(level::off) = to_string_(reset); } template SPDLOG_INLINE void ansicolor_sink::set_color(level::level_enum color_level, string_view_t color) { std::lock_guard lock(mutex_); colors_.at(static_cast(color_level)) = to_string_(color); } template SPDLOG_INLINE void ansicolor_sink::log(const details::log_msg &msg) { // Wrap the originally formatted message in color codes. // If color is not supported in the terminal, log as is instead. std::lock_guard lock(mutex_); msg.color_range_start = 0; msg.color_range_end = 0; memory_buf_t formatted; formatter_->format(msg, formatted); if (should_do_colors_ && msg.color_range_end > msg.color_range_start) { // before color range print_range_(formatted, 0, msg.color_range_start); // in color range print_ccode_(colors_.at(static_cast(msg.level))); print_range_(formatted, msg.color_range_start, msg.color_range_end); print_ccode_(reset); // after color range print_range_(formatted, msg.color_range_end, formatted.size()); } else // no color { print_range_(formatted, 0, formatted.size()); } fflush(target_file_); } template SPDLOG_INLINE void ansicolor_sink::flush() { std::lock_guard lock(mutex_); fflush(target_file_); } template SPDLOG_INLINE void ansicolor_sink::set_pattern(const std::string &pattern) { std::lock_guard lock(mutex_); formatter_ = std::unique_ptr(new pattern_formatter(pattern)); } template SPDLOG_INLINE void ansicolor_sink::set_formatter( std::unique_ptr sink_formatter) { std::lock_guard lock(mutex_); formatter_ = std::move(sink_formatter); } template SPDLOG_INLINE bool ansicolor_sink::should_color() { return should_do_colors_; } template SPDLOG_INLINE void ansicolor_sink::set_color_mode(color_mode mode) { switch (mode) { case color_mode::always: should_do_colors_ = true; return; case color_mode::automatic: should_do_colors_ = details::os::in_terminal(target_file_) && details::os::is_color_terminal(); return; case color_mode::never: should_do_colors_ = false; return; default: should_do_colors_ = false; } } template SPDLOG_INLINE void ansicolor_sink::print_ccode_(const string_view_t &color_code) { fwrite(color_code.data(), sizeof(char), color_code.size(), target_file_); } template SPDLOG_INLINE void ansicolor_sink::print_range_(const memory_buf_t &formatted, size_t start, size_t end) { fwrite(formatted.data() + start, sizeof(char), end - start, target_file_); } template SPDLOG_INLINE std::string ansicolor_sink::to_string_(const string_view_t &sv) { return std::string(sv.data(), sv.size()); } // ansicolor_stdout_sink template SPDLOG_INLINE ansicolor_stdout_sink::ansicolor_stdout_sink(color_mode mode) : ansicolor_sink(stdout, mode) {} // ansicolor_stderr_sink template SPDLOG_INLINE ansicolor_stderr_sink::ansicolor_stderr_sink(color_mode mode) : ansicolor_sink(stderr, mode) {} } // namespace sinks } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/sinks/ansicolor_sink.h000066400000000000000000000076001475521542100270160ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include #include #include #include #include #include namespace spdlog { namespace sinks { /** * This sink prefixes the output with an ANSI escape sequence color code * depending on the severity * of the message. * If no color terminal detected, omit the escape codes. */ template class ansicolor_sink : public sink { public: using mutex_t = typename ConsoleMutex::mutex_t; ansicolor_sink(FILE *target_file, color_mode mode); ~ansicolor_sink() override = default; ansicolor_sink(const ansicolor_sink &other) = delete; ansicolor_sink(ansicolor_sink &&other) = delete; ansicolor_sink &operator=(const ansicolor_sink &other) = delete; ansicolor_sink &operator=(ansicolor_sink &&other) = delete; void set_color(level::level_enum color_level, string_view_t color); void set_color_mode(color_mode mode); bool should_color(); void log(const details::log_msg &msg) override; void flush() override; void set_pattern(const std::string &pattern) final override; void set_formatter(std::unique_ptr sink_formatter) override; // Formatting codes const string_view_t reset = "\033[m"; const string_view_t bold = "\033[1m"; const string_view_t dark = "\033[2m"; const string_view_t underline = "\033[4m"; const string_view_t blink = "\033[5m"; const string_view_t reverse = "\033[7m"; const string_view_t concealed = "\033[8m"; const string_view_t clear_line = "\033[K"; // Foreground colors const string_view_t black = "\033[30m"; const string_view_t red = "\033[31m"; const string_view_t green = "\033[32m"; const string_view_t yellow = "\033[33m"; const string_view_t blue = "\033[34m"; const string_view_t magenta = "\033[35m"; const string_view_t cyan = "\033[36m"; const string_view_t white = "\033[37m"; /// Background colors const string_view_t on_black = "\033[40m"; const string_view_t on_red = "\033[41m"; const string_view_t on_green = "\033[42m"; const string_view_t on_yellow = "\033[43m"; const string_view_t on_blue = "\033[44m"; const string_view_t on_magenta = "\033[45m"; const string_view_t on_cyan = "\033[46m"; const string_view_t on_white = "\033[47m"; /// Bold colors const string_view_t yellow_bold = "\033[33m\033[1m"; const string_view_t red_bold = "\033[31m\033[1m"; const string_view_t bold_on_red = "\033[1m\033[41m"; private: FILE *target_file_; mutex_t &mutex_; bool should_do_colors_; std::unique_ptr formatter_; std::array colors_; void print_ccode_(const string_view_t &color_code); void print_range_(const memory_buf_t &formatted, size_t start, size_t end); static std::string to_string_(const string_view_t &sv); }; template class ansicolor_stdout_sink : public ansicolor_sink { public: explicit ansicolor_stdout_sink(color_mode mode = color_mode::automatic); }; template class ansicolor_stderr_sink : public ansicolor_sink { public: explicit ansicolor_stderr_sink(color_mode mode = color_mode::automatic); }; using ansicolor_stdout_sink_mt = ansicolor_stdout_sink; using ansicolor_stdout_sink_st = ansicolor_stdout_sink; using ansicolor_stderr_sink_mt = ansicolor_stderr_sink; using ansicolor_stderr_sink_st = ansicolor_stderr_sink; } // namespace sinks } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "ansicolor_sink-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/sinks/base_sink-inl.h000066400000000000000000000034201475521542100265130ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include #include #include #include template SPDLOG_INLINE spdlog::sinks::base_sink::base_sink() : formatter_{details::make_unique()} {} template SPDLOG_INLINE spdlog::sinks::base_sink::base_sink( std::unique_ptr formatter) : formatter_{std::move(formatter)} {} template void SPDLOG_INLINE spdlog::sinks::base_sink::log(const details::log_msg &msg) { std::lock_guard lock(mutex_); sink_it_(msg); } template void SPDLOG_INLINE spdlog::sinks::base_sink::flush() { std::lock_guard lock(mutex_); flush_(); } template void SPDLOG_INLINE spdlog::sinks::base_sink::set_pattern(const std::string &pattern) { std::lock_guard lock(mutex_); set_pattern_(pattern); } template void SPDLOG_INLINE spdlog::sinks::base_sink::set_formatter(std::unique_ptr sink_formatter) { std::lock_guard lock(mutex_); set_formatter_(std::move(sink_formatter)); } template void SPDLOG_INLINE spdlog::sinks::base_sink::set_pattern_(const std::string &pattern) { set_formatter_(details::make_unique(pattern)); } template void SPDLOG_INLINE spdlog::sinks::base_sink::set_formatter_(std::unique_ptr sink_formatter) { formatter_ = std::move(sink_formatter); } level-zero-1.20.6/third_party/spdlog_headers/spdlog/sinks/base_sink.h000066400000000000000000000031041475521542100257320ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once // // base sink templated over a mutex (either dummy or real) // concrete implementation should override the sink_it_() and flush_() methods. // locking is taken care of in this class - no locking needed by the // implementers.. // #include #include #include namespace spdlog { namespace sinks { template class SPDLOG_API base_sink : public sink { public: base_sink(); explicit base_sink(std::unique_ptr formatter); ~base_sink() override = default; base_sink(const base_sink &) = delete; base_sink(base_sink &&) = delete; base_sink &operator=(const base_sink &) = delete; base_sink &operator=(base_sink &&) = delete; void log(const details::log_msg &msg) final override; void flush() final override; void set_pattern(const std::string &pattern) final override; void set_formatter(std::unique_ptr sink_formatter) final override; protected: // sink formatter std::unique_ptr formatter_; Mutex mutex_; virtual void sink_it_(const details::log_msg &msg) = 0; virtual void flush_() = 0; virtual void set_pattern_(const std::string &pattern); virtual void set_formatter_(std::unique_ptr sink_formatter); }; } // namespace sinks } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "base_sink-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/sinks/basic_file_sink-inl.h000066400000000000000000000023001475521542100276550ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include #include namespace spdlog { namespace sinks { template SPDLOG_INLINE basic_file_sink::basic_file_sink(const filename_t &filename, bool truncate, const file_event_handlers &event_handlers) : file_helper_{event_handlers} { file_helper_.open(filename, truncate); } template SPDLOG_INLINE const filename_t &basic_file_sink::filename() const { return file_helper_.filename(); } template SPDLOG_INLINE void basic_file_sink::sink_it_(const details::log_msg &msg) { memory_buf_t formatted; base_sink::formatter_->format(msg, formatted); file_helper_.write(formatted); } template SPDLOG_INLINE void basic_file_sink::flush_() { file_helper_.flush(); } } // namespace sinks } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/sinks/basic_file_sink.h000066400000000000000000000043671475521542100271140ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include #include #include #include #include namespace spdlog { namespace sinks { /* * Trivial file sink with single file as target */ template class basic_file_sink final : public base_sink { public: explicit basic_file_sink(const filename_t &filename, bool truncate = false, const file_event_handlers &event_handlers = {}); const filename_t &filename() const; protected: void sink_it_(const details::log_msg &msg) override; void flush_() override; private: details::file_helper file_helper_; }; using basic_file_sink_mt = basic_file_sink; using basic_file_sink_st = basic_file_sink; } // namespace sinks // // factory functions // template inline std::shared_ptr basic_logger_mt(const std::string &logger_name, const filename_t &filename, bool truncate = false, const file_event_handlers &event_handlers = {}) { return Factory::template create(logger_name, filename, truncate, event_handlers); } template inline std::shared_ptr basic_logger_st(const std::string &logger_name, const filename_t &filename, bool truncate = false, const file_event_handlers &event_handlers = {}) { return Factory::template create(logger_name, filename, truncate, event_handlers); } } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "basic_file_sink-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/sinks/sink-inl.h000066400000000000000000000013251475521542100255230ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include SPDLOG_INLINE bool spdlog::sinks::sink::should_log(spdlog::level::level_enum msg_level) const { return msg_level >= level_.load(std::memory_order_relaxed); } SPDLOG_INLINE void spdlog::sinks::sink::set_level(level::level_enum log_level) { level_.store(log_level, std::memory_order_relaxed); } SPDLOG_INLINE spdlog::level::level_enum spdlog::sinks::sink::level() const { return static_cast(level_.load(std::memory_order_relaxed)); } level-zero-1.20.6/third_party/spdlog_headers/spdlog/sinks/sink.h000066400000000000000000000015751475521542100247520ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include namespace spdlog { namespace sinks { class SPDLOG_API sink { public: virtual ~sink() = default; virtual void log(const details::log_msg &msg) = 0; virtual void flush() = 0; virtual void set_pattern(const std::string &pattern) = 0; virtual void set_formatter(std::unique_ptr sink_formatter) = 0; void set_level(level::level_enum log_level); level::level_enum level() const; bool should_log(level::level_enum msg_level) const; protected: // sink log level - default is all level_t level_{level::trace}; }; } // namespace sinks } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "sink-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/sinks/wincolor_sink-inl.h000066400000000000000000000156041475521542100274440ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include #include #include #include namespace spdlog { namespace sinks { template SPDLOG_INLINE wincolor_sink::wincolor_sink(void *out_handle, color_mode mode) : out_handle_(out_handle), mutex_(ConsoleMutex::mutex()), formatter_(details::make_unique()) { set_color_mode_impl(mode); // set level colors colors_[level::trace] = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; // white colors_[level::debug] = FOREGROUND_GREEN | FOREGROUND_BLUE; // cyan colors_[level::info] = FOREGROUND_GREEN; // green colors_[level::warn] = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY; // intense yellow colors_[level::err] = FOREGROUND_RED | FOREGROUND_INTENSITY; // intense red colors_[level::critical] = BACKGROUND_RED | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY; // intense white on red background colors_[level::off] = 0; } template SPDLOG_INLINE wincolor_sink::~wincolor_sink() { this->flush(); } // change the color for the given level template void SPDLOG_INLINE wincolor_sink::set_color(level::level_enum level, std::uint16_t color) { std::lock_guard lock(mutex_); colors_[static_cast(level)] = color; } template void SPDLOG_INLINE wincolor_sink::log(const details::log_msg &msg) { if (out_handle_ == nullptr || out_handle_ == INVALID_HANDLE_VALUE) { return; } std::lock_guard lock(mutex_); msg.color_range_start = 0; msg.color_range_end = 0; memory_buf_t formatted; formatter_->format(msg, formatted); if (should_do_colors_ && msg.color_range_end > msg.color_range_start) { // before color range print_range_(formatted, 0, msg.color_range_start); // in color range auto orig_attribs = static_cast(set_foreground_color_(colors_[static_cast(msg.level)])); print_range_(formatted, msg.color_range_start, msg.color_range_end); // reset to orig colors ::SetConsoleTextAttribute(static_cast(out_handle_), orig_attribs); print_range_(formatted, msg.color_range_end, formatted.size()); } else // print without colors if color range is invalid (or color is disabled) { write_to_file_(formatted); } } template void SPDLOG_INLINE wincolor_sink::flush() { // windows console always flushed? } template void SPDLOG_INLINE wincolor_sink::set_pattern(const std::string &pattern) { std::lock_guard lock(mutex_); formatter_ = std::unique_ptr(new pattern_formatter(pattern)); } template void SPDLOG_INLINE wincolor_sink::set_formatter(std::unique_ptr sink_formatter) { std::lock_guard lock(mutex_); formatter_ = std::move(sink_formatter); } template void SPDLOG_INLINE wincolor_sink::set_color_mode(color_mode mode) { std::lock_guard lock(mutex_); set_color_mode_impl(mode); } template void SPDLOG_INLINE wincolor_sink::set_color_mode_impl(color_mode mode) { if (mode == color_mode::automatic) { // should do colors only if out_handle_ points to actual console. DWORD console_mode; bool in_console = ::GetConsoleMode(static_cast(out_handle_), &console_mode) != 0; should_do_colors_ = in_console; } else { should_do_colors_ = mode == color_mode::always ? true : false; } } // set foreground color and return the orig console attributes (for resetting later) template std::uint16_t SPDLOG_INLINE wincolor_sink::set_foreground_color_(std::uint16_t attribs) { CONSOLE_SCREEN_BUFFER_INFO orig_buffer_info; if (!::GetConsoleScreenBufferInfo(static_cast(out_handle_), &orig_buffer_info)) { // just return white if failed getting console info return FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; } // change only the foreground bits (lowest 4 bits) auto new_attribs = static_cast(attribs) | (orig_buffer_info.wAttributes & 0xfff0); auto ignored = ::SetConsoleTextAttribute(static_cast(out_handle_), static_cast(new_attribs)); (void)(ignored); return static_cast(orig_buffer_info.wAttributes); // return orig attribs } // print a range of formatted message to console template void SPDLOG_INLINE wincolor_sink::print_range_(const memory_buf_t &formatted, size_t start, size_t end) { if (end > start) { #if defined(SPDLOG_UTF8_TO_WCHAR_CONSOLE) wmemory_buf_t wformatted; details::os::utf8_to_wstrbuf(string_view_t(formatted.data() + start, end - start), wformatted); auto size = static_cast(wformatted.size()); auto ignored = ::WriteConsoleW(static_cast(out_handle_), wformatted.data(), size, nullptr, nullptr); #else auto size = static_cast(end - start); auto ignored = ::WriteConsoleA(static_cast(out_handle_), formatted.data() + start, size, nullptr, nullptr); #endif (void)(ignored); } } template void SPDLOG_INLINE wincolor_sink::write_to_file_(const memory_buf_t &formatted) { auto size = static_cast(formatted.size()); DWORD bytes_written = 0; auto ignored = ::WriteFile(static_cast(out_handle_), formatted.data(), size, &bytes_written, nullptr); (void)(ignored); } // wincolor_stdout_sink template SPDLOG_INLINE wincolor_stdout_sink::wincolor_stdout_sink(color_mode mode) : wincolor_sink(::GetStdHandle(STD_OUTPUT_HANDLE), mode) {} // wincolor_stderr_sink template SPDLOG_INLINE wincolor_stderr_sink::wincolor_stderr_sink(color_mode mode) : wincolor_sink(::GetStdHandle(STD_ERROR_HANDLE), mode) {} } // namespace sinks } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/sinks/wincolor_sink.h000066400000000000000000000052341475521542100266620ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #include #include #include #include #include #include #include #include #include namespace spdlog { namespace sinks { /* * Windows color console sink. Uses WriteConsoleA to write to the console with * colors */ template class wincolor_sink : public sink { public: wincolor_sink(void *out_handle, color_mode mode); ~wincolor_sink() override; wincolor_sink(const wincolor_sink &other) = delete; wincolor_sink &operator=(const wincolor_sink &other) = delete; // change the color for the given level void set_color(level::level_enum level, std::uint16_t color); void log(const details::log_msg &msg) final override; void flush() final override; void set_pattern(const std::string &pattern) override final; void set_formatter(std::unique_ptr sink_formatter) override final; void set_color_mode(color_mode mode); protected: using mutex_t = typename ConsoleMutex::mutex_t; void *out_handle_; mutex_t &mutex_; bool should_do_colors_; std::unique_ptr formatter_; std::array colors_; // set foreground color and return the orig console attributes (for resetting later) std::uint16_t set_foreground_color_(std::uint16_t attribs); // print a range of formatted message to console void print_range_(const memory_buf_t &formatted, size_t start, size_t end); // in case we are redirected to file (not in console mode) void write_to_file_(const memory_buf_t &formatted); void set_color_mode_impl(color_mode mode); }; template class wincolor_stdout_sink : public wincolor_sink { public: explicit wincolor_stdout_sink(color_mode mode = color_mode::automatic); }; template class wincolor_stderr_sink : public wincolor_sink { public: explicit wincolor_stderr_sink(color_mode mode = color_mode::automatic); }; using wincolor_stdout_sink_mt = wincolor_stdout_sink; using wincolor_stdout_sink_st = wincolor_stdout_sink; using wincolor_stderr_sink_mt = wincolor_stderr_sink; using wincolor_stderr_sink_st = wincolor_stderr_sink; } // namespace sinks } // namespace spdlog #ifdef SPDLOG_HEADER_ONLY #include "wincolor_sink-inl.h" #endif level-zero-1.20.6/third_party/spdlog_headers/spdlog/spdlog-inl.h000066400000000000000000000060561475521542100247260ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #ifndef SPDLOG_HEADER_ONLY #include #endif #include #include namespace spdlog { SPDLOG_INLINE void initialize_logger(std::shared_ptr logger) { details::registry::instance().initialize_logger(std::move(logger)); } SPDLOG_INLINE std::shared_ptr get(const std::string &name) { return details::registry::instance().get(name); } SPDLOG_INLINE void set_formatter(std::unique_ptr formatter) { details::registry::instance().set_formatter(std::move(formatter)); } SPDLOG_INLINE void set_pattern(std::string pattern, pattern_time_type time_type) { set_formatter( std::unique_ptr(new pattern_formatter(std::move(pattern), time_type))); } SPDLOG_INLINE void enable_backtrace(size_t n_messages) { details::registry::instance().enable_backtrace(n_messages); } SPDLOG_INLINE void disable_backtrace() { details::registry::instance().disable_backtrace(); } SPDLOG_INLINE void dump_backtrace() { default_logger_raw()->dump_backtrace(); } SPDLOG_INLINE level::level_enum get_level() { return default_logger_raw()->level(); } SPDLOG_INLINE bool should_log(level::level_enum log_level) { return default_logger_raw()->should_log(log_level); } SPDLOG_INLINE void set_level(level::level_enum log_level) { details::registry::instance().set_level(log_level); } SPDLOG_INLINE void flush_on(level::level_enum log_level) { details::registry::instance().flush_on(log_level); } SPDLOG_INLINE void set_error_handler(void (*handler)(const std::string &msg)) { details::registry::instance().set_error_handler(handler); } SPDLOG_INLINE void register_logger(std::shared_ptr logger) { details::registry::instance().register_logger(std::move(logger)); } SPDLOG_INLINE void apply_all(const std::function)> &fun) { details::registry::instance().apply_all(fun); } SPDLOG_INLINE void drop(const std::string &name) { details::registry::instance().drop(name); } SPDLOG_INLINE void drop_all() { details::registry::instance().drop_all(); } SPDLOG_INLINE void shutdown() { details::registry::instance().shutdown(); } SPDLOG_INLINE void set_automatic_registration(bool automatic_registration) { details::registry::instance().set_automatic_registration(automatic_registration); } SPDLOG_INLINE std::shared_ptr default_logger() { return details::registry::instance().default_logger(); } SPDLOG_INLINE spdlog::logger *default_logger_raw() { return details::registry::instance().get_default_raw(); } SPDLOG_INLINE void set_default_logger(std::shared_ptr default_logger) { details::registry::instance().set_default_logger(std::move(default_logger)); } SPDLOG_INLINE void apply_logger_env_levels(std::shared_ptr logger) { details::registry::instance().apply_logger_env_levels(std::move(logger)); } } // namespace spdlog level-zero-1.20.6/third_party/spdlog_headers/spdlog/spdlog.h000066400000000000000000000267731475521542100241560ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) // spdlog main header file. // see example.cpp for usage example #ifndef SPDLOG_H #define SPDLOG_H #pragma once #include #include #include #include #include #include #include #include #include namespace spdlog { using default_factory = synchronous_factory; // Create and register a logger with a templated sink type // The logger's level, formatter and flush level will be set according the // global settings. // // Example: // spdlog::create("logger_name", "dailylog_filename", 11, 59); template inline std::shared_ptr create(std::string logger_name, SinkArgs &&...sink_args) { return default_factory::create(std::move(logger_name), std::forward(sink_args)...); } // Initialize and register a logger, // formatter and flush level will be set according the global settings. // // Useful for initializing manually created loggers with the global settings. // // Example: // auto mylogger = std::make_shared("mylogger", ...); // spdlog::initialize_logger(mylogger); SPDLOG_API void initialize_logger(std::shared_ptr logger); // Return an existing logger or nullptr if a logger with such name doesn't // exist. // example: spdlog::get("my_logger")->info("hello {}", "world"); SPDLOG_API std::shared_ptr get(const std::string &name); // Set global formatter. Each sink in each logger will get a clone of this object SPDLOG_API void set_formatter(std::unique_ptr formatter); // Set global format string. // example: spdlog::set_pattern("%Y-%m-%d %H:%M:%S.%e %l : %v"); SPDLOG_API void set_pattern(std::string pattern, pattern_time_type time_type = pattern_time_type::local); // enable global backtrace support SPDLOG_API void enable_backtrace(size_t n_messages); // disable global backtrace support SPDLOG_API void disable_backtrace(); // call dump backtrace on default logger SPDLOG_API void dump_backtrace(); // Get global logging level SPDLOG_API level::level_enum get_level(); // Set global logging level SPDLOG_API void set_level(level::level_enum log_level); // Determine whether the default logger should log messages with a certain level SPDLOG_API bool should_log(level::level_enum lvl); // Set global flush level SPDLOG_API void flush_on(level::level_enum log_level); // Start/Restart a periodic flusher thread // Warning: Use only if all your loggers are thread safe! template inline void flush_every(std::chrono::duration interval) { details::registry::instance().flush_every(interval); } // Set global error handler SPDLOG_API void set_error_handler(void (*handler)(const std::string &msg)); // Register the given logger with the given name SPDLOG_API void register_logger(std::shared_ptr logger); // Apply a user defined function on all registered loggers // Example: // spdlog::apply_all([&](std::shared_ptr l) {l->flush();}); SPDLOG_API void apply_all(const std::function)> &fun); // Drop the reference to the given logger SPDLOG_API void drop(const std::string &name); // Drop all references from the registry SPDLOG_API void drop_all(); // stop any running threads started by spdlog and clean registry loggers SPDLOG_API void shutdown(); // Automatic registration of loggers when using spdlog::create() or spdlog::create_async SPDLOG_API void set_automatic_registration(bool automatic_registration); // API for using default logger (stdout_color_mt), // e.g: spdlog::info("Message {}", 1); // // The default logger object can be accessed using the spdlog::default_logger(): // For example, to add another sink to it: // spdlog::default_logger()->sinks().push_back(some_sink); // // The default logger can replaced using spdlog::set_default_logger(new_logger). // For example, to replace it with a file logger. // // IMPORTANT: // The default API is thread safe (for _mt loggers), but: // set_default_logger() *should not* be used concurrently with the default API. // e.g do not call set_default_logger() from one thread while calling spdlog::info() from another. SPDLOG_API std::shared_ptr default_logger(); SPDLOG_API spdlog::logger *default_logger_raw(); SPDLOG_API void set_default_logger(std::shared_ptr default_logger); // Initialize logger level based on environment configs. // // Useful for applying SPDLOG_LEVEL to manually created loggers. // // Example: // auto mylogger = std::make_shared("mylogger", ...); // spdlog::apply_logger_env_levels(mylogger); SPDLOG_API void apply_logger_env_levels(std::shared_ptr logger); template inline void log(source_loc source, level::level_enum lvl, format_string_t fmt, Args &&...args) { default_logger_raw()->log(source, lvl, fmt, std::forward(args)...); } template inline void log(level::level_enum lvl, format_string_t fmt, Args &&...args) { default_logger_raw()->log(source_loc{}, lvl, fmt, std::forward(args)...); } template inline void trace(format_string_t fmt, Args &&...args) { default_logger_raw()->trace(fmt, std::forward(args)...); } template inline void debug(format_string_t fmt, Args &&...args) { default_logger_raw()->debug(fmt, std::forward(args)...); } template inline void info(format_string_t fmt, Args &&...args) { default_logger_raw()->info(fmt, std::forward(args)...); } template inline void warn(format_string_t fmt, Args &&...args) { default_logger_raw()->warn(fmt, std::forward(args)...); } template inline void error(format_string_t fmt, Args &&...args) { default_logger_raw()->error(fmt, std::forward(args)...); } template inline void critical(format_string_t fmt, Args &&...args) { default_logger_raw()->critical(fmt, std::forward(args)...); } template inline void log(source_loc source, level::level_enum lvl, const T &msg) { default_logger_raw()->log(source, lvl, msg); } template inline void log(level::level_enum lvl, const T &msg) { default_logger_raw()->log(lvl, msg); } #ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT template inline void log(source_loc source, level::level_enum lvl, wformat_string_t fmt, Args &&...args) { default_logger_raw()->log(source, lvl, fmt, std::forward(args)...); } template inline void log(level::level_enum lvl, wformat_string_t fmt, Args &&...args) { default_logger_raw()->log(source_loc{}, lvl, fmt, std::forward(args)...); } template inline void trace(wformat_string_t fmt, Args &&...args) { default_logger_raw()->trace(fmt, std::forward(args)...); } template inline void debug(wformat_string_t fmt, Args &&...args) { default_logger_raw()->debug(fmt, std::forward(args)...); } template inline void info(wformat_string_t fmt, Args &&...args) { default_logger_raw()->info(fmt, std::forward(args)...); } template inline void warn(wformat_string_t fmt, Args &&...args) { default_logger_raw()->warn(fmt, std::forward(args)...); } template inline void error(wformat_string_t fmt, Args &&...args) { default_logger_raw()->error(fmt, std::forward(args)...); } template inline void critical(wformat_string_t fmt, Args &&...args) { default_logger_raw()->critical(fmt, std::forward(args)...); } #endif template inline void trace(const T &msg) { default_logger_raw()->trace(msg); } template inline void debug(const T &msg) { default_logger_raw()->debug(msg); } template inline void info(const T &msg) { default_logger_raw()->info(msg); } template inline void warn(const T &msg) { default_logger_raw()->warn(msg); } template inline void error(const T &msg) { default_logger_raw()->error(msg); } template inline void critical(const T &msg) { default_logger_raw()->critical(msg); } } // namespace spdlog // // enable/disable log calls at compile time according to global level. // // define SPDLOG_ACTIVE_LEVEL to one of those (before including spdlog.h): // SPDLOG_LEVEL_TRACE, // SPDLOG_LEVEL_DEBUG, // SPDLOG_LEVEL_INFO, // SPDLOG_LEVEL_WARN, // SPDLOG_LEVEL_ERROR, // SPDLOG_LEVEL_CRITICAL, // SPDLOG_LEVEL_OFF // #ifndef SPDLOG_NO_SOURCE_LOC #define SPDLOG_LOGGER_CALL(logger, level, ...) \ (logger)->log(spdlog::source_loc{__FILE__, __LINE__, SPDLOG_FUNCTION}, level, __VA_ARGS__) #else #define SPDLOG_LOGGER_CALL(logger, level, ...) \ (logger)->log(spdlog::source_loc{}, level, __VA_ARGS__) #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE #define SPDLOG_LOGGER_TRACE(logger, ...) \ SPDLOG_LOGGER_CALL(logger, spdlog::level::trace, __VA_ARGS__) #define SPDLOG_TRACE(...) SPDLOG_LOGGER_TRACE(spdlog::default_logger_raw(), __VA_ARGS__) #else #define SPDLOG_LOGGER_TRACE(logger, ...) (void)0 #define SPDLOG_TRACE(...) (void)0 #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_DEBUG #define SPDLOG_LOGGER_DEBUG(logger, ...) \ SPDLOG_LOGGER_CALL(logger, spdlog::level::debug, __VA_ARGS__) #define SPDLOG_DEBUG(...) SPDLOG_LOGGER_DEBUG(spdlog::default_logger_raw(), __VA_ARGS__) #else #define SPDLOG_LOGGER_DEBUG(logger, ...) (void)0 #define SPDLOG_DEBUG(...) (void)0 #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_INFO #define SPDLOG_LOGGER_INFO(logger, ...) \ SPDLOG_LOGGER_CALL(logger, spdlog::level::info, __VA_ARGS__) #define SPDLOG_INFO(...) SPDLOG_LOGGER_INFO(spdlog::default_logger_raw(), __VA_ARGS__) #else #define SPDLOG_LOGGER_INFO(logger, ...) (void)0 #define SPDLOG_INFO(...) (void)0 #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_WARN #define SPDLOG_LOGGER_WARN(logger, ...) \ SPDLOG_LOGGER_CALL(logger, spdlog::level::warn, __VA_ARGS__) #define SPDLOG_WARN(...) SPDLOG_LOGGER_WARN(spdlog::default_logger_raw(), __VA_ARGS__) #else #define SPDLOG_LOGGER_WARN(logger, ...) (void)0 #define SPDLOG_WARN(...) (void)0 #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_ERROR #define SPDLOG_LOGGER_ERROR(logger, ...) \ SPDLOG_LOGGER_CALL(logger, spdlog::level::err, __VA_ARGS__) #define SPDLOG_ERROR(...) SPDLOG_LOGGER_ERROR(spdlog::default_logger_raw(), __VA_ARGS__) #else #define SPDLOG_LOGGER_ERROR(logger, ...) (void)0 #define SPDLOG_ERROR(...) (void)0 #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_CRITICAL #define SPDLOG_LOGGER_CRITICAL(logger, ...) \ SPDLOG_LOGGER_CALL(logger, spdlog::level::critical, __VA_ARGS__) #define SPDLOG_CRITICAL(...) SPDLOG_LOGGER_CRITICAL(spdlog::default_logger_raw(), __VA_ARGS__) #else #define SPDLOG_LOGGER_CRITICAL(logger, ...) (void)0 #define SPDLOG_CRITICAL(...) (void)0 #endif #ifdef SPDLOG_HEADER_ONLY #include "spdlog-inl.h" #endif #endif // SPDLOG_H level-zero-1.20.6/third_party/spdlog_headers/spdlog/tweakme.h000066400000000000000000000143301475521542100243050ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once /////////////////////////////////////////////////////////////////////////////// // // Edit this file to squeeze more performance, and to customize supported // features // /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Under Linux, the much faster CLOCK_REALTIME_COARSE clock can be used. // This clock is less accurate - can be off by dozens of millis - depending on // the kernel HZ. // Uncomment to use it instead of the regular clock. // // #define SPDLOG_CLOCK_COARSE /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment if source location logging is not needed. // This will prevent spdlog from using __FILE__, __LINE__ and SPDLOG_FUNCTION // // #define SPDLOG_NO_SOURCE_LOC /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment if thread id logging is not needed (i.e. no %t in the log pattern). // This will prevent spdlog from querying the thread id on each log call. // // WARNING: If the log pattern contains thread id (i.e, %t) while this flag is // on, zero will be logged as thread id. // // #define SPDLOG_NO_THREAD_ID /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment to prevent spdlog from using thread local storage. // // WARNING: if your program forks, UNCOMMENT this flag to prevent undefined // thread ids in the children logs. // // #define SPDLOG_NO_TLS /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment to avoid spdlog's usage of atomic log levels // Use only if your code never modifies a logger's log levels concurrently by // different threads. // // #define SPDLOG_NO_ATOMIC_LEVELS /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment to enable usage of wchar_t for file names on Windows. // // #define SPDLOG_WCHAR_FILENAMES /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment to override default eol ("\n" or "\r\n" under Linux/Windows) // // #define SPDLOG_EOL ";-)\n" /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment to override default folder separators ("/" or "\\/" under // Linux/Windows). Each character in the string is treated as a different // separator. // // #define SPDLOG_FOLDER_SEPS "\\" /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment to use your own copy of the fmt library instead of spdlog's copy. // In this case spdlog will try to include so set your -I flag // accordingly. // // #define SPDLOG_FMT_EXTERNAL /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment to use C++20 std::format instead of fmt. // // #define SPDLOG_USE_STD_FORMAT /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment to enable wchar_t support (convert to utf8) // // #define SPDLOG_WCHAR_TO_UTF8_SUPPORT /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment to prevent child processes from inheriting log file descriptors // // #define SPDLOG_PREVENT_CHILD_FD /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment to customize level names (e.g. "MY TRACE") // // #define SPDLOG_LEVEL_NAMES { "MY TRACE", "MY DEBUG", "MY INFO", "MY WARNING", "MY ERROR", "MY // CRITICAL", "OFF" } /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment to customize short level names (e.g. "MT") // These can be longer than one character. // // #define SPDLOG_SHORT_LEVEL_NAMES { "T", "D", "I", "W", "E", "C", "O" } /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment to disable default logger creation. // This might save some (very) small initialization time if no default logger is needed. // // #define SPDLOG_DISABLE_DEFAULT_LOGGER /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment and set to compile time level with zero cost (default is INFO). // Macros like SPDLOG_DEBUG(..), SPDLOG_INFO(..) will expand to empty statements if not enabled // // #define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_INFO /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Uncomment (and change if desired) macro to use for function names. // This is compiler dependent. // __PRETTY_FUNCTION__ might be nicer in clang/gcc, and __FUNCTION__ in msvc. // Defaults to __FUNCTION__ (should work on all compilers) if not defined. // // #ifdef __PRETTY_FUNCTION__ // # define SPDLOG_FUNCTION __PRETTY_FUNCTION__ // #else // # define SPDLOG_FUNCTION __FUNCTION__ // #endif /////////////////////////////////////////////////////////////////////////////// level-zero-1.20.6/third_party/spdlog_headers/spdlog/version.h000066400000000000000000000006411475521542100243350ustar00rootroot00000000000000// Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) #pragma once #define SPDLOG_VER_MAJOR 1 #define SPDLOG_VER_MINOR 14 #define SPDLOG_VER_PATCH 1 #define SPDLOG_TO_VERSION(major, minor, patch) (major * 10000 + minor * 100 + patch) #define SPDLOG_VERSION SPDLOG_TO_VERSION(SPDLOG_VER_MAJOR, SPDLOG_VER_MINOR, SPDLOG_VER_PATCH) level-zero-1.20.6/third_party/xla/000077500000000000000000000000001475521542100170075ustar00rootroot00000000000000level-zero-1.20.6/third_party/xla/LICENSE000066400000000000000000000261341475521542100200220ustar00rootroot00000000000000 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.level-zero-1.20.6/third_party/xla/README.md000066400000000000000000000006231475521542100202670ustar00rootroot00000000000000# Source location https://github.com/openxla/xla/tree/18d21413942e140f923da9eefe7a5b7c7206157f/xla/service/graphcycles # Note Some modifications were made to the files, including the complete removal of the external `abseil` library, which was replaced with equivalent `std::` containers. Additionally, certain C++17 features were substituted with equivalent code to ensure compatibility with C++14. level-zero-1.20.6/third_party/xla/graphcycles.cc000077500000000000000000000402411475521542100216260ustar00rootroot00000000000000/* Copyright 2017 The OpenXLA Authors. 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. // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2024 Intel Corporation ==============================================================================*/ // GraphCycles provides incremental cycle detection on a dynamic // graph using the following algorithm: // // A dynamic topological sort algorithm for directed acyclic graphs // David J. Pearce, Paul H. J. Kelly // Journal of Experimental Algorithmics (JEA) JEA Homepage archive // Volume 11, 2006, Article No. 1.7 // // Brief summary of the algorithm: // // (1) Maintain a rank for each node that is consistent // with the topological sort of the graph. I.e., path from x to y // implies rank[x] < rank[y]. // (2) When a new edge (x->y) is inserted, do nothing if rank[x] < rank[y]. // (3) Otherwise: adjust ranks in the neighborhood of x and y. //#include "xla/service/graphcycles/graphcycles.h" #include "graphcycles.h" #include #include #include #include // #include "absl/algorithm/container.h" // #include "absl/container/flat_hash_set.h" // #include "absl/strings/str_cat.h" // #include "absl/types/span.h" //#include "xla/service/graphcycles/ordered_set.h" #include "ordered_set.h" #include #include //#include "tsl/platform/logging.h" namespace xla { namespace { using NodeSet = std::unordered_set; using OrderedNodeSet = OrderedSet; constexpr int32_t max_path_len_20 = 20; struct Node { int32_t rank; // rank number assigned by Pearce-Kelly algorithm // Note (ecg@): the padding between these two fields bothered me, so I tried // the following alternatives: // - Separate bitmap to track visited[]. // - Separate std::vector visited. // - Tagged top or bottom bit of "rank" to keep track of "visited". // However, keeping the bool here (despite the padding) achieves the best // performance for the IsReachableNonConst microbenchmark. bool visited; // Temporary marker used by depth-first-search }; struct NodeIO { OrderedNodeSet in; // List of immediate predecessor nodes in graph OrderedNodeSet out; // List of immediate successor nodes in graph }; } // namespace struct GraphCycles::Rep { std::vector nodes_; std::vector node_io_; std::vector free_nodes_; // Indices for unused entries in nodes_ // Temporary state. std::vector deltaf_; // Results of forward DFS std::vector deltab_; // Results of backward DFS std::vector list_; // All nodes to reprocess std::vector merged_; // Rank values to assign to list_ entries std::vector stack_; // Emulates recursion stack when doing depth first search // User-supplied data. Stored outside of Node since it is rarely accessed. std::vector node_data_; }; GraphCycles::GraphCycles() : rep_(new Rep) {} // Define the destructor here because Rep is also defined in this file. GraphCycles::~GraphCycles() { delete rep_; } bool GraphCycles::CheckInvariants() const { Rep* r = rep_; NodeSet ranks; // Set of ranks seen so far. for (size_t x = 0; x < r->nodes_.size(); x++) { Node* nx = &r->nodes_[x]; if (nx->visited) { // LOG(FATAL) << "Did not clear visited marker on node " << x; std::cerr << "Did not clear visited marker on node " << x; std::exit(EXIT_FAILURE); } if (!ranks.insert(nx->rank).second) { // LOG(FATAL) << "Duplicate occurrence of rank " << nx->rank; std::cerr << "Duplicate occurrence of rank " << nx->rank; std::exit(EXIT_FAILURE); } NodeIO* nx_io = &r->node_io_[x]; for (int32_t y : nx_io->out.GetSequence()) { Node* ny = &r->nodes_[y]; if (nx->rank >= ny->rank) { /* LOG(FATAL) << "Edge " << x << "->" << y << " has bad rank assignment " << nx->rank << "->" << ny->rank; */ std::cerr << "Edge " << x << "->" << y << " has bad rank assignment " << nx->rank << "->" << ny->rank; std::exit(EXIT_FAILURE); } } } return true; } int32_t GraphCycles::NewNode() { if (rep_->free_nodes_.empty()) { Node n; n.visited = false; n.rank = static_cast(rep_->nodes_.size()); rep_->nodes_.emplace_back(n); rep_->node_io_.emplace_back(); rep_->node_data_.push_back(nullptr); return n.rank; } else { // Preserve preceding rank since the set of ranks in use must be // a permutation of [0,rep_->nodes_.size()-1]. int32_t r = rep_->free_nodes_.back(); rep_->free_nodes_.pop_back(); rep_->node_data_[r] = nullptr; return r; } } void GraphCycles::RemoveNode(int32_t node) { NodeIO* x = &rep_->node_io_[node]; for (int32_t y : x->out.GetSequence()) { rep_->node_io_[y].in.Erase(node); } for (int32_t y : x->in.GetSequence()) { rep_->node_io_[y].out.Erase(node); } x->in.Clear(); x->out.Clear(); rep_->free_nodes_.push_back(node); } void* GraphCycles::GetNodeData(int32_t node) const { return rep_->node_data_[node]; } void GraphCycles::SetNodeData(int32_t node, void* data) { rep_->node_data_[node] = data; } bool GraphCycles::HasEdge(int32_t x, int32_t y) const { return rep_->node_io_[x].out.Contains(y); } void GraphCycles::RemoveEdge(int32_t x, int32_t y) { rep_->node_io_[x].out.Erase(y); rep_->node_io_[y].in.Erase(x); // No need to update the rank assignment since a previous valid // rank assignment remains valid after an edge deletion. } static bool ForwardDFS(GraphCycles::Rep* r, int32_t n, int32_t upper_bound); static void BackwardDFS(GraphCycles::Rep* r, int32_t n, int32_t lower_bound); static void Reorder(GraphCycles::Rep* r); static void Sort(const std::vector& nodes, std::vector* delta); static void MoveToList(GraphCycles::Rep* r, std::vector* src, std::vector* dst); static void ClearVisitedBits(GraphCycles::Rep* r, const std::vector& visited_indices); bool GraphCycles::InsertEdge(int32_t x, int32_t y) { if (x == y) return false; Rep* r = rep_; NodeIO* nx_io = &r->node_io_[x]; if (!nx_io->out.Insert(y)) { // Edge already exists. return true; } NodeIO* ny_io = &r->node_io_[y]; ny_io->in.Insert(x); Node* nx = &r->nodes_[x]; Node* ny = &r->nodes_[y]; if (nx->rank <= ny->rank) { // New edge is consistent with existing rank assignment. return true; } // Current rank assignments are incompatible with the new edge. Recompute. // We only need to consider nodes that fall in the range [ny->rank,nx->rank]. if (!ForwardDFS(r, y, nx->rank)) { // Found a cycle. Undo the insertion and tell caller. nx_io->out.Erase(y); ny_io->in.Erase(x); // Since we do not call Reorder() on this path, clear any visited // markers left by ForwardDFS. ClearVisitedBits(r, r->deltaf_); return false; } BackwardDFS(r, x, ny->rank); Reorder(r); return true; } static bool ForwardDFS(GraphCycles::Rep* r, int32_t n, int32_t upper_bound) { // Avoid recursion since stack space might be limited. // We instead keep a stack of nodes to visit. r->deltaf_.clear(); r->stack_.clear(); r->stack_.push_back(n); while (!r->stack_.empty()) { n = r->stack_.back(); r->stack_.pop_back(); Node* nn = &r->nodes_[n]; if (nn->visited) continue; nn->visited = true; r->deltaf_.push_back(n); NodeIO* nn_io = &r->node_io_[n]; for (auto w : nn_io->out.GetSequence()) { Node* nw = &r->nodes_[w]; if (nw->rank == upper_bound) { return false; // Cycle } if (!nw->visited && nw->rank < upper_bound) { r->stack_.push_back(w); } } } return true; } static void BackwardDFS(GraphCycles::Rep* r, int32_t n, int32_t lower_bound) { r->deltab_.clear(); r->stack_.clear(); r->stack_.push_back(n); while (!r->stack_.empty()) { n = r->stack_.back(); r->stack_.pop_back(); Node* nn = &r->nodes_[n]; if (nn->visited) continue; nn->visited = true; r->deltab_.push_back(n); NodeIO* nn_io = &r->node_io_[n]; for (auto w : nn_io->in.GetSequence()) { Node* nw = &r->nodes_[w]; if (!nw->visited && lower_bound < nw->rank) { r->stack_.push_back(w); } } } } static void Reorder(GraphCycles::Rep* r) { Sort(r->nodes_, &r->deltab_); Sort(r->nodes_, &r->deltaf_); // Adds contents of delta lists to list_ (backwards deltas first). r->list_.clear(); MoveToList(r, &r->deltab_, &r->list_); MoveToList(r, &r->deltaf_, &r->list_); // Produce sorted list of all ranks that will be reassigned. r->merged_.resize(r->deltab_.size() + r->deltaf_.size()); std::merge(r->deltab_.begin(), r->deltab_.end(), r->deltaf_.begin(), r->deltaf_.end(), r->merged_.begin()); // Assign the ranks in order to the collected list. for (size_t i = 0; i < r->list_.size(); i++) { r->nodes_[r->list_[i]].rank = r->merged_[i]; } } static void Sort(const std::vector& nodes, std::vector* delta) { std::sort(delta->begin(), delta->end(), [&](int32_t a, int32_t b) { return nodes[a].rank < nodes[b].rank; }); } static void MoveToList(GraphCycles::Rep* r, std::vector* src, std::vector* dst) { for (size_t i = 0; i < src->size(); i++) { int32_t w = (*src)[i]; (*src)[i] = r->nodes_[w].rank; // Replace src entry with its rank r->nodes_[w].visited = false; // Prepare for future DFS calls dst->push_back(w); } } static void ClearVisitedBits(GraphCycles::Rep* r, const std::vector& visited_indices) { for (auto index : visited_indices) { r->nodes_[index].visited = false; } } int GraphCycles::FindPath(int32_t x, int32_t y, int max_path_len, int32_t path[]) const { // Forward depth first search starting at x until we hit y. // As we descend into a node, we push it onto the path. // As we leave a node, we remove it from the path. int path_len = 0; Rep* r = rep_; NodeSet seen; r->stack_.clear(); r->stack_.push_back(x); while (!r->stack_.empty()) { int32_t n = r->stack_.back(); r->stack_.pop_back(); if (n < 0) { // Marker to indicate that we are leaving a node path_len--; continue; } if (path_len < max_path_len) { path[path_len] = n; } path_len++; r->stack_.push_back(-1); // Will remove tentative path entry if (n == y) { return path_len; } for (auto w : r->node_io_[n].out.GetSequence()) { if (seen.insert(w).second) { r->stack_.push_back(w); } } } return 0; } std::string GraphCycles::Path(int x, int y, const int max_path_len) { static const int kPathSize = max_path_len; int32_t path[max_path_len_20]; int np = FindPath(x, y, kPathSize, path); std::string result; for (int i = 0; i < np; i++) { if (i >= kPathSize) { result += " ..."; break; } if (!result.empty()) result.push_back(' '); char buf[20]; snprintf(buf, sizeof(buf), "%d", path[i]); result += buf; } return result; } std::pair, bool> GraphCycles::PathDagIDs(int x, int y, const int max_path_len) { static const int kPathSize = max_path_len; std::vector path; path.reserve(kPathSize); int np = FindPath(x, y, kPathSize, path.data()); bool overflow = np > max_path_len; for (int i = 0; i < np; i++) { if (i >= kPathSize) { break; } path.push_back(path[i]); } return std::pair, bool>(path, overflow); } bool GraphCycles::IsReachable(int32_t x, int32_t y) const { return FindPath(x, y, 0, nullptr) > 0; } bool GraphCycles::IsReachableNonConst(int32_t x, int32_t y) { if (x == y) return true; Rep* r = rep_; Node* nx = &r->nodes_[x]; Node* ny = &r->nodes_[y]; if (nx->rank >= ny->rank) { // x cannot reach y since it is after it in the topological ordering return false; } // See if x can reach y using a DFS search that is limited to y's rank bool reachable = !ForwardDFS(r, x, ny->rank); // Clear any visited markers left by ForwardDFS. ClearVisitedBits(r, r->deltaf_); return reachable; } bool GraphCycles::CanContractEdge(int32_t a, int32_t b) { assert(HasEdge(a, b) && "No edge exists from a to b"); RemoveEdge(a, b); bool reachable = IsReachableNonConst(a, b); // Restore the graph to its original state. InsertEdge(a, b); // If reachable, then contracting edge will cause cycle. return !reachable; } int32_t GraphCycles::ContractEdge(int32_t a, int32_t b, bool &success) { assert(HasEdge(a, b) && "No edge exists from a to b"); RemoveEdge(a, b); if (IsReachableNonConst(a, b)) { // Restore the graph to its original state. InsertEdge(a, b); success = false; return -1; } if (rep_->node_io_[b].in.Size() + rep_->node_io_[b].out.Size() > rep_->node_io_[a].in.Size() + rep_->node_io_[a].out.Size()) { // Swap "a" and "b" to minimize copying. std::swap(a, b); } NodeIO* nb_io = &rep_->node_io_[b]; OrderedNodeSet out = std::move(nb_io->out); OrderedNodeSet in = std::move(nb_io->in); for (int32_t y : out.GetSequence()) { rep_->node_io_[y].in.Erase(b); } for (int32_t y : in.GetSequence()) { rep_->node_io_[y].out.Erase(b); } rep_->free_nodes_.push_back(b); rep_->node_io_[a].out.Reserve(rep_->node_io_[a].out.Size() + out.Size()); for (int32_t y : out.GetSequence()) { InsertEdge(a, y); } rep_->node_io_[a].in.Reserve(rep_->node_io_[a].in.Size() + in.Size()); for (int32_t y : in.GetSequence()) { InsertEdge(y, a); } // Note, if the swap happened it might be what originally was called "b". success = true; return a; } std::vector GraphCycles::Successors(int32_t node) const { return rep_->node_io_[node].out.GetSequence(); } std::vector GraphCycles::Predecessors(int32_t node) const { return rep_->node_io_[node].in.GetSequence(); } std::vector GraphCycles::SuccessorsCopy(int32_t node) const { return Successors(node); } std::vector GraphCycles::PredecessorsCopy(int32_t node) const { return Predecessors(node); } namespace { void SortInPostOrder(const std::vector& nodes, std::vector* to_sort) { std::sort(to_sort->begin(), to_sort->end(), [&](int32_t a, int32_t b) { assert(a == b || nodes[a].rank != nodes[b].rank); return nodes[a].rank > nodes[b].rank; }); } } // namespace auto contains = [](const std::unordered_set& set, int32_t key) { return set.find(key) != set.end(); }; std::vector GraphCycles::AllNodesInPostOrder() const { std::unordered_set free_nodes_set; std::copy(rep_->free_nodes_.begin(), rep_->free_nodes_.end(), std::inserter(free_nodes_set, free_nodes_set.begin())); std::vector all_nodes; all_nodes.reserve(rep_->nodes_.size() - free_nodes_set.size()); for (int64_t i = 0, e = rep_->nodes_.size(); i < e; i++) { int32_t index = static_cast(i); if (!contains(free_nodes_set, index)) { all_nodes.push_back(index); } } SortInPostOrder(rep_->nodes_, &all_nodes); return all_nodes; } std::string GraphCycles::DebugString() const { std::unordered_set free_nodes_set(rep_->free_nodes_.begin(), rep_->free_nodes_.end()); std::string result = "digraph {\n"; for (int64_t i = 0, end = rep_->nodes_.size(); i < end; i++) { int32_t index = static_cast(i); if (!contains(free_nodes_set, index)) { continue; } for (int32_t succ : rep_->node_io_[i].out.GetSequence()) { result += " \"" + std::to_string(i) + "\" -> \"" + std::to_string(succ) + "\"\n"; } } result += "}\n"; return result; } } // namespace xla level-zero-1.20.6/third_party/xla/graphcycles.h000077500000000000000000000147101475521542100214720ustar00rootroot00000000000000/* Copyright 2017 The OpenXLA Authors. 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. // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2024 Intel Corporation ==============================================================================*/ #ifndef XLA_SERVICE_GRAPHCYCLES_GRAPHCYCLES_H_ #define XLA_SERVICE_GRAPHCYCLES_GRAPHCYCLES_H_ #include // GraphCycles detects the introduction of a cycle into a directed // graph that is being built up incrementally. // // Nodes are identified by small integers. It is not possible to // record multiple edges with the same (source, destination) pair; // requests to add an edge where one already exists are silently // ignored. // // It is also not possible to introduce a cycle; an attempt to insert // an edge that would introduce a cycle fails and returns false. // // GraphCycles uses no internal locking; calls into it should be // serialized externally. // Performance considerations: // Works well on sparse graphs, poorly on dense graphs. // Extra information is maintained incrementally to detect cycles quickly. // InsertEdge() is very fast when the edge already exists, and reasonably fast // otherwise. // FindPath() is linear in the size of the graph. // The current implementation uses O(|V|+|E|) space. // #include // #include "absl/types/span.h" // #include #include namespace xla { // NOTE!!! // For now a copy of this is forked to net/plaque. If you // find a bug or add a feature, please inform the owners of the // net/plaque copy in case it should be integrated. // NOTE!!! class GraphCycles { public: GraphCycles(); ~GraphCycles(); // Allocate an unused node id and return it. // The new node has a null pointer for its node data. // All node identifiers passed to other routines in this interface // must have been allocated by NewNode() and not yet deallocated // by RemoveNode(). int32_t NewNode(); // Remove "node" from the graph, deleting all edges to and from it. // After this call the identifier "node" it may no longer be used // as an argument to any routine until it has been reallocated with // NewNode(). void RemoveNode(int32_t node); // Attempt to insert an edge from source_node to dest_node. If the // edge would introduce a cycle, return false without making any // changes. Otherwise add the edge and return true. bool InsertEdge(int32_t source_node, int32_t dest_node); // Remove any edge that exists from source_node to dest_node. void RemoveEdge(int32_t source_node, int32_t dest_node); // Return whether there is an edge directly from source_node to dest_node. bool HasEdge(int32_t source_node, int32_t dest_node) const; // Contracts the edge from 'a' to node 'b', merging nodes 'a' and 'b'. One of // the nodes is removed from the graph, and edges to/from it are added to // the remaining one, which is returned. If contracting the edge would create // a cycle, does nothing and return no value. int32_t ContractEdge(int32_t a, int32_t b, bool &success); // Return true if can contract edge, otherwise return false. bool CanContractEdge(int32_t a, int32_t b); // Return whether dest_node is reachable from source_node // by following edges. bool IsReachable(int32_t source_node, int32_t dest_node) const; // A faster non-thread-safe version of IsReachable. bool IsReachableNonConst(int32_t source_node, int32_t dest_node); // Return or set the node data for a node. This data is unused // by the implementation. void *GetNodeData(int32_t node) const; void SetNodeData(int32_t node, void *data); // Find a path from "source" to "dest". If such a path exists, place the // node IDs of the nodes on the path in the array path[], and return the // number of nodes on the path. If the path is longer than max_path_len // nodes, only the first max_path_len nodes are placed in path[]. The client // should compare the return value with max_path_len" to see when this // occurs. If no path exists, return 0. Any valid path stored in path[] // will start with "source" and end with "dest". There is no guarantee that // the path is the shortest, but no node will appear twice in the path, // except the source and destination node if they are identical; therefore, // the return value is at most one greater than the number of nodes in the // graph. int FindPath(int32_t source, int32_t dest, int max_path_len, int32_t path[]) const; // Returns the path as string. std::string Path(int x, int y, const int max_path_len); // Returns the path as vector and overflow pair. std::pair, bool> PathDagIDs(int x, int y, const int max_path_len); // Check internal invariants. Crashes on failure, returns true on success. // Expensive: should only be called from graphcycles_test.cc. bool CheckInvariants() const; // Warning: Do not use these if iterating over the span and modifying the // GraphCycles at the same time. Instead use SuccessorsCopy/PredecessorsCopy. std::vector Successors(int32_t node) const; std::vector Predecessors(int32_t node) const; // Return a copy of the successors set. This is needed for code using the // collection while modifying the GraphCycles. std::vector SuccessorsCopy(int32_t node) const; // Return a copy of the predecessors set. This is needed for code using the // collection while modifying the GraphCycles. std::vector PredecessorsCopy(int32_t node) const; // Returns all nodes in post order. // // If there is a path from X to Y then X appears after Y in the // returned vector. std::vector AllNodesInPostOrder() const; // Returns the graph in graphviz format. std::string DebugString() const; // ---------------------------------------------------- struct Rep; private: Rep *rep_; // opaque representation GraphCycles(const GraphCycles &) = delete; GraphCycles &operator=(const GraphCycles &) = delete; }; } // namespace xla #endif // XLA_SERVICE_GRAPHCYCLES_GRAPHCYCLES_H_ level-zero-1.20.6/third_party/xla/ordered_set.h000077500000000000000000000061541475521542100214700ustar00rootroot00000000000000/* Copyright 2019 The OpenXLA Authors. 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. // SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2024 Intel Corporation ==============================================================================*/ #ifndef XLA_SERVICE_GRAPHCYCLES_ORDERED_SET_H_ #define XLA_SERVICE_GRAPHCYCLES_ORDERED_SET_H_ #include #include #include #include // #include "absl/container/flat_hash_map.h" // #include "absl/types/span.h" //#include "tsl/platform/logging.h" namespace xla { // This is a set data structure that provides a deterministic iteration order. // The iteration order of elements only depends on the sequence of // inserts/deletes, so as long as the inserts/deletes happen in the same // sequence, the set will have the same iteration order. // // Assumes that T can be cheaply copied for simplicity. template class OrderedSet { public: // Inserts `value` into the ordered set. Returns true if the value was not // present in the set before the insertion. bool Insert(T value) { bool new_insertion = value_to_index_.insert({value, static_cast(value_sequence_.size())}).second; if (new_insertion) { value_sequence_.push_back(value); } return new_insertion; } // Removes `value` from the set. Assumes `value` is already present in the // set. void Erase(T value) { auto it = value_to_index_.find(value); if (it == value_to_index_.end()) { std::cerr << "Value not found in OrderedSet" << std::endl; exit(0); } auto index = it->second; // Since we don't want to move values around in `value_sequence_` we swap // the value in the last position and with value to be deleted and then // pop_back. value_to_index_[value_sequence_.back()] = index; std::swap(value_sequence_[it->second], value_sequence_.back()); value_sequence_.pop_back(); value_to_index_.erase(it); } void Reserve(size_t new_size) { value_to_index_.reserve(new_size); value_sequence_.reserve(new_size); } void Clear() { value_to_index_.clear(); value_sequence_.clear(); } bool Contains(T value) const { return value_to_index_.find(value) != value_to_index_.end(); } size_t Size() const { return value_sequence_.size(); } std::vector const& GetSequence() const { return value_sequence_; } private: // The stable order that we maintain through insertions and deletions. std::vector value_sequence_; // Maps values to their indices in `value_sequence_`. std::unordered_map value_to_index_; };; } // namespace xla #endif // XLA_SERVICE_GRAPHCYCLES_ORDERED_SET_H_